:root {
  color-scheme: dark;
  --bg: #202124;
  --panel: #292a2e;
  --border: #404146;
  --fg: #f5f5f5;
  --muted: #b3b4b8;
  --accent: #e7b46b;
  --accent2: #c3c4c9;
  --danger: #ffc1a8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }
button:disabled, input:disabled { opacity: .5; cursor: not-allowed; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: auto; padding: 13px 20px; background: #17181a; border-bottom: 1px solid #303136; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 850; letter-spacing: -1.6px; font-size: 27px; text-decoration: none; line-height: 1; }
.brand img { flex-shrink: 0; }
.brand-accent { color: var(--accent); }
.search-wrap { order: 3; width: 100%; display: flex; align-items: center; gap: 9px; background: #292a2e; border: 1px solid var(--border); border-radius: 12px; padding: 0 13px; color: var(--muted); }
.search-wrap svg { flex: 0 0 18px; width: 18px; height: 18px; }
.search-wrap input { width: 100%; min-width: 0; background: transparent; border: 0; padding: 12px 0; outline: none; font-size: 14px; }
.search-wrap:focus-within { border-color: var(--accent2); }
.iconbutton { margin-left: auto; display: grid; place-items: center; border: 1px solid var(--border); background: var(--panel); color: var(--muted); width: 44px; height: 44px; border-radius: 13px; }
.iconbutton:hover { color: var(--fg); border-color: var(--accent2); }
.iconbutton svg { width: 21px; height: 21px; }
.layout { max-width: 1280px; margin: auto; }
.sidebar { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; background: #18191b; border-top: 1px solid var(--border); padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); }
.sidebar nav { display: flex; gap: 6px; max-width: 460px; margin: auto; }
.nav-item { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 12px; padding: 7px 8px; min-height: 54px; font-size: 12px; font-weight: 650; }
.nav-item svg { width: 21px; height: 21px; flex-shrink: 0; }
.nav-item:hover { color: var(--fg); background: var(--panel); }
.nav-item.active { color: var(--accent); background: #3a332a; border-color: #5b4931; }
.workspace { min-width: 0; display: flex; flex-direction: column; min-height: calc(100dvh - 130px); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { width: 100%; padding: 12px 20px 28px; flex: 1; }
.library { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin: 0 0 24px; }
.chip { font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 6px 10px; border-radius: 99px; background: #27282b; }
.warning { color: var(--danger); width: 100%; font-size: 13px; line-height: 1.5; text-align: center; }
#screen { min-width: 0; }
#screen[data-mode="quiz"], #screen[data-mode="chosen"], #screen[data-mode="empty"], #screen[data-mode="error"] { max-width: 660px; margin: 0 auto; }
.eyebrow { font-weight: 750; color: var(--accent2); font-size: 11px; letter-spacing: 1.7px; text-transform: uppercase; margin: 0 0 12px; }
h1 { font-size: clamp(32px, 7vw, 52px); line-height: 1.08; letter-spacing: -1.7px; margin: 0 0 10px; overflow-wrap: anywhere; }
h2 { font-size: 17px; line-height: 1.3; letter-spacing: -.3px; margin: 0 0 5px; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 24px; max-width: 660px; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; gap: 10px; border: 1px solid var(--border); border-radius: 10px; background: #292a2e; padding: 15px 13px; min-height: 100px; font-size: 14px; font-weight: 650; transition: background .15s, border-color .15s, transform .15s; overflow-wrap: anywhere; }
.option:hover, .option:focus-visible { border-color: var(--accent); background: #37383c; transform: translateY(-2px); }
.option:active { transform: scale(.98); }
.emoji { display: grid; place-items: center; width: 38px; height: 38px; font-size: 22px; background: #3c3d41; border-radius: 12px; }
.arrow { position: absolute; right: 12px; top: 13px; color: var(--accent2); font-size: 20px; line-height: 1; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.primary, .secondary { padding: 12px 17px; border-radius: 7px; min-height: 44px; font-size: 14px; font-weight: 700; border: 1px solid transparent; }
.primary { background: var(--accent); color: #24201a; }
.primary:hover { background: #f4c889; }
.secondary { background: #2d2e32; color: var(--fg); border-color: var(--border); }
.secondary:hover { border-color: var(--accent2); background: #38393d; }
.progress { display: flex; gap: 5px; margin: 0 0 24px; }
.progress span { height: 4px; flex: 1; max-width: 44px; background: #45464a; border-radius: 8px; }
.progress .done { background: var(--accent); }
.grid { display: grid; grid-template-columns: 1fr; gap: 15px; align-items: start; }
.media { display: grid; grid-template-columns: minmax(92px, 36%) minmax(0, 1fr); align-items: start; gap: 13px; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.media.hero { border-color: var(--accent); background: #292a2e; }
.poster { position: relative; background: #333438; aspect-ratio: 2/3; overflow: hidden; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.poster img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.placeholder { font-size: 32px; }
.ribbon { position: absolute; top: 6px; left: 6px; right: 6px; padding: 5px 3px; background: var(--accent); color: #24201a; font-size: 10px; text-align: center; font-weight: 800; border-radius: 6px; }
.body { min-width: 0; padding: 3px 0; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 0; }
.genres { font-size: 12px; color: var(--accent2); line-height: 1.5; }
.overview { font-size: 13px; color: var(--fg); line-height: 1.6; margin: 6px 0; overflow-wrap: anywhere; }
.overview summary { cursor: pointer; color: var(--muted); min-height: 36px; padding: 8px 0; }
.why { font-size: 12px; color: var(--accent); line-height: 1.5; }
.body .primary, .body .secondary { width: 100%; margin-top: 6px; padding: 9px 5px; font-size: 12px; }
.loading { padding: 35px 0; color: var(--muted); text-align: center; }
footer { color: var(--muted); font-size: 12px; padding: 20px; text-align: center; }
.selection { font-size: 42px; margin-bottom: 10px; }
.selection-poster { max-width: 220px; margin-top: 16px; border-radius: 12px; display: block; width: 100%; }
.browse-grid { grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 16px 12px; }
.browse-grid .media { display: block; padding: 0; border: 0; background: transparent; border-radius: 6px; }
.browse-grid .body { padding-top: 9px; }
.browse-grid .body .secondary { background: transparent; }
.browse-grid h2 { font-size: 14px; }
.browse-grid .media:hover .poster { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 340px) {
  .options { grid-template-columns: 1fr; }
  .option { min-height: 80px; }
}
@media (min-width: 700px) {
  .top { position: sticky; top: 0; z-index: 20; flex-wrap: nowrap; padding: 10px 24px; gap: 24px; min-height: 64px; }
  .search-wrap { order: 0; width: min(390px, 42vw); margin-left: 24px; border-radius: 8px; }
  .iconbutton { margin-left: auto; border: 0; background: transparent; }
  .layout { max-width: none; display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
  .sidebar { position: sticky; top: 64px; align-self: start; height: calc(100dvh - 64px); border: 0; border-right: 1px solid #303136; background: #1b1c1e; padding: 22px 12px; }
  .sidebar nav { display: grid; gap: 6px; max-width: none; margin: 0; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; min-height: 44px; font-size: 14px; border-radius: 8px; }
  .nav-item svg { width: 19px; height: 19px; }
  .workspace { min-height: calc(100dvh - 64px); padding-bottom: 0; }
  main { padding: 24px 30px 44px; }
  .library { justify-content: flex-start; margin-bottom: 28px; }
  #screen[data-mode="quiz"] { max-width: 700px; padding: 25px; border: 1px solid var(--border); border-radius: 13px; background: #252629; margin: 0 auto; }
  h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -1px; }
  .option { padding: 15px; min-height: 108px; font-size: 15px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .media { display: block; padding: 12px; }
  .media .body { padding-top: 13px; }
  .browse-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 24px 18px; }
  .body .primary, .body .secondary { font-size: 13px; }
}
@media (min-width: 1050px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr); }
  main { padding: 28px 36px 48px; }
  .grid:not(.browse-grid) { max-width: 920px; }
  #screen[data-mode="results"] { max-width: 920px; margin: auto; }
  .browse-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
