:root {
    color-scheme: dark;
    --ink: #101611;
    --panel: #19211b;
    --panel-raised: #202a23;
    --paper: #f0f1e8;
    --muted: #9da69b;
    --line: rgba(235, 244, 224, .12);
    --lime: #c8fa65;
    --orange: #ff765e;
    --mono: "DM Mono", monospace;
    --sans: "Space Grotesk", sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--sans);
    background-image: radial-gradient(rgba(222, 243, 211, .09) .7px, transparent .7px);
    background-size: 19px 19px;
}
button, a { color: inherit; font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.arcade-shell { width: min(1180px, calc(100% - 64px)); margin: 0 auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 11px; align-items: center; text-decoration: none; font-size: 18px; font-weight: 700; }
.brand-light { color: var(--muted); font-weight: 400; }
.brand-mark { width: 23px; height: 23px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(-8deg); }
.brand-mark i { background: var(--lime); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .46; }
.topbar-status, .topbar-link, .eyebrow, .now-playing, .game-score > span, .overlay-kicker, .overlay-hint, .game-controls, .card-copy small, .mini-stat > span, .arcade-footer, .keycap { font-family: var(--mono); letter-spacing: 0; }
.topbar-status { display: flex; align-items: center; gap: 9px; color: #b7c0b5; font-size: 10px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--lime); box-shadow: 0 0 11px rgba(200, 250, 101, .62); }
.topbar-link { color: var(--paper); text-decoration: none; font-size: 10px; }
.topbar-link span { color: var(--lime); margin-left: 5px; }
.topbar-actions { display: flex; align-items: center; gap: 22px; }
.account-button { padding: 8px 0; border: 0; border-bottom: 1px solid var(--lime); background: transparent; color: var(--lime); font: 10px var(--mono); white-space: nowrap; }
.account-button span { color: var(--paper); }
.intro { min-height: 232px; display: flex; align-items: center; justify-content: space-between; padding: 22px 0 28px; }
.eyebrow { color: var(--muted); font-size: 10px; }
.eyebrow > span { color: var(--lime); margin-right: 9px; }
.intro h1 { margin: 16px 0 0; font-size: clamp(42px, 5vw, 64px); line-height: .96; letter-spacing: 0; font-weight: 600; }
.intro h1 > span { color: var(--lime); }
.intro-aside { width: 224px; position: relative; padding-top: 21px; }
.sparkle { position: absolute; top: -25px; left: 0; color: var(--orange); font-size: 24px; }
.intro-aside p { margin: 0 0 19px; color: #c3cabe; font-size: 14px; line-height: 1.55; }
.game-count { font: 10px var(--mono); color: var(--muted); }
.game-count strong { margin-right: 7px; color: var(--lime); font-size: 13px; font-weight: 500; }
.arcade-layout { display: grid; grid-template-columns: minmax(0, 1.68fr) minmax(280px, .82fr); gap: 18px; align-items: stretch; }
.game-panel, .side-panel { min-width: 0; border: 1px solid var(--line); background: rgba(25, 33, 27, .96); }
.game-panel { padding: 0 24px 16px; }
.panel-topline { min-height: 43px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.now-playing { display: flex; align-items: center; gap: 8px; color: var(--lime); font-size: 9px; }
.now-playing .live-dot { width: 6px; height: 6px; }
.now-playing .slash { color: #566157; }
#game-category { color: var(--muted); }
.icon-button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.icon-button:hover { color: var(--lime); }
.game-heading { min-height: 83px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.game-heading h2 { margin: 0 0 4px; font-size: 21px; font-weight: 600; }
.game-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.game-score { min-width: 60px; text-align: right; }
.game-score > span { display: block; color: var(--muted); font-size: 9px; }
.game-score strong { font: 20px var(--mono); color: var(--lime); }
.game-stage { position: relative; min-height: 322px; overflow: hidden; display: grid; place-items: center; background: #101712; border: 1px solid rgba(220, 246, 200, .12); }
.game-stage::after { position: absolute; inset: 0; content: ""; pointer-events: none; background: linear-gradient(180deg, transparent 70%, rgba(12, 17, 13, .32)); }
.game-art { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 58% 49%, #233d2e 0, #17271d 37%, #101712 76%); transition: opacity .25s ease; }
.game-art.hidden { opacity: 0; }
.art-orbit { position: absolute; width: 215px; height: 215px; top: 50%; left: 50%; border: 1px solid rgba(200, 250, 101, .17); border-radius: 50%; transform: translate(-50%, -50%); }
.art-orbit::before, .art-orbit::after { position: absolute; content: ""; inset: 17px; border: 1px dashed rgba(200, 250, 101, .16); border-radius: 50%; }
.art-orbit::after { inset: -21px; border-style: solid; opacity: .45; }
.art-spark { position: absolute; color: var(--lime); font-size: 20px; }
.art-spark-one { top: 21%; left: 26%; }
.art-spark-two { bottom: 19%; right: 27%; color: var(--orange); font-size: 15px; }
.art-star { position: absolute; top: 24%; right: 31%; color: #f2e7a5; font-size: 18px; }
.art-snake { position: absolute; display: flex; gap: 3px; top: 48%; left: 50%; transform: translate(-50%, -50%) rotate(-22deg); filter: drop-shadow(0 0 12px rgba(200, 250, 101, .35)); }
.art-snake i { width: 27px; height: 27px; border-radius: 6px; background: var(--lime); }
.art-snake i:first-child { position: relative; background: #e7faaf; }
.art-snake i:first-child::after { content: "··"; position: absolute; right: 4px; top: -3px; color: #293a1e; font: bold 20px var(--sans); }
.art-snake i:nth-child(3) { opacity: .76; }
.art-snake i:nth-child(4) { opacity: .48; }
.art-fruit { position: absolute; top: 40%; left: calc(50% + 83px); width: 13px; height: 13px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 18px rgba(255, 118, 94, .64); }
.game-mount { z-index: 1; position: relative; width: 100%; display: grid; justify-items: center; }
.game-canvas { display: block; width: min(100%, 560px); max-height: 322px; height: auto; object-fit: contain; image-rendering: pixelated; }
.game-overlay { z-index: 2; position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; background: rgba(13, 19, 14, .28); transition: opacity .18s ease; }
.game-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-kicker, .overlay-hint { color: #c0cdb7; font-size: 9px; }
.play-button { padding: 12px 19px; border: 0; background: var(--lime); color: #172012; font-weight: 700; font-size: 12px; transition: background .15s, transform .15s; }
.play-button:hover { background: #dbff93; transform: translateY(-2px); }
.play-button > span:first-child { margin-right: 6px; font-size: 10px; }
.overlay-hint { color: #879487; font-size: 8px; }
.game-controls { min-height: 44px; display: flex; justify-content: space-between; align-items: end; gap: 10px; color: var(--muted); font-size: 8px; }
.control-actions { display: flex; align-items: center; gap: 14px; }
.text-button { padding: 3px 0; border: 0; background: none; color: var(--paper); font: 9px var(--mono); }
.text-button:hover { color: var(--lime); }
.text-button > span { margin-right: 3px; color: var(--lime); font-size: 13px; }
.keycap { color: #d3d9ce; font-size: 8px; }
.keycap small { margin-left: 3px; color: var(--muted); font-size: 8px; }
.side-panel { padding: 20px 19px 15px; display: flex; flex-direction: column; }
.side-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.side-heading h2 { margin: 8px 0 0; font-size: 19px; line-height: 1.1; font-weight: 600; }
.lime { color: var(--lime); }
.side-count { color: #657064; font: 11px var(--mono); }
.game-list { display: grid; gap: 8px; }
.game-card { width: 100%; min-height: 67px; display: flex; align-items: center; gap: 11px; padding: 8px; border: 1px solid transparent; background: #202922; text-align: left; transition: border-color .16s, background .16s, transform .16s; }
.game-card:hover { border-color: rgba(200, 250, 101, .45); transform: translateX(2px); }
.game-card.selected { border-color: var(--lime); background: #252f25; }
.card-art { width: 49px; height: 49px; flex: 0 0 49px; display: grid; place-content: center; position: relative; overflow: hidden; }
.snake-thumb { display: flex; align-items: center; gap: 2px; background: #203d2c; }
.snake-thumb i { width: 9px; height: 9px; background: var(--lime); border-radius: 2px; }
.snake-thumb i:nth-child(2) { opacity: .76; }.snake-thumb i:nth-child(3) { opacity: .48; }
.snake-thumb b { position: absolute; width: 7px; height: 7px; top: 11px; right: 10px; border-radius: 50%; background: var(--orange); }
.memory-thumb { grid-template-columns: repeat(2, 16px); grid-template-rows: repeat(2, 16px); gap: 3px; background: #3b2e2b; }
.memory-thumb i { display: grid; place-items: center; background: #76534a; color: #ffd1a5; font-style: normal; font-size: 10px; }
.memory-thumb i:first-child, .memory-thumb i:last-child { background: #f19b6b; color: #38281e; }
.tiles-thumb { grid-template-columns: repeat(2, 18px); grid-template-rows: repeat(2, 18px); gap: 2px; background: #303833; }
.tiles-thumb i { display: grid; place-items: center; background: #d6cbab; color: #413c2e; font: 10px var(--mono); font-style: normal; }
.tiles-thumb i:nth-child(2) { background: #e7a768; }.tiles-thumb i:nth-child(3) { background: #8bc28d; }.tiles-thumb i:nth-child(4) { background: #49564a; }
.sha-thumb { background: #34372d; color: var(--lime); font: 9px var(--mono); }
.sha-thumb i { position: absolute; right: 7px; bottom: 5px; color: var(--orange); font-size: 8px; font-style: normal; }
.card-copy { min-width: 0; flex: 1; display: grid; gap: 5px; }
.card-copy strong { overflow: hidden; color: var(--paper); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.card-copy small { color: var(--muted); font-size: 8px; }
.card-copy small span { margin: 0 3px; color: var(--lime); }
.card-arrow { align-self: flex-start; color: #788273; font-size: 14px; }
.game-card.selected .card-arrow { color: var(--lime); }
.side-note { display: flex; align-items: start; gap: 10px; margin-top: auto; padding: 18px 0 14px; border-bottom: 1px solid var(--line); }
.side-note > span { color: var(--orange); font-size: 17px; }
.side-note p { margin: 1px 0 0; color: #a7b0a5; font-size: 11px; line-height: 1.5; }
.mini-stat { display: flex; justify-content: space-between; align-items: end; padding-top: 13px; }
.mini-stat > span { color: var(--muted); font-size: 8px; }
.mini-stat strong { color: var(--lime); font: 15px var(--mono); }
.mini-stat strong small { color: var(--muted); font-size: 8px; }
.leaderboard { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.leaderboard-heading { display: flex; justify-content: space-between; color: var(--muted); font: 8px var(--mono); }
.leaderboard-heading small { color: var(--lime); font: inherit; }
#leaderboard-list { display: grid; gap: 7px; margin: 11px 0 0; padding: 0; list-style: none; }
#leaderboard-list li { display: flex; justify-content: space-between; gap: 12px; color: #c3cabe; font-size: 10px; }
#leaderboard-list li strong { color: var(--lime); font: 10px var(--mono); }
#leaderboard-list .leaderboard-empty { color: var(--muted); }
.community-thumb { background: #384135; color: var(--lime); font: 9px var(--mono); }
.account-dialog { width: min(560px, calc(100% - 28px)); max-height: min(88vh, 760px); overflow: auto; padding: 25px; border: 1px solid rgba(200, 250, 101, .42); background: #19211b; color: var(--paper); }
.account-dialog::backdrop { background: rgba(5, 9, 6, .78); backdrop-filter: blur(4px); }
.account-dialog-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.account-dialog-head h2 { margin: 7px 0 0; font-size: 22px; }
.account-dialog .icon-button { font-size: 26px; }
.account-intro, .upload-note, .market-empty { color: var(--muted); font-size: 12px; line-height: 1.55; }
.auth-form, .upload-form { display: grid; gap: 12px; }
.auth-form label, .upload-form label { display: grid; gap: 6px; color: #c3cabe; font: 9px var(--mono); }
.auth-form input, .upload-form input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 0; background: #101712; color: var(--paper); font: 12px var(--sans); }
.upload-form input[type="file"] { min-height: auto; font-size: 10px; }
.auth-form .play-button, .upload-form .play-button { justify-self: start; }
.form-message { min-height: 16px; margin: 0; color: var(--orange); font-size: 11px; }
.mode-button { margin-top: 8px; padding: 5px 0; border: 0; background: transparent; color: var(--lime); font-size: 11px; }
.player-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 0; color: var(--muted); font: 9px var(--mono); }
.player-summary > span strong { color: var(--paper); }
.player-summary > strong { color: var(--lime); font: 15px var(--mono); white-space: nowrap; }
.player-summary > strong small { font-size: 8px; }
.player-summary .text-button { font-size: 8px; }
.upload-section, .market-section { padding-top: 16px; border-top: 1px solid var(--line); }
.upload-section h3, .market-section h3 { margin: 0 0 8px; font-size: 14px; }
.upload-section h3 small { margin-left: 6px; color: var(--lime); font: 8px var(--mono); }
.upload-note { margin: 0 0 12px; font-size: 10px; }
.upload-note code { color: var(--lime); overflow-wrap: anywhere; }
.upload-form { grid-template-columns: minmax(0, 1fr) 120px; align-items: end; }
.upload-form .file-label { grid-column: 1 / -1; }
.upload-form .play-button, .upload-form .form-message { grid-column: 1 / -1; }
.market-section { margin-top: 17px; }
.market-list { display: grid; gap: 7px; }
.market-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; background: #202922; }
.market-item > div { min-width: 0; display: grid; gap: 4px; }
.market-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.market-item small { color: var(--muted); font: 8px var(--mono); }
.market-buy { min-width: 74px; padding: 7px 8px; border: 1px solid var(--lime); background: transparent; color: var(--lime); font: 8px var(--mono); }
.market-buy:disabled { border-color: var(--line); color: var(--muted); cursor: default; }
.market-empty { margin: 3px 0; font-size: 11px; }
.arcade-footer { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #788276; font-size: 8px; }
.arcade-footer span > span { color: #596358; }
.arcade-footer a { color: #a7b0a5; text-decoration: none; }
.arcade-footer a:hover { color: var(--lime); }

.memory-board { width: min(100% - 28px, 350px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px; }
.memory-card { aspect-ratio: 1; border: 1px solid rgba(255, 209, 165, .16); background: #382d29; color: #ffd1a5; font-size: clamp(19px, 4vw, 31px); transition: transform .18s, background .18s; }
.memory-card:hover { transform: translateY(-2px); }
.memory-card.flipped, .memory-card.matched { background: #e88e61; color: #34251d; }
.memory-card.matched { border-color: #e6d9a8; }
.tiles-board { width: min(100% - 28px, 420px); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; padding: 10px; border-radius: 4px; background: #303832; }
.tile { aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px; background: #39443b; color: #f6f0dc; font: 600 clamp(12px, 2.8vw, 22px) var(--mono); }
.tile[data-value="2"] { background: #d9cfb0; color: #423c2c; }.tile[data-value="4"] { background: #e9aa70; color: #483320; }
.tile[data-value="8"] { background: #e67e56; color: white; }.tile[data-value="16"] { background: #bf6348; color: white; }
.tile[data-value="32"], .tile[data-value="64"] { background: #85b784; color: #172419; }
.archive-game-frame { display: block; width: 100%; min-height: 322px; border: 0; background: #101712; }
.archive-game-message { max-width: 390px; padding: 28px; color: #b7c0b5; font-size: 13px; line-height: 1.7; text-align: center; }
.archive-game-message strong { display: block; margin-bottom: 8px; color: var(--lime); font-size: 17px; }
.touch-pad { display: none; grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(2, 32px); gap: 4px; margin: 8px auto 0; }
.touch-pad button { border: 1px solid var(--line); background: #202a23; color: var(--lime); }
.touch-pad button[data-dir="up"] { grid-area: 1 / 2; }.touch-pad button[data-dir="left"] { grid-area: 2 / 1; }.touch-pad button[data-dir="down"] { grid-area: 2 / 2; }.touch-pad button[data-dir="right"] { grid-area: 2 / 3; }

@media (max-width: 780px) {
    .arcade-shell { width: min(100% - 36px, 600px); }
    .arcade-layout { grid-template-columns: 1fr; }
    .intro { min-height: 208px; }
    .side-panel { min-height: 0; }
    .side-note { margin-top: 19px; }
    .game-stage { min-height: 300px; }
    .game-canvas { max-height: 300px; }
    .arcade-footer { flex-wrap: wrap; padding: 17px 0; }
}
@media (max-width: 480px) {
    .arcade-shell { width: calc(100% - 28px); }
    .topbar { height: 62px; }
    .brand { font-size: 16px; }
    .topbar-status { font-size: 8px; }
    .topbar-link { font-size: 8px; }
    .topbar-actions { gap: 10px; }
    .account-button { font-size: 8px; }
    .account-button span { display: none; }
    .intro { min-height: 192px; }
    .intro h1 { font-size: 45px; }
    .intro-aside { width: 135px; }
    .intro-aside p { font-size: 12px; }
    .game-panel { padding: 0 13px 13px; }
    .game-heading { min-height: 74px; }
    .game-heading h2 { font-size: 19px; }
    .game-heading p { max-width: 220px; font-size: 11px; }
    .game-stage { min-height: 322px; }
    .game-canvas { max-height: 280px; }
    .game-controls { align-items: center; font-size: 7px; }
    .control-actions { gap: 8px; }
    .text-button { font-size: 8px; }
    .keycap { display: none; }
    .touch-pad { display: grid; }
    .side-panel { padding: 17px 13px 13px; }
    .arcade-footer { font-size: 7px; }
    .arcade-footer > span:nth-child(2) { order: 3; width: 100%; }
    .account-dialog { padding: 18px; }
    .player-summary { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}