/* ---------- tokens ---------- */
:root {
  --red: #d01012;
  --yellow: #f6b804;
  --blue: #0066b3;
  --green: #237841;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #eceae3;
  --tile: #f7f7f4;
  --text: #1c1b19;
  --text-soft: #5f5c55;
  --border: #ddd9cf;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
  --radius: 16px;
  --font-display: "Baloo 2", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1e2127;
    --surface-2: #262a31;
    --tile: #f3f3f0;
    --text: #f1f0ec;
    --text-soft: #a7a49c;
    --border: #333842;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}
.brand-brick {
  position: relative;
  width: 44px;
  height: 30px;
  border-radius: 6px;
  background: var(--red);
  flex: none;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18);
}
.brand-brick i {
  position: absolute;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.brand-brick i:nth-child(1) { left: 5px; }
.brand-brick i:nth-child(2) { left: 21px; }
.brand-brick i:nth-child(3) { left: 5px; top: auto; bottom: -6px; opacity: 0; }
.brand-brick i:nth-child(4) { left: 21px; top: auto; bottom: -6px; opacity: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; }
.brand-text small { color: var(--text-soft); font-size: .78rem; letter-spacing: .02em; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-soft);
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { color: #fff; background: var(--blue); }

/* ---------- layout ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 60px;
}
.view-head { margin-bottom: 26px; }
.view-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; }
.view-head p { color: var(--text-soft); margin: 6px 0 0; max-width: 60ch; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  background: var(--btn-bg);
  border: none;
  border-radius: 12px;
  padding: 11px 20px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.22);
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.22); }
.btn.red { --btn-bg: var(--red); }
.btn.yellow { --btn-bg: var(--yellow); color: #1c1b19; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: none;
}
.btn.ghost:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- chips / badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: .8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.chip.solid-green { background: var(--green); color: #fff; border-color: transparent; }
.chip.solid-yellow { background: var(--yellow); color: #1c1b19; border-color: transparent; }
.chip.solid-red { background: var(--red); color: #fff; border-color: transparent; }

/* ---------- random view ---------- */
.spotlight {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.spotlight .media {
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 320px;
}
.spotlight .media img { width: 100%; height: 100%; max-height: 440px; object-fit: contain; cursor: zoom-in; }
.spotlight .media img:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.spotlight .body { padding: clamp(22px, 4vw, 36px); display: flex; flex-direction: column; gap: 16px; }
.spotlight .body h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 800; }
.spotlight .by { color: var(--text-soft); font-size: .92rem; margin-top: -8px; }
.spotlight .blurb { font-size: 1.02rem; }
.spotlight .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.spotlight .sub-actions { display: flex; flex-wrap: wrap; gap: 16px; font-size: .88rem; }
.spotlight .sub-actions a { color: var(--blue); font-weight: 600; text-decoration: none; }
.spotlight .sub-actions a:hover { text-decoration: underline; }

.dice-hint { margin-top: 16px; color: var(--text-soft); font-size: .85rem; }
kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .8em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
}

/* ---------- browse view ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 22px;
}
.toolbar .field { display: flex; align-items: center; gap: 7px; }
.toolbar label { font-weight: 600; font-size: .82rem; color: var(--text-soft); white-space: nowrap; }
.toolbar select {
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  max-width: 100%;
}
.reset-filters {
  font: inherit;
  font-weight: 600;
  font-size: .82rem;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}
.reset-filters:hover { color: var(--text); border-color: var(--text-soft); }
.count { margin-left: auto; color: var(--text-soft); font-size: .85rem; white-space: nowrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card .thumb {
  background: var(--tile);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.card .thumb img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.card .thumb img:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.card .card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { font-size: 1.12rem; font-weight: 700; }
.card .by { color: var(--text-soft); font-size: .84rem; margin-top: -6px; }
.card .card-actions { margin-top: auto; display: flex; gap: 8px; }
.card .card-actions .btn { padding: 9px 14px; font-size: .85rem; flex: 1; }

/* ---------- calendar view ---------- */
.calendar-hero {
  position: relative;
  background: linear-gradient(160deg, #0b3d2e, #0a2a3a 60%, #1c1b3a);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 44px);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.calendar-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.8), transparent),
    radial-gradient(2px 2px at 70% 20%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 55% 45%, rgba(255,255,255,.6), transparent);
  pointer-events: none;
}
.calendar-hero > * { position: relative; z-index: 1; }
.soon-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--yellow);
  color: #1c1b19;
  padding: 5px 12px;
  border-radius: 999px;
}
.calendar-hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; margin: 14px 0 8px; }
.calendar-hero p { max-width: 54ch; color: rgba(255,255,255,.82); margin: 0; }

.countdown { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.countdown .unit {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 78px;
  text-align: center;
}
.countdown .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; line-height: 1; }
.countdown .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.7); margin-top: 6px; }

.door-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  margin-top: 32px;
}
.door {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-soft);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.06);
  cursor: not-allowed;
  user-select: none;
}
.door::before {
  content: "🔒";
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: .7rem;
  opacity: .5;
}
.door:nth-child(3n) { background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.door:nth-child(4n) { background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.door.peek { border-color: var(--red); color: var(--red); }
.door.peek::before { content: "🎁"; opacity: 1; }

/* ---------- misc ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
}
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px clamp(16px, 4vw, 40px) 32px;
}
.site-footer a { color: var(--blue); }
.fine-print {
  margin: 22px auto 0;
  max-width: 70ch;
  color: var(--text-soft);
  font-size: .82rem;
  text-align: center;
}

.based-on {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: clamp(16px, 4vw, 28px);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 24px);
  box-shadow: var(--shadow);
}
.based-on img {
  width: clamp(120px, 26vw, 200px);
  flex: none;
  border-radius: 10px;
  background: var(--tile);
}
.based-on-body { display: flex; flex-direction: column; gap: 8px; }
.based-on-kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.based-on-body h2 { font-size: clamp(1.05rem, 2.6vw, 1.3rem); font-weight: 800; }
.based-on-body p { margin: 0; color: var(--text-soft); font-size: .9rem; max-width: 52ch; }
.based-on-body .btn { align-self: flex-start; margin-top: 6px; }

@media (max-width: 560px) {
  .based-on { flex-direction: column; text-align: center; align-items: center; }
  .based-on-body { align-items: center; }
  .based-on-body .btn { align-self: center; }
}

.fade-in { animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; }
  .btn:active { transform: none; }
  #lightbox { animation: none; }
}

/* ---------- lightbox ---------- */
body.lb-open { overflow: hidden; }
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 56px);
  background: rgba(8, 9, 12, .82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade .18s ease both;
  cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox figure {
  margin: 0;
  max-width: 1100px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: auto;
}
#lightbox img {
  min-height: 0;
  max-height: calc(100vh - 140px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f7f4;
}
#lightbox figcaption {
  text-align: center;
  color: #f1f0ec;
  font-weight: 600;
  font-size: .9rem;
}
.lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, .22); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .spotlight { grid-template-columns: 1fr; }
  .spotlight .media { min-height: 240px; }
  .count { width: 100%; margin-left: 0; }
}
