/* Red Edge's expedition journal, deliberately independent of the portal menu skin. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #f3ecd8; }
#game-root { --ink: #24231e; --red: #c72b24; --paper: #f7f0df; --muted: #686153; --line: #332c262b; --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px); position: relative; isolation: isolate; width: 100%; height: 100vh; height: 100dvh; height: var(--runner-viewport-height, 100dvh); min-height: 0; overflow: hidden; color: var(--ink); font-family: Arial, Helvetica, sans-serif; -webkit-tap-highlight-color: transparent; }
#game-root *, #game-root *::before, #game-root *::after { box-sizing: border-box; }
#game-root button, #game-root a { touch-action: manipulation; }
#game-root button { font: inherit; cursor: pointer; }
#game-root button:disabled { cursor: default; opacity: .65; }
#game-root :focus-visible { outline: 2px solid #b6211d; outline-offset: 3px; }
#game-root a { color: inherit; text-underline-offset: 4px; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline-offset: -4px !important; }
#game-root .runner-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
#game-root .screen { position: absolute; inset: 0; z-index: 10; display: none; overflow-y: auto; overscroll-behavior: contain; padding: max(24px, var(--safe-top)) max(28px, var(--safe-right)) max(22px, var(--safe-bottom)) max(28px, var(--safe-left)); }
#game-root .screen.active { display: flex; }
#game-root .title-screen { flex-direction: column; justify-content: space-between; gap: 22px; background: linear-gradient(90deg, #f7f0dff2 0%, #f7f0dfc9 30%, #f7f0df05 67%), linear-gradient(0deg, #f7f0dff2 0%, #f7f0df00 24%); }
#game-root .expedition-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; }
#game-root .brand { display: inline-flex; gap: 0; align-items: center; font-size: 19px; font-weight: 900; letter-spacing: -.7px; text-decoration: none; }
#game-root .brand > span { font-weight: 500; }
#game-root .brand small { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); font-size: 8px; font-weight: 700; letter-spacing: 2px; }
#game-root .edition-label { display: flex; align-items: center; gap: 20px; font-size: 9px; letter-spacing: 2px; }
#game-root .edition-label b { border: 1px solid var(--ink); padding: 8px; font-size: 13px; letter-spacing: 0; }
#game-root .title-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); align-items: center; gap: clamp(20px, 4vw, 84px); flex-shrink: 0; width: 100%; max-width: 1440px; margin: auto; }
#game-root .eyebrow { display: flex; align-items: center; gap: 10px; font-size: 9px; letter-spacing: 2px; font-weight: 700; line-height: 1.5; }
#game-root .eyebrow i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: 0 0 auto; }
#game-root .title { margin: 23px 0; font-size: clamp(66px, 8.6vw, 142px); font-weight: 900; letter-spacing: -.075em; line-height: .87; }
#game-root .title span, #game-root .title strong { display: block; }
#game-root .title strong { color: var(--red); font-weight: 900; }
#game-root .subtitle { margin: 22px 0 0; font-size: clamp(14px, 1.2vw, 18px); line-height: 1.65; color: #4b4439; }
#game-root .launch-panel { width: 100%; max-width: 340px; justify-self: end; align-self: end; background: #f7f0dfee; padding: 23px 24px; border-top: 3px solid var(--red); box-shadow: 0 12px 42px #3425170b; }
#game-root .mission-heading { display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: 1.5px; font-weight: 700; }
#game-root .mission-heading b { color: var(--red); font-size: 23px; line-height: 1; }
#game-root .mission-goal { margin: 10px 0 24px; font-size: 19px; font-weight: 700; letter-spacing: -.6px; }
#game-root .control-strip { display: flex; gap: 22px; margin-bottom: 22px; }
#game-root .control-strip p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
#game-root .control-strip b { font-size: 9px; letter-spacing: 1px; }
#game-root .control-strip span { font-size: 11px; color: var(--muted); }
#game-root .primary-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #a71f19; width: 100%; min-height: 54px; padding: 14px 18px; background: var(--red); color: #fff9ee; font-size: 15px; font-weight: 700; box-shadow: 0 4px 0 #8d251d; transition: background .15s ease, transform .15s ease; }
#game-root .primary-btn > span { font-size: 22px; line-height: .8; }
#game-root .primary-btn:hover { background: #b8201a; }
#game-root .primary-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #8d251d; }
#game-root .keyboard-note { margin: 15px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
#game-root kbd { font-family: inherit; color: var(--ink); font-weight: 700; }
#game-root .keyboard-note > span { margin: 0 6px; }
#game-root .utility-row { display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; border-top: 1px solid var(--line); }
#game-root .text-btn { border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--ink); padding: 13px 0; min-height: 44px; font-size: 10px; }
#game-root .text-btn:hover { border-bottom-color: var(--red); }
#game-root .menu-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
#game-root .menu-foot strong { color: var(--ink); }
#game-root .route-footer { flex-shrink: 0; width: 100%; max-width: 1440px; margin: 0 auto; }
#game-root .route-caption { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; }
#game-root .route-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; list-style: none; padding: 0; margin: 0; }
#game-root .route-strip li { display: flex; align-items: center; gap: 12px; padding: 13px 0 0; border-top: 1px solid #6c604868; position: relative; }
#game-root .route-strip li.reached { border-top-color: var(--red); }
#game-root .route-strip li.reached::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--red); position: absolute; top: -3px; left: 0; }
#game-root .route-strip b { font-size: 25px; font-weight: 400; color: var(--muted); letter-spacing: -1px; }
#game-root .route-strip span { font-size: 11px; line-height: 1.35; font-weight: 700; }
#game-root .route-strip small { font-size: 8px; margin-left: auto; align-self: end; color: #595244; }
#game-root .overlay { align-items: center; justify-content: center; background: #201d196b; backdrop-filter: blur(4px); }
#game-root .field-card { width: min(100%, 460px); margin: auto; padding: clamp(22px, 3vw, 36px); background: var(--paper); border-top: 4px solid var(--red); box-shadow: 0 24px 90px #130d1238; }
#game-root .pause-card h2 { font-size: 58px; line-height: .98; letter-spacing: -3px; margin: 24px 0; }
#game-root .pause-card em { font-style: normal; color: var(--red); }
#game-root .pause-note { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 26px; }
#game-root .button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#game-root .secondary-btn { flex: 1 1 80px; min-width: 0; overflow-wrap: anywhere; min-height: 44px; padding: 10px 8px; font-size: 11px; color: var(--ink); background: transparent; border: 1px solid var(--line); }
#game-root .secondary-btn:hover { background: #e7decb; border-color: #746959; }
#game-root .result-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
#game-root .result-header .eyebrow { font-size: 8px; letter-spacing: 1.3px; }
#game-root .result-kicker { color: var(--red); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; text-align: right; }
#game-root .result-distance { font-size: clamp(62px, 9vw, 100px); line-height: 1.1; font-weight: 900; letter-spacing: -6px; margin-top: 18px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#game-root .result-goal { font-size: 12px; color: var(--muted); margin: 2px 0 22px; }
#game-root .result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; border-block: 1px solid var(--line); padding: 18px 0; }
#game-root .result-stats > div { display: flex; flex-direction: column; gap: 5px; }
#game-root .result-stats b { font-size: 19px; font-weight: 700; letter-spacing: -.6px; overflow-wrap: anywhere; }
#game-root .result-stats span { font-size: 9px; color: var(--muted); }
#game-root .result-tip { font-size: 12px; line-height: 1.55; padding-left: 12px; border-left: 2px solid var(--red); margin: 20px 0; }
#game-root .nn-score-nudge { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 0 0 18px; }
#game-root .share-status { font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; margin: 12px 0 0; }
#game-root .share-status:empty { display: none; }
#game-root .hud { position: absolute; inset: max(20px, var(--safe-top)) max(26px, var(--safe-right)) auto max(26px, var(--safe-left)); z-index: 3; pointer-events: none; display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto); column-gap: 30px; padding-right: 105px; }
#game-root .hidden { display: none !important; }
#game-root .hud-distance-block { display: flex; flex-direction: column; }
#game-root .hud-label { font-size: 8px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #595244; }
#game-root .hud-value { font-size: 48px; font-weight: 900; line-height: 1.2; letter-spacing: -3px; font-variant-numeric: tabular-nums; }
#game-root .hud-route, #game-root .hud-record { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; font-size: 10px; letter-spacing: .7px; }
#game-root .hud-route > :first-child { font-weight: 700; text-transform: uppercase; }
#game-root .hud-route > :last-child, #game-root .hud-record { color: #595244; font-size: 9px; }
#game-root .goal-track { grid-column: 1 / -1; max-width: 300px; margin-top: 6px; font-size: 8px; letter-spacing: 1px; }
#game-root .goal-line { height: 2px; background: #28201422; margin-top: 7px; overflow: hidden; }
#game-root .goal-line i { display: block; height: 100%; width: 0; background: var(--red); }
#game-root .icon-btn { display: none; position: absolute; z-index: 5; top: max(18px, var(--safe-top)); width: 44px; height: 44px; background: #f7f0dfdb; border: 1px solid var(--line); color: var(--ink); font-size: 20px; }
#game-root .icon-btn.visible { display: block; }
#mute-btn { right: max(76px, calc(var(--safe-right) + 64px)); }
#pause-btn { right: max(26px, calc(var(--safe-right) + 14px)); }
#game-root #flow-toast { position: absolute; top: 25%; left: 50%; transform: translate(-50%, 8px); padding: 10px 16px; max-width: 90%; background: #f7f0dff2; border-left: 3px solid var(--red); color: #91251f; font-size: 13px; font-weight: 700; letter-spacing: 1px; opacity: 0; z-index: 4; pointer-events: none; transition: opacity .14s, transform .14s; }
#game-root #flow-toast.show { opacity: 1; transform: translate(-50%, 0); }
#game-root .gesture-hint { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); padding: 8px 12px; color: #f7f0df; font-size: 11px; text-align: center; z-index: 4; opacity: 0; pointer-events: none; }
#game-root .gesture-hint.show { opacity: 1; }
#game-root .touch-controls { position: absolute; z-index: 4; bottom: max(16px, var(--safe-bottom)); left: max(18px, var(--safe-left)); right: max(18px, var(--safe-right)); display: none; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
#game-root .touch-button { pointer-events: auto; touch-action: none; min-width: 90px; min-height: 52px; border: 1px solid #f2e8d35c; background: #f7f0df0f; color: #fbf2df; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
#game-root .touch-button > span { font-size: 19px; margin-right: 7px; }
#game-root .touch-button:active { background: #f7f0df30; }
#game-root .jump-button { background: #c72b2470; border-color: #f3c5a77d; }
#game-root .touch-note { color: #f3ecd899; font-size: 7px; letter-spacing: 1px; text-align: center; }
#game-root .no-script { position: absolute; z-index: 20; inset: auto 20px 20px; background: var(--paper); padding: 18px; }
@media (min-width: 1200px) { #game-root .screen { padding-inline: max(5vw, var(--safe-left)) max(5vw, var(--safe-right)); padding-block: max(34px, var(--safe-top)) max(34px, var(--safe-bottom)); } #game-root .title-screen { gap: 36px; } }
@media (hover: none), (any-pointer: coarse) {
  #game-root[data-state="running"] .touch-controls { display: flex; }
  #game-root .gesture-hint { bottom: max(90px, calc(var(--safe-bottom) + 74px)); }
}
@media (max-width: 700px) {
  #game-root .screen { padding: max(20px, var(--safe-top)) max(22px, var(--safe-right)) max(18px, var(--safe-bottom)) max(22px, var(--safe-left)); }
  #game-root .title-screen { gap: 19px; background: linear-gradient(180deg, #f7f0dff2 0%, #f7f0df85 33%, #f7f0dfb5 62%, #f7f0dffa 100%); }
  #game-root .title-layout { display: flex; flex-direction: column; gap: 24px; align-items: stretch; }
  #game-root .edition-label { font-size: 0; gap: 0; }
  #game-root .edition-label b { font-size: 12px; }
  #game-root .title { font-size: clamp(56px, 16.7vw, 110px); margin: 17px 0 12px; }
  #game-root .title-copy .eyebrow { font-size: 7px; letter-spacing: 1.4px; }
  #game-root .subtitle { font-size: 12px; margin-top: 12px; line-height: 1.5; }
  #game-root .launch-panel { width: 100%; max-width: none; padding: 15px 0 0; background: transparent; box-shadow: none; }
  #game-root .mission-goal { font-size: 17px; margin: 8px 0 16px; }
  #game-root .control-strip { margin-bottom: 16px; justify-content: space-between; }
  #game-root .keyboard-note { display: none; }
  #game-root .utility-row { margin-top: 12px; }
  #game-root .route-strip { gap: 12px; }
  #game-root .route-strip li { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 10px; }
  #game-root .route-strip b { font-size: 18px; }
  #game-root .route-strip span { font-size: 9px; }
  #game-root .route-strip small { flex-basis: 100%; margin-left: 0; font-size: 7px; }
  #game-root .route-caption { font-size: 7px; letter-spacing: .5px; }
  #game-root #title-runs { display: none; }
  #game-root .hud { inset-inline: max(20px, var(--safe-left)) max(20px, var(--safe-right)); column-gap: 12px; row-gap: 5px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-right: 0; }
  #game-root .hud-distance-block { grid-column: 1 / -1; padding-right: 108px; }
  #game-root .hud-record { grid-column: 2; gap: 6px; padding-top: 2px; text-align: right; }
  #game-root .hud-value { font-size: 40px; }
  #game-root .hud-route { font-size: 9px; }
  #game-root .goal-track { max-width: 210px; margin-top: 10px; }
  #game-root .field-card { padding: 24px 22px; }
}
@media (max-height: 680px) and (max-width: 700px) and (min-height: 501px) {
  #game-root .title-screen { gap: 14px; }
  #game-root .title-layout { gap: 12px; }
  #game-root .title { font-size: 56px; }
  #game-root .subtitle { display: none; }
  #game-root .route-caption { display: none; }
  #game-root .mission-goal { margin-bottom: 12px; }
  #game-root .control-strip { margin-bottom: 12px; }
}
@media (max-height: 500px) {
  #game-root .screen { padding-block: max(14px, var(--safe-top)) max(14px, var(--safe-bottom)); gap: 12px; }
  #game-root .title-layout { grid-template-columns: minmax(0, 1fr) minmax(240px, 40%); gap: 4vw; }
  #game-root .title { font-size: clamp(48px, 8.4vw, 85px); margin: 14px 0; }
  #game-root .title-copy .eyebrow { font-size: 7px; letter-spacing: 1px; }
  #game-root .subtitle { font-size: 12px; margin: 10px 0; }
  #game-root .launch-panel { padding: 13px 16px; }
  #game-root .mission-goal { margin: 6px 0 12px; font-size: 16px; }
  #game-root .control-strip { margin-bottom: 12px; gap: 15px; }
  #game-root .control-strip b { font-size: 8px; }
  #game-root .control-strip span { font-size: 10px; }
  #game-root .primary-btn { min-height: 44px; padding: 11px 14px; font-size: 13px; }
  #game-root .keyboard-note { display: none; }
  #game-root .utility-row { margin-top: 8px; }
  #game-root .text-btn { padding: 7px 0; min-height: 44px; font-size: 10px; }
  #game-root .route-footer { display: none; }
  #game-root .field-card { max-width: 520px; padding: 20px 24px; }
  #game-root .pause-card h2 { font-size: 38px; margin: 16px 0; }
  #game-root .pause-note { font-size: 12px; margin-bottom: 18px; }
  #game-root .result-distance { font-size: 58px; letter-spacing: -3px; margin-top: 8px; }
  #game-root .result-goal { margin-bottom: 10px; }
  #game-root .result-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 12px 0; gap: 8px; }
  #game-root .result-stats b { font-size: 16px; }
  #game-root .result-stats span { font-size: 8px; }
  #game-root .result-tip { margin: 12px 0; font-size: 11px; }
  #game-root .nn-score-nudge { margin-bottom: 12px; font-size: 10px; }
  #game-root .hud { top: max(12px, var(--safe-top)); }
  #game-root .hud-value { font-size: 36px; }
  #game-root .goal-track { margin-top: 3px; }
  #game-root .touch-controls { bottom: max(8px, var(--safe-bottom)); }
  #game-root .touch-button { min-height: 44px; min-width: 86px; }
  #game-root .gesture-hint { bottom: 60px; }
}
@media (max-height: 320px) {
  #game-root .expedition-header { display: none; }
  #game-root .subtitle { font-size: 10px; }
  #game-root .launch-panel { padding: 10px 14px; }
  #game-root .control-strip { display: none; }
  #game-root .menu-foot { font-size: 8px; }
  #game-root .touch-note { display: none; }
}

/* Size constraints must not force a menu wider than an embedded phone viewport.
   Auto margins center only when there is space; non-shrinking children keep the
   top and bottom of tall screens reachable through their own scroll container. */
