:root {
  --red: #d8272e;
  --red-dark: #9e171c;
  --ink: #171717;
  --paper: #e9e4d9;
  --cream: #f5f1e8;
  --metal: #c9c7c0;
  --dim: #6f6c67;
  --pixel: "Courier New", "Microsoft YaHei", monospace;
  --sans: "Arial Narrow", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: var(--sans); background: var(--paper); }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.shell-width { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.noise { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }

.site-header, .game-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; color: white; background: var(--red); border-radius: 4px 12px 4px 12px; font: 900 27px/1 var(--pixel); transform: skew(-5deg); box-shadow: inset -4px -4px 0 rgba(0,0,0,.12); }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font: 900 19px/.9 var(--pixel); letter-spacing: -1px; }
.brand small { margin-top: 5px; font: 700 8px/1 var(--pixel); letter-spacing: 2px; }
.status-pill { border: 1px solid #a7a39a; border-radius: 30px; padding: 10px 15px; color: #5b5955; font: 700 10px/1 var(--pixel); letter-spacing: 1px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #67a150; box-shadow: 0 0 7px #67a150; }

.home-page { min-height: 100vh; background-color: var(--paper); background-image: linear-gradient(rgba(80,70,50,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(80,70,50,.045) 1px, transparent 1px); background-size: 28px 28px; }
.home-main { display: grid; grid-template-columns: .88fr 1.12fr; align-items: center; gap: 88px; min-height: calc(100vh - 176px); padding: 34px 0 56px; }
.eyebrow { margin: 0 0 20px; color: var(--red); font: 800 11px/1 var(--pixel); letter-spacing: 2.2px; text-transform: uppercase; }
.duo-banner { width: fit-content; display: flex; align-items: center; gap: 9px; margin-bottom: 24px; padding: 10px 13px 10px 10px; color: white; background: var(--red); border: 2px solid var(--red-dark); border-radius: 3px; box-shadow: 5px 5px 0 #b9b3a8; transform: rotate(-1deg); font: 900 12px/1 var(--pixel); letter-spacing: .5px; }
.duo-banner .duo-pads { display: grid; place-items: center; width: 42px; height: 26px; color: var(--red); background: #f3eee5; border-radius: 9px 9px 4px 4px; font-size: 8px; letter-spacing: 5px; padding-left: 5px; box-shadow: inset 0 -3px 0 #c8c1b7; }
.duo-banner b { padding: 5px 7px; color: var(--red); background: white; font: inherit; }
.hero-copy h1 { margin: 0; font: 900 clamp(48px, 6.2vw, 82px)/.97 var(--sans); letter-spacing: -5px; }
.hero-copy h1 span { color: var(--red); text-shadow: 4px 4px 0 #bbb5aa; }
.intro { max-width: 490px; margin: 30px 0 25px; color: #5e5b56; font-size: 16px; line-height: 1.9; }
.mini-specs { display: flex; gap: 9px; flex-wrap: wrap; }
.mini-specs span { padding: 8px 10px; border: 1px solid #b8b3aa; border-radius: 3px; color: #5b5954; font: 700 10px/1 var(--pixel); }

.console-panel { position: relative; border-radius: 10px; background: linear-gradient(145deg, #d2d0c9, #aaa8a2); border: 1px solid #8b8984; box-shadow: 0 34px 55px rgba(54,45,35,.22), inset 0 2px 0 #eeece7, inset 0 -5px 0 #8a8985; }
.console-topline { height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 27px; border-bottom: 2px solid #96948e; color: #55534f; font: 800 10px/1 var(--pixel); letter-spacing: 1.5px; }
.power-label { display: flex; align-items: center; gap: 8px; }
.power-label i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 7px rgba(216,39,46,.7); }
.cartridge-bay { position: relative; margin: 18px 24px 20px; padding: 30px; border-radius: 5px; background: #bebcb5; border: 1px solid #8f8d87; box-shadow: inset 0 5px 12px rgba(0,0,0,.14), 0 1px 0 #e9e7e1; }
.bay-groove { position: absolute; left: 0; right: 0; top: 10px; height: 6px; border-top: 1px solid #8f8c86; border-bottom: 1px solid #dad8d1; }
.cartridge-bay h2 { margin: 3px 0 19px; font-size: 23px; letter-spacing: -1px; }
.multiplayer-notice { margin: 0 0 20px; overflow: hidden; color: #eeeae0; background: #242322; border: 2px solid var(--red); border-radius: 5px; box-shadow: 4px 4px 0 rgba(158,23,28,.22); }
.multiplayer-title { min-height: 42px; display: grid; grid-template-columns: 38px auto 1fr; align-items: center; gap: 9px; padding: 7px 10px; background: linear-gradient(90deg,#a9161c,#d8272e); }
.multiplayer-title > span { width: 34px; height: 27px; display: grid; place-items: center; color: var(--red); background: white; border-radius: 8px 8px 4px 4px; font: 900 10px/1 var(--pixel); box-shadow: inset 0 -3px 0 #d6d0c8; }
.multiplayer-title strong { font: 900 12px/1 var(--pixel); letter-spacing: .3px; }
.multiplayer-title small { justify-self: end; color: #ffd8d9; font: 700 8px/1 var(--pixel); }
.multiplayer-options { display: grid; grid-template-columns: 1fr 1fr; }
.multiplayer-option { min-height: 65px; display: grid; grid-template-columns: 27px 1fr; align-items: center; gap: 9px; padding: 10px 11px; }
.multiplayer-option + .multiplayer-option { border-left: 1px solid #4b4743; }
.multiplayer-option > i { width: 26px; height: 26px; display: grid; place-items: center; color: #f0d064; background: #171717; border: 1px solid #4d4946; border-radius: 50%; font: normal 900 8px/1 var(--pixel); }
.multiplayer-option > span { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.multiplayer-option strong { color: white; font: 900 10px/1 var(--pixel); }
.multiplayer-option small { color: #918c84; font: 8px/1.45 var(--pixel); }
.game-card { width: 100%; display: grid; grid-template-columns: 76px 1fr 28px; align-items: center; gap: 17px; padding: 14px; text-align: left; background: #d8d6ce; border: 2px solid #95928b; border-radius: 5px; cursor: pointer; transition: .18s ease; }
.game-card:not(.selected) { filter: grayscale(1); }
.game-card.selected { filter: none; }
.rom-library { display: grid; gap: 11px; max-height: 272px; padding: 2px 6px 6px 2px; overflow-y: auto; scrollbar-color: var(--red) #aaa8a2; scrollbar-width: thin; }
.rom-library-status { margin: 10px 2px 0; color: #706d67; font: 8px/1.5 var(--pixel); text-align: center; }
.game-card:hover, .game-card.selected { border-color: var(--red); background: #e4e1d8; box-shadow: 4px 4px 0 rgba(158,23,28,.18); transform: translate(-2px,-2px); }
.cart-art { position: relative; height: 77px; display: grid; place-items: center; color: white; background: var(--red); border: 6px solid #383838; border-radius: 3px; box-shadow: inset 0 0 0 2px #efe7d9; }
.cart-art b { font: 900 31px/1 var(--sans); }
.cart-art i { position: absolute; right: 3px; bottom: 3px; font: 800 8px/1 var(--pixel); }
.game-meta { display: flex; flex-direction: column; min-width: 0; }
.game-meta small { color: #77736c; font: 700 9px/1 var(--pixel); letter-spacing: 1.2px; }
.game-meta strong { margin: 7px 0 9px; font-size: 22px; }
.game-meta em { color: #66625d; font: normal 10px/1 var(--pixel); }
.game-meta em span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #599a4a; margin-right: 5px; }
.pixel-check { color: white; background: var(--red); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 2px; font-weight: 900; opacity: 0; transform: scale(.72); transition: opacity .18s ease, transform .18s ease; }
.game-card.selected .pixel-check { opacity: 1; transform: scale(1); }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #77736d; font: 700 9px/1 var(--pixel); }
.or-divider::before, .or-divider::after { content: ""; height: 1px; background: #9c9992; flex: 1; }
.upload-zone { min-height: 74px; display: flex; justify-content: center; align-items: center; gap: 13px; border: 2px dashed #929089; border-radius: 4px; color: #4f4d49; cursor: pointer; transition: .18s; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--red); background: rgba(255,255,255,.22); }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone > span:last-child { display: flex; flex-direction: column; gap: 5px; }
.upload-zone strong { font-size: 13px; }
.upload-zone small { color: #77736d; font: 9px/1 var(--pixel); }
.upload-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #8b8881; font-size: 21px; }
.selected-file { min-height: 74px; grid-template-columns: 45px 1fr 30px; align-items: center; gap: 13px; padding: 10px; border: 2px solid var(--red); background: #dbd9d1; }
.selected-file:not([hidden]) { display: grid; }
.file-chip { display: grid; place-items: center; height: 44px; color: white; background: #3c3b39; font: 800 10px/1 var(--pixel); }
.selected-file > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.selected-file strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selected-file small { color: #666; font: 9px/1 var(--pixel); }
.selected-file button { border: 0; background: transparent; font-size: 25px; cursor: pointer; }
.primary-button { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 20px; color: white; background: var(--red); border: 0; border-radius: 3px; box-shadow: 0 5px 0 var(--red-dark); font-weight: 900; font-size: 17px; cursor: pointer; transition: .12s; }
.primary-button:hover { background: #e6333a; transform: translateY(-1px); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-dark); }
.primary-button:disabled { opacity: .7; cursor: wait; }
.primary-button i { font-style: normal; font-size: 12px; }
.privacy-note { margin: 15px 0 0; text-align: center; color: #77736d; font: 9px/1.4 var(--pixel); }
.console-footer { height: 55px; display: flex; align-items: center; padding: 0 27px; gap: 10px; color: #77746f; }
.console-footer .vent { width: 36px; height: 5px; background: #85837e; border-radius: 8px; box-shadow: 0 2px 0 #dedcd5; }
.console-footer b { margin-left: auto; font: 800 8px/1 var(--pixel); letter-spacing: 1px; }
.home-footer { min-height: 84px; border-top: 1px solid #bdb8ad; display: flex; align-items: center; justify-content: space-between; color: #75716b; font: 700 9px/1.5 var(--pixel); letter-spacing: .5px; }
.home-footer p { margin: 0; }
.home-footer p span { color: var(--red); margin-right: 12px; }

.play-page { min-height: 100vh; color: #eeeae0; background: #171717; overscroll-behavior: none; }
.game-input-locked, .game-input-locked body { width: 100%; height: 100%; overflow: hidden; touch-action: none; overscroll-behavior: none; }
.play-page.game-input-locked { touch-action: none; overscroll-behavior: none; }
.play-page.game-input-locked * { -webkit-tap-highlight-color: transparent; }
.play-page .noise { opacity: .1; mix-blend-mode: soft-light; }
.game-header { border-bottom: 1px solid #343434; }
.brand-light strong { color: white; }
.brand-light small { color: #999; }
.now-playing { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.now-playing span { color: var(--red); font: 700 8px/1 var(--pixel); letter-spacing: 2px; }
.now-playing strong { font-size: 14px; }
.back-link { color: #aaa; font: 700 11px/1 var(--pixel); transition: color .15s; }
.back-link:hover { color: white; }
.back-link b { color: var(--red); margin-left: 7px; }
.game-main { padding: 42px 0 80px; }
.tv-shell { max-width: 960px; margin: auto; background: linear-gradient(145deg,#3c3b3a,#242323); border-radius: 11px; border: 1px solid #52504d; box-shadow: 0 28px 60px #090909, inset 0 2px 0 #5f5c58; padding: 18px 20px 0; }
.tv-shell, .tv-shell *, .mobile-pad, .mobile-pad * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; user-drag: none; -webkit-tap-highlight-color: transparent; }
.screen-wrap, .screen-wrap *, .mobile-pad, .mobile-pad button { touch-action: none; }
.tv-top { height: 27px; display: flex; justify-content: space-between; color: #8f8c86; font: 700 8px/1 var(--pixel); letter-spacing: 1px; }
.tv-top b { color: #aaa; }
.tv-top i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #65a852; box-shadow: 0 0 6px #65a852; }
.screen-bezel { width: min(100%, 816px); max-width: 816px; margin: 0 auto; padding: 20px; border-radius: 14px; background: #0c0c0c; border: 4px solid #151515; box-shadow: inset 0 0 0 2px #4c4a47, inset 0 0 35px #000, 0 2px 0 #55524e; }
.screen-wrap { position: relative; width: 100%; aspect-ratio: 256/240; overflow: hidden; background: #050505; border-radius: 3px; }
#nesCanvas { display: block; width: 100%; height: 100%; image-rendering: crisp-edges; image-rendering: pixelated; background: #050505; }
.scanlines { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg,rgba(0,0,0,.13) 0,rgba(0,0,0,.13) 1px,transparent 1px,transparent 3px); mix-blend-mode: multiply; }
.loading-screen, .start-overlay { position: absolute; inset: 0; color: #eee; background: #080808; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; }
.loading-screen span { width: 38%; height: 5px; position: relative; background: #292929; overflow: hidden; }
.loading-screen span::after { content: ""; position: absolute; width: 45%; height: 100%; background: var(--red); animation: loading 1s infinite steps(8); }
.loading-screen p { margin-top: 17px; font: 700 9px/1 var(--pixel); letter-spacing: 1px; }
.loading-screen.error { color: #ff6868; }
.loading-screen.error span { display: none; }
.start-overlay { display: none; cursor: pointer; z-index: 3; background: rgba(4,4,4,.9); }
.start-overlay.visible { display: flex; }
.start-overlay strong { margin: 16px 0 8px; font: 900 17px/1 var(--pixel); letter-spacing: 2px; }
.start-overlay small { color: #999; font: 9px/1 var(--pixel); }
.start-triangle { width: 56px; height: 56px; display: grid; place-items: center; padding-left: 4px; border: 2px solid var(--red); border-radius: 50%; color: var(--red); font-size: 20px; box-shadow: 0 0 22px rgba(216,39,46,.2); }
@keyframes loading { from { left: -45%; } to { left: 100%; } }
.control-strip { min-height: 103px; display: flex; align-items: center; justify-content: space-between; gap: 25px; max-width: 830px; margin: 0 auto; }
.score-display { display: flex; flex-direction: column; gap: 6px; }
.score-display small { color: #918e89; font: 700 8px/1 var(--pixel); letter-spacing: 1.2px; }
.score-display strong { color: var(--red); font: 900 25px/1 var(--pixel); letter-spacing: 3px; text-shadow: 0 0 9px rgba(216,39,46,.38); }
.control-buttons { display: flex; gap: 8px; }
.control-buttons button { min-width: 70px; padding: 10px 12px; color: #bcb9b3; background: #2d2c2b; border: 1px solid #54514e; border-radius: 3px; font: 700 9px/1 var(--pixel); cursor: pointer; box-shadow: 0 2px 0 #111; }
.control-buttons button:hover, .control-buttons button.active { color: white; border-color: #88847e; }
.control-buttons button span { margin-right: 5px; color: var(--red); }
.control-buttons .rank-button { position: relative; min-width: 82px; color: white; background: linear-gradient(#e4353c,#bb171e); border-color: #ef555b; box-shadow: 0 2px 0 #720b0f, 0 0 14px rgba(216,39,46,.2); }
.control-buttons .rank-button:hover { border-color: #ff7a7e; background: linear-gradient(#f0444b,#cc1d24); }
.rank-button span { color: #ffe18a !important; }
.rank-button b { font: inherit; }
.rank-button i { position: absolute; top: -9px; right: -7px; padding: 3px 4px; color: #211b0b; background: #f2c94c; border-radius: 6px; font: normal 800 6px/1 var(--pixel); box-shadow: 0 0 0 2px #292827; animation: rank-pulse 1.6s ease-in-out infinite; }
.rank-entry-hint { display: none; }
@keyframes rank-pulse { 50% { transform: translateY(-1px); box-shadow: 0 0 0 2px #292827, 0 0 9px rgba(242,201,76,.75); } }
.key-guide { margin: 0 -20px; min-height: 37px; display: flex; align-items: center; justify-content: center; gap: 9px; background: #202020; color: #777; font: 700 8px/1 var(--pixel); }
.key-guide span { color: #bbb; padding: 4px 6px; background: #333; border: 1px solid #4c4c4c; border-radius: 2px; }
.gamepad-strip { margin: 0 -20px; min-height: 68px; display: grid; grid-template-columns: 1fr 1px 1fr auto; align-items: center; gap: 18px; padding: 10px 22px; background: #292827; border-top: 1px solid #3b3a38; }
.pad-slot { min-width: 0; display: grid; grid-template-columns: 36px 1fr 8px; align-items: center; gap: 10px; }
.pad-slot > i { width: 36px; height: 30px; display: grid; place-items: center; color: #777; background: #1b1b1b; border: 1px solid #444; border-radius: 10px 10px 5px 5px; font: normal 800 9px/1 var(--pixel); }
.pad-slot > span { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pad-slot strong { color: #aaa; font: 800 9px/1 var(--pixel); }
.pad-slot small { overflow: hidden; color: #666; font: 8px/1 var(--pixel); white-space: nowrap; text-overflow: ellipsis; }
.pad-slot > b { width: 7px; height: 7px; border-radius: 50%; background: #555; }
.pad-slot.connected > i { color: white; border-color: var(--red); }
.pad-slot.connected small { color: #9f9b94; }
.pad-slot.connected > b { background: #65a852; box-shadow: 0 0 7px #65a852; }
.pad-divider { width: 1px; height: 34px; background: #444; }
.gamepad-strip > p { margin: 0; color: #777; font: 8px/1.55 var(--pixel); text-align: right; }
.gamepad-strip > p span { color: #aaa; }
.remote-play { min-height: 88px; margin: 0 -20px; padding: 14px 22px; display: grid; grid-template-columns: minmax(240px,1fr) auto auto; align-items: center; gap: 20px; color: #ddd8cf; background: #211f1e; border-top: 1px solid #403c39; }
.remote-play-copy p { margin: 0 0 6px; color: var(--red); font: 800 8px/1 var(--pixel); letter-spacing: 1.5px; }
.remote-play-copy h2 { margin: 0 0 7px; font-size: 15px; }
.remote-play-copy small { color: #77726c; font: 8px/1.45 var(--pixel); }
.remote-room { min-width: 315px; display: flex; align-items: center; gap: 12px; }
.remote-room[hidden] { display: none; }
.remote-qr { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
#remoteQrCode { width: 92px; height: 92px; display: grid; place-items: center; padding: 5px; overflow: hidden; color: #171717; background: white; border: 2px solid #eee9df; border-radius: 3px; box-shadow: 0 3px 0 #0c0c0c; }
#remoteQrCode svg { display: block; width: 100%; height: 100%; }
#remoteQrCode.failed { color: var(--red); font: 900 14px/1 var(--pixel); }
.remote-qr > small { max-width: 24px; color: #9b968e; font: 8px/1.4 var(--pixel); }
.remote-room-info { display: grid; grid-template-columns: auto; align-content: center; gap: 7px; }
.remote-room-info > span { color: #77726c; font: 8px/1 var(--pixel); }
.remote-room-info strong { color: #f1d365; font: 900 24px/1 var(--pixel); letter-spacing: 4px; }
.remote-room button, .remote-create { border: 1px solid #55504c; border-radius: 3px; color: #ddd8cf; background: #302d2b; font: 800 8px/1 var(--pixel); cursor: pointer; }
.remote-room button { padding: 6px 8px; }
.remote-create { min-height: 39px; padding: 0 14px; border-color: #bc292f; background: #9e171c; color: white; white-space: nowrap; }
.remote-create span { margin-left: 8px; }
.remote-create:disabled { opacity: .55; cursor: wait; }
.mobile-pad { display: none; }
.leaderboard-section { max-width: 960px; margin: 76px auto 0; scroll-margin-top: 18px; }
.rank-heading { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 22px; border-bottom: 1px solid #3a3937; }
.rank-heading .eyebrow { margin-bottom: 10px; }
.rank-heading h2 { margin: 0; font-size: 29px; letter-spacing: -1px; }
.rank-heading > p { margin: 0; color: #777; font-size: 11px; line-height: 1.8; text-align: right; }
.leaderboard-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 48px; padding-top: 25px; }
.ranking { list-style: none; padding: 0; margin: 0; }
.ranking li { min-height: 67px; display: grid; grid-template-columns: 45px 1fr auto; align-items: center; border-bottom: 1px solid #333; }
.ranking li.has-stage { grid-template-columns: 45px 1fr auto auto; gap: 18px; }
.ranking .rank-no { color: #6d6964; font: 900 16px/1 var(--pixel); }
.ranking li:first-child .rank-no { color: #e4b74b; }
.ranking .rank-name { font: 800 13px/1 var(--pixel); letter-spacing: 1px; }
.ranking .rank-score { color: #ccc; font: 800 18px/1 var(--pixel); letter-spacing: 2px; }
.ranking .rank-stage { color: #8d8983; font: 800 9px/1 var(--pixel); white-space: nowrap; }
.ranking li:first-child .rank-score { color: #e4b74b; }
.ranking .ranking-status { display: flex; align-items: center; min-height: 88px; color: #777; font: 700 10px/1.6 var(--pixel); }
.score-form { padding: 20px; background: #222; border: 1px solid #3d3c3a; border-radius: 4px; }
.score-form p { margin: 0 0 17px; color: #bbb; font: 800 10px/1 var(--pixel); letter-spacing: 1px; }
.score-form label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 13px; color: #777; font-size: 10px; }
.score-form [hidden] { display: none; }
.score-form input { width: 100%; height: 38px; padding: 0 10px; color: #eee; background: #141414; border: 1px solid #444; border-radius: 2px; outline: none; font: 700 12px/1 var(--pixel); }
.score-form input:focus { border-color: var(--red); }
.score-form input[readonly] { color: var(--red); border-color: #4e3939; background: #191313; cursor: default; }
.score-form button { width: 100%; height: 41px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: white; background: var(--red); border: 0; border-radius: 2px; font-size: 11px; font-weight: 800; cursor: pointer; }
.score-form button:disabled { opacity: .65; cursor: wait; }
.score-form small { display: block; margin-top: 11px; color: #666; font-size: 9px; line-height: 1.5; }
.game-footer { min-height: 72px; display: flex; align-items: center; justify-content: space-between; color: #545454; border-top: 1px solid #2c2c2c; font: 700 8px/1 var(--pixel); letter-spacing: 1px; }

@media (max-width: 900px) {
  .home-main { grid-template-columns: 1fr; gap: 45px; padding-top: 55px; }
  .hero-copy { text-align: center; }
  .hero-copy .duo-banner { margin-inline: auto; }
  .hero-copy .intro { margin-inline: auto; }
  .mini-specs { justify-content: center; }
  .console-panel { width: min(620px,100%); margin: auto; }
  .home-footer { margin-top: 60px; }
  .leaderboard-grid { grid-template-columns: 1fr; }
  .screen-bezel { width: 560px; }
}

@media (max-width: 650px), (hover: none) and (pointer: coarse) and (max-width: 900px) {
  .shell-width { width: min(100% - 26px, 1180px); }
  .site-header, .game-header { min-height: 74px; }
  .status-pill, .now-playing { display: none; }
  .hero-copy h1 { letter-spacing: -3px; }
  .home-main { padding-top: 35px; }
  .console-topline { padding: 0 16px; }
  .cartridge-bay { margin: 12px; padding: 25px 15px; }
  .multiplayer-title { grid-template-columns: 38px 1fr; }
  .multiplayer-title small { display: none; }
  .multiplayer-option { grid-template-columns: 24px 1fr; gap: 7px; padding: 9px 8px; }
  .multiplayer-option > i { width: 23px; height: 23px; }
  .multiplayer-option strong { font-size: 8px; }
  .multiplayer-option small { font-size: 7px; }
  .game-card { grid-template-columns: 62px 1fr 24px; gap: 12px; padding: 10px; }
  .cart-art { height: 64px; }
  .game-meta strong { font-size: 18px; }
  .home-footer { flex-direction: column; justify-content: center; gap: 12px; text-align: center; }
  .game-main { width: 100%; padding-top: 18px; }
  .tv-shell { padding: 10px 8px 0; border-radius: 0; border-left: 0; border-right: 0; }
  .tv-top { padding: 0 8px; }
  .screen-bezel { width: 278px; max-width: 100%; padding: 8px; border-width: 3px; }
  .control-strip { min-height: 72px; gap: 10px; padding-inline: 10px; border-top: 1px solid #45423f; }
  .control-buttons { gap: 5px; }
  .control-buttons button { min-width: 42px; font-size: 0; padding: 9px; }
  .control-buttons button span { font-size: 15px; margin: 0; }
  .control-buttons .rank-button { min-width: 60px; padding-inline: 5px; }
  .rank-button b { display: inline; margin-left: 4px; font: 800 8px/1 var(--pixel); }
  .rank-button i { top: -7px; right: -4px; }
  .score-display strong { font-size: 18px; }
  .key-guide { display: none; }
  .gamepad-strip { margin: 0 -8px; min-height: 58px; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 12px; }
  .remote-play { margin: 0 -8px; padding: 13px 12px; grid-template-columns: 1fr auto; gap: 12px; }
  .remote-play-copy h2 { font-size: 13px; }
  .remote-room { grid-column: 1 / 3; grid-row: 2; min-width: 0; justify-content: center; }
  #remoteQrCode { width: 104px; height: 104px; }
  .rank-entry-hint { min-height: 28px; margin: 0 -8px; display: flex; align-items: center; justify-content: center; gap: 7px; color: #b8b3aa; background: #211d1d; border-top: 1px solid #453434; font: 700 7px/1 var(--pixel); letter-spacing: .2px; }
  .rank-entry-hint span { color: #f2c94c; }
  .pad-divider, .gamepad-strip > p { display: none; }
  .pad-slot { grid-template-columns: 31px 1fr 7px; gap: 7px; }
  .pad-slot > i { width: 31px; }
  .mobile-pad { width: 100%; margin: 8px auto 0; display: flex; align-items: center; justify-content: space-between; min-height: 140px; padding: 6px 5px max(6px, env(safe-area-inset-bottom)); touch-action: none; }
  .mobile-pad button { color: #aaa; background: #292929; border: 1px solid #454545; box-shadow: 0 3px 0 #090909; outline: none; }
  .dpad { --stick-x: 0px; --stick-y: 0px; width: 126px; height: 126px; display: grid; grid-template: repeat(3,1fr)/repeat(3,1fr); touch-action: none; }
  .dpad button { font-size: 11px; pointer-events: none; transition: color .06s, background .06s, transform .06s; }
  .dpad button.pressed { color: white; background: #3d3b39; transform: translateY(2px); box-shadow: 0 1px 0 #090909; }
  .dpad button:nth-child(1) { grid-area: 1/2; }
  .dpad button:nth-child(2) { grid-area: 2/1; }
  .dpad i { grid-area: 2/2; position: relative; z-index: 2; background: #343332; border-radius: 5px; box-shadow: inset 0 1px 0 #4b4947; transform: translate(var(--stick-x), var(--stick-y)); transition: transform 45ms linear; }
  .dpad button:nth-child(4) { grid-area: 2/3; }
  .dpad button:nth-child(5) { grid-area: 3/2; }
  .touch-middle { display: flex; gap: 6px; transform: rotate(-8deg); align-self: flex-end; margin-bottom: 14px; }
  .touch-middle button { min-width: 48px; min-height: 32px; padding: 8px 7px; border-radius: 16px; font: 700 7px/1 var(--pixel); }
  .ab-pad { display: flex; gap: 9px; transform: rotate(-12deg); }
  .ab-pad button { width: 54px; height: 54px; border-radius: 50%; color: white; background: var(--red); border-color: #ed565b; font: 900 17px/1 var(--pixel); touch-action: none; }
  .ab-pad button.pressed { transform: translateY(3px); background: #a9161c; box-shadow: 0 0 0 #090909, inset 0 2px 5px rgba(0,0,0,.3); }
  .leaderboard-section { width: calc(100% - 26px); margin-top: 55px; }
  .rank-heading { align-items: flex-start; }
  .rank-heading > p { display: none; }
  .game-footer { width: calc(100% - 26px); }
  .game-footer span:last-child { display: none; }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 550px) {
  .game-header { display: none; }
  .game-main { min-height: 100dvh; padding: 0; }
  .tv-shell { width: 100%; max-width: none; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); grid-template-rows: 1fr auto; align-items: center; gap: 0 10px; padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); border: 0; border-radius: 0; }
  .tv-top, .gamepad-strip, .rank-entry-hint { display: none; }
  .screen-bezel { grid-column: 1; grid-row: 1 / 3; width: 272px; max-width: 100%; padding: 5px; }
  .mobile-pad { grid-column: 2; grid-row: 1; align-self: end; width: 100%; min-height: 142px; margin: 0; }
  .control-strip { grid-column: 2; grid-row: 2; align-self: start; width: 100%; min-height: 68px; padding: 0 4px 8px; }
  .score-display small { font-size: 7px; }
  .control-buttons { gap: 5px; }
  .control-buttons button { min-width: 38px; padding: 8px; }
  .leaderboard-section { margin-top: 38px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation-duration: .01ms !important; } }

.controller-page { min-height: 100dvh; color: #eeeae0; background: #171717; overscroll-behavior: none; }
.controller-page.controller-active { overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.controller-header { width: min(920px, calc(100% - 32px)); min-height: 84px; margin: auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #353331; }
.player-two-badge { padding: 9px 12px; color: white; background: var(--red); border-radius: 3px; font: 900 9px/1 var(--pixel); letter-spacing: 1px; }
.controller-main { width: min(920px, calc(100% - 32px)); min-height: calc(100dvh - 84px); margin: auto; display: grid; place-items: center; }
.controller-connect { width: min(470px,100%); padding: 30px; background: #242322; border: 1px solid #44413e; border-radius: 7px; box-shadow: 0 25px 60px #090909; }
.controller-connect[hidden], .remote-controller[hidden] { display: none; }
.controller-connect > p { margin: 0 0 10px; color: var(--red); font: 800 9px/1 var(--pixel); letter-spacing: 2px; }
.controller-connect h1 { margin: 0 0 24px; font-size: 30px; }
.controller-connect label { display: block; margin-bottom: 9px; color: #88837c; font-size: 11px; }
.room-code-entry { display: grid; grid-template-columns: 1fr 92px; gap: 9px; }
.room-code-entry input { min-width: 0; height: 52px; padding: 0 14px; border: 1px solid #57524e; border-radius: 3px; outline: none; color: #f1d365; background: #111; font: 900 22px/1 var(--pixel); letter-spacing: 6px; }
.room-code-entry input:focus { border-color: var(--red); }
.room-code-entry button { border: 0; border-radius: 3px; color: white; background: var(--red); font-weight: 900; cursor: pointer; }
.room-code-entry button:disabled { opacity: .6; }
.controller-connect small { display: block; margin-top: 13px; color: #77726c; font-size: 10px; line-height: 1.5; }
.remote-controller { width: 100%; }
.nes-controller-brand, .nes-controller-number { display: none; }
.remote-controller-top { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; color: #a9a49c; background: #242322; border: 1px solid #44413e; border-radius: 5px; font: 800 9px/1 var(--pixel); }
.remote-controller-top > div { display: flex; align-items: center; gap: 9px; }
.connection-light { width: 8px; height: 8px; border-radius: 50%; background: #65a852; box-shadow: 0 0 8px #65a852; }
.remote-controller-top > span { color: #77726c; }
.remote-pad-layout { position: relative; min-height: 330px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 4%; touch-action: none; }
.remote-pad-layout button { touch-action: none; color: #bbb6ae; background: #292827; border: 1px solid #4d4946; box-shadow: 0 4px 0 #080808; outline: none; }
.remote-dpad { --stick-x: 0px; --stick-y: 0px; width: 180px; height: 180px; display: grid; grid-template: repeat(3,1fr)/repeat(3,1fr); touch-action: none; }
.remote-dpad button { pointer-events: none; font-size: 15px; }
.remote-dpad button:nth-child(1) { grid-area: 1/2; }
.remote-dpad button:nth-child(2) { grid-area: 2/1; }
.remote-dpad i { grid-area: 2/2; position: relative; z-index: 2; background: #363432; border-radius: 6px; box-shadow: inset 0 2px 0 #504d49; transform: translate(var(--stick-x), var(--stick-y)); }
.remote-dpad button:nth-child(4) { grid-area: 2/3; }
.remote-dpad button:nth-child(5) { grid-area: 3/2; }
.remote-dpad button.pressed { color: white; background: #403d3a; box-shadow: 0 1px 0 #080808; transform: translateY(3px); }
.remote-middle { display: flex; gap: 10px; align-self: flex-end; margin-bottom: 52px; transform: rotate(-8deg); }
.remote-middle button { min-width: 65px; min-height: 37px; border-radius: 20px; font: 800 8px/1 var(--pixel); }
.remote-middle button.pressed { transform: translateY(3px); box-shadow: 0 1px 0 #080808; }
.remote-ab { display: flex; gap: 14px; transform: rotate(-12deg); }
.remote-ab button { width: 76px; height: 76px; border-radius: 50%; color: white; background: var(--red); border-color: #ef555b; font: 900 22px/1 var(--pixel); }
.remote-ab button.pressed { transform: translateY(4px); background: #9e171c; box-shadow: 0 0 0 #080808; }
.remote-controller > p { margin: 0; color: #66625d; text-align: center; font: 8px/1.5 var(--pixel); }

@media (max-width: 650px) {
  .controller-header { min-height: 70px; }
  .controller-main { min-height: calc(100dvh - 70px); }
  .controller-connect { padding: 22px 18px; }
  .remote-pad-layout { min-height: 390px; padding-inline: 6px; }
  .remote-dpad { width: 132px; height: 132px; }
  .remote-middle { position: absolute; left: 50%; bottom: 58px; gap: 7px; margin: 0; transform: translateX(-50%) rotate(-8deg); }
  .remote-middle button { min-width: 49px; padding-inline: 6px; }
  .remote-ab { gap: 8px; }
  .remote-ab button { width: 57px; height: 57px; }
}

.controller-page.controller-landscape { background: radial-gradient(circle at center,#2c2b29 0,#111 72%); }
.controller-landscape .controller-header { display: none; }
.controller-landscape .controller-main { width: 100%; min-height: 100vh; min-height: var(--controller-vh,100dvh); }
.controller-landscape .remote-controller { height: 100vh; height: var(--controller-vh,100dvh); display: grid; place-items: center; }
.controller-landscape .remote-controller-top { position: fixed; top: max(14px,env(safe-area-inset-top)); left: 50%; width: min(300px,38vw); min-height: 27px; padding: 0 10px; transform: translateX(-50%); z-index: 5; color: #33312f; background: #bcbab4; border: 1px solid #8c8983; border-radius: 4px; box-shadow: inset 0 1px 0 #e1dfda; font-size: 7px; }
.controller-landscape .remote-controller-top > span { color: #56534f; }
.controller-landscape .connection-light { width: 6px; height: 6px; }
.controller-landscape .remote-pad-layout { width: min(calc(var(--controller-landscape-width,100vw) - 24px),900px); height: min(calc(var(--controller-vh,100dvh) - 18px),390px); min-height: 0; margin: auto; padding: 63px max(5%,env(safe-area-inset-right)) 30px max(5%,env(safe-area-inset-left)); overflow: hidden; color: #252422; background: linear-gradient(160deg,#d8d7d2 0,#aaa9a4 76%,#92918d 100%); border: 5px solid #73726e; border-radius: 18px; box-shadow: inset 0 3px 0 #f4f2ed, inset 0 -7px 0 #85847f, 0 12px 24px rgba(0,0,0,.55); }
.controller-landscape .remote-pad-layout::before { content: ""; position: absolute; inset: 57px 25px 27px; background: linear-gradient(#242424,#171717); border: 3px solid #696762; border-radius: 7px; box-shadow: inset 0 0 0 2px #080808; }
.controller-landscape .remote-pad-layout::after { content: "SELECT     START"; position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); color: #b8b6b0; font: 700 6px/1 var(--pixel); letter-spacing: .8px; white-space: pre; }
.controller-landscape .remote-pad-layout > * { position: relative; z-index: 2; }
.controller-landscape .nes-controller-brand { position: absolute; top: 17px; left: 30px; display: flex; align-items: baseline; gap: 8px; }
.controller-landscape .nes-controller-brand strong { color: #b01820; font: italic 900 15px/1 var(--sans); letter-spacing: -1px; }
.controller-landscape .nes-controller-brand span { color: #42413e; font: 800 6px/1 var(--pixel); letter-spacing: 1px; }
.controller-landscape .nes-controller-number { position: absolute; top: 21px; right: 31px; display: block; color: #55534f; font: 800 7px/1 var(--pixel); letter-spacing: 1px; }
.controller-landscape .remote-dpad { width: var(--controller-dpad-size,min(43vh,166px)); height: var(--controller-dpad-size,min(43vh,166px)); }
.controller-landscape .remote-dpad button { color: #77746f; background: linear-gradient(#242424,#101010); border-color: #090909; box-shadow: 0 5px 0 #050505, inset 0 1px 0 #444; }
.controller-landscape .remote-dpad i { background: #171717; border-radius: 2px; box-shadow: inset 0 1px 0 #3e3e3e; }
.controller-landscape .remote-dpad button.pressed { color: #bbb8b2; background: #090909; box-shadow: 0 1px 0 #050505; }
.controller-landscape .remote-middle { position: absolute; left: 50%; bottom: 49px; gap: 11px; margin: 0; transform: translateX(-50%); }
.controller-landscape .remote-middle button { min-width: min(11vw,72px); min-height: 31px; padding: 0 10px; color: #d2d0ca; background: linear-gradient(#5e5b58,#383634); border: 3px solid #a9a7a1; border-radius: 16px; box-shadow: 0 3px 0 #080808, inset 0 1px 0 #817d79; font-size: 0; }
.controller-landscape .remote-middle button.pressed { box-shadow: 0 1px 0 #080808; }
.controller-landscape .remote-ab { gap: min(2.2vw,16px); padding: 10px 12px; background: #aaa8a2; border: 2px solid #d3d1ca; border-radius: 8px; box-shadow: 0 5px 0 #050505, inset 0 -3px 0 #7e7c77; transform: rotate(-8deg); }
.controller-landscape .remote-ab button { width: var(--controller-action-size,min(19vh,73px)); height: var(--controller-action-size,min(19vh,73px)); color: #f2e7e0; background: radial-gradient(circle at 35% 30%,#e1434a,#a81017 72%); border: 2px solid #760b10; box-shadow: 0 5px 0 #51070a, inset 0 2px 1px rgba(255,255,255,.25); }
.controller-landscape .remote-ab button.pressed { background: #8d0d13; box-shadow: 0 1px 0 #51070a; }
.controller-landscape .remote-controller > p { display: none; }
.controller-page.controller-forced-landscape { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.controller-forced-landscape .controller-main { position: fixed; top: 50%; left: 50%; width: var(--controller-landscape-width); height: var(--controller-vh); min-height: 0; margin: 0; transform: translate(-50%,-50%) rotate(var(--controller-force-rotation,90deg)); transform-origin: center; }
.controller-forced-landscape .remote-controller { width: 100%; height: 100%; }
.controller-forced-landscape .remote-controller-top { position: absolute; }
