/* Game Backlog — dusk living room */
:root {
  --bg: #131529;
  --bg-deep: #0d0f1f;
  --surface: #1c1f3a;
  --surface-2: #262a4d;
  --line: #32365c;
  --text: #e9e8f7;
  --muted: #9a9cc0;
  --lamp: #ffb454;
  --lamp-deep: #e08f1f;
  --violet: #8d8af8;
  --mint: #57d9a3;
  --rose: #f87e9b;
  --radius: 14px;
  --disp: 'Bungee', sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --mono: 'Chivo Mono', monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 75% -10%, #2b2450 0%, transparent 60%),
    radial-gradient(900px 420px at 10% 108%, #241d3e 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: min(1180px, 100% - 40px); margin: 0 auto; }

.mono { font-family: var(--mono); }

/* ---------- header ---------- */
.top {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
  padding: 26px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--disp);
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 24px rgba(255, 180, 84, 0.25);
}
.wordmark span { color: var(--lamp); }

.who { display: flex; align-items: center; gap: 10px; }
.who-name { font-weight: 700; }

.pip {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  box-shadow: 0 0 8px 0 currentColor;
}

/* ---------- buttons & inputs ---------- */
button { font: inherit; cursor: pointer; }

.primary {
  background: var(--lamp);
  color: #241a05;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-weight: 700;
}
.primary:hover { background: #ffc477; }

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

input[type="text"], select {
  font: inherit;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}
input[type="text"]::placeholder { color: #6d6f96; }
input[type="text"]:focus-visible, select:focus-visible,
button:focus-visible, input[type="range"]:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0;
}

/* ---------- identity gate ---------- */
.gate { display: grid; place-items: center; padding: 12vh 0; }
.gate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.gate-title { font-family: var(--disp); font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.gate-sub { color: var(--muted); margin: 0 0 18px; }
.gate-form { display: flex; gap: 10px; }
.gate-form input { flex: 1; min-width: 0; }
.gate-known { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.gate-known button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px;
}
.gate-known button:hover { border-color: var(--lamp); }

/* ---------- week rail (signature) ---------- */
.week { margin-top: 26px; }
.week-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-nav .ghost { padding: 4px 12px; font-size: 18px; line-height: 1.2; }
.week-label { color: var(--muted); font-size: 13px; min-width: 130px; text-align: center; }

.rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}
.day.is-today {
  border-color: var(--lamp-deep);
  box-shadow: 0 0 0 1px var(--lamp-deep), 0 0 34px rgba(255, 180, 84, 0.18);
}
.day.is-past { opacity: 0.55; }

.day-head { display: flex; align-items: baseline; justify-content: space-between; }
.day-name {
  font-family: var(--disp);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.day.is-today .day-name { color: var(--lamp); }
.day-date { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.day-empty { color: #6d6f96; font-size: 13px; margin: auto 0; }

.cand {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  text-align: left;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 13.5px;
}
.cand:hover { border-color: var(--muted); }
.cand.is-mine { border-color: var(--lamp); }
.cand.is-leader { background: #2a2344; }
.cand-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cand-pips { display: flex; gap: 3px; flex: none; }
.cand-pips .pip { width: 8px; height: 8px; box-shadow: none; }

.leader-tag {
  font-family: var(--disp);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--lamp);
  align-self: flex-start;
  margin: -4px 0 -6px 2px;
}

.day-vote {
  margin-top: auto;
  width: 100%;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
}
.day-vote:hover { color: var(--text); }

/* ---------- shelf ---------- */
.shelf { margin: 34px 0 40px; }
.shelf-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.add-form { display: flex; gap: 8px; flex-wrap: wrap; }
.add-form #addTitle { width: 240px; }
.add-form #addPlatform { width: 130px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
}
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--surface-2); color: var(--text); border-color: var(--muted); }

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

.game {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.game-top { display: flex; align-items: flex-start; gap: 8px; }
.game-title { font-weight: 700; font-size: 16px; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.game-del {
  background: transparent; border: none; color: #6d6f96;
  font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.game-del:hover { color: var(--rose); }

.game-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.platform {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 8px; font-family: var(--mono); font-size: 11px;
}
.added-by { display: inline-flex; align-items: center; gap: 5px; }
.added-by .pip { width: 8px; height: 8px; box-shadow: none; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row input[type="range"] {
  flex: 1;
  accent-color: var(--lamp);
  height: 22px;
  margin: 0;
}
.game.st-playing .bar-row input[type="range"] { accent-color: var(--violet); }
.game.st-finished .bar-row input[type="range"] { accent-color: var(--mint); }
.pct { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 4ch; text-align: right; }

.status-row { display: flex; gap: 6px; }
.status-row .st {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 0;
  font-size: 12px;
}
.game.st-backlog .st[data-st="backlog"] { color: var(--text); border-color: var(--muted); background: var(--surface-2); }
.game.st-playing .st[data-st="playing"] { color: var(--violet); border-color: var(--violet); background: rgba(141, 138, 248, 0.12); }
.game.st-finished .st[data-st="finished"] { color: var(--mint); border-color: var(--mint); background: rgba(87, 217, 163, 0.1); }

.grid-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
}

/* ---------- footer ---------- */
.foot {
  text-align: center;
  color: #565879;
  font-size: 11px;
  padding: 18px 0 22px;
  letter-spacing: 0.06em;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .rail { grid-template-columns: repeat(7, minmax(160px, 1fr)); }
}
@media (max-width: 720px) {
  .rail {
    display: flex;
    scroll-snap-type: x mandatory;
  }
  .day { min-width: 200px; scroll-snap-align: start; }
  .add-form { width: 100%; }
  .add-form #addTitle { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .day.is-today { animation: lamp-on 900ms ease-out; }
  @keyframes lamp-on {
    from { box-shadow: 0 0 0 1px var(--lamp-deep), 0 0 0 rgba(255, 180, 84, 0); }
    to { box-shadow: 0 0 0 1px var(--lamp-deep), 0 0 34px rgba(255, 180, 84, 0.18); }
  }
}
