.playing { background: #eef1f5; }
.playing .site-header { display: none; }
.game-view { position: fixed; inset: 0; z-index: 50; width: 100%; max-width: none; height: 100dvh; padding: 0; display: flex; flex-direction: column; background: #eef1f5; }
.game-topbar { position: relative; z-index: 20; flex: none; min-height: 62px; padding: 8px 18px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .97); box-shadow: 0 1px 3px rgba(16, 24, 40, .04); }
.brand.mini { padding: 0; border: 0; background: transparent; cursor: pointer; }
.brand.mini .coin { width: 32px; height: 32px; }
#game-peer-label { color: var(--ink-soft); font-size: 12px; font-weight: 720; }
#game-peer-label:focus { outline: none; }
.quality-pill { position: absolute; left: 50%; transform: translateX(-50%); min-height: 36px; padding: 7px 12px; border: 1px solid #b9dec7; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 750; cursor: pointer; }
.quality-pill:hover { border-color: #7fbd97; }
.game-tools { margin-left: auto; display: flex; gap: 7px; }
.game-tools button { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--ink-soft); cursor: pointer; font-size: 16px; }
.game-tools button:hover { border-color: #b5bdc9; background: #f8f9fb; }
.emulator-frame { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 18px; background: #eef1f5; }
#emulator-player, .emulator-frame video { grid-area: 1 / 1; }
#emulator-player { width: 100%; height: 100%; display: grid; place-items: center; }
#emulator-player .ejs_canvas_parent { display: grid; place-items: center; }
.emulator-frame canvas, .emulator-frame video { width: min(100%, calc(133.333dvh - 130.667px)); height: min(100%, calc(75vw - 27px)); max-width: 100%; max-height: 100%; aspect-ratio: 4 / 3; image-rendering: auto; background: #000; box-shadow: 0 8px 28px rgba(16, 24, 40, .18); }
#game-placeholder { position: absolute; inset: 18px; z-index: 3; display: grid; place-content: center; gap: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--ink-soft); text-align: center; }
.connection-overlay { position: absolute; inset: 62px 0 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(238, 241, 245, .88); backdrop-filter: blur(5px); }
.modal-card { width: min(100%, 420px); padding: 32px; border: 1px solid #efc1c5; border-radius: 16px; background: #fff; text-align: center; box-shadow: var(--shadow); }
.signal-icon { width: 54px; height: 54px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--coral-soft); color: var(--coral); font-size: 26px; }
.modal-card h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.modal-card p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.sheet { position: absolute; z-index: 45; top: 74px; right: 14px; width: min(calc(100% - 28px), 370px); padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, .98); box-shadow: var(--shadow); }
.sheet h2 { margin: 0; font-size: 24px; }
.sheet .sheet-handle { display: none; }
.sheet-header { margin-bottom: 13px; }
.diagnostics dl { margin: 0; }
.diagnostics dl div { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border-soft); font-size: 11px; }
.diagnostics dt { color: var(--muted); }
.diagnostics dd { margin: 0; text-align: right; font-weight: 750; }
.diagnostics > p { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.game-menu-panel { display: grid; gap: 6px; }
.menu-row { width: 100%; min-height: 44px; padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border-soft); border-radius: 9px; background: #fff; text-align: left; }
.menu-row:hover { background: #f8f9fb; }
.menu-row b { color: var(--muted); }

@media (max-width: 680px) {
  .game-topbar { min-height: 56px; padding: 7px 9px; gap: 8px; }
  .brand.mini { display: none; }
  #game-peer-label { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .quality-pill { position: static; margin-left: auto; transform: none; min-width: 0; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .game-tools { margin-left: 0; }.game-tools button { width: 42px; }
  .emulator-frame { padding: 0; background: #000; }
  .emulator-frame canvas, .emulator-frame video { width: min(100vw, calc(133.333dvh - 74.667px)); height: min(calc(100dvh - 56px), 75vw); }
  #game-placeholder { inset: 0; border: 0; border-radius: 0; }
  .connection-overlay { inset: 56px 0 0; }
  .sheet { top: auto; right: 0; bottom: 0; left: 0; width: 100%; padding: 20px 18px max(22px, env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .sheet .sheet-handle { display: block; }
  .modal-card { padding: 27px 20px; }
}
