:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05080d;
  color: #f3f8ff;
  --game-width: 512;
  --game-height: 358;
  --game-aspect: 512 / 358;
  --rsc-mobile-top-clearance: 28px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  scroll-behavior: auto;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 72% 46% at 50% -12%, rgba(39, 83, 110, .32), transparent 72%),
    linear-gradient(180deg, #101a23 0, #080d14 42%, #05080d 100%);
}

.app-shell {
  /* Classic mode keeps a centered 512x358 RSC surface. Expanded mode may
     grow with the window while preserving that same aspect ratio. */
  width: min(100%, calc(var(--game-width) * 1px + 32px));
  max-width: calc(100vw - 16px);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.desktop-masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0 3px 12px;
}

.view-mode-toggle {
  display: flex;
  align-items: stretch;
  width: fit-content;
  margin: 0 auto 10px;
  border: 1px solid rgba(164, 222, 243, .45);
  border-radius: 9px;
  overflow: hidden;
  background: rgba(5, 14, 20, .72);
}

.view-mode-button {
  margin: 0;
  padding: 5px 10px;
  border: 0;
  color: #c5d8e4;
  background: transparent;
  font: 700 .74rem/1.1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
}

.view-mode-button[aria-pressed="true"] {
  color: #071218;
  background: #8be0fb;
}

