:root {
  color-scheme: dark;
  --base: #14101d;
  --ivory: #fff4df;
  --muted: #c3b6c7;
  --accent: #ffda78;
  --ink: #231521;
  --rose: #ff9aaf;
  --line: #47364e;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--base);
  color: var(--ivory);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 53% 39%, #25172d 0%, transparent 70%), var(--base); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.arcade { max-width: 1152px; margin: auto; padding: max(.4rem, env(safe-area-inset-top)) max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-right)) max(2.5rem, env(safe-area-inset-bottom)) max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-left)); }
.masthead, .masthead nav, .brand, .quiet-button, .coin-line, .row-heading, .machine-sign, .machine-deck, .name-fields { display: flex; align-items: center; }
.masthead { min-height: 4.2rem; justify-content: space-between; }
.brand { gap: .72rem; font-weight: 850; letter-spacing: .12em; font-size: 1.07rem; white-space: nowrap; }
.brand-sprite { display: inline-block; position: relative; width: 1.7rem; height: 1.5rem; background: #ffb268; clip-path: polygon(16% 0,83% 0,83% 13%,94% 13%,94% 57%,84% 57%,84% 69%,100% 83%,100% 100%,0 100%,0 83%,15% 69%,15% 57%,6% 57%,6% 13%,16% 13%); }
.brand-sprite::before { content: ""; position: absolute; inset: 17% 19% 40%; border: 2px solid #463048; background: #8af0cc; }
.brand-sprite i { position:absolute; left:23%; bottom:16%; width:16%; height:8%; background:#483047; box-shadow: .55rem 0 #483047; }
.masthead nav { gap: clamp(.7rem,3vw,1.6rem); }
.back, .return-hall { color: var(--muted); font-size: .85rem; }
.back:hover, .return-hall:hover { color: white; }
.quiet-button { justify-content: center; gap: .5rem; min-height: 2.5rem; border: 1px solid #57475e; border-radius: .4rem; background: #27202f; padding: .4rem .8rem; color: var(--ivory); font-size: .82rem; }
.quiet-button:not(:disabled):hover { border-color: var(--accent); }
.sound-bars { display: flex; align-items: center; gap: 2px; height: .9rem; color: #83efc7; }
.sound-bars i { width: 3px; height: 6px; background: currentColor; }
.sound-bars i:nth-child(2) { height: 12px; }
.sound-bars i:nth-child(3) { height: 9px; }
#game-sound[aria-pressed="false"] .sound-bars i { height: 3px; color: var(--muted); }
.hall-hero { min-height: clamp(236px, 26vw, 304px); display: flex; align-items: center; position: relative; isolation: isolate; overflow:hidden; border: 1px solid #59405c; border-radius: .7rem; background: #251128 url("./art/arcade-hall.jpg") center / cover no-repeat; }
.hero-copy { padding: clamp(1.3rem,4vw,3.1rem); }
.marquee-en, .credit, .machine-sign, .score-top, .rank-num, .rank-score { font-family: "Courier New", ui-monospace, monospace; }
.marquee-en { display: inline-block; color: #ffc27e; font-size: clamp(.69rem,1.2vw,.9rem); font-weight: 800; letter-spacing: .24em; }
h1 { margin: .33rem 0 .42rem; color: #fff2d6; font-size: clamp(2.55rem,5.6vw,4.55rem); font-weight: 950; line-height: 1.13; letter-spacing: .035em; text-shadow: 0 3px #c75274, 0 6px #522341; }
.hero-copy p { margin: .72rem 0 1.12rem; font-size: clamp(.88rem,1.6vw,1.03rem); color: #efdeed; }
.coin-line { gap: 1rem; }
.coin-button, .sign-button { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 2.72rem; padding: .45rem 1.05rem; border: 1px solid #ffe6a8; border-radius: .3rem; background: #ffcf69; box-shadow: 0 3px #ad6b3d; font-weight: 800; color: #302018; }
.coin-button:hover, .sign-button:hover { background: #ffe39a; }
.coin-button:active { transform: translateY(2px); box-shadow: 0 1px #ad6b3d; }
.coin { display: inline-block; width: 1.04rem; height: 1.04rem; border: 2px solid #8c571b; outline: 1px solid #8c571b; outline-offset: -5px; border-radius: 50%; background: #ffe385; }
.credit { font-size: .72rem; letter-spacing: .10em; color: #eaceb8; }
.row-heading { gap: .74rem; margin: 1.85rem 0 1rem; }
.row-heading h2 { margin: 0; font-size: clamp(1.17rem, 2vw, 1.5rem); letter-spacing: .04em; }
.section-led { width: .47rem; height: .82rem; background: #ffaf8b; box-shadow: 3px 3px #7c405b; }
.row-line { flex: 1; height: 1px; background: linear-gradient(90deg,#624757, #332637); }
.machines { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(.65rem,2.4vw,1.6rem); }
.machine { --trim: #ee879d; --rim:#784754; --panel:#613a4a; display:block; position:relative; min-width:0; width:100%; padding: 0; border: 2px solid var(--rim); border-radius: .6rem .6rem .42rem .42rem; background:#251d2c; box-shadow: inset 5px 0 #ffffff0e,inset -5px 0 #0005,0 5px #0d0a13; text-align:left; transition:transform .15s,border-color .15s; }
.machine.keeper { --trim:#86e1d2; --rim:#426d6f; --panel:#304f55; }
.machine.dribble { --trim:#f4c080; --rim:#7f6249; --panel:#59473b; }
.machine:hover, .machine:focus-visible { border-color: var(--trim); transform: translateY(-3px); }
.machine-sign { justify-content: space-between; gap:.4rem; margin: .48rem .53rem; padding: .28rem .55rem; color: var(--trim); background: #221a29; border: 1px solid var(--rim); box-shadow: inset 0 0 12px var(--panel); font-weight: 900; letter-spacing: .12em; font-size: clamp(.70rem,1.15vw,.9rem); text-align:center; }
.bolts { font-size:.66em; }
.bezel { position: relative; display: block; border: clamp(6px,.85vw,11px) solid #120e18; border-radius:.44rem; margin:0 .68rem; background:#171420; box-shadow:0 0 0 1px #493746; overflow:hidden; }
.bezel img { display:block; width:100%; height:auto; aspect-ratio: 2.32; object-fit:cover; object-position: 50% 50%; image-rendering:pixelated; }
.machine-deck { position:relative; height:1.52rem; margin: .35rem .3rem 0; border-top: 1px solid var(--rim); border-bottom: 2px solid #120d18; background:linear-gradient(178deg,var(--panel),#221b29 88%); }
.stick { position:absolute; left:12%; bottom:4px; width:10px; height:3px; border-radius:50%; background:#110c17; }
.stick::before, .stick::after, .slot::before { position:absolute; content:""; }
.stick::before { width:3px;height:7px;bottom:1px;left:4px;background:#a6989a; }
.stick::after { width:8px;height:7px;bottom:6px;left:1px;border-radius:4px;background:var(--trim);box-shadow:inset -2px -2px #0004; }
.deck-dots { margin-left:auto; margin-right:12%; width:8px;height:5px; border-radius:50%; background:var(--trim); box-shadow:12px -2px #e9d4aa,24px -4px var(--trim); }
.machine-label { display:grid; position:relative; gap:.28rem; padding:.66rem 2rem .76rem .87rem; }
.machine-label strong { font-size:clamp(1.05rem,2vw,1.35rem); line-height:1.2; letter-spacing:.04em; }
.machine-label small { color:var(--muted); line-height:1.45; font-size:.81rem; }
.slot { position:absolute; right:.83rem; top:.8rem; width:.57rem; height:1.15rem; border:1px solid var(--rim); background:#100c16; border-radius:2px; }
.slot::before { top:.22rem; left:35%; height:.49rem; width:2px; background:var(--trim); }
.classic-games { display:grid; grid-template-columns:repeat(auto-fit, minmax(156px,1fr)); gap:.6rem; }
.classic { display:flex; align-items:center; gap:.62rem; min-width:0; text-align:left; border:1px solid #45374c; border-radius:.4rem; padding:.45rem; background:#231d2b; }
.classic img { width:38%; max-width:66px; height:auto; border-radius:2px; image-rendering:pixelated; }
.classic:hover { border-color:#ab849c; }
.classic strong,.classic small { display:block; }
.classic strong { font-size:.91rem; }
.classic small { margin-top:.18rem;color:var(--muted);font-size:.74rem; }
.return-hall { margin:.25rem 0 .8rem; padding:.4rem .1rem; min-height:2.6rem; border:0; background:transparent; }
.play-layout { display:grid; grid-template-columns:minmax(0, 2.5fr) minmax(240px,1fr); gap:1rem; align-items:start; }
.cabinet, .scoreboard { min-width:0; padding:clamp(.6rem,2.2vw,1.1rem); border:1px solid #574257; border-radius:.7rem; background:#28202f; }
.score-top { color:#8de2cb; font-size:.81rem;letter-spacing:.19em;font-weight:bold; }
.scoreboard h2 { margin:.35rem 0 .4rem; font-size:1.35rem; }
.board-caption,.board-empty,.sign-status { font-size:.83rem;line-height:1.55;color:var(--muted); }
.board-caption { margin:.25rem 0 .8rem; }
.board-empty { padding:.8rem 0;border-top:1px dashed #5c485a; }
#rankings { list-style:none; padding:0;margin:0; }
#rankings li { display:flex;align-items:center;gap:.8rem;padding:.5rem .1rem;border-top:1px dashed #544052; }
.rank-num { font-size:.77rem; color:#cfabb9; }
.rank-name { font-size:.93rem; overflow-wrap:anywhere; }
.rank-score { margin-left:auto;color:var(--accent);font-weight:bold; }
#signature { border-top:1px solid #685362; padding-top:.78rem; }
#signature label { display:block;font-size:.88rem;color:var(--accent);margin-bottom:.52rem; }
.name-fields { gap:.4rem; }
.name-fields input { min-width:0;width:100%;border:1px solid #705c73;border-radius:.3rem;padding:.55rem;background:#19151f;font-size:1rem; }
.sign-button { min-height:2.45rem; flex:none; padding:.4rem .65rem; font-size:.85rem; }
.sign-status:empty { display:none; }

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: .5rem;
  margin: .06rem .15rem .57rem;
  min-height: 3.15rem;
}
.genre {
  margin: 0 0 .15rem;
  color: var(--muted);
  font-size: .875rem;
  letter-spacing: .12em;
}
.game-header h2 { margin: 0; font-size: clamp(1.25rem, 3.3vw, 1.65rem); line-height: 1.15; }
.game-metrics { max-width: 58%; text-align: right; font-variant-numeric: tabular-nums; }
#hud { margin: 0; color: var(--accent); font-size: .875rem; line-height: 1.35; }
.game-score { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .05rem .6rem; margin: .17rem 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
#current-score { color: var(--ivory); }
.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 8 / 5;
  border: 3px solid #16101b;
  border-radius: .55rem;
  background: #10182c;
  outline-offset: 2px;
}
.stage:focus:not(:focus-visible) { outline: none; }
.stage canvas, .poster {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.poster { object-fit: fill; }
.stage:not([data-state="ready"]) .poster { display: none; }
.stage-menu { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(10 15 16 / 66%); text-align: center; }
.stage[data-state="ready"] .stage-menu {
  place-items: end start;
  text-align: left;
  background: linear-gradient(0deg, rgb(10 15 16 / 68%), transparent 54%);
}
.stage-copy { padding: min(3.4vw, 1.25rem); }
.stage-headline { margin: 0 0 .25rem; font-weight: 750; font-size: clamp(1.2rem, 3.35vw, 1.7rem); }
.stage-message { margin: 0 0 .55rem; font-size: .875rem; line-height: 1.45; }
.play {
  min-height: 2.75rem;
  padding: .4rem 1.1rem;
  border: 1px solid #ffe7b6;
  border-radius: .48rem;
  background: var(--accent);
  color: var(--ink);
  font-size: .94rem;
  font-weight: 720;
  box-shadow: 0 3px 0 #93663b;
}
.play:hover { background: #ffe4ac; }
.play:active { box-shadow: 0 1px 0 #93663b; transform: translateY(2px); }
.controller {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin: .7rem 0 .45rem;
  user-select: none;
  -webkit-user-select: none;
}
.dpad {
  --pad: clamp(2.25rem, 9.8vw, 2.75rem);
  display: grid;
  grid-template: repeat(3, var(--pad)) / repeat(3, var(--pad));
}
.direction {
  display: grid;
  place-items: center;
  border: 1px solid #6d556d;
  border-radius: .4rem;
  background: #392c41;
  box-shadow: inset 0 -.14rem 0 #221929;
  touch-action: none;
}
.direction span {
  width: .65rem;
  height: .58rem;
  background: #d6e4d6;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.up { grid-area: 1 / 2; }
.left { grid-area: 2 / 1; }
.left span { transform: rotate(-90deg); }
.right { grid-area: 2 / 3; }
.right span { transform: rotate(90deg); }
.down { grid-area: 3 / 2; }
.down span { transform: rotate(180deg); }
.dpad-center { grid-area: 2 / 2; border: 1px solid #4c3a52; border-radius: .35rem; background: #302536; }
.direction:not(:disabled):hover, .direction.is-down { background: #6c4765; }
.direction.is-down { box-shadow: inset 0 .14rem 0 #302536; }
.system-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.action-area { display: grid; justify-items: center; flex: 0 0 auto; gap: .4rem; width: clamp(3.25rem, 11vw, 5rem); }
.action {
  display: grid;
  place-items: center;
  width: clamp(3.2rem, 11vw, 4rem);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid #fac9aa;
  border-radius: 50%;
  background: var(--rose);
  color: #352017;
  font: 800 1.3rem ui-monospace, monospace;
  box-shadow: 0 .24rem 0 #84543f;
  touch-action: none;
}
.action:not(:disabled):hover { background: #fac9aa; }
.action.is-down { transform: translateY(2px); box-shadow: 0 .1rem 0 #84543f; }
.instructions { margin: .2rem .12rem; font-size: .94rem; line-height: 1.5; color: var(--ivory); }
.keyboard-hint { margin: .3rem .12rem .05rem; color: var(--muted); font-size: .8125rem; line-height: 1.4; }

#booth[data-horizontal="true"] .dpad { grid-template: 3.15rem / repeat(2,minmax(2.6rem,3.15rem)); gap:.32rem; }
#booth[data-horizontal="true"] .dpad .up, #booth[data-horizontal="true"] .dpad .down, #booth[data-horizontal="true"] .dpad-center { display:none; }
#booth[data-horizontal="true"] .dpad .left, #booth[data-horizontal="true"] .dpad .right { grid-area:auto; }
#booth[data-horizontal="true"] .controller { padding:.5rem .15rem; }

@media (max-width:720px) {
  .arcade { padding-left:max(.85rem,env(safe-area-inset-left)); padding-right:max(.85rem,env(safe-area-inset-right)); }
  .masthead { min-height:3.45rem; }
  .hall-hero { min-height:226px; background-position:57% center; }
  .hall-hero::before { content:""; z-index:-1; position:absolute; inset:0; background:linear-gradient(90deg,#1a0c23f0,#1a0c238a 48%,transparent 82%); }
  .hero-copy { padding:1.18rem; }
  .coin-line { gap:.7rem; }
  .row-heading { margin:1.38rem 0 .72rem; }
  .machines { grid-template-columns:repeat(3,minmax(0,1fr)); gap:.5rem; }
  .machine-label { padding:.58rem .55rem .68rem; }
  .slot { display:none; }
  .play-layout { grid-template-columns:1fr; }
  .system-keys { flex-direction:column; }
}
@media (max-width:540px) {
  .machines { grid-template-columns:1fr; gap:.75rem; }
  .machine { display:grid; grid-template-columns:43% 1fr; padding: .55rem .55rem .4rem; column-gap:.62rem; align-items:center; }
  .machine-sign { grid-column:2; grid-row:1; margin:0; padding:.2rem .35rem; font-size:.7rem; }
  .bezel { grid-row:1/3; grid-column:1; margin:0; width:100%; border-width:5px; }
  .bezel img { aspect-ratio:1.75; }
  .machine-label { grid-row:2; grid-column:2; padding:.38rem 0 .16rem; gap:.22rem; }
  .machine-label strong { font-size:1.12rem; }
  .machine-label small { font-size:.72rem; }
  .machine-deck { grid-row:3; grid-column:1/-1; height:.75rem; margin:.35rem 0 0; }
  .stick { bottom:1px; } .stick::before { height:4px; } .stick::after { bottom:3px; height:5px; }
  .classic-games { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .game-header:has(#scoreline:not([hidden])) {min-height:3.65rem;}
  #hud {font-size:.76rem;}
}
@media (max-width:350px) { .arcade {padding-left:.6rem;padding-right:.6rem;} .credit {font-size:.65rem;} .brand {gap:.45rem;} }
@media (pointer:coarse) { .keyboard-hint { display:none; } }
@media (prefers-reduced-motion:reduce) { .machine { transition:none; } }
.stage[data-state="finished"] #go-sign:not([hidden]) + #play { color:var(--ivory); background:#302737; border-color:#8d7589; box-shadow:0 3px #24192b; }
.hero-duels { display:inline-flex; align-items:center; min-height:2.1rem; margin-top:.48rem; font-size:.84rem; color:#a7e8d9; }
.hero-duels:hover { text-decoration:underline; }
.duel-tile { min-height:3.5rem; }
.duel-icon { display:grid; place-items:center; flex:none; width:2.4rem; aspect-ratio:1; border:1px solid #565168; border-radius:.25rem; background:#182b31; color:#9ae6d6; font:800 1.4rem ui-monospace,monospace; }
.duel-tile:nth-child(2) .duel-icon { color:#ffc1d9; background:#382539; }
.duel-tile:nth-child(3) .duel-icon { color:#ffd290; background:#382c2a; }

.machines--retro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.machine--bridge { --trim: #ffb681; --rim: #815743; --panel: #63433e; }
.machine--iron { --trim: #9ae7b2; --rim: #457065; --panel: #304f48; }
.machines--retro .bezel img { aspect-ratio: 2.05; object-fit: contain; }
.action-buttons { display: flex; align-items: center; gap: .38rem; }
.action-area span { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.action--jump { background: #9de3cb; border-color: #c4eedc; box-shadow: 0 .24rem 0 #477665; }
.action--jump:not(:disabled):hover { background: #c4eedc; }
.action--jump.is-down { box-shadow: 0 .1rem 0 #477665; }
@media (max-width: 540px) {
  .machines--retro { grid-template-columns: minmax(0, 1fr); }
  .machines--retro .bezel img { aspect-ratio: 1.75; }
  .action-buttons .action-area { width: auto; }
  .action-buttons .action { width: clamp(2.8rem, 12.5vw, 3.6rem); }
}
