/* Keep the existing portal toolbar; isolate the source game's viewport below. */
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.toolbar {
  position: relative; z-index: 2; flex: 0 0 auto; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  min-height: 52px; border-bottom: 1px solid #302c30; background: #111013;
  color: #eae7e5; font: 16px/normal "Segoe UI", sans-serif;
}
.toolbar h1 { margin: 0; min-width: 0; font-size: 13px; font-weight: 600; letter-spacing: .025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar .short-title { display: none; }
.toolbar .guide-home { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.toolbar .guide-home:hover { color: #ffcb05; }
.toolbar nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.toolbar button, .toolbar nav a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 5px; color: #d9d5d6; background: transparent; font: inherit; font-size: 12px; text-decoration: none; text-shadow: none; box-shadow: none; cursor: pointer; }
.toolbar button:hover, .toolbar nav a:hover { background: #292328; color: #fff; }
.toolbar nav .touch-controls-help { display: none; }
@media (pointer: coarse) {
  .toolbar nav .keyboard-controls-help { display: none; }
  .toolbar nav .touch-controls-help { display: inline-flex; }
}
.toolbar :focus-visible { outline: 2px solid #e49b80; outline-offset: -3px; }
#player-stage { flex: 1 1 0; min-height: 0; width: 100%; position: relative; }
#game-root { position: relative; width: 100%; height: 100%; overflow: hidden; contain: layout paint; isolation: isolate; container: game-view / size; }
#game-root #game { width: 100%; height: 100%; }
.skip { position: fixed; top: -60px; left: 12px; z-index: 4; padding: 12px; background: #fff; color: #111; font: 16px "Segoe UI", sans-serif; }
.skip:focus { top: 4px; }
#notice { position: fixed; z-index: 3; bottom: max(16px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid #65535a; border-radius: 8px; background: #211b20; color: #f5e9ed; font: 13px/1.5 "Segoe UI", sans-serif; box-shadow: 0 4px 20px #0005; pointer-events: none; }
#game-root .sync.error { background: #ff5f6d; }
[hidden] { display: none !important; }
@media (max-width: 640px) {
  .toolbar { min-height: 48px; gap: 6px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
  .toolbar .full-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .toolbar .short-title { display: inline; letter-spacing: .08em; color: #e5b19b; }
  .toolbar button, .toolbar nav a { padding: 0 8px; }
}

/* Optional quiz shortcut and native buttons keep the existing starter grid. */
#scr-test .test-shortcut { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
#scr-test .test-shortcut .note { flex: 1 1 180px; margin: 0; }
#starter-grid > button.cell { appearance: none; min-width: 0; color: inherit; font: inherit; text-shadow: inherit; }
#starter-grid > button.cell:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
