:root{color-scheme:dark;font-family:Tahoma,Verdana,sans-serif;font-size:16px;line-height:1.5;color:#e2e5e7;background:#15181c;--line:#46515b;--muted:#aab5be;--accent:#e8ba6b}
*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}a{color:#b8d2e8}button,.button{display:inline-block;background:#35414d;color:#e8edf2;border:1px solid;border-color:#6b7c8c #202830 #202830 #6b7c8c;border-radius:2px;padding:8px 13px;box-shadow:inset 0 0 0 1px #ffffff08;cursor:pointer;text-decoration:none;font-size:14px}button:hover,.button:hover{background:#435465}button:active,.button:active{border-color:#1b242d #6b7c8c #6b7c8c #1b242d;box-shadow:inset 1px 1px 2px #0005}button:disabled{opacity:.5;cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
header{display:flex;align-items:center;justify-content:space-between;gap:20px;background:#252c34;border-top:3px solid #9eb2c3;border-bottom:1px solid #080c10;box-shadow:0 2px 0 #46505b;padding:15px max(24px,calc((100vw - 1440px)/2))}header a.brand{font-family:Consolas,'Courier New',monospace;font-size:27px;font-weight:bold;letter-spacing:-1px;text-decoration:none;color:var(--accent);text-shadow:2px 2px #10151b}header nav{display:flex;gap:16px;align-items:center;font-size:14px}header nav>a{padding:6px 9px;border:1px solid #4a5865;background:#1b222a;text-decoration:none}
main{max-width:1440px;margin:auto;padding:26px 24px;display:grid;grid-template-columns:310px minmax(0,1fr);gap:24px}main>section{min-width:0}aside{background:#20262d;border:1px solid #52606d;box-shadow:inset 1px 1px #7c89952b,2px 3px 0 #0c1014;align-self:start}aside .filters{padding:16px;border-bottom:1px solid #10161c;background:#2a323b}label{display:block;margin-bottom:6px;font-size:14px;color:#cad3db}input[type=search],select{width:100%;min-width:0;padding:9px;background:#141b22;color:#e5e9ec;border:1px solid;border-color:#10151a #53606b #53606b #10151a;border-radius:1px;margin-bottom:10px;font-size:14px}input::placeholder{color:#8999a8}#original{width:100%;text-align:left;margin-bottom:16px;color:#f0d19e;background:#3b4249;border-left:3px solid #c89c57}.list-header{display:flex;justify-content:space-between;gap:8px;font-size:12px;letter-spacing:.3px;color:#b4c3d0;padding:9px 15px;background:#344556;border-top:1px solid #536777}.games{height:min(565px,calc(100dvh - 345px));min-height:240px;overflow:auto;border-top:1px solid #111a22;scrollbar-color:#596a79 #192129;scrollbar-width:thin}.game{display:flex;gap:12px;justify-content:space-between;padding:9px 15px;text-decoration:none;border-bottom:1px solid #303943;color:#d3dce4;font-size:14px}.game:nth-child(even){background:#242d36}.game span{overflow-wrap:anywhere}.game small{font-size:12px;color:#93a8bb;flex-shrink:0;margin-top:1px}.game:hover{background:#344659}.game.selected{background:#40536a;color:#fff0d2;box-shadow:inset 3px 0 var(--accent)}.game.selected small{color:#d0dbe4}
h1{font-size:25px;line-height:1.25;margin:0 0 7px;color:#f0e5cf;font-weight:600}h2{font-size:18px;margin:0 0 10px}p{margin:8px 0 16px}#game-meta{color:var(--muted);font-size:12px}.actions{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}.primary{background:#ae8750;color:#14191e;border-color:#eccf9d #664c2e #664c2e #eccf9d;min-width:140px;font-weight:bold}.primary:hover{background:#cba369}#player{background:#29333e;border:1px solid;border-color:#71808d #080d12 #080d12 #71808d;box-shadow:inset 0 0 0 1px #465461,3px 4px 0 #0c1014;margin-top:17px;color:#d9e2eb;padding:5px}.player-head{padding:4px 8px 9px;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:12px;letter-spacing:.3px;color:#bccbd7}.player-head button{padding:4px 10px;font-size:12px}#screen{aspect-ratio:4/3;max-height:660px;background:#080b0e;border:2px solid;border-color:#0c1218 #475361 #475361 #0c1218;display:grid;place-items:center}#screen iframe{display:block;width:100%;height:100%;border:0}#screen .idle{text-align:center;padding:28px;color:#8c9aa7;max-width:380px;font-size:14px}#screen .idle strong{display:block;color:#bdcbd8;font-family:Consolas,'Courier New',monospace;font-size:18px;font-weight:normal;margin-bottom:8px}#player:fullscreen{display:flex;flex-direction:column;width:100vw;height:100vh;margin:0}#player:fullscreen #screen{flex:1;aspect-ratio:auto;max-height:none}#player:fullscreen iframe{height:100%}#keys{padding:9px 7px 4px;display:flex;gap:5px;flex-wrap:wrap}#keys button{padding:5px 10px;min-width:35px}#status{min-height:24px;margin:11px 0;color:#b9c8d4;font-size:14px;overflow-wrap:anywhere}#status:empty{display:none}#save-status,#cache-status{font-size:14px;color:var(--muted)}
dialog{color:#e2e5e7;background:#252f39;max-width:540px;width:calc(100vw - 32px);border:1px solid #738291;box-shadow:5px 6px 0 #080d12;padding:22px}dialog::backdrop{background:#070b11b8}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:15px}.dialog-heading h2{margin:0;color:#efd1a0}.dialog-heading button{font-size:22px;line-height:1;padding:4px 9px}#saves-dialog .button{margin:0}#import-error{color:#ffb2a6}#empty{padding:16px;color:var(--muted);font-size:14px}[hidden]{display:none!important}
@media(min-width:1200px){#screen{aspect-ratio:16/10}}@media(max-width:820px){main{grid-template-columns:1fr;padding:16px;gap:22px}header{padding:12px 16px}header nav{gap:10px}.games{height:210px;min-height:0}aside .filters{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}#original{grid-column:1/-1;margin-bottom:10px}#search-label{grid-column:1/-1}#filter-label{display:none}input[type=search],select{margin-bottom:0}h1{font-size:23px}#screen{aspect-ratio:4/3}#player{margin-top:12px}}@media(max-width:380px){header a.brand{font-size:23px}header nav{gap:7px}header nav button{padding:7px 9px}main{padding:12px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

header #export{font-size:20px;line-height:1.1;padding:6px 10px;min-width:42px}header #load{min-width:64px}
header #load{font-size:20px;line-height:1.1;padding:6px 10px;min-width:42px}

.game-heading{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:7px}.game-heading h1{margin:0;overflow-wrap:anywhere}.title-controls{display:flex;gap:7px;flex-shrink:0}.icon-button{width:38px;height:34px;min-width:0;display:inline-flex;align-items:center;justify-content:center;padding:0;font-size:21px;line-height:1}.primary.icon-button{min-width:38px;font-size:17px}#favorite[aria-pressed=true]{color:var(--accent)}.player-head #full{padding:0;width:32px;height:28px}#screen:fullscreen{width:100vw;height:100vh;max-height:none;aspect-ratio:auto;border:0;background:#000}#screen:fullscreen iframe{width:100%;height:100%}

header{display:block;padding:0}.header-inner{max-width:1440px;margin:auto;padding:15px 24px;display:flex;align-items:center;justify-content:space-between;gap:20px}.game-heading #status{margin:0;font-size:13px;line-height:1.4;min-height:0;flex:1;min-width:160px;color:#aab9c5}.game-heading #status:empty{display:none}
@media(min-width:821px){main{align-items:stretch}aside{align-self:stretch;display:flex;flex-direction:column}.games{height:0;min-height:0;flex:1}}
@media(max-width:820px){.header-inner{padding:12px 16px}.game-heading #status{font-size:12px;min-width:130px}}@media(max-width:380px){.header-inner{padding:12px}.header-inner{gap:12px}}
@media(min-width:821px){aside{contain:size;min-height:0;overflow:hidden}.games{flex:1 1 0px;height:0;min-height:0;overflow-y:auto}}

.game-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start}.heading-main{display:flex;align-items:center;flex-wrap:wrap;gap:10px 14px;min-width:0;min-height:34px}#return-game{grid-column:2;justify-self:end;white-space:nowrap;min-height:34px;padding:6px 10px;font-size:13px}
/* Touch controls share the fullscreen surface with the game. */
#game-stage{position:relative}#touch-controls{display:none}#exit-full{display:none;position:absolute;right:max(8px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));z-index:3;width:40px;height:40px;padding:0;font-size:20px;background:#252f39dd}
#game-stage:fullscreen,#game-stage.expanded{width:100vw;height:100dvh;max-height:none;margin:0;padding:8px;background:#080b0e;display:flex;flex-direction:column;gap:8px;overflow:hidden;box-sizing:border-box}
#game-stage.expanded{position:fixed;inset:0;z-index:1000}.game-expanded{overflow:hidden}#game-stage:fullscreen #screen,#game-stage.expanded #screen{flex:1;min-height:0;max-height:none;aspect-ratio:auto;width:100%;border:0}#game-stage:fullscreen #keys,#game-stage.expanded #keys{display:none}#game-stage:fullscreen #exit-full,#game-stage.expanded #exit-full{display:block}
@media(any-pointer:coarse),(max-width:1100px){
 #keys{display:none!important}#touch-controls{display:grid;grid-template-columns:auto minmax(50px,1fr) auto;gap:8px;align-items:center;padding:14px 8px max(12px,env(safe-area-inset-bottom));user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:none}
 #touch-controls button{touch-action:none;user-select:none;-webkit-user-select:none;min-width:44px;min-height:44px;padding:6px;font-size:15px;font-weight:bold;border-radius:8px}#touch-controls button.pressed{background:#b18d56;color:#111;border-color:#72501e #e7c187 #e7c187 #72501e}
 #touch-dpad{display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);touch-action:none;gap:1px;background:#151d25;border-radius:14px;overflow:hidden}#touch-dpad button{font-size:23px;border-radius:4px}#touch-dpad [data-direction="38"]{grid-area:1/2}#touch-dpad [data-direction="37"]{grid-area:2/1}#touch-dpad span{grid-area:2/2;background:#35414d}#touch-dpad [data-direction="39"]{grid-area:2/3}#touch-dpad [data-direction="40"]{grid-area:3/2}
 #touch-actions{display:grid;grid-template-columns:repeat(2,48px);gap:8px;justify-content:end}#touch-actions button{min-height:48px;border-radius:50%;color:#f0d19e}#game-stage[data-group=sega] #touch-actions button:first-child{grid-row:2}#game-stage[data-group=sega] #touch-actions button:nth-child(2){grid-column:2;grid-row:1}#game-stage[data-group=sega] #touch-actions button:nth-child(3){grid-column:2;grid-row:2}
 #touch-menu{display:flex;flex-direction:column;gap:8px;align-items:center}#touch-menu button{font-size:12px;min-width:50px;max-width:68px}
 #game-stage:fullscreen,#game-stage.expanded{padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}#game-stage:fullscreen #touch-controls,#game-stage.expanded #touch-controls{flex-shrink:0;padding-bottom:0}
}
@media(any-pointer:coarse) and (orientation:landscape),(max-width:1100px) and (orientation:landscape){
 #game-stage:fullscreen,#game-stage.expanded{display:grid;grid-template-columns:134px minmax(0,1fr) 112px;grid-template-rows:minmax(0,1fr) 44px;gap:6px 10px}
 #game-stage:fullscreen #screen,#game-stage.expanded #screen{grid-area:1/2/3/3;height:100%}
 #game-stage:fullscreen #touch-controls,#game-stage.expanded #touch-controls{display:contents}
 #game-stage:fullscreen #touch-dpad,#game-stage.expanded #touch-dpad{grid-area:1/1;align-self:center}
 #game-stage:fullscreen #touch-actions,#game-stage.expanded #touch-actions{grid-area:1/3;align-self:center}
 #game-stage:fullscreen #touch-menu,#game-stage.expanded #touch-menu{grid-area:2/1;flex-direction:row;justify-content:center;gap:5px}
}
@media(max-width:360px){#touch-controls{padding-left:0;padding-right:0;gap:4px}#touch-dpad{grid-template-columns:repeat(3,40px);grid-template-rows:repeat(3,40px)}#touch-dpad button{min-width:40px;min-height:40px}#touch-actions{grid-template-columns:repeat(2,44px);gap:4px}}
