:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #111216;
  --surface-raised: #15161a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.94);
  --text-secondary: rgba(255, 255, 255, 0.64);
  --text-muted: rgba(255, 255, 255, 0.42);
  --accent: #71d1c5;
  --accent-ink: #09201d;
  --danger: #f08e9b;
  --content: 1320px;
  font-family: Geist, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .025; background-image: radial-gradient(rgba(255,255,255,.8) .5px, transparent .5px); background-size: 5px 5px; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 4; padding: 8px 12px; background: var(--accent); color: var(--accent-ink); border-radius: 6px; font-weight: 600; }
.skip-link:focus { top: 12px; }

.topbar { height: 58px; display: flex; align-items: center; gap: 28px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(11,12,15,.96); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; letter-spacing: .18em; }
.brand-mark { width: 12px; height: 12px; border-radius: 3px 3px 3px 1px; background: var(--accent); }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; display: block; }
.topnav { display: flex; align-items: center; gap: 22px; height: 100%; }
.nav-link { position: relative; color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -20px; height: 2px; background: var(--accent); }
.account-nav { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.account-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.account-link:hover { color: var(--text); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-raised); border: 1px solid var(--line-strong); color: var(--accent); font-size: 12px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; }
.text-button:hover { color: var(--text); }

.shell { width: min(calc(100% - 56px), var(--content)); margin: 0 auto; padding: 42px 0 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1, .auth-heading h1 { margin: 0; font-size: clamp(28px, 3vw, 36px); line-height: 1.1; letter-spacing: -.035em; font-weight: 650; }
.page-heading p { max-width: 44ch; margin: 8px 0 0; color: var(--text-secondary); }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--text-secondary); }
.subtle { color: var(--text-muted); }

