/* Shared surfaces and state colors. Components inherit these in both themes. */
:root {
  color-scheme: dark;
  --bg: #181b1a;
  --panel: #202522;
  --panel2: #2a302c;
  --line: #3a423c;
  --line-strong: #69766c;
  --text: #f0f1eb;
  --muted: #aeb8af;
  --orange: #e3a071;
  --on-accent: #261b13;
  --accent-hover: #efb78d;
  --accent-tint: #393027;
  --danger: #ffb3b5;
  --danger-bg: #392629;
  --success: #b4d8a3;
  --success-bg: #29372a;
  --warning: #e6c384;
  --warning-bg: #353124;
  --backdrop: #10161380;
  --card-min: 250px;
  --radius: 7px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel2: #eaece7;
  --line: #cdd3cc;
  --line-strong: #87958a;
  --text: #242b27;
  --muted: #566259;
  --orange: #a64c25;
  --on-accent: #ffffff;
  --accent-hover: #893b1a;
  --accent-tint: #f5e7da;
  --danger: #a32f3c;
  --danger-bg: #fbe9e9;
  --success: #386128;
  --success-bg: #e7f0e2;
  --warning: #76551c;
  --warning-bg: #f6eedc;
  --backdrop: #29352f50;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
button:focus:not(:focus-visible) { outline: none; }
[hidden] { display: none !important; }
.container { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.accent { color: var(--orange); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: .7rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
h2 { font-size: 1.65rem; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.skip { position: absolute; top: -100px; left: 10px; background: var(--orange); color: var(--on-accent); padding: 12px; z-index: 99; }
.skip:focus { top: 10px; }
.navbar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav-row { display: flex; align-items: center; gap: 25px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.05rem; font-weight: 650; letter-spacing: -.02em; text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 5px; background: var(--orange); color: var(--on-accent); font-size: 1.1rem; }
nav { display: flex; gap: 6px; }
.nav-actions { display: flex; gap: 10px; margin-left: auto; }
.nav-btn, .text-btn { border: 0; background: none; color: var(--muted); padding: 9px 11px; border-radius: 4px; font-size: .8rem; font-weight: 500; text-decoration: none; text-align: center; white-space: nowrap; }
.nav-btn.active, .nav-btn:hover { background: var(--panel2); color: var(--text); }
.nav-btn span { display: inline-block; min-width: 20px; border-radius: 3px; background: var(--panel); font-size: .72rem; margin-left: 4px; }
.icon-btn, .avatar { display: grid; place-items: center; height: 36px; min-width: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.avatar { background: var(--panel2); font-weight: 700; }
.primary-btn, .secondary-btn, .play-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--text); font-size: .86rem; font-weight: 600; text-decoration: none; }
.primary-btn { background: var(--orange); color: var(--on-accent); border-color: var(--orange); }
.primary-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary-btn:hover, .play-btn:hover { background: var(--panel2); border-color: var(--line-strong); }
.live-dot { display: inline-block; width: 6px; height: 6px; background: var(--orange); border-radius: 50%; margin-right: 6px; }
.section { padding: 30px 0 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head .eyebrow { margin-bottom: 9px; }
.library-heading { margin-bottom: 24px; }
.library-heading h1 { font-size: 1.9rem; line-height: 1.2; font-weight: 650; letter-spacing: -.03em; margin: 0 0 7px; }
.library-heading p { font-size: .85rem; margin: 0; }
.library-tools { display: flex; align-items: center; gap: 10px; }
.library-tools .secondary-btn { min-height: 40px; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 0 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; }
.search span { color: var(--muted); font-size: 1.5rem; }
.search input { background: none; border: 0; min-width: 0; width: 100%; height: 40px; font-size: .85rem; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
.filters { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.categories { display: flex; gap: 7px; flex-wrap: wrap; }
.category-btn { border: 1px solid transparent; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 500; padding: 7px 11px; border-radius: 4px; }
.category-btn:hover { background: var(--panel2); color: var(--text); }
.category-btn.active { color: var(--text); background: var(--panel2); border-color: var(--line-strong); box-shadow: inset 0 -2px var(--orange); }
select { border: 1px solid var(--line); background: var(--panel); padding: 7px 8px; border-radius: 5px; font-size: .8rem; }
.sort-label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.results-bar { display: flex; align-items: center; justify-content: space-between; font-size: .76rem; min-height: 52px; }
.text-btn { font-size: .75rem; padding: 6px; }
.text-btn:hover { color: var(--orange); }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: 20px; }
.game-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s; }
.game-card:hover { border-color: var(--line-strong); }
.game-art { display: block; flex-shrink: 0; position: relative; aspect-ratio: 8/5; overflow: hidden; text-decoration: none; background: var(--panel2); }
.game-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-symbol { display: grid; place-items: center; width: 100%; height: 100%; font-size: 4.2rem; background: var(--panel2); color: var(--text); }
.badge { position: absolute; left: 10px; top: 10px; padding: 4px 7px; z-index: 1; border: 1px solid #ffffff45; border-radius: 4px; background: #18201de8; color: #fff; font-size: .6rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.favorite-btn { position: absolute; z-index: 2; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; border: 1px solid #ffffff66; background: #18201df2; color: #fff; font-size: 1.2rem; }
.favorite-btn[aria-pressed=true] { color: #ffda92; }
.game-body { display: flex; flex-direction: column; flex: 1; padding: 14px; }
.game-title-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.game-body h3 { font-size: .94rem; font-weight: 600; margin: 0; }
.genre { color: var(--muted); font-size: .68rem; }
.game-description { color: var(--muted); font-size: .78rem; line-height: 1.5; min-height: 2.6em; margin: 8px 0 12px; }
.game-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.game-bottom small { color: var(--muted); font-size: .68rem; }
.play-btn { min-height: 34px; padding: 6px 12px; font-size: .75rem; }
.empty { grid-column: 1/-1; text-align: center; padding: 45px 15px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.planned-section { margin-top: 25px; border-top: 1px solid var(--line); padding: 20px 0; }
.planned-section summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.planned-section summary span { color: var(--muted); font-weight: 400; font-size: .8rem; }
.planned-section>p { font-size: .85rem; }
.planned-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; margin-top: 12px; }
.planned-game { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.planned-game h3 { font-size: .82rem; font-weight: 500; margin: 0; }
.planned-game span { color: var(--muted); font-size: .7rem; }
.planned-meta { display: flex; align-items: center; gap: 12px; margin-top: 5px; }
.planned-meta .availability { color: var(--muted); font-size: .68rem; }
.recent-section { padding: 0 0 22px; }
.recent-section .section-head { margin-bottom: 12px; }
.recent-section h2 { font-size: .85rem; color: var(--muted); font-weight: 500; }
.recent-section .muted { font-size: .75rem; }
.recent-games { display: flex; gap: 12px; overflow: auto; padding-bottom: 5px; }
.recent-card { display: flex; align-items: center; gap: 12px; min-width: 160px; padding: 8px 15px 8px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); text-decoration: none; font-size: .74rem; }
.recent-card img { width: 65px; height: 42px; border-radius: 3px; object-fit: cover; }
.library-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; border-top: 1px solid var(--line); padding: 22px 0 30px; }
.ai-link { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; text-decoration: none; font-size: .82rem; width: fit-content; max-width: 100%; }
.ai-link img { width: 192px; height: 112px; flex-shrink: 0; object-fit: cover; object-position: center 36%; border-radius: 3px; background: #fff; }
.ai-link:hover span { color: var(--orange); }
.music-link { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; font-size: .82rem; }
.music-link-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.music-link-copy img { width: 192px; height: 112px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.music-link-copy>span { min-width: 0; }
.music-link strong, .music-link .muted { display: block; }
.music-link strong { font-weight: 550; }
.music-link .muted { font-size: .75rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-link button { flex-shrink: 0; }
.library-page .account-banner { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 15px 0; margin: 0; font-size: .75rem; }
.footer { padding-block: 18px 25px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .72rem; }
.footer .brand { font-size: .95rem; gap: 0; color: var(--text); }
.footer strong { font-weight: 500; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--orange); }
dialog { width: min(480px, calc(100vw - 28px)); max-height: 85dvh; background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: 7px; padding: 25px; box-shadow: 0 12px 48px #0003; }
dialog::backdrop { background: var(--backdrop); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 20px; }
.panel-head h2 { font-size: 1.4rem; }
.field { display: block; margin: 18px 0; font-size: .82rem; }
.field input { display: block; width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); margin-top: 8px; }
.field input::placeholder { color: var(--muted); }
.setting-row, .record-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.setting-row small, .record-row small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; line-height: 1.5; margin-top: 3px; }
.setting-row input[type=checkbox] { flex-shrink: 0; width: 20px; height: 20px; margin: 3px 0; accent-color: var(--orange); }
.record-row>strong { font-size: .78rem; font-weight: 600; text-align: right; max-width: 40%; overflow-wrap: anywhere; }
.record-player { min-width: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; margin-top: 22px; }
.dialog-actions button { min-height: 42px; }
.danger-btn { color: var(--danger); }
.back-link { color: var(--muted); font-size: .8rem; text-decoration: none; }
.back-link:hover { color: var(--text); }
#panel { width: min(540px, calc(100vw - 28px)); padding: 0; }
#panel[open] { display: flex; flex-direction: column; max-height: 85dvh; }
#panel .panel-head { flex-shrink: 0; margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
#panel .panel-head h2 { font-size: 1.12rem; font-weight: 600; letter-spacing: 0; }
#panelBody { overflow: auto; padding: 0 20px 20px; min-height: 0; }
#panelBody hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
#panelBody>div>p { font-size: .8rem; line-height: 1.6; }
.toast { position: fixed; z-index: 100; bottom: 22px; left: 50%; transform: translate(-50%, 140%); opacity: 0; padding: 12px 18px; border-radius: 5px; background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); font-size: .86rem; max-width: calc(100vw - 30px); transition: transform .2s, opacity .2s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.compact { --card-min: 205px; }
.reduce-motion *, .reduce-motion *:before, .reduce-motion *:after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
html:has(body.reduce-motion) { scroll-behavior: auto; }
@media (max-width: 820px) {
  .nav-row { flex-wrap: wrap; gap: 14px; padding-block: 12px; }
  .nav-row nav { order: 3; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .nav-row .nav-btn { padding: 9px 6px; font-size: .78rem; min-width: 0; }
  .library-heading { align-items: flex-start; }
  .library-tools { flex-wrap: wrap; justify-content: flex-end; }
  .library-links { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .container { width: calc(100% - 32px); }
  .library-heading { display: block; }
  .library-tools { justify-content: flex-start; margin-top: 18px; flex-wrap: nowrap; }
  .library-tools .search { min-width: 0; flex: 1; width: auto; }
  .library-tools .secondary-btn { font-size: .74rem; padding: 9px 12px; }
  .section-head { flex-wrap: wrap; gap: 15px; }
  .filters { align-items: flex-start; flex-direction: column; gap: 12px; }
  .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .game-body { padding: 11px; }
  .game-title-row { align-items: flex-start; flex-direction: column; gap: 2px; }
  .game-body h3 { font-size: .85rem; }
  .game-description { font-size: .74rem; }
  .game-bottom { gap: 8px; }
  .planned-grid { grid-template-columns: 1fr; }
  .library-links { gap: 20px; }
  .library-page .account-banner { flex-direction: row; align-items: center; font-size: .72rem; }
  .footer { flex-wrap: wrap; }
  .music-link { font-size: .78rem; }
}
@media (max-width: 430px) { .nav-row #favoriteTotal { display: none; } }
@media (max-width: 360px) { .games-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *:before, *:after { animation: none !important; transition: none !important; } }
