:root {
  color-scheme: dark;
  --bg: #17191b;
  --sidebar: #1b1d1f;
  --panel: #222527;
  --line: #363a3c;
  --muted: #a6adaf;
  --text: #f4f5f1;
  --accent: #c4df9b;
  --accent-ink: #233019;
  font-family: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
svg { width: 19px; height: 19px; stroke-width: 1.8; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 20;
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 34px; font-size: 18px; font-weight: 700; letter-spacing: -.6px; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.side-group-label { color: var(--muted); font-size: 12px; font-weight: 500; padding: 0 12px; margin-bottom: 10px; }
.side-nav, .side-categories { display: grid; gap: 3px; }
.side-link, .side-category {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c1c6c7;
  text-align: left;
  font-size: 13px;
  transition: background-color .15s, color .15s;
}
.side-link svg { width: 17px; height: 17px; flex: none; }
.side-link:hover, .side-category:hover { background: #2b2f31; color: var(--text); }
.side-link[aria-pressed=true], .side-category[aria-pressed=true] { background: #30382a; color: var(--accent); }
.categories-label { margin-top: 28px; }
.side-category { padding: 8px 12px; font-size: 12px; }
.side-category span { min-width: 0; flex: 1; }
.side-category-count { margin-left: auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.sidebar-recent { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.sidebar-recent-list { display: grid; gap: 4px; }
.sidebar-recent-game { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; }
.sidebar-recent-game:hover { background: #2b2f31; }
.sidebar-recent-art { position: relative; display: grid; place-items: center; flex: none; width: 34px; height: 34px; overflow: hidden; border-radius: 5px; background: #343c30; color: var(--accent); font-weight: 700; }
.sidebar-recent-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sidebar-recent-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.school-shortcut { margin-top: auto; padding: 25px 8px 18px; display: flex; align-items: center; gap: 10px; font-size: 12px; flex: none; }
.school-shortcut img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.school-shortcut small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.school-shortcut:hover, .sidebar-foot a:hover { color: var(--accent); }
.sidebar-foot { padding: 16px 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.content { min-width: 0; }
.topbar { min-height: 76px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px clamp(22px, 3.5vw, 56px); }
.topbar-location { font-size: 13px; color: var(--muted); }
.topbar-location strong { font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.search-box { width: clamp(205px, 24vw, 330px); height: 40px; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; height: 16px; flex: none; }
.search-box input { min-width: 0; flex: 1; padding: 8px 0; border: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd { font-family: inherit; font-size: 11px; color: var(--muted); border: 1px solid #505557; border-radius: 3px; padding: 1px 5px; }
.icon-button { width: 40px; height: 40px; flex: none; display: grid; place-items: center; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; }
.icon-button:hover { border-color: var(--muted); }
.shuffle-button { width: auto; padding: 0 12px; font-size: 12px; }
.mobile-menu { display: none; }
.wallet-link { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.wallet-link:hover { border-color: #be9c5d; }
.wallet-link img { width: 22px; height: 22px; object-fit: contain; }

.main { max-width: 1560px; margin: auto; padding: 35px clamp(22px, 3.5vw, 56px) 64px; }
.page-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 27px; }
h1 { font-size: clamp(34px, 3.5vw, 48px); font-weight: 600; letter-spacing: -.045em; line-height: 1.15; }
.page-intro p { color: var(--muted); font-size: 13px; margin-top: 9px; }
.coin-summary { width: 238px; flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.coin-summary > img { width: 34px; height: 34px; object-fit: contain; }
.coin-summary-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.coin-summary-copy strong { font-size: 12px; font-weight: 600; }
.coin-summary-copy small { color: var(--muted); font-size: 10px; }
.reward-meter { height: 3px; margin-top: 4px; background: #454238; border-radius: 4px; overflow: hidden; }
.reward-meter i { display: block; width: 0; height: 100%; background: #d1b776; transition: width .2s; }

.spotlight { display: grid; grid-template-columns: 1.4fr 1fr; min-height: 285px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #252b23; }
.spotlight-art { position: relative; min-height: 285px; background: #182c1c; overflow: hidden; }
.spotlight-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spotlight-info { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 28px 32px; }
.spotlight-kicker { font-size: 13px; color: #c2ccba; }
.spotlight-category { font-size: 12px; color: #c2ccba; }
.spotlight-info h2 { font-size: clamp(38px, 4.3vw, 60px); font-weight: 600; letter-spacing: -.055em; line-height: 1.1; margin: 5px 0 9px; overflow-wrap: anywhere; }
.spotlight-info p { color: #c2ccba; font-size: 13px; line-height: 1.6; }
.play-button { min-height: 42px; padding: 11px 24px; border: 0; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.play-button:hover { background: #d2e9b0; }

.school-section { margin-top: 28px; padding: 22px 0 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.section-heading h2 { font-size: 21px; letter-spacing: -.025em; font-weight: 600; }
.school-section h2 { font-size: 16px; letter-spacing: 0; }
.school-schedules-link { color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.school-schedules-link:hover { color: var(--accent); }
.school-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.school-link { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; font-weight: 500; border-radius: 7px; padding: 4px; }
.school-link:hover { background: var(--panel); }
.school-logo { display: grid; place-items: center; width: 48px; height: 48px; flex: none; background: #fff; border-radius: 8px; padding: 5px; }
.school-logo img { width: 100%; height: 100%; object-fit: contain; }

.quick-section, .catalog-section { margin-top: 34px; }
.result-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.game-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; }
.quick-card, .game-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); transition: border-color .15s; }
.quick-card:hover, .game-card:hover { border-color: #859777; }
.thumb { position: relative; aspect-ratio: 1.6; background: #303a2a; overflow: hidden; }
.thumb img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 32px; font-weight: 600; }
.card-info { display: grid; gap: 5px; padding: 13px 14px; }
.card-info strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info small { color: var(--muted); font-size: 11px; }
.card-open { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; background: transparent; border: 0; border-radius: 8px; }
.card-open:focus-visible { outline-offset: -3px; }
.favorite-button { position: absolute; top: 8px; right: 8px; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #ffffff50; border-radius: 6px; background: #17191bea; color: #fff; opacity: 0; transition: opacity .15s; }
.favorite-button svg { width: 16px; height: 16px; }
.quick-card:hover .favorite-button, .game-card:hover .favorite-button, .quick-card:focus-within .favorite-button, .game-card:focus-within .favorite-button, .favorite-button.is-saved { opacity: 1; }
.favorite-button.is-saved { color: var(--accent); }
.favorite-button.is-saved svg { fill: currentColor; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.filter-button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; }
.filter-button:hover { color: var(--text); border-color: var(--muted); }
.filter-button.is-active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.empty-state { border: 1px dashed var(--line); border-radius: 9px; padding: 40px 20px; text-align: center; }
.empty-state svg { color: var(--muted); margin-bottom: 13px; }
.empty-state h3 { font-size: 20px; font-weight: 600; }
.empty-state p { font-size: 13px; color: var(--muted); margin: 9px 0 20px; }
.empty-state button, .load-more { border: 1px solid #66715d; background: var(--panel); color: var(--text); padding: 11px 20px; border-radius: 7px; font-size: 13px; }
.load-more { display: block; margin: 26px auto 0; }
.load-more:hover, .empty-state button:hover { border-color: var(--accent); }
.footer { border-top: 1px solid var(--line); padding: 22px clamp(22px, 3.5vw, 56px); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.footer a { text-decoration: underline; text-underline-offset: 3px; }

.player { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.player-bar { min-height: 60px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 18px; background: var(--sidebar); }
.player-bar button, .player-bar a { color: var(--text); background: transparent; border: 0; padding: 8px 0; font-size: 12px; white-space: nowrap; }
.player-bar button:hover, .player-bar a:hover { color: var(--accent); }
.player-bar strong { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-actions { display: flex; align-items: center; gap: 17px; }
.player-actions span { font-size: 10px; color: var(--muted); }
.player-actions .player-reward { color: #dfc588; white-space: nowrap; }
.player iframe { border: 0; width: 100%; flex: 1; background: #fff; }
.menu-scrim { display: none; }
.coin-toast { position: fixed; z-index: 70; right: 24px; bottom: 24px; padding: 12px 17px; border: 1px solid #bfa66a; border-radius: 8px; background: #2d291d; color: #f1d99f; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; }
.coin-toast.is-visible { opacity: 1; }

@media (max-width: 1250px) {
  .school-link { flex-direction: column; text-align: center; gap: 8px; }
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .brand { gap: 7px; font-size: 16px; }
  .main, .topbar, .footer { padding-left: 24px; padding-right: 24px; }
  .topbar-location { display: none; }
  .topbar-actions { flex: 1; justify-content: flex-end; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spotlight { grid-template-columns: 1.1fr 1fr; }
  .spotlight-info { padding: 24px; }
  .school-grid { gap: 6px; }
}
@media(max-width:680px) {
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: 240px; transform: translateX(-100%); transition: transform .18s; }
  .sidebar.is-open { transform: translateX(0); }
  .menu-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 19; width: 100%; height: 100%; background: #0009; border: 0; }
  .mobile-menu { display: grid; }
  .topbar { min-height: 66px; padding: 12px 16px; gap: 9px; }
  .topbar-actions { min-width: 0; gap: 7px; }
  .search-box { width: auto; flex: 1; min-width: 0; }
  .search-box kbd { display: none; }
  .wallet-link { width: 40px; flex: none; padding: 0; justify-content: center; }
  .wallet-link span { display: none; }
  .main { padding: 26px 16px 48px; }
  .page-intro { align-items: flex-start; margin-bottom: 23px; }
  .coin-summary { width: 190px; padding: 10px; gap: 8px; }
  .coin-summary > img { width: 28px; height: 28px; }
  .spotlight { grid-template-columns: 1.1fr 1fr; min-height: 225px; }
  .spotlight-art { min-height: 225px; }
  .spotlight-info { padding: 20px; gap: 14px; }
  .spotlight-info h2 { font-size: 38px; }
  .spotlight-info p { font-size: 12px; }
  .school-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; }
  .school-link { flex-direction: row; text-align: left; font-size: 11px; }
  .school-logo { width: 38px; height: 38px; border-radius: 6px; }
  .school-section { margin-top: 24px; padding: 20px 0; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .quick-grid { gap: 12px; }
  .section-heading h2 { font-size: 19px; }
  .school-section h2 { font-size: 15px; }
  .footer { padding: 20px 16px; flex-direction: column; gap: 7px; }
  .player-bar { flex-wrap: wrap; gap: 6px 16px; padding: 8px 12px; }
  .player-bar strong { flex: 1; text-align: right; }
  .player-actions { width: 100%; justify-content: flex-end; gap: 16px; }
  .player-actions .player-reward { margin-right: auto; font-size: 9px; }
  .player-actions #open-source-credit { display: none; }
}
@media (max-width: 430px) {
  .page-intro { flex-direction: column; gap: 16px; }
  .coin-summary { width: 100%; }
  .spotlight { grid-template-columns: 1fr; }
  .spotlight-art { min-height: 185px; }
  .spotlight-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
  .spotlight-kicker { grid-column: 1 / -1; font-size: 12px; }
  .spotlight-info h2 { font-size: 34px; }
  .spotlight-info p { margin-top: 5px; }
  .play-button { padding: 11px 16px; }
  .school-link { flex-direction: column; text-align: center; }
  .card-info { padding: 11px; }
  .card-info strong { font-size: 12px; }
  .catalog-heading-row { align-items: baseline; }
}
@media (hover: none) { .favorite-button { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
