@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  --bg: #0E0F13; --surface: #171920; --surface2: #1F222B; --line: #2A2E39; --line2: #23262F;
  --text: #ECEEF3; --text2: #C3C8D2; --muted: #9BA1AE; --accent: #FFB547; --accent2: #FFCB7A;
  --ok: #5DD6AE; --warn: #FFB547; --blue: #6FA8FF;
  --cps2: #6FA8FF; --cps1: #C29BFF; --neo: #FF9B6B; --cps3: #FF7FB5; --arcade: #5DD6AE;
  --mono: "JetBrains Mono", ui-monospace, monospace; --display: "Space Grotesk", Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); } a:hover { color: var(--accent2); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* Top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px 28px; border-bottom: 1px solid var(--surface2); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font: 700 20px/1 var(--display); }
.logo span { color: var(--muted); }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 10px; text-decoration: none; color: var(--text2); font-weight: 500; }
.topnav a[aria-current="page"] { background: var(--surface2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.sync { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-left: auto; }
.sync.bad svg { stroke: var(--warn); }
.version { font: 500 11px var(--mono); color: var(--muted); }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3A3F4C; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.primary:hover { background: var(--accent2); color: var(--bg); }
.btn.ghost { background: transparent; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 44px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.search { flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; }
.search input::placeholder { color: #8A909C; }
.kbd { font: 500 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }
.select { height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 500 13px Inter, sans-serif; min-width: 180px; }

/* Layout */
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 28px 48px; display: flex; flex-wrap: wrap; gap: 28px; }
.side { flex: 1 1 200px; max-width: 240px; display: flex; flex-direction: column; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.narrow { max-width: 1240px; margin: 0 auto; padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.side a, .side button.f { display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--text2); background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.side a.on, .side button.f.on { background: var(--surface2); color: var(--text); font-weight: 600; }
.side .n { color: var(--muted); font: 500 12px var(--mono); }
.side h3 { font: 600 11px/1 Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 8px; margin: 0; }
h1 { margin: 0; font: 700 26px/1.2 var(--display); }
h1 .muted { font-weight: 500; }
h2 { margin: 0; font: 700 17px/1.2 var(--display); }
.sub { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line2); }
.row > .lbl { flex: 1 1 240px; min-width: 0; }
.row .t { font-weight: 500; } .row .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* Segmented control and toggle */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { flex: 1 1 0; min-height: 36px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; color: var(--text2); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.tog { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.tog input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tog span { width: 44px; height: 26px; border-radius: 13px; background: var(--line); display: flex; align-items: center; padding: 3px; transition: .15s; pointer-events: none; }
.tog span::after { content: ""; width: 20px; height: 20px; border-radius: 10px; background: var(--muted); transition: .15s; }
.tog input:checked + span { background: var(--accent); justify-content: flex-end; }
.tog input:checked + span::after { background: var(--bg); }
.tog input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="range"] { accent-color: var(--accent); width: 220px; }

/* Game cards */
.tile { background-color: var(--surface2); background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 4px); display: flex; align-items: center; justify-content: center; position: relative; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); position: relative; }
.game:hover { border-color: #3A3F4C; color: var(--text); }
.game.warn { border-color: #5A4520; }
.game .tile { height: 150px; border-bottom: 3px solid var(--c); }
.game.warn .tile { opacity: .6; }
.game .tag { font: 700 30px/1 var(--mono); color: var(--c); letter-spacing: -.02em; text-align: center; padding: 0 8px; word-break: break-all; }
.game .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.game .ttl { font-weight: 600; font-size: 15px; line-height: 1.25; }
.game .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.badge { font: 600 11px/1 var(--mono); color: var(--c); border: 1px solid var(--c); border-radius: 4px; padding: 3px 5px; }
.game .note { font-size: 12px; color: var(--muted); }
.game .note.w { color: var(--warn); display: flex; gap: 6px; align-items: flex-start; }
.fav { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 8px; border: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
.list .grid { grid-template-columns: 1fr; gap: 8px; }
.list .game { flex-direction: row; align-items: center; }
.list .game .tile { height: 64px; width: 96px; flex: none; border-bottom: 0; border-right: 3px solid var(--c); }
.list .game .tag { font-size: 16px; }
.list .fav { top: 50%; transform: translateY(-50%); }
.list .game .info { padding: 10px 56px 10px 14px; }

.continue { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.continue .tile { width: 120px; height: 80px; border-radius: 8px; border-bottom: 3px solid var(--c); flex: none; }
.continue .tag { font: 700 24px/1 var(--mono); color: var(--c); }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.empty { border: 2px dashed #3A3F4C; border-radius: 14px; padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty strong { color: var(--text); font: 700 18px var(--display); }
.chips { display: none; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chips button { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--text2); border: 1px solid var(--line); cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 500; }
.chips button.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Key caps */
.cap { font: 700 13px var(--mono); color: var(--text); background: var(--bg); border: 1px solid #3A3F4C; border-bottom-width: 3px; border-radius: 6px; padding: 5px 10px; min-width: 18px; text-align: center; white-space: nowrap; display: inline-block; }
.cap.listen { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.cap.none { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--line); color: var(--text); padding: 12px 16px; border-radius: 10px; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; }

@media (max-width: 760px) {
  .top { padding: 12px 16px; gap: 10px; }
  .topnav a span { display: none; }
  .topnav a { padding: 0 12px; }
  .sync span { display: none; }
  .wrap, .narrow { padding: 16px; gap: 16px; }
  .side { display: none; }
  .chips { display: flex; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .game .tile { height: 110px; }
  .game .tag { font-size: 24px; }
  .game .info { padding: 10px; }
  .game .ttl { font-size: 13px; }
  .hide-sm { display: none !important; }
  .continue .tile { width: 72px; height: 56px; }
  .continue .tag { font-size: 16px; }
}
[hidden] { display: none !important; }
