:root {
  --ink: #111218;
  --ink-2: #191b22;
  --ink-3: #252832;
  --paper: #f6f1e7;
  --paper-2: #e9e2d5;
  --white: #fffdf8;
  --coral: #f25c3b;
  --coral-dark: #d94327;
  --mint: #39e6c9;
  --gold: #e8b44f;
  --muted: #777871;
  --line: rgba(17, 18, 24, .13);
  --shadow: 0 24px 70px rgba(16, 17, 22, .17);
  --radius: 3px;
  --max: 1340px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -60px; background: var(--mint); padding: 12px 18px; z-index: 9999; font-weight: 800; }
.skip-link:focus { top: 12px; }

.boot-screen {
  position: fixed; inset: 0; z-index: 9999; background: var(--ink);
  color: var(--paper); display: grid; place-content: center; justify-items: center; gap: 20px;
  transition: opacity .45s ease, visibility .45s ease;
}
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-screen p { font: 500 11px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .22em; }
.boot-mark, .brand-mark {
  position: relative; display: grid; place-items: center; background: var(--coral); color: var(--paper);
  font: 800 26px/1 "Manrope", sans-serif; width: 50px; height: 50px; overflow: hidden;
}
.boot-mark { width: 68px; height: 68px; font-size: 35px; }
.boot-mark i, .brand-mark i { position: absolute; background: var(--mint); width: 11px; height: 11px; right: 0; bottom: 0; }
.boot-track { width: 180px; height: 2px; background: rgba(255,255,255,.18); }
.boot-track span { display: block; height: 100%; background: var(--mint); animation: boot 1.25s ease-in-out infinite; }
@keyframes boot { 0% { width: 0; margin-left: 0; } 55% { width: 80%; margin-left: 10%; } 100% { width: 0; margin-left: 100%; } }

.topbar {
  height: 78px; padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  display: flex; align-items: center; gap: 42px; position: sticky; top: 0; z-index: 80;
  background: rgba(246, 241, 231, .92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; font-size: 20px; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; font-size: 20px; }
.brand-mark i { width: 7px; height: 7px; }
.main-nav { display: flex; align-items: stretch; height: 100%; gap: 30px; }
.main-nav a {
  display: grid; place-items: center; position: relative; color: var(--muted);
  font-weight: 700; font-size: 13px;
}
.main-nav a::after { content: ""; position: absolute; bottom: 0; height: 3px; left: 50%; right: 50%; background: var(--coral); transition: .2s ease; }
.main-nav a:hover, .main-nav a.active { color: var(--ink); }
.main-nav a.active::after { left: 0; right: 0; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.status-chip {
  border: 1px solid var(--line); background: transparent; padding: 9px 12px; display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; font: 500 9px/1 "DM Mono", monospace; letter-spacing: .08em; cursor: pointer;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa; }
.status-chip.connected .status-dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(57,230,201,.14); }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; cursor: pointer; font: 500 20px/1 monospace; }
.icon-btn:hover { background: var(--ink); color: var(--paper); }
.profile-button { border: 0; background: transparent; display: flex; align-items: center; gap: 9px; padding: 3px 0 3px 8px; cursor: pointer; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font: 600 11px/1 "DM Mono", monospace; letter-spacing: .04em;
}
.profile-label { text-align: left; display: grid; line-height: 1.2; }
.profile-label strong { font-size: 12px; }
.profile-label small { font: 400 9px/1.3 "DM Mono", monospace; color: var(--muted); text-transform: uppercase; }