.view-mode-button:focus-visible { outline: 2px solid #a5e9ff; outline-offset: 2px; }

.brand {
  color: #c9efff;
  font-size: .91rem;
  font-weight: 760;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.brand-divider { width: 1px; height: 15px; background: #527083; }
.section-label { color: #b5c4d0; font-size: .82rem; }
.release-label { margin-left: auto; color: #7e93a4; font-size: .75rem; font-variant-numeric: tabular-nums; }

.game-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid rgba(122, 184, 214, .35);
  border-radius: 14px;
  background: #000;
  box-shadow: 0 24px 72px rgba(0, 0, 0, .42), 0 0 0 1px rgba(8, 14, 19, .6) inset;
  isolation: isolate;
}

/* The game is a direct-manipulation surface.  Do not let iOS turn a hold,
   drag, or image press into a browser selection/copy callout.  The hidden
   keyboard bridge below deliberately opts back in so typing and composition
   remain native. */
.app-shell,
.app-shell * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game-canvas {
  display: block;
  width: calc(var(--game-width) * 1px);
  height: calc(var(--game-height) * 1px);
  max-width: 100%;
  max-height: calc(100dvh - 88px);
  aspect-ratio: var(--game-aspect);
  /* Classic is 1:1 with the 512x358 software buffer (346 world + 12 chat tabs).
     Expanded letterboxes that same buffer. Never stretch X and Y independently. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  background: #000;
}

body[data-play-view="expanded"][data-mode="desktop"] .app-shell {
  width: min(100%, calc((100dvh - 88px) * var(--game-aspect) + 32px));
}

body[data-play-view="expanded"][data-mode="desktop"] #game-canvas {
  width: min(100%, calc((100dvh - 88px) * var(--game-aspect)));
  height: auto;
}

body[data-mode="mobile"] #game-canvas {
  /* Mobile may still use a density-scaled backing store from the presenter;
     keep the CSS default flexible when soft rendering is explicitly requested. */
  image-rendering: auto;
}

/* Keep the launcher selection visible, then remove the browser focus ring as
   soon as the canvas becomes the active gameplay surface. */
#game-canvas:focus {
  outline: 2px solid rgba(255, 255, 255, .95);
  outline-offset: -2px;
}

.app-shell[data-gameplay="1"] #game-canvas:focus {
  outline: none;
}

.keyboard-proxy {
  position: fixed;
  left: env(safe-area-inset-left, 0);
  top: env(safe-area-inset-top, 0);
  /* Keep the proxy in the active layer. Do NOT clip-path it — Safari often
     refuses to show the IME for a clipped/zero-hit focused field. */
  z-index: 1;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  resize: none;
  opacity: .01;
  border: 0;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  font-size: 16px;
  pointer-events: none;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* While the IME is requested, give Safari a real on-screen focus target. */
body[data-keyboard="1"] .keyboard-proxy,
.keyboard-proxy.rsc-keyboard-active {
  left: max(8px, env(safe-area-inset-left, 0));
  right: max(8px, env(safe-area-inset-right, 0));
  top: auto;
  bottom: max(8px, env(safe-area-inset-bottom, 0));
  width: auto;
  height: 28px;
  opacity: 0.02;
  z-index: 45;
}

.chat-history-controls {
  position: fixed;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 196, 0, .5);
  border-radius: 12px;
  background: rgba(0, 0, 0, .72);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  -webkit-tap-highlight-color: transparent;
}

.chat-history-controls[hidden] { display: none !important; }

.chat-history-control {
  display: grid;
  place-items: center;
  width: clamp(48px, 12vw, 64px);
  height: clamp(44px, 10vw, 56px);
  padding: 0;
  border: 1px solid rgba(255, 216, 77, .5);
  border-radius: 9px;
  color: #ffe57b;
  background: rgba(13, 25, 31, .92);
  font: 800 clamp(26px, 6vw, 34px)/1 system-ui, -apple-system, sans-serif;
  touch-action: manipulation;
}

.chat-history-control:active { transform: scale(.94); background: rgba(76, 62, 13, .92); }
.chat-history-control:focus-visible { outline: 2px solid #ffe57b; outline-offset: 2px; }

.status-card {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 3;
  display: grid;
  width: min(288px, calc(100% - 28px));
  gap: 6px;
  padding: 14px 15px 13px;
  border: 1px solid rgba(173, 219, 240, .31);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(19, 34, 45, .94), rgba(4, 9, 14, .92));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .46);
  backdrop-filter: blur(12px);
  transition: opacity 220ms ease, visibility 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.status-kicker { color: #76d4f4; font-size: .62rem; font-weight: 750; letter-spacing: .13em; }
.status-title { color: #f0f8ff; font-size: .95rem; line-height: 1.15; }
.status-message { color: #c7d7e2; font-size: .77rem; line-height: 1.35; }
.status-detail { color: #839cab; font-size: .69rem; line-height: 1.35; }

.progress-track {
  display: block;
  height: 4px;
  margin: 3px 0 1px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(171, 211, 229, .16);
}

.progress-bar {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #51c7ed, #a9edff);
  box-shadow: 0 0 12px rgba(111, 220, 249, .8);
  transition: width 260ms ease;
}

.game-controls {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 4;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.game-controls-pad {
  display: grid;
  grid-template-columns: repeat(2, var(--rsc-mobile-control-size, 40px));
  gap: var(--rsc-mobile-control-gap, 8px);
}

.overlay-drag-handle {
  display: none;
  width: 100%;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 216, 77, .35);
  border-radius: 10px;
  color: #ffd84d;
  background: rgba(0, 0, 0, .55);
  font-size: .85rem;
  letter-spacing: .12em;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

.overlay-drag-handle:active { cursor: grabbing; }

.overlay-resize-handle {
  display: none;
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 0 10px 0;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(255, 216, 77, .95) 46% 54%, transparent 54% 70%,
      rgba(255, 216, 77, .95) 70% 78%, transparent 78%);
  cursor: nwse-resize;
  touch-action: none;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

/* Touchscreen laptops can expose a coarse pointer alongside a real trackpad
   and hardware keyboard.  JavaScript classifies those as desktop; never let a
   broad responsive rule bring the mobile keyboard button back. */
body[data-mode="desktop"] #keyboard-button { display: none !important; }

.game-control,
.update-now {
  border: 1px solid rgba(164, 222, 243, .54);
  color: #d8f6ff;
  background: rgba(5, 14, 20, .72);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .32);
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.game-control {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 13px;
  touch-action: manipulation;
}

.game-control svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-control:active { transform: scale(.94); background: rgba(36, 81, 99, .86); }
.game-control:focus-visible, .update-now:focus-visible { outline: 2px solid #a5e9ff; outline-offset: 2px; }

.orientation-note {
  display: none;
  position: absolute;
  inset: auto 18px max(18px, env(safe-area-inset-bottom));
  z-index: 2;
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  color: #b9cddd;
  background: rgba(3, 8, 12, .76);
  font-size: .72rem;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}

.app-shell[data-state="ready"] .status-card,
.app-shell[data-state="ready"] .orientation-note {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
}

.app-shell[data-state="error"] .status-card { border-color: rgba(255, 161, 143, .62); }
.app-shell[data-state="error"] .progress-bar { background: #ff927d; box-shadow: none; }

.update-banner {
  /* Browser releases are applied on the next launch. Never obstruct the
     canvas with the retired manual-update banner. */
  display: none !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 13px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(108, 199, 234, .5);
  border-radius: 10px;
  background: rgba(15, 40, 52, .92);
  color: #dcf5ff;
  font-size: .82rem;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .22);
}

.update-now { border-radius: 7px; padding: 7px 10px; background: #8be0fb; color: #071218; font-weight: 700; }
.desktop-hint { margin: 12px 0 0; color: #718897; font-size: .76rem; text-align: center; }

@media (max-width: 800px) {
  html:has(body[data-mode="mobile"]),
  body[data-mode="mobile"] { height: 100%; min-height: 100%; overflow: hidden; }

  body[data-mode="mobile"] {
    position: fixed;
    inset: 0;
    display: block;
    min-height: 0;
    background: #000;
  }

  body[data-mode="mobile"] .app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 0;
    padding: 0;
  }

  body[data-mode="mobile"] .desktop-masthead { display: none; }
  body[data-mode="mobile"] .desktop-hint { display: none; }

  body[data-mode="mobile"] .game-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
      env(safe-area-inset-bottom) env(safe-area-inset-left);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body[data-mode="mobile"] #game-canvas {
    width: min(calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)),
      calc((100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--game-aspect)));
    max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  @supports (height: 100dvh) {
    body[data-mode="mobile"] #game-canvas {
      width: min(calc(100dvw - env(safe-area-inset-left) - env(safe-area-inset-right)),
        calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--game-aspect)));
      max-width: calc(100dvw - env(safe-area-inset-left) - env(safe-area-inset-right));
      max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
  }

  body[data-mode="mobile"] .game-controls { display: flex; flex-direction: column; }

  body[data-mode="mobile"] .status-card {
    top: max(9px, env(safe-area-inset-top));
    right: max(9px, env(safe-area-inset-right));
    width: min(286px, calc(100% - 18px));
    padding: 11px 12px;
  }

  body[data-mode="mobile"] .update-banner {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    z-index: 10;
    margin: 0;
  }

  @media (orientation: portrait) {
    body[data-mode="mobile"] .app-shell[data-state="ready"] .orientation-note {
      display: block;
      visibility: visible;
      opacity: 1;
      transform: none;
      animation: orientation-note-dismiss 6s ease forwards;
    }
  }
}

/* JavaScript applies this on real phones/tablets too. It covers mobile
   browsers configured to request desktop pages, which otherwise report a fine
   pointer and leave the game in the cramped desktop frame. */
body[data-mode="mobile"] {
  /* A Home Screen game needs a stable viewport while the phone rotates.
     Safari's dynamic viewport can animate through an intermediate landscape
     height, leaving a fixed canvas scaled larger than its hit-test surface.
     svh is the settled, always-visible viewport on modern iOS. */
  --rsc-mobile-viewport-width: 100vw;
  --rsc-mobile-viewport-height: 100vh;
  position: fixed;
  inset: 0;
  width: var(--rsc-mobile-viewport-width);
  height: var(--rsc-mobile-viewport-height);
  max-width: var(--rsc-mobile-viewport-width);
  max-height: var(--rsc-mobile-viewport-height);
  display: block;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #000;
}

/* Credential entry uses a fixed, clipped keyboard proxy. Android is allowed
   to overlay its IME, but it must never resize or scroll the login canvas. */
body[data-mode="mobile"][data-login-keyboard="1"] {
  overflow: hidden;
  overscroll-behavior: none;
}

body[data-mode="mobile"][data-login-keyboard="1"] .keyboard-proxy {
  scroll-margin: 0;
}

body[data-mode="mobile"] .app-shell {
  position: fixed;
  inset: 0;
  width: var(--rsc-mobile-viewport-width);
  height: var(--rsc-mobile-viewport-height);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body[data-mode="mobile"] .desktop-masthead { display: none; }
body[data-mode="mobile"] .desktop-hint { display: none; }
body[data-mode="mobile"] .view-mode-toggle { display: none !important; }
body[data-fullscreen="1"] .view-mode-toggle { display: none !important; }

body[data-mode="mobile"] .game-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overscroll-behavior: none;
  touch-action: none;
  /* Flex centering is more reliable than grid place-items alone on iOS Safari
     when the canvas has explicit inline width/height from bootstrap.js. */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* iOS can keep the document taller than the visual viewport during a browser
   chrome transition unless every fixed ancestor explicitly clips it.  This is
   deliberately mobile-only: desktop page scrolling is unchanged. */
html:has(body[data-mode="mobile"]) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}

@supports (-webkit-touch-callout: none) {
  html:has(body[data-mode="mobile"]),
  body[data-mode="mobile"],
  body[data-mode="mobile"] .app-shell {
    min-height: -webkit-fill-available;
  }

  /* iPhone Home Screen games need a genuine strip below the status/battery
     area so the system pull-down gesture and the game's top tabs never
     compete.  The canvas itself begins below this strip, preserving exact
     canvas-relative touch coordinates. */
  body[data-mode="mobile"] {
    --rsc-mobile-top-clearance: 52px;
  }
}

@supports (height: 100svh) {
  body[data-mode="mobile"] {
    --rsc-mobile-viewport-height: 100svh;
  }
}

/* In landscape, Android browsers can report the keyboard-reduced small
   viewport even when interactive-widget is overlaying the IME. Keep the
   fullscreen/game canvas at the large pre-keyboard height and let only the
   chat line/history strip respond to visualViewport. */
@media (orientation: landscape) {
  @supports (height: 100lvh) {
    body[data-mode="mobile"][data-keyboard="1"] {
      --rsc-mobile-viewport-height: 100lvh;
    }
  }
}

body[data-mode="mobile"] #game-canvas {
  width: min(calc(var(--rsc-mobile-viewport-width) - env(safe-area-inset-left) - env(safe-area-inset-right)),
    calc((var(--rsc-mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--game-aspect)));
  max-width: calc(var(--rsc-mobile-viewport-width) - env(safe-area-inset-left) - env(safe-area-inset-right));
  max-height: calc(var(--rsc-mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0 auto;
  flex-shrink: 0;
  align-self: center;
  justify-self: center;
}

/* Fullscreen fills the device viewport; JS sets exact CSS px from the visual
   viewport so the game matches phone/tablet/desktop window size like a client.
   Aspect ratio stays 512×358 (no independent stretch). */
body[data-mode="mobile"][data-fullscreen="1"] #game-canvas,
html.rsc-pseudo-fullscreen #game-canvas,
body.rsc-pseudo-fullscreen #game-canvas {
  margin: 0;
  flex-shrink: 0;
}

/* Safari's landscape browser chrome can sit over the first few physical
   pixels of an edge-to-edge canvas even after the safe-area inset is applied.
   Leave a real top hit-test gutter above the game rather than translating
   it: the canvas rect and its offset-based pointer mapping stay identical.
   This keeps the top game tabs (settings, friends, map and inventory) fully
   touchable without sacrificing the bottom of the playable surface. */
@media (orientation: landscape) {
  body[data-mode="mobile"]:not([data-fullscreen="1"]) .game-stage {
    padding-top: calc(env(safe-area-inset-top) + var(--rsc-mobile-top-clearance));
  }

  body[data-mode="mobile"]:not([data-fullscreen="1"]) #game-canvas {
    width: min(calc(var(--rsc-mobile-viewport-width) - env(safe-area-inset-left) - env(safe-area-inset-right)),
      calc((var(--rsc-mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--rsc-mobile-top-clearance)) * var(--game-aspect)));
    max-height: calc(var(--rsc-mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--rsc-mobile-top-clearance));
  }

  /* In fullscreen, browser chrome is hidden so the game fills the full safe viewport without extra top clearance. */
  body[data-mode="mobile"][data-fullscreen="1"] .game-stage {
    padding: 0;
  }

}

body[data-mode="mobile"] .game-controls {
  --rsc-mobile-control-size: 40px;
  --rsc-mobile-control-gap: 8px;
  position: fixed;
  z-index: 30;
  left: auto;
  right: max(10px, env(safe-area-inset-right, 0));
  bottom: max(12px, env(safe-area-inset-bottom, 0));
  top: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 6px 14px;
  border: 1px solid rgba(255, 216, 77, .45);
  border-radius: 14px;
  background: rgba(0, 0, 0, .58);
  pointer-events: none;
  touch-action: none;
}

body[data-mode="mobile"] .game-controls-pad {
  display: grid;
  grid-template-columns: repeat(2, var(--rsc-mobile-control-size));
  gap: var(--rsc-mobile-control-gap);
  pointer-events: none;
}

body[data-mode="mobile"] .overlay-drag-handle,
body[data-mode="mobile"] .overlay-resize-handle {
  display: block;
}

body[data-mode="mobile"][data-fullscreen="1"],
html.rsc-pseudo-fullscreen body,
body.rsc-pseudo-fullscreen {
  --rsc-mobile-top-clearance: 0px;
}

body[data-mode="mobile"][data-fullscreen="1"] .orientation-note {
  display: none !important;
}

body[data-mode="mobile"][data-fullscreen="1"] .game-stage,
html.rsc-pseudo-fullscreen .game-stage,
body.rsc-pseudo-fullscreen .game-stage {
  padding: 0 !important;
}

/* Let bootstrap.js set exact device-fitted width/height; do not fight with !important caps. */
body[data-mode="mobile"][data-fullscreen="1"] #game-canvas,
html.rsc-pseudo-fullscreen #game-canvas,
body.rsc-pseudo-fullscreen #game-canvas {
  max-width: none;
  max-height: none;
}

body[data-mode="desktop"] .chat-history-controls { display: none !important; }

body[data-mode="mobile"] .game-control {
  width: var(--rsc-mobile-control-size);
  height: var(--rsc-mobile-control-size);
  border-color: rgba(255, 216, 77, .78);
  border-radius: clamp(12px, 3vmin, 18px);
  color: #ffd84d;
  background: rgba(0, 0, 0, .72);
  font-weight: 700;
  pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .46), 0 0 0 1px rgba(255, 216, 77, .12);
}

body[data-mode="mobile"] .game-control svg {
  width: clamp(29px, 7.2vmin, 40px);
  height: clamp(29px, 7.2vmin, 40px);
}

body[data-mode="mobile"] .status-card {
  top: max(9px, env(safe-area-inset-top));
  right: max(9px, env(safe-area-inset-right));
  width: min(286px, calc(100% - 18px));
  padding: 11px 12px;
}

body[data-mode="mobile"] .update-banner {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  left: max(8px, env(safe-area-inset-left));
  z-index: 10;
  margin: 0;
}

@media (orientation: portrait) {
  body[data-mode="mobile"] .app-shell[data-state="ready"] .orientation-note {
    display: block;
    visibility: visible;
    opacity: 1;
    transform: none;
    animation: orientation-note-dismiss 6s ease forwards;
  }
}

@keyframes orientation-note-dismiss {
  0%, 70% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
