:root{color-scheme:dark;--bg:#191815;--cream:#f6edda;--muted:#c1b8a8;--panel:#26231f;--line:#484037;--red:#ff695b;--black:#181311;font-family:system-ui,"Microsoft YaHei",sans-serif}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:radial-gradient(ellipse at 25% 15%,#3b2721 0,transparent 49%),var(--bg);color:var(--cream)}
main{max-width:1230px;margin:auto;padding:0 clamp(14px,5vw,62px) 36px}
header{height:68px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:10px}
.wordmark{font-weight:850;letter-spacing:.05em;white-space:nowrap}
.wordmark>span:first-child{display:inline-block;background:var(--red);width:20px;height:11px;border-radius:2px;margin-right:5px;box-shadow:inset 0 -3px #a2322a}
.accent{color:var(--red)}
.network{font-size:.875rem;color:var(--muted)}
.network::before{content:"";display:inline-block;width:7px;height:7px;background:#a68b6f;border-radius:50%;margin-right:7px}
.network.online::before{background:#a6db8b}
.intro{margin:34px 0 25px}
h1{font-size:clamp(1.85rem,5vw,3.25rem);line-height:1.1;margin:0 0 12px;letter-spacing:-.035em}
h2{margin:0 0 14px;font-size:1.13rem}
p{margin:0;line-height:1.55;color:var(--muted)}
.layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,320px);gap:20px;align-items:start}
.cabinet{padding:clamp(10px,2vw,19px);border:1px solid #62544b;border-radius:20px;background:#322d28;box-shadow:0 9px 0 #100f0d}
.screen{position:relative;background:#100e0d;border:3px solid #0a0908;border-radius:12px;overflow:hidden;display:grid;place-items:center;aspect-ratio:4/3}
canvas{display:block;width:100%;height:100%;position:absolute;inset:0;object-fit:contain;image-rendering:pixelated}
.screen:fullscreen{height:100%;border:0;border-radius:0}
.splash{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;background:repeating-linear-gradient(transparent 0 3px,#0002 3px 5px),radial-gradient(ellipse,#342320,#14100f 72%)}
.splash strong{font-size:clamp(1.1rem,3vw,1.6rem)}
.splash span{color:var(--muted);font-size:.875rem}
.pixel{width:44px;height:32px;background:#ff695b;margin-bottom:12px;clip-path:polygon(14% 0,86% 0,86% 12%,100% 12%,100% 75%,86% 75%,86% 100%,14% 100%,14% 75%,0 75%,0 12%,14% 12%);position:relative}
.pixel::after{content:"";position:absolute;inset:8px 10px 11px;background:#361e1a;border-bottom:4px solid #ac3b30}
.console-bar,.actions,.row{display:flex;align-items:center;gap:8px}
.console-bar{justify-content:space-between;margin:10px 0}
#game-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}
button,input,.file{font:inherit}
button,.file{color:var(--cream);background:#36302a;border:1px solid #615548;border-radius:7px;min-height:40px;padding:7px 11px;cursor:pointer}
.actions button{white-space:nowrap;font-size:.875rem}
button:hover:not(:disabled),.file:hover{filter:brightness(1.16)}
button:disabled{cursor:default;opacity:.52}
:focus-visible,.file:focus-within{outline:2px solid #ff9c90;outline-offset:3px}
.controller{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid #655147;padding:12px 1px 0;touch-action:none;user-select:none}
.dpad{display:grid;grid-template:repeat(3,clamp(29px,5vw,39px))/repeat(3,clamp(29px,5vw,39px));touch-action:none}
.dpad button,.system-buttons button,.ab button{min-height:0;padding:0;touch-action:none}
.dpad button{background:#1e1c19;border:1px solid #51483e;border-radius:4px}
[data-key=up]{grid-area:1/2}[data-key=left]{grid-area:2/1}[data-key=right]{grid-area:2/3}[data-key=down]{grid-area:3/2}
.dpad::after{content:"";grid-area:2/2;background:#1e1c19}
.ab,.system-buttons{display:flex;align-items:center;gap:6px}
.ab button{height:clamp(40px,7vw,57px);width:clamp(40px,7vw,57px);background:#a83431;border-color:#d05048;border-radius:50%;font-weight:800;box-shadow:0 4px #641f1e}
.system-buttons button{font:700 clamp(.62rem,1.4vw,.75rem) system-ui;padding:5px 6px;border-radius:12px;background:#1e1c19}
.controller button.pressed{filter:brightness(1.55);transform:translateY(2px)}
aside{display:grid;gap:12px}
.panel{background:var(--panel);padding:16px;border:1px solid var(--line);border-radius:12px}
.primary{width:100%;background:var(--red);border-color:var(--red);color:var(--black);font-weight:800}
.wide,.file{width:100%}
form{margin-top:14px}
form label,.muted,.guide p,#status{font-size:.875rem}
form label{display:block;margin-bottom:6px;color:var(--muted)}
#owner-key{min-width:0;width:100%;padding:8px;background:#171511;border:1px solid #655748;border-radius:7px;color:var(--cream)}
.access{max-width:470px;margin:60px auto}
#access-status:not(:empty),.secondary-start{margin-top:10px}
.row button{flex:none}
.save-choice{display:flex;align-items:center;gap:7px;margin-top:10px}
.save-actions{margin-top:10px;flex-wrap:wrap}
.save-actions .file{width:auto}
.room-code{font:800 1.45rem ui-monospace,monospace;letter-spacing:.16em;margin:0 0 10px;color:#ff958a}
.players{padding:0;list-style:none;display:grid;gap:6px;color:var(--muted)}
.players b{color:var(--cream);margin-right:10px}
.quiet{margin-top:6px;background:transparent}
#status:not(:empty),.muted,.guide p+p{margin-top:9px}
.file{position:relative;display:block;text-align:center}
.file input{position:absolute;inset:0;opacity:0;width:100%;cursor:pointer}
.file:has(:disabled){opacity:.55}
kbd{color:var(--cream);font:inherit}
@media(max-width:760px){.layout{grid-template-columns:1fr}.intro{margin:22px 0 16px}header{height:54px}.screen{max-height:53svh}.dpad{grid-template:repeat(3,35px)/repeat(3,35px)}}
@media(max-width:350px){.dpad{grid-template:repeat(3,29px)/repeat(3,29px)}.ab button{width:35px;height:35px}.system-buttons button{padding-inline:4px}}