main > section { padding-left: max(24px, calc((100vw - var(--max)) / 2)); padding-right: max(24px, calc((100vw - var(--max)) / 2)); }
.hero { min-height: 675px; display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-copy { padding: 72px 40px 72px 0; position: relative; z-index: 2; }
.eyebrow { margin: 0 0 18px; color: var(--muted); text-transform: uppercase; font: 500 10px/1.4 "DM Mono", monospace; letter-spacing: .17em; }
.eyebrow span { width: 26px; height: 2px; display: inline-block; background: var(--coral); vertical-align: middle; margin-right: 9px; }
.hero h1 { margin: 0; font-size: clamp(63px, 6.2vw, 99px); line-height: .89; letter-spacing: -.075em; font-weight: 800; max-width: 680px; }
.hero h1 em { color: var(--coral); font-style: normal; }
.hero-lede { color: #5f605c; font-size: 17px; line-height: 1.7; max-width: 520px; margin: 28px 0 34px; }
.hero-actions { display: flex; align-items: center; gap: 28px; }
.primary-button, .secondary-button, .danger-button {
  min-height: 48px; padding: 0; border: 0; display: inline-flex; align-items: stretch; cursor: pointer;
  text-transform: uppercase; font: 700 10px/1 "DM Mono", monospace; letter-spacing: .1em;
}
.primary-button span { display: grid; place-items: center; padding: 0 22px; background: var(--coral); color: white; }
.primary-button b { width: 48px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-size: 17px; }
.primary-button:hover span { background: var(--coral-dark); }
.primary-button:hover b { background: var(--mint); color: var(--ink); }
.primary-button.wide { width: 100%; }
.primary-button.wide span { flex: 1; }
.secondary-button { padding: 0 18px; border: 1px solid var(--line); background: transparent; }
.secondary-button:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.secondary-button.light { color: white; border-color: rgba(255,255,255,.25); }
.danger-button { padding: 0 18px; background: transparent; border: 1px solid rgba(242,92,59,.35); color: var(--coral); }
.text-button { font: 600 11px/1 "DM Mono", monospace; border-bottom: 1px solid var(--ink); padding: 8px 0; text-transform: uppercase; letter-spacing: .06em; }
.hero-stats { display: flex; gap: 28px; margin-top: 66px; }
.hero-stats div { display: grid; padding-right: 28px; border-right: 1px solid var(--line); }
.hero-stats div:last-child { border: 0; }
.hero-stats strong { font: 500 20px/1.3 "DM Mono", monospace; }
.hero-stats span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }

.hero-visual { height: 100%; min-height: 675px; position: relative; background: var(--ink); margin-right: calc(max(24px, (100vw - var(--max)) / 2) * -1); overflow: hidden; }
.hero-grid { position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(57,230,201,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(57,230,201,.18) 1px, transparent 1px); background-size: 42px 42px; transform: perspective(600px) rotateX(56deg) scale(1.5); transform-origin: 50% 100%; }
.hero-visual::after { content: "PLAY / SAVE / RANK"; position: absolute; right: 20px; top: 100px; color: rgba(255,255,255,.19); font: 500 9px/1 "DM Mono", monospace; letter-spacing: .22em; writing-mode: vertical-rl; }
.feature-card { position: absolute; cursor: pointer; transition: transform .25s ease, border-color .25s ease; }
.feature-card:hover { transform: translateY(-5px); }
.feature-main {
  width: 52%; height: 54%; left: 8%; top: 16%; background: var(--coral); color: white;
  border: 1px solid rgba(255,255,255,.2); box-shadow: 28px 28px 0 rgba(57,230,201,.85);
}
.mini-game { height: 73%; position: relative; border-bottom: 1px solid rgba(255,255,255,.25); overflow: hidden; background: radial-gradient(circle at center, rgba(255,255,255,.13), transparent 60%); }
.mini-game::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed rgba(255,255,255,.6); }
.mini-game i { position: absolute; width: 8px; height: 74px; top: 40%; background: var(--paper); }
.mini-game i:first-child { left: 13%; transform: translateY(-45%); }
.mini-game i:nth-child(2) { right: 13%; transform: translateY(8%); }
.mini-game b { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); left: 60%; top: 43%; box-shadow: -35px 26px 0 -4px rgba(255,255,255,.4), -70px 52px 0 -5px rgba(255,255,255,.25); }
.mini-game span { position: absolute; top: 10%; font: 500 18px/1 "DM Mono", monospace; }
.mini-game span:nth-last-child(2) { right: 52%; }
.mini-game span:last-child { left: 52%; }
.feature-meta { height: 27%; padding: 14px 17px; display: grid; align-content: center; }
.feature-meta span, .feature-side span { color: rgba(255,255,255,.67); text-transform: uppercase; font: 500 8px/1 "DM Mono", monospace; letter-spacing: .14em; }
.feature-meta strong { font-size: 21px; line-height: 1.1; letter-spacing: -.04em; }
.feature-meta small { font: 400 8px/1.3 "DM Mono", monospace; }
.feature-side { width: 28%; height: 27%; right: 6%; border: 1px solid rgba(255,255,255,.18); color: white; display: grid; grid-template-rows: 1fr auto; }
.feature-side.top { top: 12%; background: #252834; }
.feature-side.bottom { top: 44%; background: #23271f; }
.feature-side > div:last-child { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.15); display: grid; }
.feature-side strong { font-size: 11px; }
.block-art { display: grid; grid-template-columns: repeat(5, 18px); grid-template-rows: repeat(4, 18px); align-content: center; justify-content: center; gap: 3px; }
.block-art i { background: var(--gold); }
.block-art i:nth-child(1) { grid-column: 2; grid-row: 1; }
.block-art i:nth-child(2) { grid-column: 2; grid-row: 2; }
.block-art i:nth-child(3) { grid-column: 3; grid-row: 2; }
.block-art i:nth-child(4) { grid-column: 4; grid-row: 2; }
.block-art i:nth-child(n+5) { background: var(--mint); grid-row: 4; }
.block-art i:nth-child(5) { grid-column: 1; }.block-art i:nth-child(6) { grid-column: 2; }.block-art i:nth-child(7) { grid-column: 3; }
.rock-art { display: grid; place-items: center; color: var(--mint); font: 500 37px/1 "DM Mono", monospace; }
.rock-art i { color: var(--paper); font-size: 24px; }
.visual-caption { position: absolute; bottom: 34px; right: 6%; color: rgba(255,255,255,.54); font: 400 9px/1.7 "DM Mono", monospace; text-align: right; text-transform: uppercase; letter-spacing: .1em; }

.library-section { padding-top: 96px; padding-bottom: 104px; background: var(--white); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.section-heading h2 { margin: 0; font-size: clamp(33px, 4vw, 52px); line-height: .98; letter-spacing: -.055em; }
.section-heading .eyebrow { margin-bottom: 13px; }
.view-toggle { display: flex; border: 1px solid var(--line); }
.view-toggle button { width: 39px; height: 37px; background: transparent; border: 0; cursor: pointer; }
.view-toggle button + button { border-left: 1px solid var(--line); }
.view-toggle button.active { background: var(--ink); color: var(--paper); }
.library-toolbar { display: grid; grid-template-columns: 240px 1fr auto; gap: 20px; align-items: center; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.search-box { display: flex; align-items: center; border: 1px solid var(--line); height: 42px; background: white; }
.search-box span { font-size: 22px; width: 40px; text-align: center; }
.search-box input { border: 0; background: transparent; outline: 0; min-width: 0; width: 100%; font-size: 12px; }
.filter-tabs { display: flex; justify-content: center; gap: 4px; overflow-x: auto; }
.filter-tabs button {
  border: 0; background: transparent; padding: 10px 12px; color: var(--muted); cursor: pointer;
  font: 500 9px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
.filter-tabs button.active { color: var(--ink); background: var(--paper-2); }
.select-wrap { display: grid; grid-template-columns: auto auto; align-items: center; gap: 9px; }
.select-wrap > span { color: var(--muted); font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.select-wrap select { height: 40px; border: 1px solid var(--line); background: transparent; padding: 0 28px 0 10px; font-size: 11px; font-weight: 700; }
.game-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px 20px; }
.game-card { min-width: 0; position: relative; }
.game-cover {
  aspect-ratio: 1.35; background: var(--ink-2); color: white; position: relative; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(0,0,0,.1);
}
.game-cover::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 23px 23px; opacity: .4; }
.game-cover::after { content: attr(data-code); position: absolute; right: 11px; top: 10px; font: 500 8px/1 "DM Mono", monospace; letter-spacing: .12em; color: rgba(255,255,255,.5); }
.cover-art { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font: 500 clamp(38px, 4vw, 64px)/1 "DM Mono", monospace; color: var(--game-accent, var(--mint)); filter: drop-shadow(12px 12px 0 rgba(0,0,0,.22)); transition: transform .25s ease; }
.cover-art small { font-size: .23em; letter-spacing: .2em; position: absolute; bottom: 16px; left: 16px; color: white; filter: none; }
.game-cover:hover .cover-art { transform: scale(1.08) rotate(-2deg); }
.play-badge { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%) scale(.7); width: 54px; height: 54px; z-index: 3; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; opacity: 0; transition: .2s ease; font-size: 17px; padding-left: 3px; }
.game-cover:hover .play-badge { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.favorite-btn { position: absolute; left: 10px; top: 10px; z-index: 3; width: 31px; height: 31px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(17,18,24,.48); color: white; cursor: pointer; opacity: 0; }
.game-card:hover .favorite-btn, .favorite-btn.active { opacity: 1; }
.favorite-btn.active { color: var(--gold); }
.game-info { padding: 12px 3px 0; }
.game-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-topline h3 { margin: 0; font-size: 15px; letter-spacing: -.025em; }
.players-tag { white-space: nowrap; font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; padding: 5px 6px; border: 1px solid var(--line); color: var(--muted); }
.game-info p { margin: 5px 0 9px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-line { display: flex; justify-content: space-between; font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.score-line strong { color: var(--ink); }
.game-grid.list-view { grid-template-columns: 1fr; gap: 0; }
.game-grid.list-view .game-card { display: grid; grid-template-columns: 120px 1fr; gap: 17px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.game-grid.list-view .game-cover { aspect-ratio: 1.45; }
.game-grid.list-view .cover-art { font-size: 31px; }
.game-grid.list-view .game-info { padding-top: 4px; }
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state > span { font: 500 48px/1 "DM Mono", monospace; color: var(--coral); }
.empty-state h3 { margin: 12px 0 3px; }
.empty-state p { margin: 0; color: var(--muted); }

.ranking-section { background: var(--paper-2); padding-top: 96px; padding-bottom: 110px; }
.ranking-select { grid-template-columns: 1fr; gap: 6px; min-width: 220px; }
.ranking-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 22px; }
.podium { background: var(--ink); color: white; min-height: 320px; display: flex; align-items: flex-end; justify-content: center; gap: 8px; padding: 44px 28px 0; }
.podium-player { width: 31%; display: grid; justify-items: center; text-align: center; }
.podium-player .avatar { width: 50px; height: 50px; margin-bottom: 10px; border: 2px solid var(--paper); }
.podium-player strong { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.podium-player small { color: var(--mint); font: 500 9px/1.7 "DM Mono", monospace; }
.podium-step { width: 100%; background: var(--ink-3); margin-top: 14px; display: grid; place-items: center; font: 500 35px/1 "DM Mono", monospace; color: rgba(255,255,255,.3); }
.podium-player:nth-child(1) .podium-step { height: 94px; }
.podium-player:nth-child(2) .podium-step { height: 145px; background: var(--coral); color: white; }
.podium-player:nth-child(3) .podium-step { height: 69px; }
.ranking-table-wrap { background: var(--white); overflow-x: auto; }
.ranking-table { border-collapse: collapse; width: 100%; min-width: 530px; }
.ranking-table th { text-align: left; padding: 16px 20px; color: var(--muted); font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; border-bottom: 1px solid var(--line); }
.ranking-table td { padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 12px; }
.ranking-table td:first-child { color: var(--muted); font: 500 10px/1 "DM Mono", monospace; }
.ranking-table td:nth-child(3) { font: 500 12px/1 "DM Mono", monospace; }
.rank-player { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.rank-player .avatar { width: 29px; height: 29px; font-size: 8px; }
.no-scores { color: var(--muted); text-align: center; }

footer { min-height: 150px; padding: 35px max(24px, calc((100vw - var(--max)) / 2)); background: var(--ink); color: var(--paper); display: flex; align-items: center; gap: 35px; }
.footer-brand { margin-right: 15px; }
footer p { color: rgba(255,255,255,.5); font: 400 9px/1.5 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
footer nav { margin-left: auto; display: flex; gap: 20px; color: rgba(255,255,255,.6); font-size: 11px; }
footer a:hover { color: var(--mint); }

dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(7,8,11,.77); backdrop-filter: blur(6px); }
.auth-dialog { width: min(940px, calc(100vw - 36px)); max-height: calc(100vh - 36px); background: var(--paper); box-shadow: var(--shadow); overflow: auto; }
.auth-dialog[open] { display: grid; grid-template-columns: .85fr 1.15fr; animation: dialogIn .3s ease; }
@keyframes dialogIn { from { transform: translateY(15px); opacity: 0; } }
.auth-art { min-height: 640px; background: var(--ink); color: white; position: relative; overflow: hidden; padding: 35px; }
.auth-noise { position: absolute; inset: 0; background-image: linear-gradient(rgba(57,230,201,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(57,230,201,.08) 1px, transparent 1px); background-size: 32px 32px; transform: perspective(400px) rotateX(55deg) scale(1.6); transform-origin: 50% 100%; }
.auth-logo { position: relative; display: flex; align-items: center; gap: 12px; font-size: 19px; }
.auth-logo > span { display: grid; place-items: center; width: 40px; height: 40px; background: var(--coral); font-weight: 800; position: relative; }
.auth-logo i { position: absolute; bottom: 0; right: 0; width: 8px; height: 8px; background: var(--mint); }
.auth-message { position: absolute; left: 35px; bottom: 54px; }
.auth-message p { margin: 0; font: 500 40px/.96 "DM Mono", monospace; color: var(--mint); text-shadow: 4px 4px 0 rgba(242,92,59,.8); }
.auth-message small { display: block; margin-top: 15px; color: rgba(255,255,255,.55); font: 400 9px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .13em; }
.auth-pixels i { position: absolute; width: 12px; height: 12px; background: var(--coral); }
.auth-pixels i:nth-child(1) { left: 15%; top: 33%; }.auth-pixels i:nth-child(2) { left: 25%; top: 30%; background: var(--mint); }.auth-pixels i:nth-child(3) { left: 35%; top: 36%; }.auth-pixels i:nth-child(4) { left: 57%; top: 27%; background: var(--gold); }.auth-pixels i:nth-child(5) { left: 72%; top: 39%; background: var(--mint); }
.auth-panel { padding: 55px 58px 42px; align-self: center; }
.auth-panel h2 { margin: 0; font-size: 42px; line-height: 1; letter-spacing: -.055em; }
.auth-subtitle { margin: 12px 0 26px; color: var(--muted); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: 12px; color: var(--muted); cursor: pointer; font: 700 10px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .09em; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.auth-tabs button.active { color: var(--ink); border-color: var(--coral); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font: 600 10px/1.3 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.auth-form input:not([type=checkbox]) { height: 45px; border: 1px solid var(--line); background: var(--white); padding: 0 13px; font-family: "Manrope", sans-serif; font-size: 13px; text-transform: none; letter-spacing: 0; }
.auth-form input:focus { border-color: var(--ink); outline: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-label { grid-template-columns: 17px 1fr !important; align-items: start; text-transform: none !important; letter-spacing: 0 !important; font-family: "Manrope", sans-serif !important; font-weight: 500 !important; line-height: 1.5 !important; }
.check-label input { accent-color: var(--coral); }
.check-label a { text-decoration: underline; }
.form-message { min-height: 20px; margin: 12px 0 0; font-size: 12px; color: var(--coral); }
.secure-note { display: block; color: var(--muted); font-size: 9px; line-height: 1.5; margin-top: 5px; }
.auth-mobile-brand { display: none; }

.panel-dialog { width: min(900px, calc(100vw - 30px)); max-height: min(850px, calc(100vh - 30px)); background: var(--paper); box-shadow: var(--shadow); }
.panel-dialog[open] { animation: dialogIn .25s ease; }
.dialog-header { padding: 28px 31px 21px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header .eyebrow { margin-bottom: 8px; }
.dialog-header h2 { margin: 0; font-size: 32px; letter-spacing: -.045em; }
.close-button { width: 40px; height: 40px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 25px; line-height: 1; }
.close-button:hover { background: var(--ink); color: white; }
.close-button.light { border-color: rgba(255,255,255,.22); color: white; }
.settings-layout { min-height: 470px; display: grid; grid-template-columns: 190px 1fr; }
.settings-nav { padding: 24px 0; border-right: 1px solid var(--line); }
.settings-nav button { display: block; width: 100%; border: 0; background: transparent; padding: 13px 25px; text-align: left; cursor: pointer; font-weight: 700; font-size: 11px; border-left: 3px solid transparent; color: var(--muted); }
.settings-nav button.active { border-color: var(--coral); color: var(--ink); background: var(--paper-2); }
.settings-content { padding: 29px 32px; overflow: auto; }
.settings-content h3 { margin: 0 0 5px; font-size: 21px; letter-spacing: -.03em; }
.settings-content p { margin: 0; color: var(--muted); font-size: 12px; }
.panel-title { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.player-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 25px; }
.control-column h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.player-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.player-dot.p1 { background: var(--coral); }.player-dot.p2 { background: var(--mint); }
.keymap { border-top: 1px solid var(--line); }
.key-row { height: 41px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.key-row span { font-size: 11px; color: var(--muted); }
kbd, .key-button { font: 500 9px/1 "DM Mono", monospace; border: 1px solid rgba(17,18,24,.23); background: var(--white); border-radius: 2px; box-shadow: 0 2px 0 rgba(17,18,24,.2); padding: 5px 7px; min-width: 29px; text-align: center; }
.key-button { cursor: pointer; min-width: 48px; }
.key-button.listening { color: var(--coral); border-color: var(--coral); animation: keylisten .7s infinite alternate; }
@keyframes keylisten { to { background: rgba(242,92,59,.1); } }
.gamepad-help { display: grid; grid-template-columns: 44px 1fr auto; gap: 13px; align-items: center; margin-top: 25px; background: var(--ink); color: white; padding: 16px; }
.pad-icon { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); font-size: 24px; }
.gamepad-help strong { font-size: 11px; }
.gamepad-help p { color: rgba(255,255,255,.5); font-size: 9px; }
.connection-label { font: 500 8px/1.5 "DM Mono", monospace; color: var(--mint); text-align: right; max-width: 120px; text-transform: uppercase; }
.setting-row { display: grid; grid-template-columns: 1fr minmax(140px, 240px) 45px; align-items: center; gap: 15px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.setting-row label { display: grid; }
.setting-row label strong { font-size: 12px; }.setting-row label small { color: var(--muted); font-size: 10px; }
.setting-row input[type=range] { accent-color: var(--coral); }.setting-row output { font: 500 10px/1 "DM Mono", monospace; }
input[role=switch] { appearance: none; width: 43px; height: 23px; border-radius: 20px; background: #bbb; position: relative; cursor: pointer; justify-self: end; }
input[role=switch]::after { content: ""; position: absolute; width: 17px; height: 17px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: .2s; }
input[role=switch]:checked { background: var(--coral); }
input[role=switch]:checked::after { left: 23px; }
.account-card { margin: 25px 0; display: flex; align-items: center; gap: 15px; padding: 22px; background: var(--white); border: 1px solid var(--line); }
.avatar.large { width: 60px; height: 60px; font-size: 16px; }
.account-card div { display: grid; }.account-card small, .account-card span { color: var(--muted); font-size: 11px; }
.dialog-footer { border-top: 1px solid var(--line); min-height: 73px; padding: 12px 31px; display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.dialog-footer > span { margin-right: auto; font-size: 11px; color: var(--muted); }

.profile-dialog { width: min(690px, calc(100vw - 30px)); }
.profile-hero { background: var(--ink); color: white; padding: 30px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 17px; }
.avatar.xlarge { width: 75px; height: 75px; font-size: 18px; background: var(--coral); }
.profile-hero h3 { margin: 0; font-size: 23px; }.profile-hero p { margin: 0; color: rgba(255,255,255,.55); font: 400 10px/1.4 "DM Mono", monospace; }
.level-block { display: grid; justify-items: center; border-left: 1px solid rgba(255,255,255,.2); padding-left: 28px; }
.level-block span { font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; color: var(--mint); }
.level-block strong { font: 500 31px/1.2 "DM Mono", monospace; }
.profile-stats { display: grid; grid-template-columns: repeat(3,1fr); border-bottom: 1px solid var(--line); }
.profile-stats div { display: grid; padding: 22px 28px; border-right: 1px solid var(--line); }
.profile-stats div:last-child { border: 0; }.profile-stats strong { font: 500 22px/1.4 "DM Mono", monospace; }.profile-stats span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.recent-scores { padding: 27px 30px 34px; }.recent-scores h3 { margin: 0 0 13px; font-size: 16px; }
.recent-score { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; }.recent-score strong { font: 500 11px/1 "DM Mono", monospace; }.recent-score time { color: var(--muted); font-size: 9px; }

.game-dialog { width: min(1450px, 100vw); height: min(940px, 100vh); max-width: 100vw; max-height: 100vh; background: var(--ink); color: white; }
.game-dialog[open] { animation: gameIn .25s ease; }
@keyframes gameIn { from { opacity: 0; transform: scale(.98); } }
.game-shell { height: 100%; display: grid; grid-template-rows: 88px 1fr 47px; }
.game-header { border-bottom: 1px solid rgba(255,255,255,.14); padding: 15px 26px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 30px; }
.game-header .eyebrow { color: rgba(255,255,255,.47); margin: 0 0 5px; }.game-header .eyebrow i { font-style: normal; }
.game-header h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.game-header-score { display: grid; justify-items: end; }.game-header-score span { color: rgba(255,255,255,.45); font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }.game-header-score strong { color: var(--mint); font: 500 22px/1.4 "DM Mono", monospace; }
.game-body { min-height: 0; display: grid; grid-template-columns: 1fr 270px; }
.canvas-wrap { position: relative; min-width: 0; background: #090a0e; display: grid; place-items: center; overflow: hidden; }
#gameCanvas { display: block; width: 100%; height: 100%; object-fit: contain; background: #090a0e; image-rendering: pixelated; }
.game-start-overlay, .pause-overlay, .game-over-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; background: radial-gradient(circle, rgba(17,18,24,.68), rgba(7,8,11,.95)); }
.game-start-overlay h3 { margin: 0; font: 500 clamp(34px,5vw,68px)/1 "DM Mono", monospace; color: var(--mint); text-shadow: 5px 5px 0 rgba(242,92,59,.8); }
.game-start-overlay > p:not(.game-kicker) { color: rgba(255,255,255,.65); max-width: 500px; margin: 19px 0; }
.game-kicker { font: 500 9px/1 "DM Mono", monospace; color: var(--coral); text-transform: uppercase; letter-spacing: .2em; }
.game-start-overlay > small { margin-top: 14px; color: rgba(255,255,255,.43); font: 400 9px/1 "DM Mono", monospace; }
.game-start-overlay kbd { color: var(--ink); }
.mode-switch { display: flex; border: 1px solid rgba(255,255,255,.25); margin: 4px 0 20px; }
.mode-switch button { border: 0; background: transparent; color: rgba(255,255,255,.6); padding: 11px 17px; cursor: pointer; font: 500 9px/1 "DM Mono", monospace; text-transform: uppercase; }
.mode-switch button.active { background: var(--paper); color: var(--ink); }
.mode-switch button:disabled { opacity: .25; cursor: not-allowed; }
.pause-overlay p, .game-over-overlay > p { color: var(--mint); font: 500 42px/1 "DM Mono", monospace; text-shadow: 4px 4px 0 var(--coral); }
.game-over-overlay > strong { font: 500 60px/1.2 "DM Mono", monospace; }
.game-over-overlay > span { color: rgba(255,255,255,.55); margin-bottom: 25px; }
.game-over-overlay > div { display: flex; gap: 12px; }
.game-sidebar { border-left: 1px solid rgba(255,255,255,.14); overflow-y: auto; background: #15171d; }
.game-sidebar section { padding: 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.game-sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
.live-controls { display: grid; gap: 9px; }
.live-control-row { display: flex; justify-content: space-between; color: rgba(255,255,255,.53); font-size: 9px; }
.live-control-row kbd { background: var(--ink-3); color: white; border-color: rgba(255,255,255,.15); box-shadow: none; }
.sidebar-title { display: flex; justify-content: space-between; }.sidebar-title > span { color: var(--mint); font: 500 8px/1 "DM Mono", monospace; }
.mini-ranking { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.mini-ranking li { counter-increment: rank; display: grid; grid-template-columns: 22px 1fr auto; gap: 7px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.09); font-size: 9px; align-items: center; }
.mini-ranking li::before { content: counter(rank, decimal-leading-zero); color: rgba(255,255,255,.3); font: 500 8px/1 "DM Mono", monospace; }
.mini-ranking strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.mini-ranking span { color: var(--mint); font: 500 8px/1 "DM Mono", monospace; }
.your-best { display: grid; background: rgba(57,230,201,.06); }.your-best span { color: rgba(255,255,255,.5); font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; }.your-best strong { color: var(--mint); font: 500 26px/1.5 "DM Mono", monospace; }
.game-footer { border-top: 1px solid rgba(255,255,255,.14); padding: 0 22px; display: flex; align-items: center; gap: 28px; color: rgba(255,255,255,.45); font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; }
.game-footer span { display: flex; align-items: center; gap: 8px; }.game-footer b { width: 7px; height: 7px; background: var(--mint); border-radius: 50%; }.game-footer i { color: white; font-style: normal; }
.game-footer button { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; text-transform: uppercase; }.game-footer kbd { margin-left: 6px; }

.toast-region { position: fixed; z-index: 10000; right: 20px; bottom: 20px; display: grid; gap: 9px; pointer-events: none; }
.toast { min-width: 250px; max-width: 360px; background: var(--ink); color: white; box-shadow: var(--shadow); border-left: 4px solid var(--mint); padding: 13px 16px; font-size: 11px; animation: toastIn .25s ease; }
.toast.error { border-color: var(--coral); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } }
.legal-page { max-width: 800px; margin: 0 auto; padding: 70px 25px 100px; }
.legal-page h1 { font-size: 52px; letter-spacing: -.05em; }.legal-page h2 { margin-top: 45px; }.legal-page p, .legal-page li { color: #555; }

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
body.high-contrast { --paper: #fff; --paper-2: #ececec; --muted: #4b4b4b; --line: rgba(0,0,0,.28); }

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .hero-visual { margin-right: -24px; }
  .feature-main { width: 61%; left: 5%; }
  .feature-side { width: 28%; right: 3%; }
  .game-grid { grid-template-columns: repeat(3,1fr); }
  .library-toolbar { grid-template-columns: 220px 1fr; }.select-wrap { display: none; }
}
@media (max-width: 820px) {
  .main-nav { display: none; }
  .status-chip { display: none; }
  .profile-label { display: none; }
  .topbar { padding: 0 18px; height: 67px; }
  .hero { display: block; padding: 0; }
  .hero-copy { padding: 65px 24px 58px; }
  .hero h1 { font-size: clamp(61px,15vw,93px); }
  .hero-visual { min-height: 570px; margin: 0; }
  .feature-main { width: 58%; height: 53%; top: 13%; }
  .library-section, .ranking-section { padding: 75px 24px; }
  .game-grid { grid-template-columns: repeat(2,1fr); }
  .library-toolbar { grid-template-columns: 1fr; }.filter-tabs { justify-content: flex-start; }
  .ranking-layout { grid-template-columns: 1fr; }
  footer { flex-wrap: wrap; } footer nav { margin-left: 0; }
  .auth-dialog[open] { grid-template-columns: 1fr; }.auth-art { display: none; }.auth-panel { padding: 42px 34px; }.auth-mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 32px; }
  .settings-layout { grid-template-columns: 1fr; }.settings-nav { display: flex; border-right: 0; border-bottom: 1px solid var(--line); padding: 0; overflow-x: auto; }.settings-nav button { border-left: 0; border-bottom: 3px solid transparent; padding: 14px 16px; white-space: nowrap; }.settings-nav button.active { border-bottom-color: var(--coral); }
  .game-body { grid-template-columns: 1fr; }.game-sidebar { display: none; }.game-dialog { height: 100vh; }.game-header { grid-template-columns: 1fr auto auto; }.game-header-score { display: none; }
}
@media (max-width: 540px) {
  .hero-copy { padding-top: 48px; }.hero h1 { font-size: 58px; }.hero-lede { font-size: 15px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 14px; }.hero-stats { gap: 12px; margin-top: 45px; }.hero-stats div { padding-right: 12px; }.hero-stats strong { font-size: 16px; }.hero-stats span { font-size: 7px; }
  .hero-visual { min-height: 470px; }.feature-main { width: 72%; height: 57%; top: 12%; }.feature-side { width: 29%; right: 2%; }.feature-side.bottom { display: none; }.feature-meta strong { font-size: 16px; }
  .section-heading { align-items: start; }.section-heading h2 { font-size: 37px; }.view-toggle { display: none; }
  .library-section, .ranking-section { padding-left: 17px; padding-right: 17px; }
  .game-grid { gap: 22px 10px; }.game-topline { display: block; }.players-tag { display: inline-block; margin-top: 5px; }.game-info p { font-size: 9px; }
  .cover-art { font-size: 37px; }
  .podium { padding-left: 12px; padding-right: 12px; }
  footer { display: grid; }
  .auth-panel { padding: 30px 22px; }.auth-panel h2 { font-size: 35px; }.form-row { grid-template-columns: 1fr; }
  .dialog-header { padding: 21px; }.settings-content { padding: 25px 20px; }.player-controls { grid-template-columns: 1fr; }.gamepad-help { grid-template-columns: 40px 1fr; }.connection-label { grid-column: 2; text-align: left; }.dialog-footer { padding: 11px 20px; }
  .setting-row { grid-template-columns: 1fr auto; }.setting-row input[type=range] { grid-column: 1; }.setting-row output { grid-column: 2; grid-row: 2; }
  .profile-hero { grid-template-columns: auto 1fr; }.level-block { grid-column: 1 / -1; border: 0; border-top: 1px solid rgba(255,255,255,.2); padding: 12px 0 0; width: 100%; }.profile-stats div { padding: 16px 10px; }.profile-stats span { font-size: 7px; }
  .game-header { padding: 12px 15px; }.game-header h2 { font-size: 18px; }.game-shell { grid-template-rows: 70px 1fr 43px; }.game-footer { padding: 0 12px; gap: 10px; }.game-footer span:nth-child(2) { display: none; }
  .game-start-overlay h3 { font-size: 37px; }.game-over-overlay > div { flex-direction: column; }.mode-switch button { padding: 10px; }
}
