@import url("/cic/shell-tokens.css");
:root {
                    font-family: "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  color: var(--of-ink);
  background: var(--of-paper);
}

:root[data-theme="dark"] {
          }

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; background: var(--of-paper); touch-action: manipulation; }
body { overflow-x: clip; }
button, select, input, textarea, a, [role="button"] { font: inherit; touch-action: manipulation; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible { outline: 3px solid var(--of-warn); outline-offset: 2px; }
#app { width: 100%; min-height: 100%; padding: clamp(.8rem, 2vw, 1.5rem); }
.app-header, .mission-panel, .hud, .controls-panel { width: min(100%, 72rem); margin-inline: auto; }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-block: .4rem 1rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--of-primary); font-size: .76rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .25rem; font-size: clamp(1.7rem, 5vw, 3rem); line-height: .95; letter-spacing: -.055em; text-shadow: 2px 2px 0 #b7cbe3; }
h2 { font-size: clamp(1.25rem, 4vw, 2rem); }
.lede { max-width: 42rem; margin-bottom: 0; color: var(--of-ink-soft); }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.button, .control-button { min-height: var(--control-min-h); border: 1px solid var(--of-rule); border-radius: .2rem; padding: .6rem .8rem; font-weight: 900; letter-spacing: .03em; text-transform: uppercase;  }
.button.primary { color: #fff; background: var(--of-primary); border-color: var(--of-primary); }
.button.secondary { color: var(--of-ink); background: color-mix(in srgb, var(--of-paper-soft) 74%, transparent); }
.mission-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto minmax(10rem, 1.2fr); gap: .7rem; align-items: end; padding: .8rem; border: 1px solid var(--of-rule); background: color-mix(in srgb, var(--of-paper-soft) 76%, transparent); }
.loadout-group { display: grid; gap: .3rem; font-size: .82rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
select { min-height: var(--control-min-h); min-width: 0; padding: .5rem; color: var(--of-ink); background: var(--of-paper); border: 1px solid var(--of-rule); border-radius: .2rem; font-size: 1rem; }
.mission-readout { display: grid; gap: .25rem; color: var(--of-ink-soft); font-size: .9rem; }
.mission-readout strong { color: var(--of-primary); font-size: 1.15rem; }
.game-frame { position: relative; width: min(100%, 72rem); margin: 1rem auto 0; aspect-ratio: 16 / 9; overflow: hidden; border: 3px solid #101c35; outline: 1px solid #9ec5e0; box-shadow: 0 .65rem 1.5rem rgba(10, 25, 50, .22); background: #07172a; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.game-overlay { position: absolute; inset: 0; display: grid; place-content: center; gap: .7rem; padding: 1.5rem; color: #f4f7ff; text-align: center; background: radial-gradient(circle at 72% 22%, rgba(84, 159, 207, .24), transparent 28%), linear-gradient(90deg, rgba(5, 13, 35, .94), rgba(5, 13, 35, .52)); }
.game-overlay h2, .game-overlay p { margin: 0; }
.game-overlay p { max-width: 28rem; color: #d8e2ff; }
.game-overlay .button { justify-self: center; min-width: 13rem; }
.game-controls { display: none; position: absolute; z-index: 2; inset: 0; pointer-events: none; opacity: var(--control-opacity, 0.6); transform: scale(var(--control-scale, 1)); transform-origin: bottom center; transition: opacity .15s ease; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.game-controls:active, .game-controls.touch-active { opacity: 0.92; }
.game-controls .touch-cluster, .game-controls .control-button { pointer-events: auto; -webkit-tap-highlight-color: transparent; }
:root[data-reduced-motion="on"] .game-controls { transition: none !important; animation: none !important; }
.touch-note { display: none; }
.hud { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: .65rem; padding: .8rem 0; }
.hud > div { display: grid; gap: .3rem; min-width: 0; padding: .55rem .65rem; border: 1px solid var(--of-rule); border-top: 3px solid var(--of-primary); background: color-mix(in srgb, var(--of-paper-soft) 74%, transparent); }
.hud span { color: var(--of-ink-soft); font-size: .76rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.hud strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: .55rem; overflow: hidden; border: 1px solid var(--of-rule); background: var(--of-paper); }
.meter i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #15934a, #87e766); transition: width .18s linear; }
.controls-panel { padding: .8rem; border: 1px solid var(--of-rule); background: color-mix(in srgb, var(--of-paper-soft) 60%, transparent); }
.controls-panel > p { margin-bottom: .65rem; color: var(--of-ink-soft); font-size: .88rem; }
.touch-controls { display: flex; justify-content: space-between; gap: 1rem; }
.touch-cluster { display: flex; gap: .45rem; }
.control-button { min-width: 3.6rem; min-height: 3.2rem; color: var(--of-ink); background: var(--of-paper-soft); touch-action: manipulation; }
.control-button.action { min-width: 4.8rem; color: #fff; background: var(--of-primary); border-color: var(--of-primary); }
.control-button[aria-pressed="true"] { color: #fff; background: var(--of-good); border-color: var(--of-good); transform: translateY(1px); }
.app-help { position: fixed; z-index: 5; right: max(.75rem, env(safe-area-inset-right)); bottom: max(.75rem, env(safe-area-inset-bottom)); width: min(26rem, calc(100vw - 1.5rem)); padding: 1rem; color: var(--of-ink); background: color-mix(in srgb, var(--of-paper) 82%, transparent); border: 1px solid var(--of-rule); box-shadow: 0 .6rem 1.8rem rgba(0, 0, 0, .22); backdrop-filter: blur(10px); }
.app-help p { color: var(--of-ink-soft); line-height: 1.45; }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.help-heading h2 { margin: 0; }
.icon-button { width: var(--control-min-h); min-height: var(--control-min-h); color: var(--of-ink); background: transparent; border: 1px solid var(--of-rule); border-radius: .2rem; font-size: 1.6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:root:not([data-help="on"]) [data-explanation] { display: none; }

@media (pointer: coarse), (display-mode: standalone), (max-width: 48rem), (max-height: 560px) {
  .app-header { display: grid; }
  .header-actions { justify-content: flex-start; }
  .mission-panel { grid-template-columns: 1fr 1fr; }
  .mission-panel .button, .mission-readout { grid-column: span 1; }
  .hud { grid-template-columns: 1fr 1fr; }
  .game-controls { display: none; }
  .touch-note { display: block; }
  #app[data-mode="playing"] { padding: 0; min-height: 100dvh; background: #07172a; }
  #app[data-mode="playing"] .app-header,
  #app[data-mode="playing"] .mission-panel,
  #app[data-mode="playing"] .hud,
  #app[data-mode="playing"] .controls-panel { display: none; }
  #app[data-mode="playing"] .game-frame { width: 100%; height: 100dvh; min-height: 100dvh; margin: 0; aspect-ratio: auto; border-width: 0; outline: 0; box-shadow: none; }
  #app[data-mode="playing"] .game-controls { display: flex; }
  .game-controls .control-button { min-width: 48px; min-height: 48px; border-radius: 50%; padding: .35rem; opacity: .78; backdrop-filter: blur(4px); touch-action: manipulation; }
  .game-controls .direction { color: #eaf6ff; background: rgba(8, 27, 53, .78); border-color: rgba(180, 222, 255, .65); font-size: 1.35rem; min-width: 52px; min-height: 52px; }
  .game-controls .action { color: #fff; background: rgba(23, 76, 200, .86); border-color: #9fc9ff; }
  .game-controls .fire-button { width: 60px; height: 60px; min-width: 60px; min-height: 60px; background: rgba(205, 67, 65, .9); border-color: #ffd5a8; }
  .game-controls .jump-button { width: 52px; height: 52px; min-width: 52px; min-height: 52px; align-self: flex-start; margin-bottom: 2.55rem; }
  .movement-cluster { align-self: flex-end; }
  .action-cluster { align-items: flex-end; }
}
@media (max-width: 25rem) {
  #app { padding-inline: .55rem; }
  .header-actions, .header-actions .button { width: 100%; }
  .mission-panel { grid-template-columns: 1fr; }
  .mission-panel .button, .mission-readout { grid-column: auto; }
  .hud { grid-template-columns: 1fr 1fr; gap: .4rem; }
  .hud > div { padding: .45rem; }
  .controls-panel { padding: .55rem; }
  .touch-controls { gap: .5rem; }
  .touch-cluster { gap: .25rem; }
  .control-button { min-width: 48px; min-height: 48px; padding-inline: .45rem; }
  .control-button.action { min-width: 48px; }
  #app[data-mode="playing"] .game-controls .control-button { min-width: 48px; min-height: 48px; }
  #app[data-mode="playing"] .game-controls .fire-button { width: 60px; height: 60px; min-width: 60px; min-height: 60px; }
  #app[data-mode="playing"] .game-controls .jump-button { width: 52px; height: 52px; min-width: 52px; min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

.alpha-movement-surface { display: none; }
:root[data-control-scheme="alpha-adaptive"] .alpha-movement-surface,
:root:not([data-control-scheme="fixed-buttons"]) .alpha-movement-surface { position: absolute; inset: 0 55% 0 0; display: block; pointer-events: auto; touch-action: none; }
.alpha-movement-pad { position: absolute; width: 120px; height: 120px; border: 1px solid rgba(190, 225, 255, .75); border-radius: 50%; background: rgba(8, 27, 53, .44); transform: translate(-50%, -50%); pointer-events: none; }
.alpha-movement-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; border: 1px solid #d8edff; border-radius: 50%; background: rgba(33, 96, 202, .78); transform: translate(-50%, -50%); box-shadow: 0 .25rem .8rem rgba(0,0,0,.42); }
.movement-cluster { position: absolute; left: calc(24px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
:root[data-control-scheme="alpha-adaptive"] .movement-cluster,
:root:not([data-control-scheme="fixed-buttons"]) .movement-cluster { display: none; }
:root[data-control-scheme="alpha-adaptive"] .action-cluster,
:root:not([data-control-scheme="fixed-buttons"]) .action-cluster { position: absolute; right: calc(var(--action-cluster-inset, 24px) + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 10rem; height: 8.5rem; touch-action: none; pointer-events: auto; }
:root[data-control-scheme="alpha-adaptive"] .action-cluster .fire-button,
:root:not([data-control-scheme="fixed-buttons"]) .action-cluster .fire-button { position: absolute; right: 0; bottom: 0; width: 60px; height: 60px; min-width: 60px; min-height: 60px; border-radius: 50%; touch-action: manipulation; }
:root[data-control-scheme="alpha-adaptive"] .action-cluster .jump-button,
:root:not([data-control-scheme="fixed-buttons"]) .action-cluster .jump-button { position: absolute; right: 4.8rem; bottom: 2.2rem; width: 52px; height: 52px; min-width: 52px; min-height: 52px; border-radius: 50%; margin: 0; touch-action: manipulation; }

/* Handedness mirroring */
:root[data-handedness="left"] .alpha-movement-surface { inset: 0 0 0 55%; }
:root[data-handedness="left"] .action-cluster { right: auto; left: calc(var(--action-cluster-inset, 24px) + env(safe-area-inset-left, 0px)); }
:root[data-handedness="left"] .action-cluster .fire-button { right: auto; left: 0; }
:root[data-handedness="left"] .action-cluster .jump-button { right: auto; left: 4.8rem; }
:root[data-handedness="left"] .movement-cluster { left: auto; right: calc(24px + env(safe-area-inset-right, 0px)); }

/* One-handed mode */
:root[data-one-handed="on"] .alpha-movement-surface { inset: 0 0 0 45%; }
:root[data-one-handed="on"][data-handedness="left"] .alpha-movement-surface { inset: 0 45% 0 0; }
:root[data-one-handed="on"] .action-cluster { right: calc(6px + env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
:root[data-one-handed="on"][data-handedness="left"] .action-cluster { right: auto; left: calc(6px + env(safe-area-inset-left, 0px)); }

/* Fixed stick mode */
:root[data-stick-mode="fixed"] .alpha-movement-pad { position: absolute; left: 5rem; top: calc(100% - 5rem); display: block !important; }
:root[data-stick-mode="fixed"][data-handedness="left"] .alpha-movement-pad { left: calc(100% - 5rem); }

/* Layout edit mode */
:root[data-layout-edit="true"] .action-cluster,
:root[data-layout-edit="true"] .alpha-movement-pad { outline: 2px dashed #9ec5e0; cursor: move; }
:root[data-layout-edit="true"] .alpha-movement-pad { display: block !important; left: 5rem; top: calc(100% - 5rem); }
:root[data-layout-edit="true"] .alpha-movement-surface { cursor: move; }

/* Touch debug indicators */
.touch-indicator { position: absolute; width: 44px; height: 44px; border: 2px solid #549fcf; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; background: rgba(84, 159, 207, 0.2); z-index: 100; }

@media (orientation: landscape) and (max-height: 560px) {
  .game-frame { height: calc(100dvh - 1rem); min-height: 0; }
  .hud { position: absolute; top: .3rem; left: 50%; z-index: 3; width: min(58%, 34rem); transform: translateX(-50%); opacity: .82; }
}
