/* Arcade-only: a consistent window-sized play surface, without changing physics units. */
body.arcade-screen {
  display:block!important; padding:0!important; margin:0!important;
  width:100%;height:100dvh;min-height:0!important;overflow:hidden!important;
  background:#daf4f4!important;color:#193a50;
}
.arcade-screen .arcade-shell {display:flex;flex-direction:column;width:100%;height:100dvh;min-height:0}
.arcade-screen .arcade-topbar {
  display:flex;align-items:center;gap:12px;flex:0 0 auto;min-height:52px;
  padding:6px max(16px,env(safe-area-inset-right));background:#fff0b3;
  border-bottom:3px solid #efc65c;box-shadow:0 3px 0 #c4e1dd;
}
.arcade-screen .arcade-back {text-decoration:none;white-space:nowrap;color:#075f70;font-weight:900;padding:10px;border-radius:12px}
.arcade-screen .arcade-brand {flex:1;min-width:0}
.arcade-screen .arcade-brand :is(h1,.game-title) {
  font-size:clamp(17px,2.2vw,29px)!important;text-align:left!important;
  margin:0!important;padding:0!important;background:none!important;line-height:1.15;color:#193a50!important;
  -webkit-text-fill-color:#193a50!important;box-shadow:none!important;white-space:normal;
}
.arcade-screen .arcade-toolbar {display:flex;gap:8px}
.arcade-screen .arcade-toolbar button,.arcade-screen .arcade-controls-close {
  min-height:42px;border:2px solid #087e91;border-radius:12px;background:#087e91;color:#fff;
  padding:8px 13px;cursor:pointer;font:800 14px "Nunito",sans-serif;
}
.arcade-screen .arcade-toolbar button:first-child {background:#fff;color:#075f70}
.arcade-screen .arcade-hud {display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;flex:0 0 auto;padding:5px 10px;background:#c9f7fa;max-height:22dvh;overflow:auto}
.arcade-screen .arcade-original-hud {margin:0!important;padding:0!important;background:none!important;box-shadow:none!important;border:0!important;color:#193a50!important}
.arcade-screen .arcade-original-hud .stats {margin:0!important;gap:8px!important;flex-wrap:wrap;justify-content:center}
.arcade-screen .arcade-original-hud :is(.stat-box,.sb) {font-size:16px!important;line-height:1.35!important;padding:6px 10px!important;white-space:nowrap;background:#fff0b3!important;color:#17384f!important;border:1px solid #d7a92d;border-radius:8px}
.arcade-screen .arcade-original-hud :is(.stat-box,.sb) * {color:#17384f!important;-webkit-text-fill-color:#17384f!important;text-shadow:none!important}
.arcade-screen .arcade-hud :is(.stats,.game-stats,.header-stats,.stat-card,.progress-capsule,.score-bar) {color:#17384f!important}
.arcade-screen .arcade-hud :is(.stats,.game-stats,.header-stats,.stat-card,.progress-capsule,.score-bar) * {color:#17384f!important;-webkit-text-fill-color:#17384f!important;text-shadow:none!important}
.arcade-screen .arcade-actions {margin:0!important;gap:5px!important;display:flex!important;flex-wrap:wrap}
.arcade-screen .arcade-actions :is(button,a) {font-size:15px!important;padding:7px 11px!important;min-height:40px!important;max-height:none!important}
.arcade-screen #energy-container {position:static!important;display:flex;align-items:center;gap:10px;padding:5px 9px!important;box-shadow:none!important;border:1px solid #9bd8df!important;border-radius:12px!important;background:#fff!important;z-index:auto!important}
.arcade-screen #energy-bar-wrapper {margin:0!important;gap:6px!important}
.arcade-screen #energy-label {font-size:14px!important;min-width:0!important;color:#075f70!important}
.arcade-screen #energy-bar-bg {width:65px!important;height:12px!important}
.arcade-screen #energy-text {font-size:14px!important;color:#193a50!important}
.arcade-screen #energy-reward {display:none}
.arcade-screen #get-energy-btn {margin:0!important;padding:8px 12px!important;font-size:15px!important;min-height:42px}
.arcade-screen .arcade-stage {flex:1;min-height:0;min-width:0;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;background:radial-gradient(ellipse at top,#d3f3f2,#b7dedb)}
.arcade-screen .arcade-play-root:not(canvas) {display:flex!important;align-items:center;justify-content:center;position:relative!important;flex:1;width:100%!important;height:100%!important;max-width:none!important;min-height:0!important;margin:0!important;border-radius:0!important;gap:12px}
.arcade-screen .arcade-stage canvas:not(.arcade-3d-canvas):not(.arcade-simulation) {flex:none;display:block;object-fit:fill;border:0!important;border-radius:0!important;margin:0!important;box-shadow:none!important}
.arcade-screen .arcade-stage canvas.arcade-simulation {display:none!important}
.arcade-screen .arcade-stage canvas.arcade-3d-canvas {flex:none;display:block;object-fit:initial;border:0!important;border-radius:0!important;margin:0!important;box-shadow:none!important}
.arcade-screen :is(.start-overlay,#startOverlay) {width:100%!important;height:100%!important;inset:0!important;border-radius:0!important}
.arcade-screen #startScreen {width:100vw!important;height:100dvh!important;inset:0!important}
.arcade-screen .arcade-stage .start-title {font-size:clamp(22px,4vw,42px)!important;text-align:center;max-width:95%}
/* Dialogs own their foreground and surface colors. A global text color here
   made light text disappear on the dark Sanskrit practice card. */
.arcade-screen .arcade-board-content {overflow:auto;justify-content:flex-start;flex-direction:column;gap:10px;padding:clamp(12px,3vw,30px)}
.arcade-screen .arcade-board-content > * {flex-shrink:0;max-width:100%}
.arcade-screen .arcade-board-content .grid {width:min(900px,100%);max-width:none!important}
.arcade-screen .arcade-control-panel {
  position:fixed;bottom:max(16px,env(safe-area-inset-bottom));left:max(16px,env(safe-area-inset-left));
  width:325px;max-width:calc(100vw - 32px);max-height:65dvh;overflow:auto;padding:12px;
  border:2px solid #087e91;border-radius:22px;background:rgba(255,253,241,.97);
  box-shadow:0 8px 30px #193a5033;z-index:1100;color:#193a50;
}
.arcade-screen [hidden] {display:none!important}
.arcade-screen .arcade-control-heading {display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.arcade-screen .arcade-controls-close {font-size:22px;padding:0 10px;min-height:36px}
.arcade-screen .arcade-pad {display:flex;align-items:center;justify-content:center;gap:15px}
.arcade-screen .arcade-directions {display:grid;grid-template-columns:repeat(3,48px);grid-template-rows:repeat(2,48px);gap:5px}
.arcade-screen .arcade-directions button:nth-child(1) {grid-column:2}
.arcade-screen .arcade-directions button:nth-child(2) {grid-column:1;grid-row:2}
.arcade-screen .arcade-directions button:nth-child(3) {grid-column:2;grid-row:2}
.arcade-screen .arcade-directions button:nth-child(4) {grid-column:3;grid-row:2}
.arcade-screen .arcade-pad button {touch-action:none;user-select:none;min-height:48px;border:2px solid #7fc2cc;border-bottom-width:5px;border-radius:13px;background:#e1f7fb;color:#15475a;font-size:25px;font-weight:900;cursor:pointer}
.arcade-screen .arcade-pad button:active {background:#ffdd64;transform:translateY(2px)}
.arcade-screen .arcade-pad-actions {display:flex;flex-direction:column;gap:8px}
.arcade-screen .arcade-pad-actions button {background:#ffdd64;border-color:#dbac30;font-size:14px;min-width:72px;padding:9px}
.arcade-screen .arcade-help {font-size:12px;margin-top:10px;line-height:1.5}
.arcade-screen .arcade-help summary {cursor:pointer;padding:5px;color:#075f70;font-weight:900}
.arcade-screen .arcade-original-controls > * {font-size:12px!important;margin:8px 0!important;padding:4px!important;color:#193a50!important;max-width:100%;flex-wrap:wrap}
.arcade-screen .arcade-screen-notice {position:fixed;bottom:5px;right:10px;max-width:320px;font-size:12px;color:#193a50;background:#fff8dc;z-index:1200}
.arcade-screen .arcade-screen-notice:empty {display:none}
.arcade-screen :is(button,a):focus-visible {outline:3px solid #e66c38;outline-offset:3px}
@media(max-width:600px) {
  .arcade-screen .arcade-topbar {gap:5px;padding:5px 6px;min-height:48px}
  .arcade-screen .arcade-back {font-size:11px;padding:6px}
  .arcade-screen .arcade-toolbar {gap:4px}
  .arcade-screen .arcade-toolbar button {font-size:12px;padding:6px 8px;min-height:40px}
  .arcade-screen .arcade-toolbar {
    min-width:0;
    max-width:calc(100vw - 100px);
    flex:0 1 auto;
    flex-wrap:wrap;
    justify-content:flex-end;
  }
  .arcade-screen .arcade-hud {gap:5px;padding:4px;max-height:24dvh}
  .arcade-screen #energy-container {padding:3px 5px!important;gap:5px}
  .arcade-screen #energy-label span {display:inline}
  .arcade-screen .arcade-control-panel {bottom:10px;left:10px;width:290px;padding:9px}
}
@media(prefers-reduced-motion:reduce) {.arcade-screen * {scroll-behavior:auto!important}}
@media(pointer:coarse) and (orientation:portrait) {
  /* A phone's thumb pad gets its own space instead of covering the player. */
  .arcade-screen .arcade-shell:has(.arcade-control-panel:not([hidden])) .arcade-stage {margin-bottom:205px}
  .arcade-screen .arcade-control-panel {max-height:190px;width:calc(100vw - 20px)}
}
