/* A trial owns the viewport. The existing menu/theme remain intact outside it. */
.immersive-toolbar[hidden] { display: none !important; }
.immersive-toolbar { display: none; }
.loadout-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0; }
.loadout-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid #d9c88744; border-radius: 5px; color: #f3ddb0; font-size: 11px; background: #102e3d80; }
.loadout-chip img { object-fit: contain; flex: none; }
.snapshot-note { font-size: 10px !important; color: #abcfc0; line-height: 1.5; }

body.trial-immersive { width: 100%; height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; background: #07131d; }
body.trial-immersive > .topbar,
body.trial-immersive .rune-rail,
body.trial-immersive footer,
body.trial-immersive .cosmic-dust,
body.trial-immersive #rewardToast,
body.trial-immersive #library,
body.trial-immersive #store,
body.trial-immersive .player-heading,
body.trial-immersive .how-to { display: none !important; }
body.trial-immersive .arcade-layout { display: block; width: 100%; height: 100%; padding: 0; margin: 0; gap: 0; }
body.trial-immersive #player { position: fixed; inset: 0; z-index: 100; display: block; min-width: 0; max-width: none; width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
body.trial-immersive .player-frame,
.player-frame.immersive-frame:fullscreen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "hud toolbar" "game game" "touch touch";
  width: 100%; max-width: none; height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  margin: 0; border: 0; border-radius: 0; box-shadow: none; background: #07131d;
  min-height: 0; overflow: hidden; isolation: isolate;
}
body.trial-immersive .hud {
  grid-area: hud; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start;
  min-width: 0; min-height: 44px; max-height: 48px; gap: 16px; padding: 5px 10px;
  border: 0; border-bottom: 1px solid #b8b99130; overflow-x: auto; overflow-y: hidden;
  background: #132a35; scrollbar-width: thin; scrollbar-color: #76988d #132a35;
}
body.trial-immersive .hud-item { flex: none; min-width: 0; white-space: nowrap; text-align: left; }
body.trial-immersive .hud-item small { display: block; font-size: 8px; line-height: 1.3; letter-spacing: .7px; color: #b4cec0; }
body.trial-immersive .hud-item b { display: block; font-size: 12px; line-height: 1.35; color: #f1d595; font-weight: 600; }
body.trial-immersive .immersive-toolbar {
  grid-area: toolbar; display: flex; align-items: center; gap: 4px; min-height: 44px;
  padding: 3px 7px; background: #132a35; border-bottom: 1px solid #b8b99130; z-index: 4;
}
body.trial-immersive .immersive-toolbar button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px;
  padding: 7px 10px; border: 1px solid #a7ba913e; border-radius: 5px;
  color: #f8e4b8; background: #284955; font-size: 12px; white-space: nowrap;
  touch-action: manipulation;
}
body.trial-immersive .immersive-toolbar button:first-child { background: #4b3d32; }
body.trial-immersive .immersive-toolbar button:disabled { opacity: .45; cursor: default; }
body.trial-immersive .immersive-toolbar button:focus-visible { outline: 2px solid #f4cd7e; outline-offset: -3px; }
body.trial-immersive .canvas-wrap {
  grid-area: game; display: flex; align-items: center; justify-content: center;
  position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0;
  max-height: none; aspect-ratio: auto; overflow: hidden; background: #07131d;
}
body.trial-immersive #gameCanvas {
  display: block; width: 100%; height: 100%; max-width: none; max-height: none;
  object-fit: contain; touch-action: none; outline-offset: -2px;
}
body.trial-immersive .game-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px; background: #04121a8c; overflow: hidden; }
body.trial-immersive .overlay-panel { width: min(640px, 100%); max-width: 640px; max-height: calc(100% - 2px); overflow-y: auto; overscroll-behavior: contain; padding: 22px 25px; border-radius: 12px; }
body.trial-immersive .overlay-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
body.trial-immersive .touch-controls { grid-area: touch; min-height: 0; gap: 8px; padding: 7px 10px; border: 0; border-top: 1px solid #b8b99130; background: #173440; }
body.trial-immersive .touch-group { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
body.trial-immersive .touch-controls button { min-width: 42px; min-height: 44px; padding: 0 10px; font-size: 12px; border-radius: 5px; color: #ffe3ac; background: #315561; }
body.trial-immersive .player-bottom { display: none; }

@media (pointer: coarse), (hover: none) {
  body.trial-immersive .touch-controls:not([hidden]) { display: flex; justify-content: space-between; align-items: center; }
}
@media (max-width: 600px) and (orientation: portrait) {
  body.trial-immersive .player-frame.immersive-frame,
  body.trial-immersive .player-frame.immersive-frame:fullscreen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "toolbar" "hud" "game" "touch"; }
  body.trial-immersive .immersive-toolbar { justify-content: flex-end; min-height: 42px; }
  body.trial-immersive .hud { min-height: 33px; max-height: 36px; gap: 14px; padding: 3px 9px; }
  body.trial-immersive .hud-item small { font-size: 7px; }
  body.trial-immersive .hud-item b { font-size: 11px; }
  body.trial-immersive .overlay-panel { padding: 16px 14px; }
  body.trial-immersive .overlay-panel h2 { font-size: 23px; }
  body.trial-immersive .touch-controls { padding: 7px 6px; gap: 5px; }
  body.trial-immersive .touch-group { gap: 3px; }
  body.trial-immersive .touch-controls button { padding: 0 7px; min-width: 38px; font-size: 11px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  body.trial-immersive .hud, body.trial-immersive .immersive-toolbar { min-height: 38px; max-height: 41px; }
  body.trial-immersive .immersive-toolbar button { min-height: 32px; padding-block: 5px; font-size: 11px; }
  body.trial-immersive .touch-controls { padding: 3px 8px; }
  body.trial-immersive .touch-controls button { min-height: 40px; }
  body.trial-immersive .overlay-panel { padding: 14px 18px; }
  body.trial-immersive .overlay-panel h2 { font-size: 22px; margin-bottom: 9px; }
  body.trial-immersive .overlay-panel p { margin-bottom: 8px; }
}
