:root{color-scheme:dark;--bg:#191919;--panel:#262626;--text:#f2f2f2;--muted:#b0b0b0;--accent:#75aaff}
    *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:16px/1.6 Arial,Helvetica,sans-serif}a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}button,input{font:inherit}button,a,input{touch-action:manipulation}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}[hidden]{display:none!important}img{max-width:100%;display:block}button{border:0;border-radius:3px}h1,h2,h3,p{margin-top:0}h1{font-size:26px;line-height:1.25;margin-bottom:6px}h2{font-size:21px;line-height:1.35;margin-bottom:14px}h3{font-size:17px;line-height:1.4}section,aside{scroll-margin-top:16px}.container{width:min(1440px,calc(100% - 40px));margin:auto}.skip{position:absolute;top:-80px;left:16px;padding:8px 14px;background:var(--accent);color:#101010;z-index:20}.skip:focus{top:8px}
    .site-header{background:#262626}.header-inner{min-height:62px;display:flex;align-items:center;gap:36px}.brand{font-size:20px;font-weight:bold;color:#fff;white-space:nowrap;line-height:1.25}.brand:hover{text-decoration:none}.header-nav{display:flex;gap:25px;margin-left:auto;white-space:nowrap}.header-nav a{font-size:15px;color:#e5e5e5}.search{position:relative;width:360px;max-width:100%;margin:0}.search input{width:100%;border:1px solid #454545;border-radius:3px;background:#191919;color:#fff;padding:8px 12px;line-height:1.4;font-size:15px}.search input::placeholder{color:#b0b0b0}.search-results{position:absolute;top:100%;left:0;right:0;z-index:10;background:#303030;margin-top:5px;padding:8px;box-shadow:0 6px 14px #0007;max-height:350px;overflow:auto}.search-results ul{list-style:none;padding:0;margin:0}.search-results a{display:block;padding:8px;color:#fff;font-size:15px}.search-results a:hover{background:#414141}.search-results p{font-size:14px;margin:8px;color:var(--muted)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
    .portal{display:grid;grid-template-columns:170px minmax(0,1fr) 170px;grid-template-areas:'popular game sidebar' 'related related related' 'article article article' 'catalog catalog catalog';gap:26px 20px;padding-top:22px;padding-bottom:40px;align-items:start}.main-game{grid-area:game;min-width:0}.game-heading{margin-bottom:16px}.game-heading p{font-size:14px;color:var(--muted);margin:0}.popular{grid-area:popular}.undertale-sidebar{grid-area:sidebar}.sidebar h2{font-size:16px;margin:0 0 13px;line-height:1.3}.side-grid{display:grid;gap:12px}.game-card{display:block;min-width:0;color:#eee;background:var(--panel);border-radius:3px;overflow:hidden;line-height:1.3}.game-card:hover{color:var(--accent);text-decoration:none;background:#303030}.game-card img{width:100%;aspect-ratio:16/9;object-fit:cover;background:#101010}.game-card span{display:block;font-size:14px;padding:8px 9px;overflow-wrap:anywhere}.game-card:focus-visible{outline-offset:3px}.player{background:#080808;overflow:hidden;border-radius:3px}.game-stage{position:relative;aspect-ratio:4/3;display:grid;place-items:center;background:#080808}.play-button{font-weight:bold;font-size:18px;background:var(--accent);color:#0c182b;min-height:52px;padding:13px 24px}.play-button:hover{background:#93bdff}.play-symbol{font-size:17px;margin-right:9px}.game-stage iframe{position:absolute;inset:0;width:100%;height:100%;border:0;background:#080808}.player-toolbar{background:var(--panel);padding:8px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px}.keyboard-note{font-size:13px;color:var(--muted)}.fullscreen-button{background:#3a3a3a;color:#fff;padding:6px 13px;font-size:14px;min-height:34px}.fullscreen-button:hover{background:#484848}.player-status{margin:0;padding:11px 14px;font-size:14px;background:#303030;color:#eee}.mobile-note{display:none;font-size:13px;color:var(--muted);margin:9px 0 0}.player:fullscreen{display:flex;flex-direction:column;justify-content:center;width:100vw;height:100vh;background:#000}.player:fullscreen .game-stage{flex:1;min-height:0;width:100%;aspect-ratio:auto}.player:fullscreen .player-toolbar{flex-shrink:0}.player:fullscreen .player-status{flex-shrink:0}
    .related{grid-area:related}.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin-bottom:13px}.section-head h2{margin:0}.section-head a{font-size:14px}.related-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:14px}.related-grid .game-card span{font-size:15px;padding:10px}.article{grid-area:article;width:100%;max-width:970px;justify-self:center;color:#d0d0d0}.article section{margin-bottom:30px}.article h2{color:#f2f2f2;font-size:23px;margin-bottom:12px}.article p{margin-bottom:14px}.article ul,.article ol{padding-left:23px;margin:0 0 14px}.article li{margin:5px 0}.article a{text-decoration:underline}.article table{border-collapse:collapse;width:100%;max-width:620px;font-size:15px;text-align:left}.article th,.article td{padding:10px 14px;border-bottom:1px solid #3a3a3a}.article th{background:#2b2b2b;color:#eee}.article td:first-child{width:35%;color:#eee}.mode-list strong{color:#eee}.faq details{border-bottom:1px solid #3b3b3b;padding:12px 0}.faq summary{cursor:pointer;color:#eee;font-weight:bold}.faq details p{margin:10px 0 2px}.catalog{grid-area:catalog}.catalog-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:16px 14px}.catalog-empty{color:var(--muted)}.footer{background:#232323;padding:22px 0;color:var(--muted);font-size:13px}.footer-inner{display:flex;align-items:center;justify-content:space-between;gap:25px}.footer p{margin:0;max-width:740px}.footer-links{display:flex;gap:24px;white-space:nowrap}.footer a{color:#d3d3d3}
    dialog{border:0;border-radius:4px;padding:0;background:#292929;color:#eee;width:min(420px,calc(100% - 32px));max-height:90vh;overflow:auto}dialog::backdrop{background:#000b}.dialog-top{display:flex;align-items:center;justify-content:space-between;padding:16px;gap:16px}.dialog-top h2{font-size:20px;margin:0}.dialog-close{font-size:24px;color:#ddd;background:transparent;min-width:38px;min-height:38px}.dialog-image{width:100%;aspect-ratio:16/9;object-fit:cover;background:#101010}.dialog-body{padding:18px}.dialog-body p{margin-bottom:16px;color:var(--muted)}.dialog-back{padding:9px 14px;background:var(--accent);color:#111;font-weight:bold}
    .game-card img,.dialog-image{height:auto}
    .game-stage{aspect-ratio:16/10}
    @media(min-width:1600px){.portal{grid-template-columns:180px minmax(0,1fr) 180px}}
    @media(max-width:1100px){.header-inner{gap:24px}.brand{font-size:18px}.search{width:310px}.portal{grid-template-columns:135px minmax(0,1fr) 135px;gap:22px 14px}.side-grid{gap:10px}.sidebar h2{font-size:15px}.game-card span{font-size:14px;padding:7px}.related-grid,.catalog-grid{gap:10px}.related-grid .game-card span{font-size:14px;padding:8px}.header-nav{gap:18px}}
    @media(max-width:800px){.container{width:calc(100% - 24px)}.header-inner{flex-wrap:wrap;gap:12px;padding-top:13px;padding-bottom:12px}.brand{font-size:18px}.header-nav{gap:16px}.header-nav a{font-size:14px}.search{order:3;width:100%}.search input{font-size:16px}.portal{grid-template-columns:minmax(0,1fr);grid-template-areas:'game' 'related' 'popular' 'article' 'catalog';gap:25px;padding-top:17px}.undertale-sidebar{display:none}.game-heading{margin-bottom:12px}h1{font-size:24px}.game-heading p{display:none}.game-stage{aspect-ratio:4/3}.play-button{font-size:16px;padding:12px 17px;min-height:48px}.keyboard-note{font-size:12px;max-width:210px;line-height:1.4}.player-toolbar{padding:8px 10px}.mobile-note{display:block}.related-grid,.catalog-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 10px}.side-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 10px}.game-card span,.related-grid .game-card span{font-size:14px;padding:8px}.sidebar h2{font-size:21px;margin-bottom:13px}.section-head h2{font-size:21px}.article h2{font-size:22px}.article section{margin-bottom:27px}.footer-inner{display:block}.footer-links{margin-top:14px;gap:20px}}
    @media(max-width:480px){.brand{font-size:17px}.header-nav{gap:13px}.header-nav a{font-size:13px}.related-grid,.catalog-grid,.side-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.play-symbol{margin-right:6px}.section-head{gap:10px}.section-head a{font-size:13px}.fullscreen-button{font-size:13px;padding:6px 10px}.article th,.article td{padding:10px}.footer-links{flex-wrap:wrap}}
    @media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
    /* Player controls: quiet, icon-only, with keyboard-accessible tooltips. */
    .play-button{display:grid;place-items:center;width:68px;height:68px;min-height:0;padding:0;border-radius:50%;background:#303030;color:#ededed}
    .play-button:hover{background:#424242}.play-button svg{width:26px;height:26px;margin-left:4px;fill:currentColor}
    .player-toolbar{position:relative;min-height:48px;padding:2px 8px;gap:8px}
    .keyboard-note{font-size:12px;line-height:1.35;color:#a0a0a0;max-width:300px}
    .player-actions{display:flex;gap:2px;margin-left:auto;flex-shrink:0}
    .icon-button{position:relative;display:grid;place-items:center;width:44px;height:44px;padding:0;background:transparent;color:#bdbdbd}
    .icon-button:hover,.icon-button:focus-visible{background:#333;color:#fff}
    .icon-button svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
    .button-tooltip{position:absolute;bottom:100%;right:0;display:none;white-space:nowrap;padding:5px 8px;background:#383838;color:#fff;border-radius:3px;font-size:12px;line-height:1.4;z-index:2;pointer-events:none}
    .icon-button:hover .button-tooltip,.icon-button:focus-visible .button-tooltip{display:block}
    .icon-button.tooltip-dismissed .button-tooltip{display:none}
    .player-notice{position:absolute;right:8px;bottom:calc(100% + 8px);max-width:calc(100% - 16px);padding:6px 10px;background:#333;color:#eee;border-radius:3px;font-size:13px;z-index:3;pointer-events:none}
    .thumbnail{position:relative;width:100%;aspect-ratio:16/9;overflow:hidden;background:#101010}
    .game-card .thumbnail img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
    .thumbnail-fallback{height:100%;display:grid;place-items:center;color:#aaa;font-size:13px}
    .game-card>span,.related-grid .game-card>span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;height:54px;font-size:14px;line-height:19px;padding:8px 9px}
    @media(max-width:480px){.play-button{width:60px;height:60px}.keyboard-note{font-size:12px;max-width:155px}}
    .brand{display:block;flex-shrink:0}.brand img{width:240px;height:80px;object-fit:contain}.header-inner{gap:24px}.header-nav{align-items:center}
    .theme-picker{position:relative}.theme-toggle{width:40px;height:40px;display:grid;place-items:center;background:transparent;color:var(--text)}
    .theme-toggle svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
    :root[data-theme="light"]{color-scheme:light;--bg:#f4f4f4;--panel:#fff;--text:#202020;--muted:#626262;--accent:#225eb6}
    [data-theme="light"] .site-header,[data-theme="light"] .footer{background:#e7e7e7}
    [data-theme="light"] .header-nav a,[data-theme="light"] .game-card,[data-theme="light"] .article h2,[data-theme="light"] .article td:first-child,[data-theme="light"] .mode-list strong,[data-theme="light"] .faq summary,[data-theme="light"] .footer a{color:var(--text)}
    [data-theme="light"] .search input{background:#fff;color:#202020;border-color:#b7b7b7}
    [data-theme="light"] .search input::placeholder{color:#666}
    [data-theme="light"] .search-results,[data-theme="light"] dialog{background:#fff;color:#202020}
    [data-theme="light"] .search-results a{color:#202020}
    [data-theme="light"] .search-results a:hover,[data-theme="light"] .game-card:hover{background:#e6e6e6}
    [data-theme="light"] .article{color:#3d3d3d}
    [data-theme="light"] .article th{background:#e5e5e5;color:#202020}
    [data-theme="light"] .article td,[data-theme="light"] .article th,[data-theme="light"] .faq details{border-color:#ccc}
    [data-theme="light"] .dialog-close{color:#444}
    [data-theme="light"] .dialog-back{color:#fff}
    [data-theme="light"] .icon-button{color:#555}
    [data-theme="light"] .icon-button:hover,[data-theme="light"] .icon-button:focus-visible{background:#e6e6e6;color:#111}
    [data-theme="light"] .keyboard-note{color:#666}
    @media(max-width:1100px){.brand img{width:210px;height:70px}.header-inner{gap:16px}}
    @media(max-width:800px){.header-inner{padding-top:4px;gap:4px 12px}.brand img{width:210px;height:70px}.search{margin-top:4px}.header-nav{gap:14px}}
    @media(max-width:520px){.header-inner{display:grid;grid-template-columns:minmax(0,1fr) auto}.brand img{width:195px;height:65px}.header-nav{display:contents}.header-nav>a{grid-row:2;font-size:14px;margin-bottom:5px}.header-nav>a:last-of-type{justify-self:end}.theme-picker{grid-column:2;grid-row:1;justify-self:end}.search{grid-column:1/-1;grid-row:3;width:100%}}
    /* Reusable fixed player viewport. The game is contained at its own ratio. */
    .game-stage{position:relative;aspect-ratio:16/10;overflow:hidden;isolation:isolate;background:#000}
    .game-poster{position:absolute;inset:0;display:grid;place-items:center;overflow:hidden;background:#000;z-index:2}
    .poster-background{position:absolute;inset:-18px;background-position:center;background-size:cover;filter:blur(14px);opacity:.55;transform:scale(1.08)}
    .game-poster:after{content:'';position:absolute;inset:0;background:#0008}
    .poster-image{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:1}
    .game-poster .play-button{position:relative;z-index:3;box-shadow:0 2px 8px #0008}
    .game-frame-shell{position:absolute;inset:0;margin:auto;background:#000;z-index:1}
    .game-frame-shell iframe{position:absolute;inset:0;width:100%;height:100%;border:0;background:#000}
    .game-stage:fullscreen{width:100vw;height:100vh;aspect-ratio:auto;background:#000}
    .game-stage.pseudo-fullscreen{position:fixed;top:var(--fullscreen-top,0px);left:var(--fullscreen-left,0px);width:var(--fullscreen-width,100vw);height:100vh;height:var(--fullscreen-height,100dvh);max-width:none;max-height:none;aspect-ratio:auto;background:#000;z-index:2147483647}
    .fullscreen-controls,.fullscreen-reveal-zone{display:none}
    .game-stage:fullscreen .fullscreen-reveal-zone,.game-stage.pseudo-fullscreen .fullscreen-reveal-zone{display:block;position:absolute;left:0;right:0;bottom:0;height:26px;z-index:9}
    .game-stage:fullscreen .fullscreen-controls,.game-stage.pseudo-fullscreen .fullscreen-controls{display:flex;position:absolute;left:0;right:0;bottom:0;z-index:10;align-items:flex-end;justify-content:flex-end;padding:20px 16px 8px;background:linear-gradient(transparent,#000c);opacity:0;transform:translateY(8px);pointer-events:none;transition:opacity .18s ease,transform .18s ease}
    .game-stage:fullscreen .fullscreen-controls *,.game-stage.pseudo-fullscreen .fullscreen-controls *{pointer-events:none}
    .game-stage:fullscreen.fs-controls-visible .fullscreen-controls,.game-stage.pseudo-fullscreen.fs-controls-visible .fullscreen-controls{opacity:1;transform:none;pointer-events:auto}
    .game-stage:fullscreen.fs-controls-visible .fullscreen-controls *,.game-stage.pseudo-fullscreen.fs-controls-visible .fullscreen-controls *{pointer-events:auto}
    .game-stage.pseudo-fullscreen .fullscreen-controls{padding-bottom:max(8px,env(safe-area-inset-bottom));padding-right:max(16px,env(safe-area-inset-right))}
    .game-stage.pseudo-fullscreen .fullscreen-reveal-zone{height:max(32px,env(safe-area-inset-bottom))}
    .fullscreen-actions{display:flex;align-items:center;gap:2px}
    .fullscreen-controls .icon-button{color:#ddd}
    .fullscreen-controls .icon-button:hover,.fullscreen-controls .icon-button:focus-visible{background:#ffffff1a;color:#fff}
    .fullscreen-controls .button-tooltip{bottom:calc(100% + 2px)}
    .fs-player-notice{position:absolute;right:16px;bottom:65px;padding:6px 10px;background:#222e;color:#fff;border-radius:3px;font-size:13px}
    @media(max-width:480px){.player-actions{gap:0}.icon-button{width:40px}.fullscreen-controls{padding-left:8px!important;padding-right:8px!important}}
    @media(max-width:800px){.game-stage{aspect-ratio:4/3}}

/* Phase Selector */
.phase-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  align-items: center;
}
.phase-selector button {
  flex: 1 1 0;
  min-width: 100px;
  min-height: 44px;
  background: var(--panel);
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 16px;
  transition: background-color 0.15s, border-color 0.15s;
}
.phase-selector button:hover {
  background: #3a3a3a;
  border-color: #666;
}
.phase-selector button.active {
  background: #e0e0e0;
  color: #111;
  border-color: #e0e0e0;
  font-weight: 700;
}
@media (max-width: 480px) {
  .phase-selector {
    gap: 8px;
    margin-bottom: 20px;
  }
  .phase-selector button {
    font-size: 14px;
    min-height: 40px;
    padding: 0 10px;
  }
}