#game-root .title-layout > *, #game-root .hud > * { min-width: 0; }
#game-root .field-card { flex-shrink: 0; }
#game-root .screen { scroll-padding-block: 16px; }
#game-root .hud-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#game-root .hud-route, #game-root .hud-record, #game-root .goal-track { overflow-wrap: anywhere; }
#game-root .utility-row { flex-wrap: wrap; }
#game-root .text-btn { min-width: 44px; }
@media (max-width: 700px) and (max-height: 500px) {
  #game-root .title-screen { gap: 14px; }
  #game-root .title-layout { gap: 14px; }
  #game-root .title { font-size: clamp(44px, 14vw, 64px); margin: 12px 0; }
  #game-root .subtitle { display: none; }
  #game-root .launch-panel { padding: 14px 0 0; }
  #game-root .result-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  #game-root .screen { padding-inline: max(16px, var(--safe-left)) max(16px, var(--safe-right)); }
  #game-root .field-card { padding-inline: 18px; }
  #game-root .hud { inset-inline: max(12px, var(--safe-left)) max(12px, var(--safe-right)); }
  #game-root .hud-value { font-size: 30px; letter-spacing: -1.5px; }
  #game-root .touch-note { display: none; }
  #game-root .route-strip { gap: 8px; }
}
@media (max-height: 320px) {
  #game-root .goal-track { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #game-root *, #game-root *::before, #game-root *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  #game-root .overlay { backdrop-filter: none; }
}

/* Canvas focus is a quiet boundary, not a permanent red danger frame. */
#game-root #game-canvas:focus-visible { outline: 1px solid #80715366; outline-offset: -2px !important; }

/* Leave room for the runner inside short embedded players. */
@media (max-height: 320px) {
  #game-root .hud-route, #game-root .hud-record, #game-root .gesture-hint { display: none; }
}
