: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; }
.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; }
.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; }
.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; }
.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; }
.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 { max-width: 830px; 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: 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); }
.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; }
.mobile-pad { display: none; }
.leaderboard-section { max-width: 960px; margin: 76px auto 0; }
.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 .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 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 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; }
}

@media (max-width: 650px) {
  .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; }
  .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 { padding: 8px; border-width: 3px; }
  .control-strip { min-height: 86px; padding-inline: 10px; }
  .control-buttons button { min-width: 42px; font-size: 0; padding: 9px; }
  .control-buttons button span { font-size: 15px; margin: 0; }
  .score-display strong { font-size: 18px; }
  .key-guide { display: none; }
  .gamepad-strip { margin: 0 -8px; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .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: calc(100% - 26px); margin: 24px auto 0; display: flex; align-items: center; justify-content: space-between; min-height: 128px; }
  .mobile-pad button { color: #aaa; background: #292929; border: 1px solid #454545; box-shadow: 0 3px 0 #090909; }
  .dpad { width: 114px; height: 114px; display: grid; grid-template: repeat(3,1fr)/repeat(3,1fr); }
  .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; background: #292929; }
  .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 { padding: 8px 7px; border-radius: 12px; font: 700 7px/1 var(--pixel); }
  .ab-pad { display: flex; gap: 9px; transform: rotate(-12deg); }
  .ab-pad button { width: 46px; height: 46px; border-radius: 50%; color: white; background: var(--red); border-color: #ed565b; font: 900 16px/1 var(--pixel); }
  .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 (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation-duration: .01ms !important; } }