.games-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 24px 18px; }
.game-card { min-width: 0; }
.game-card:focus-visible { border-radius: 9px; }
.game-art { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 8px; background: #1a2120; isolation: isolate; transition: transform .18s ease, border-color .18s ease, filter .18s ease; }
.game-card:hover .game-art, .game-card:focus-visible .game-art { transform: scale(1.012); border-color: var(--line-strong); filter: brightness(1.07); }
.game-art::before, .game-art::after { content: ""; position: absolute; pointer-events: none; }
.art-first-obby { background: linear-gradient(155deg, #273c3a 0%, #182522 48%, #0f1214 100%); }
.art-first-obby::before { width: 120%; height: 70%; left: -10%; bottom: -20%; background: linear-gradient(135deg, transparent 15%, rgba(113,209,197,.35) 16%, rgba(113,209,197,.08) 50%, transparent 51%), linear-gradient(25deg, transparent 39%, rgba(255,255,255,.12) 40%, transparent 42%); transform: rotate(-5deg); }
.art-first-obby::after { width: 42%; height: 18%; top: 25%; left: 29%; border: 2px solid rgba(255,255,255,.68); border-radius: 3px; transform: skewX(-18deg); box-shadow: 32px 20px 0 -2px rgba(113,209,197,.6), -25px 32px 0 -4px rgba(255,255,255,.35); }
.art-label { position: absolute; left: 14px; bottom: 12px; z-index: 1; color: rgba(255,255,255,.86); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
/* Real artwork replaces the generated CSS decoration. */
.game-art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.game-art.has-image::before, .game-art.has-image::after { content: none; }
.game-art.has-image .art-label { text-shadow: 0 1px 6px rgba(0,0,0,.75); }
.game-copy { padding: 11px 2px 0; }
.game-copy h2 { margin: 0; color: var(--text); font-size: 17px; line-height: 1.2; font-weight: 650; }
.game-copy p { margin: 5px 0 0; color: var(--text-muted); font-size: 13px; }

.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 46px; align-items: start; }
.detail-art { aspect-ratio: 16 / 9; margin-bottom: 22px; }
.back-link { display: inline-block; margin-bottom: 26px; color: var(--text-muted); font-size: 13px; }
.back-link:hover { color: var(--text); }
.detail h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.05; letter-spacing: -.04em; font-weight: 650; }
.detail .tagline { margin: 10px 0 20px; color: var(--text-secondary); font-size: 18px; }
.detail-description { max-width: 58ch; color: var(--text-secondary); }
.detail-side { padding-top: 61px; }
.play-button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border: 0; border-radius: 7px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 650; transition: filter .18s ease, transform .18s ease, opacity .18s ease; }
.play-button:hover, .button:hover { filter: brightness(1.08); }
.play-button:active, .button:active { transform: scale(.98); }
.play-button[disabled], .button[disabled] { cursor: wait; opacity: .62; }

.auth-layout { width: min(100%, 440px); margin: 34px auto; }
.auth-heading { margin-bottom: 22px; }
.auth-heading p { margin: 9px 0 0; color: var(--text-secondary); }
.form-panel { padding: 24px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: #0d0e11; color: var(--text); }
.field input:focus { border-color: var(--accent); outline: 2px solid rgba(113,209,197,.18); outline-offset: 0; }
.form-footer { margin: 20px 0 0; color: var(--text-muted); font-size: 13px; text-align: center; }
.form-footer a, .inline-link { color: var(--accent); }
.notice { margin: 0 0 18px; padding: 11px 13px; border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: 6px; background: rgba(113,209,197,.06); color: var(--text-secondary); font-size: 13px; }
.notice.error { border-left-color: var(--danger); background: rgba(240,142,155,.07); color: #f4b6be; }

.account-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 24px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel p { color: var(--text-secondary); }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.launch-layout { width: min(100%, 640px); margin: 72px auto; text-align: center; }
.launch-layout h1 { margin: 0; font-size: 30px; font-weight: 650; }
.launch-card { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; }
.launch-card h2 { margin: 0 0 8px; font-size: 16px; }
.launch-card p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.empty-state { padding: 48px 0; color: var(--text-secondary); }
.error-state { max-width: 500px; margin: 80px auto; text-align: center; }

@media (max-width: 760px) {
  .topbar { padding: 0 16px; gap: 18px; }
  .account-nav { gap: 8px; }
  .account-link span:last-child { display: none; }
  .shell { width: min(calc(100% - 32px), var(--content)); padding-top: 30px; }
  .page-heading { display: block; }
  .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .detail, .account-layout { grid-template-columns: 1fr; gap: 28px; }
  .detail-side { padding-top: 0; }
}
@media (max-width: 460px) {
  .brand { font-size: 13px; }
  .topnav { gap: 14px; }
  .games-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Editorial discovery layer. It keeps the catalog dominant while giving the
   signed-in landing view a stronger visual point of entry. */
.library-intro { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr); gap: 30px; align-items: stretch; min-height: 430px; margin-bottom: 104px; }
.intro-copy { display: flex; flex-direction: column; justify-content: center; padding: 18px 0 28px; }
.intro-copy h1 { max-width: 72rem; margin: 0; color: var(--text); font-size: clamp(2.75rem, 6vw, 5.5rem); line-height: .94; letter-spacing: -.075em; font-weight: 620; }
.intro-copy h1 em { color: var(--text-secondary); font-style: normal; }
.intro-lede { max-width: 31ch; margin: 25px 0 0; color: var(--text-secondary); font-size: 16px; }
.intro-meta { display: flex; align-items: center; gap: 9px; margin-top: 42px; color: var(--text-muted); font-size: 12px; letter-spacing: .02em; }
.feature-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); transition: border-color .2s ease, transform .2s ease; }
.feature-grid:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.feature-art { grid-column: 1 / span 8; grid-row: 1 / span 2; min-width: 0; overflow: hidden; }
.feature-copy { grid-column: 9 / span 4; grid-row: 1 / span 2; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; padding: 24px; border-left: 1px solid var(--line); }
.feature-copy h2 { margin: 0; font-size: 24px; line-height: 1.05; letter-spacing: -.035em; font-weight: 650; }
.feature-copy p:not(.eyebrow) { margin: 10px 0 26px; color: var(--text-secondary); font-size: 13px; }
.feature-link { color: var(--accent); font-size: 13px; font-weight: 650; }
.feature-link span { display: inline-block; margin-left: 5px; transition: transform .2s ease; }
.feature-grid:hover .feature-link span { transform: translate(3px, -3px); }
.feature-art .detail-art { width: 100%; height: 100%; min-height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .7s ease; }
.feature-grid:hover .feature-art .detail-art { transform: scale(1.045); filter: brightness(1.12); }
.feature-art .art-label { display: none; }
.library-section { padding-bottom: 48px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.section-head .eyebrow { margin-bottom: 5px; }
.games-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px 18px; }
.game-card { transition: transform .2s ease; }
.game-card:hover { transform: translateY(-3px); }
.game-art { background-color: #17191a; }
.game-copy { padding-top: 13px; }
.game-copy h2 { font-size: 18px; font-weight: 620; }
.game-copy p { max-width: 28ch; line-height: 1.35; }

@media (max-width: 860px) {
  .library-intro { grid-template-columns: 1fr; min-height: 0; margin-bottom: 72px; }
  .intro-copy { padding: 0; }
  .intro-copy h1 { font-size: clamp(3rem, 12vw, 5rem); }
  .feature-grid { min-height: 330px; }
}
@media (max-width: 560px) {
  .feature-grid { display: block; }
  .feature-art { aspect-ratio: 16 / 10; }
  .feature-art .detail-art { min-height: 0; aspect-ratio: 16 / 10; }
  .feature-copy { border-top: 1px solid var(--line); border-left: 0; padding: 20px; }
  .intro-meta { margin-top: 28px; }
}

/* Compact game shelf */
.compact-library { padding-top: 30px; }
.compact-library .section-head { justify-content: flex-start; border: 0; margin: 0 0 14px; padding: 0; }
.compact-library .section-head h1 { margin: 0; color: var(--text-secondary); font-size: 16px; line-height: 1.2; letter-spacing: -.01em; font-weight: 650; }
.compact-library .games-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 160px)); gap: 22px 14px; align-items: start; }
.compact-library .game-card { padding: 9px 9px 11px; border: 1px solid rgba(255,255,255,.055); border-radius: 11px; background: #14121b; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.compact-library .game-card:hover, .compact-library .game-card:focus-visible { background: #191622; border-color: rgba(255,255,255,.12); }
.compact-library .game-card:hover { transform: translateY(-2px); }
.compact-library .game-art { aspect-ratio: 1.1 / 1; border-radius: 8px; border-color: rgba(255,255,255,.08); }
.compact-library .game-copy { padding: 9px 1px 0; }
.compact-library .game-copy h2 { overflow: hidden; color: rgba(255,255,255,.9); font-size: 13px; line-height: 1.2; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.compact-library .game-copy p { margin: 5px 0 0; }
.player-count, .detail-players { display: flex; align-items: center; gap: 5px; color: var(--text-muted) !important; font-size: 11px !important; line-height: 1.2; }
/* Google Material Symbols for UI glyphs (player counts). The ligature
   text ("group") renders as the icon once the font loads; icon sizing
   follows the row via font-size. */
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.player-count .material-symbols-outlined { font-size: 14px; }
.detail-players .material-symbols-outlined { font-size: 16px; }
.detail-players { margin: -9px 0 18px; font-size: 13px !important; }
@media (max-width: 560px) {
  .compact-library .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Friends: avatar strip matching the Kova app's shelf. The status dot is
   gray offline, accent when online or in-game; offline tiles dim. */
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 7px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.friends-section { margin-bottom: 40px; }
.friends-section .section-head { align-items: baseline; margin: 0 0 4px; padding: 0; border: 0; }
.friends-section .section-head h1 { margin: 0; color: var(--text-secondary); font-size: 16px; line-height: 1.2; letter-spacing: -.01em; font-weight: 650; }
.friend-see-all { margin-left: auto; color: var(--text); font-size: 13px; }
.friend-see-all:hover { color: var(--accent); }
.section-head .hint { margin-left: auto; color: var(--text-muted); font-size: 13px; }
.friends-page .section-head h1 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.friend-add { max-width: 420px; margin: 20px 0 6px; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.friend-add .field { margin-bottom: 12px; }
.friends-grid { display: flex; align-items: flex-start; gap: 18px; margin-top: 4px; padding: 8px 2px 10px; overflow-x: auto; }
.friends-grid.wrap { flex-wrap: wrap; overflow-x: visible; }
.friend-card { display: flex; flex: 0 0 92px; flex-direction: column; align-items: center; gap: 4px; padding: 0 2px; text-align: center; }
.friend-card.offline { opacity: .62; }
.friend-card h2 { margin: 6px 0 0; overflow: hidden; width: 100%; color: rgba(255,255,255,.9); font-size: 12px; line-height: 1.2; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.friend-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-raised); border: 1px solid var(--line-strong); color: var(--accent); font-size: 16px; font-weight: 700; }
.friend-avatar.large { width: 72px; height: 72px; background: #252630; font-size: 25px; }
.friend-avatar.small { width: 32px; height: 32px; font-size: 14px; }
.friend-status { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--text-muted); font-size: 11px; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); flex: 0 0 8px; }
.friend-status.online, .friend-status.in-game { color: var(--text-secondary); }
.friend-status.online .presence-dot, .friend-status.in-game .presence-dot { background: var(--accent); }
.friend-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.friend-add-tile { display: flex; flex: 0 0 92px; flex-direction: column; align-items: center; gap: 6px; padding: 0 2px; border: 0; background: none; color: var(--text); cursor: pointer; }
.friend-add-tile .friend-avatar { color: var(--text); font-size: 42px; font-weight: 300; }
.friend-add-tile:hover .friend-avatar { border-color: var(--accent); color: var(--accent); }
.friend-add-tile span:last-child { font-size: 12px; white-space: nowrap; }
.friend-note { align-self: center; margin: 0; color: var(--text-muted); font-size: 13px; }
.friend-error { margin: 6px 0 0; color: var(--danger); font-size: 13px; }
.play-button.small, .button.small { min-height: 32px; padding: 0 14px; font-size: 13px; }
.request-list { display: grid; gap: 10px; max-width: 560px; margin: 12px 0; }
.request-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.request-name { font-weight: 600; font-size: 14px; }
.request-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
