body:has(.arcade) {
    margin: 0;
    background: #f7f0e2 radial-gradient(#422e351c 0.75px, transparent 0.75px) 0 0 / 6px 6px;
    color: #271a2d;
    font-family: system-ui, 'Yu Gothic UI', sans-serif;
}

.arcade {
    --ink: #271a2d;
    --paper: #fff9eb;
    --rose: #ff7e9f;
    --mint: #78ebcf;
    --gold: #ffd570;
    --mono: 'Cascadia Mono', Consolas, monospace;
    max-width: 1330px;
    margin: auto;
    padding: 0 clamp(16px, 4vw, 56px);
}

.arcade *, .arcade *::before, .arcade *::after { box-sizing: border-box; }
.arcade button, .skin-button { cursor: pointer; }
.arcade button:disabled { cursor: default; }
.arcade :focus-visible, .skin-button:focus-within { outline: 3px solid #aa365d; outline-offset: 3px; }
.arcade [hidden] { display: none !important; }

.topbar, .arcade footer {
    min-height: 67px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid var(--ink);
    font: bold 13px var(--mono);
    letter-spacing: 0.08em;
}

.brand, .top-actions, .utility { display: flex; align-items: center; gap: 10px; }
.brand-icon { display: grid; place-items: center; width: 31px; height: 31px; background: var(--ink); color: var(--mint); font: italic 900 22px system-ui; }
.brand small { color: #716075; font-size: 10px; }
.utility { position: relative; padding: 7px 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); font: bold 11px var(--mono); white-space: nowrap; }
.utility:hover, .utility[aria-pressed='true'] { background: var(--mint); }
.skin-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.station { display: grid; grid-template-columns: minmax(230px, 0.85fr) minmax(320px, 1.65fr) minmax(215px, 0.8fr); gap: clamp(18px, 3vw, 42px); align-items: start; padding: clamp(24px, 4vw, 48px) 0 32px; }
.score-side, .mission-side { min-width: 0; padding-top: 16px; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: #66516a; letter-spacing: 0.12em; font: bold 11px var(--mono); }
.eyebrow > span, .score-main .label > span { width: 8px; height: 8px; background: var(--rose); display: inline-block; transform: rotate(45deg); }
.score-side h1 { margin: 14px 0 2px; font-size: clamp(2.35rem, 3.9vw, 4.65rem); line-height: 0.85; letter-spacing: -0.085em; font-weight: 1000; }
.score-side h1 span, .poster-bottom b span { color: #b52e60; }
.subtitle { margin: 11px 0 24px; color: #6a526b; font-size: 13px; font-weight: 800; letter-spacing: 0.14em; }
.scorecard { border: 2px solid var(--ink); box-shadow: 4px 4px 0 #453047; background: var(--paper); }
.score-main, .score-best { padding: 13px 15px; }
.score-main { background: var(--ink); color: var(--mint); }
.score-main .label { color: #f3dbf3; }
.score-main .label > span { width: 6px; height: 6px; margin-right: 5px; }
.score-best { color: #7d315a; }
.label { font: bold 10px var(--mono); letter-spacing: 0.09em; }
.scorecard output { display: block; margin-top: 4px; font: bold clamp(1.38rem, 2.7vw, 2.6rem) / 1.07 var(--mono); letter-spacing: -0.07em; overflow-wrap: anywhere; }
.score-best output { font-size: clamp(1.25rem, 2vw, 1.8rem); }
.score-bottom { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); font: bold 11px var(--mono); }
.score-bottom span { display: flex; justify-content: space-between; padding: 9px 10px; gap: 5px; }
.score-bottom span + span { border-left: 1px solid var(--ink); }
.score-bottom b { color: #943456; }
.launch { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 8px; margin-top: 20px; padding: 10px 12px; min-height: 46px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--rose); color: var(--ink); font: 900 14px system-ui; }
.launch b { margin-right: 4px; }
.launch:not(:disabled):hover { background: var(--gold); }
.launch:disabled { background: #e7d9de; box-shadow: none; }
.arcade kbd { display: inline-block; padding: 2px 5px; min-width: 21px; text-align: center; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font: bold 10px var(--mono); }
.game-status, .skin-status { color: #6a4363; margin: 12px 0; min-height: 2.7em; font-size: 12px; font-weight: 700; }
.skin-status:empty { display: none; }
.keyboard { display: flex; gap: 7px 11px; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed #a6929e; font-size: 11px; }

.cabinet { background: linear-gradient(90deg, #6e4022, #f8c679 3%, #372322 7%, #251715 93%, #f8c679 97%, #6e4022); padding: 8px 10px 9px; border: 3px ridge #d59752; box-shadow: 5px 6px 0 #9c6037, 8px 9px 0 #39251b; }
.cabinet-top, .cabinet-apron { position: relative; overflow: hidden; background: repeating-conic-gradient(from -40deg at 50% 120%, #85291c 0deg 7deg, #531c1b 7deg 14deg); border: 3px ridge #e0a755; color: #ffd675; text-align: center; }
.cabinet-top { width: 89%; margin: 0 auto 5px; height: clamp(70px, 17vh, 154px); }
.cabinet-title { display: grid; align-content: center; justify-items: center; height: 100%; border: 1px solid #ffc367; text-shadow: 2px 2px #35130e, 0 0 12px #2c0f0b; }
.cabinet-title b { font: 900 clamp(1.7rem, 3.7vw, 3.25rem) / 1.12 'Yu Mincho', 'MS Mincho', serif; letter-spacing: 0.05em; }
.cabinet-title small { font: bold 9px var(--mono); letter-spacing: 0.12em; }
.cabinet-apron { display: grid; place-items: center; height: clamp(20px, 4.5vh, 38px); margin-top: 2px; }
.cabinet-apron strong { font-size: 15px; }
.cabinet-top canvas, .cabinet-apron canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cabinet-top canvas { object-fit: contain; background: #210f0e; }
.cabinet-apron canvas { object-fit: cover; object-position: center 35%; }
.glass { position: relative; overflow: hidden; background: #251412; border: 2px solid #af753e; }
.glass canvas { display: block; width: 100%; height: auto; aspect-ratio: 460 / 507; transform: perspective(1050px) rotateX(10deg) scale(0.96, 1.012); }
.board-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: #1c102823; }
.board-overlay > div { display: grid; justify-items: center; align-content: center; gap: 4px; width: 72%; padding: 10px 5px; color: #fff4e0; background: #3a1917ef; border: 1px solid #e5ad68; box-shadow: 0 5px 18px #241110b0; text-align: center; }
.board-overlay strong { color: #ffd77d; font: italic 1000 clamp(1.55rem, 4vw, 3.5rem) / 0.94 system-ui; letter-spacing: -0.06em; }
.board-overlay small, .board-overlay span { font: bold clamp(7px, 1vw, 11px) var(--mono); letter-spacing: 0.12em; }
.board-overlay small { color: var(--mint); }
.cabinet-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-top: 8px; }
.cabinet-controls button { border: 1px solid #c89150; background: #3d231c; color: #fff0db; min-height: 34px; padding: 2px 10px; touch-action: none; user-select: none; font: bold 11px var(--mono); }
.cabinet-controls button:active { background: var(--mint); color: var(--ink); }
.cabinet-controls button:disabled { opacity: 0.55; }

.poster { position: relative; overflow: hidden; background: #ff9ab3 radial-gradient(#6f294f30 1px, transparent 1px) 0 0 / 7px 7px; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.poster::before { content: ''; pointer-events: none; position: absolute; width: 72%; aspect-ratio: 1; background: var(--gold); border: 1px solid #8e3d59; border-radius: 50%; left: 14%; top: 11%; }
.poster-top, .poster-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 5px; padding: 9px 10px; }
.poster-top { border-bottom: 1px solid var(--ink); font: bold 10px var(--mono); }
.poster img { position: relative; display: block; width: 100%; height: clamp(128px, 15vw, 215px); object-fit: contain; padding: 4px 8px 0; }
.poster-bottom { align-items: end; border-top: 1px solid var(--ink); background: var(--paper); }
.poster-bottom b { font-size: clamp(1.25rem, 2vw, 2rem); font-weight: 1000; line-height: 0.88; letter-spacing: -0.07em; }
.poster-bottom small { font: bold 9px / 1.4 var(--mono); text-align: right; }
.missions { margin-top: 24px; }
.missions .eyebrow { margin-bottom: 8px; }
.mission { display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 7px; padding: 9px 0; border-top: 1px solid #a8919a; }
.mission:last-child { border-bottom: 1px solid #a8919a; }
.mission-icon { width: 27px; height: 27px; border: 1px solid var(--ink); display: grid; place-items: center; font-weight: 900; }
.mission-icon.pink { background: var(--rose); }
.mission-icon.mint { background: var(--mint); }
.mission-icon.yellow { background: var(--gold); }
.mission b { display: block; font: bold 11px var(--mono); }
.mission small { display: block; font-size: 10px; line-height: 1.4; color: #6a526b; }
.mission output { color: #882e55; font: bold 11px var(--mono); }
.arcade footer { min-height: 46px; border-top: 1px solid var(--ink); border-bottom: 0; font-size: 10px; color: #66516a; }
.arcade footer b { color: #a6325d; }

@media (min-width: 930px) and (max-height: 870px) {
    .cabinet { width: min(100%, max(320px, calc((100vh - 330px) * 0.9 + 24px))); justify-self: center; }
}

@media (max-width: 929px) {
    .station { grid-template-columns: minmax(195px, 0.72fr) minmax(285px, 1fr); }
    .mission-side { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(170px, 0.72fr) minmax(215px, 1fr); column-gap: 22px; }
    .missions { margin-top: 0; }
}

@media (max-width: 555px) {
    .topbar { min-height: 53px; }
    .brand { gap: 6px; font-size: 11px; }
    .brand small { display: none; }
    .top-actions { gap: 5px; }
    .utility { padding: 6px; font-size: 10px; }
    .station { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 12px; }
    .score-side { display: grid; grid-template-columns: minmax(0, 0.84fr) minmax(0, 1fr); gap: 5px 12px; padding-top: 0; align-items: center; }
    .score-side h1 { grid-column: 1; margin: 3px 0; font-size: clamp(1.95rem, 8vw, 2.7rem); }
    .subtitle { grid-column: 1; margin: 0; font-size: 10px; }
    .scorecard { grid-column: 2; grid-row: 1 / 5; }
    .score-main, .score-best { padding: 6px 9px; }
    .score-bottom span { padding: 5px; font-size: 9px; }
    .launch { margin-top: 6px; min-height: 33px; font-size: 11px; padding: 4px 5px; }
    .game-status { margin: 2px 0 0; min-height: 0; grid-column: 1 / -1; }
    .keyboard { display: none; }
    .cabinet-top { height: 77px; }
    .cabinet-apron { height: 23px; }
    .glass canvas { aspect-ratio: 460 / 482; }
    .cabinet-controls button { min-height: 43px; }
    .mission-side { display: block; }
    .missions { margin-top: 18px; }
}

@media (max-width: 360px) {
    .brand-icon { display: none; }
}
