:root {
  --bg: #0d1117;
  --panel: #111a24;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.07);
  --text: #ffffff;
  --muted: #9ca3af;
  --dim: #6b7280;
  --amber: #C4944A;
  --teal: #2dd4bf;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --violet: #a78bfa;
  --orange: #f59e0b;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Manrope, system-ui, sans-serif; font-size: 14px; line-height: 1.45; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px; background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; text-decoration: none; font-size: 16px; }
.brand span { color: var(--amber); }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a {
  text-decoration: none; color: var(--muted); font-weight: 700;
  padding: 6px 12px; border-radius: 999px;
}
.topbar nav a.active { color: var(--text); background: var(--card); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }

.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 12px; font-weight: 700;
}
.ghost:hover { color: var(--text); }

/* login */
.login {
  max-width: 380px; margin: 12vh auto 0; padding: 32px;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
}
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login label { display: block; font-weight: 700; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.login input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #0a0f15; color: var(--text); font: inherit;
}
.btn {
  width: 100%; margin-top: 22px; padding: 14px; border: 0; border-radius: 14px;
  background: var(--amber); color: #111; font-weight: 800; font-size: 15px;
}
.error { color: var(--red); margin-top: 14px; font-weight: 600; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { color: var(--muted); text-decoration: none; font-weight: 700; display: inline-block; margin-bottom: 14px; }
.back:hover { color: var(--text); }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 24px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat.warn .n { color: var(--orange); }

/* filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-weight: 700;
}
.chip.on { background: var(--amber); color: #111; border-color: var(--amber); }

/* swaps list */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 110px 1.2fr 1.8fr 150px 120px 110px;
  align-items: center; gap: 14px; padding: 14px 18px; text-decoration: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.row:hover { border-color: rgba(196, 148, 74, 0.5); }
.row .ref { font-weight: 800; letter-spacing: .03em; }
.row .members { font-weight: 700; }
.row .members .arrow { color: var(--amber); margin: 0 6px; }
.row .games { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .date { color: var(--muted); font-size: 13px; }
.row-head { background: transparent; border: 0; padding: 0 18px; color: var(--dim); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.row-head:hover { border: 0; }

.dots { display: flex; gap: 4px; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.12); display: block; }
.dots i.on { background: var(--teal); }
.dots i.done { background: var(--green); }
.dots span { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; white-space: nowrap; border: 1px solid transparent;
}
.pill.gray { color: var(--muted); background: rgba(255,255,255,0.06); }
.pill.teal { color: var(--teal); background: rgba(45, 212, 191, 0.12); }
.pill.amber { color: var(--amber); background: rgba(196, 148, 74, 0.14); }
.pill.green { color: var(--green); background: rgba(34, 197, 94, 0.12); }
.pill.red { color: var(--red); background: rgba(239, 68, 68, 0.12); }
.pill.orange { color: var(--orange); background: rgba(245, 158, 11, 0.12); }
.cond-sealed { color: var(--violet); background: rgba(167,139,250,.14); }
.cond-like_new { color: var(--green); background: rgba(34,197,94,.12); }
.cond-good { color: var(--blue); background: rgba(59,130,246,.14); }
.cond-fair { color: var(--orange); background: rgba(245,158,11,.12); }
.cond-worn { color: var(--red); background: rgba(239,68,68,.12); }

/* detail */
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-head h1 { margin: 0; font-size: 28px; font-weight: 800; }
.detail-head .meta { color: var(--muted); width: 100%; margin-top: 2px; }

.timeline {
  display: grid; grid-template-columns: repeat(7, 1fr); margin: 22px 0 22px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 10px 16px;
}
.step { text-align: center; position: relative; padding: 0 4px; }
.step::before {
  content: ''; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: rgba(255,255,255,0.1);
}
.step:first-child::before { display: none; }
.step.done::before, .step.part::before { background: var(--green); }
.step .dot {
  position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; margin: 0 auto 8px;
  background: #1a232e; border: 2px solid rgba(255,255,255,0.15);
}
.step.done .dot { background: var(--green); border-color: var(--green); }
.step.part .dot { background: var(--bg); border-color: var(--teal); }
.step .t { font-weight: 800; font-size: 12px; }
.step .d { color: var(--muted); font-size: 11px; margin-top: 2px; min-height: 16px; }

.alert {
  display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; margin-bottom: 18px;
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.35); color: #fcd9a0; font-weight: 600;
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 20px;
  border-top-width: 3px;
}
.card.a { border-top-color: var(--amber); }
.card.b { border-top-color: var(--teal); }
.member { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: rgba(255,255,255,0.08); overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.member .name { font-weight: 800; font-size: 17px; }
.member .sub { color: var(--muted); font-size: 12px; }
.member .role { margin-left: auto; }

.label { color: var(--dim); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; margin: 18px 0 8px; }
.label:first-of-type { margin-top: 0; }

.game { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.game img.cover { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: #1a232e; flex: none; }
.game .gt { font-weight: 800; }
.game .gm { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.photos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 6px 0 12px; }
.photos img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in;
  background: #1a232e; border: 1px solid var(--border);
}

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv a { color: var(--teal); text-decoration: none; }
.kv a:hover { text-decoration: underline; }

.money { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 13px; }
.money .tot { font-weight: 800; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.money span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

.section { margin-top: 16px; }
.section .card { border-top-width: 1px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.big { font-size: 22px; font-weight: 800; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.loading { color: var(--muted); padding: 60px; text-align: center; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.88);
  display: grid; place-items: center;
}
.lightbox img { max-width: 88vw; max-height: 88vh; border-radius: 12px; }
.lb-close, .lb-nav {
  position: absolute; background: rgba(255,255,255,0.08); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1;
}
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 20px; top: 50%; }
.lb-next { right: 20px; top: 50%; }

@media (max-width: 860px) {
  .topbar { padding: 12px 16px; gap: 14px; }
  .who span { display: none; }
  main { padding: 20px 16px 60px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr auto; }
  .row .games, .row .date, .row .dots { grid-column: 1 / -1; }
  .row-head { display: none; }
  .pair, .cols3 { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(4, 1fr); row-gap: 16px; }
  .step:nth-child(5)::before { display: none; }
  .photos { grid-template-columns: repeat(4, 1fr); }
}

/* notes & reviews */
.section.pair .card { border-top-width: 1px; }
.note { padding: 12px 0; border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: 0; padding-bottom: 0; }
.note:first-of-type { padding-top: 0; }
.note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.note-date { margin-left: auto; font-size: 12px; }
.note-body { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stars { color: var(--amber); letter-spacing: 1px; }
.stars .off { color: rgba(255,255,255,0.15); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
