:root {
  --bg: #0f1923;
  --panel: #16232f;
  --panel-2: #121e29;
  --line: #23323f;
  --text: #ece8e1;
  --muted: #8b98a5;
  --red: #ff4655;
  --green: #3ddc84;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

.wrap {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- Hero ---------- */

.hero {
  padding: 1.5rem 0 3.5rem;
  background:
    radial-gradient(900px 400px at 82% -20%, rgba(255, 70, 85, 0.3), transparent 70%),
    linear-gradient(180deg, #101d28, var(--bg));
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--red);
  color: #0f1923;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-body {
  padding-top: 4rem;
  max-width: 640px;
}

.eyebrow {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin-top: 0.7rem;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  font-style: italic;
}

.lede {
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 52ch;
}

.stats {
  display: flex;
  gap: 1.75rem;
  margin-top: 1.9rem;
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.1rem;
}

.stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stats dd {
  font-size: 1.55rem;
  font-weight: 700;
}

/* ---------- Controls ---------- */

main {
  padding: 2rem 0 3.5rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 0.6rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.68rem 0.85rem;
  background: #0c151d;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

::placeholder {
  color: #61707d;
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.2rem 0 1rem;
}

.list-head h2 {
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.count {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.15rem;
  background: linear-gradient(180deg, #17242f, #131e28);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), transparent 65%);
}

.card:hover {
  transform: translateY(-3px);
  border-color: #34495c;
}

.card-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: #0b141c;
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media.fallback {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255, 70, 85, 0.35), transparent 60%),
    linear-gradient(135deg, #1b2b38, #0d161e);
}

.media-rank {
  font-size: 1.6rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(236, 232, 225, 0.5);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rank {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rank, var(--muted));
}

.rank::before {
  content: "";
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--rank, var(--muted));
}

.rank[data-rank="Iron"] { --rank: #8a8a8a; }
.rank[data-rank="Bronze"] { --rank: #b07a4e; }
.rank[data-rank="Silver"] { --rank: #c2c9d0; }
.rank[data-rank="Gold"] { --rank: #e0b23c; }
.rank[data-rank="Platinum"] { --rank: #46cfcf; }
.rank[data-rank="Diamond"] { --rank: #b07de6; }
.rank[data-rank="Ascendant"] { --rank: #45d98b; }
.rank[data-rank="Immortal"] { --rank: #ff4655; }
.rank[data-rank="Radiant"] { --rank: #ffe08a; }

.region {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.card-title {
  font-size: 1.05rem;
  line-height: 1.3;
}

.skins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  padding: 0.18rem 0.5rem;
  background: #0e1922;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c3cdd6;
  font-size: 0.72rem;
}

.chip.muted {
  color: var(--muted);
  border-style: dashed;
}

.chip.more {
  color: var(--red);
  border-color: rgba(255, 70, 85, 0.35);
}

.note {
  color: var(--muted);
  font-size: 0.85rem;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.price {
  color: var(--text);
  font-size: 1rem;
}

.price.free {
  color: var(--green);
}

.contact {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}

.contact:hover {
  text-decoration: underline;
}

.date {
  color: #61707d;
  font-size: 0.75rem;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.card-buttons {
  display: flex;
  gap: 0.4rem;
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- Share form ---------- */

.share {
  margin-top: 3rem;
}

.share details {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 1.25rem;
}

.share summary {
  cursor: pointer;
  padding: 1.05rem 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  list-style: none;
}

.share summary::-webkit-details-marker {
  display: none;
}

.share details[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.15rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-bottom: 1.25rem;
}

form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.notice {
  padding: 0.6rem 0.8rem;
  background: rgba(255, 70, 85, 0.08);
  border-left: 3px solid var(--red);
  border-radius: 4px;
  color: #ffb3b9;
  font-size: 0.82rem;
}

.btn {
  align-self: flex-start;
  padding: 0.65rem 1.3rem;
  background: var(--red);
  color: #0f1923;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  filter: none;
  border-color: #3a4d5e;
  background: rgba(255, 255, 255, 0.03);
}

.btn.small {
  align-self: center;
  padding: 0.38rem 0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: none;
  border-radius: 6px;
}

.btn.active {
  border-color: var(--red);
  color: var(--red);
}

.btn.danger {
  background: transparent;
  color: #ff8f99;
  border: 1px solid rgba(255, 70, 85, 0.5);
}

.btn.danger:hover {
  filter: none;
  background: rgba(255, 70, 85, 0.12);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hint {
  margin: -0.4rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 10;
  transform: translateX(-50%);
  padding: 0.7rem 1.1rem;
  background: #1d2d3a;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

dialog {
  width: min(440px, 92vw);
  padding: 1.4rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

dialog::backdrop {
  background: rgba(5, 10, 14, 0.78);
}

dialog h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.cred-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.cred-label {
  width: 100%;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cred-row code {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  background: #0c151d;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.9rem;
  word-break: break-all;
}

dialog form {
  margin-top: 1.1rem;
  padding-bottom: 0;
}

dialog .notice {
  margin: 0.9rem 0 0;
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(700px 380px at 50% -10%, rgba(255, 70, 85, 0.3), transparent 70%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 2rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-card h1 {
  margin-top: 1.4rem;
  font-size: 1.9rem;
}

.login-card .lede {
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.login-card form {
  margin-top: 1.4rem;
  padding-bottom: 0;
}

.login-card .btn {
  align-self: stretch;
}

.login-foot {
  margin-top: 1.2rem;
  color: #61707d;
  font-size: 0.78rem;
}

.msg {
  color: var(--muted);
  font-size: 0.85rem;
}

.msg:empty {
  display: none;
}

/* ---------- Footer ---------- */

footer {
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: #61707d;
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar input {
    grid-column: 1 / -1;
  }

  .hero-body {
    padding-top: 2.75rem;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .card-foot {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card {
    transition: none;
  }
}
