@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../../../fonts/nunito-500.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../../../fonts/nunito-600.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../../fonts/nunito-700.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../../../fonts/nunito-800.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #3c291c;
  --cream: rgba(255, 248, 236, 0.94);
  --turquoise: #14998f;
  --stripe: #e4533a;
  --gold: #f0c14d;
  /* FEEL-BAR kid mobile controls — never drop below 64 / 22 */
  --stick-h: 96px;
  --stick-gap: 22px;
  --chrome-min: 72px;
  font-family: "Nunito", "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #16324a;
  overflow: hidden;
}

button, kbd, a { font: inherit; }

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #16324a;
  overflow: hidden;
}

#view {
  display: block;
  background: #8fd0f2;
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
}

[hidden] { display: none !important; }

.card {
  position: absolute;
  left: 50%;
  bottom: 3.5vh;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  max-height: min(68vh, 620px);
  overflow: auto;
  background: var(--cream);
  color: var(--ink);
  border-radius: 26px;
  padding: 22px 26px 20px;
  box-shadow: 0 18px 50px rgba(40, 24, 10, 0.18);
  z-index: 4;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.arcade-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 110px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  border: 2px solid #d7c4a4;
  box-shadow: inset 0 -2px 0 #d7c4a4;
}

.arcade-link:hover,
.arcade-link:focus-visible {
  border-color: var(--turquoise);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.92rem;
  color: #8a5a32;
  font-weight: 700;
}

h1, h2 {
  font-family: "Nunito", "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  margin: 0.15rem 0 0.2rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); }
h2 { font-size: clamp(2rem, 4vw, 2.8rem); }

.stripe {
  width: 110px;
  height: 10px;
  margin: 0 0 10px;
  border-radius: 99px;
  background: var(--stripe);
}

.lede, .fine, #end-body, #end-mission {
  margin: 0.25rem 0 0;
  line-height: 1.45;
}

.lede { font-size: 1.2rem; }

.fine { color: #6d5344; font-size: 1.05rem; }

.choices, .end-actions {
  display: flex;
  gap: var(--stick-gap);
  margin-top: 16px;
}

.choices button, .end-actions button, .topbar button, .stick {
  border: 0;
  cursor: pointer;
  border-radius: 18px;
}

.choices button {
  flex: 1;
  text-align: left;
  background: #fff;
  color: var(--ink);
  padding: 18px 20px;
  min-height: 88px;
  border: 3px solid transparent;
  box-shadow: inset 0 -4px 0 #d7c4a4;
  font-size: 1.15rem;
}

.choices button:hover, .choices button:focus-visible {
  border-color: var(--turquoise);
}

.choices button:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 #d7c4a4;
}

.choices strong, .choices small { display: block; }
.choices strong { font-size: 1.35rem; }
.choices small { color: #6d5344; margin-top: 4px; font-size: 1.02rem; }

.keys {
  display: flex;
  gap: 22px;
  margin-top: 14px;
  font-size: 1.1rem;
}

.keys p { margin: 0; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.15em 0.45em;
  border-radius: 8px;
  background: #fff;
  border: 2px solid #e2d0b4;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.topbar, .sticks, .coach, .toast, .feel { pointer-events: none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}

.topbar button, .stick, #hangar-end {
  pointer-events: auto;
  background: rgba(255, 248, 236, 0.94);
  color: var(--ink);
  padding: 14px 18px;
  box-shadow: 0 8px 20px rgba(40, 24, 10, 0.14);
  font-weight: 700;
}

.topbar button {
  min-width: var(--chrome-min);
  min-height: var(--chrome-min);
  font-size: 1.2rem;
  border-radius: 18px;
  border: 2px solid rgba(60, 41, 28, 0.12);
}

.topbar button:active,
.topbar button.is-held {
  transform: translateY(2px);
  background: #fff;
}

#sound {
  min-width: 128px;
}

.chip {
  background: rgba(255, 248, 236, 0.9);
  border-radius: 16px;
  padding: 10px 18px;
  box-shadow: 0 6px 16px rgba(40, 24, 10, 0.1);
}
.chip p { margin: 0; text-align: center; }
#flight-name {
  font-family: "Nunito", "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 1.55rem;
  font-weight: 600;
}
#goal {
  color: #6d5344;
  font-size: 1.15rem;
  font-weight: 700;
}

.coach, .toast {
  margin: 0 auto;
  width: min(640px, calc(100% - 24px));
  text-align: center;
  background: rgba(255, 248, 236, 0.92);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 1.2rem;
  font-weight: 600;
}

.toast { margin-top: 10px; background: #fff1ea; }

.feel {
  position: absolute;
  left: 16px;
  bottom: calc(var(--stick-h) + 28px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 248, 236, 0.92);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

#feel-word { min-width: 4.2em; }

#feel-bars { display: flex; gap: 4px; }
#feel-bars i {
  display: block;
  width: 12px;
  height: 22px;
  border-radius: 3px;
  background: #e4d3ba;
}
#feel-bars i.on { background: var(--turquoise); }

.sticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: max(var(--stick-gap), 18vw);
  padding: 14px;
}

.stick {
  width: min(320px, 40vw);
  min-width: 140px;
  height: var(--stick-h);
  min-height: 64px;
  font-size: 1.45rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

.stick-icon {
  font-size: 1.6rem;
  line-height: 1;
}

#nose-up {
  box-shadow: inset 0 -6px 0 var(--turquoise), 0 8px 20px rgba(40, 24, 10, 0.14);
}
#nose-down {
  box-shadow: inset 0 -6px 0 var(--stripe), 0 8px 20px rgba(40, 24, 10, 0.14);
}

.stick.is-held,
.stick:active {
  transform: translateY(3px) scale(0.98);
  background: #fff;
}

#nose-up.is-held,
#nose-up:active {
  box-shadow: inset 0 -3px 0 var(--turquoise), 0 4px 12px rgba(40, 24, 10, 0.12);
  background: #e8fffb;
}

#nose-down.is-held,
#nose-down:active {
  box-shadow: inset 0 -3px 0 var(--stripe), 0 4px 12px rgba(40, 24, 10, 0.12);
  background: #fff0ea;
}

.ending { bottom: 50%; transform: translate(-50%, 50%); }

.mission {
  margin-top: 16px;
  padding: 14px 16px;
  border: 3px dashed #c98448;
  border-radius: 18px;
  background: rgba(255, 244, 220, 0.75);
}

.mission-label {
  margin: 0 0 6px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a5a32;
  font-weight: 800;
}

#end-mission { font-size: 1.15rem; }
#end-body { font-size: 1.15rem; }

#hangar-end {
  background: var(--turquoise);
  color: #f7fffd;
  font-weight: 800;
  min-height: 64px;
  min-width: 180px;
  font-size: 1.25rem;
  padding: 14px 22px;
}

.texty {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink);
  text-decoration: underline;
  min-height: 52px;
  font-size: 1.1rem;
  font-weight: 700;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #14998f;
  outline-offset: 3px;
}

/* ---------- CRT host overrides ---------- */
body.lpa-crt {
  background: transparent;
}

.lpa-crt-screen > #stage {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
}

@media (max-width: 720px) {
  .choices, .end-actions, .keys { flex-direction: column; }
  .card { bottom: 1.2vh; max-height: 56vh; padding: 16px 18px 14px; }
  .feel { bottom: calc(var(--stick-h) + 20px); }
  .title-row { flex-wrap: wrap; }
  .stick {
    width: min(280px, 44vw);
    font-size: 1.25rem;
  }
  h1 { font-size: clamp(2rem, 7vw, 2.8rem); }
}

@media (max-aspect-ratio: 3/4) {
  .card { max-height: 46vh; }
  #screen-title.card { max-height: min(78vh, calc(100% - 12px)); }
}

/* Short / landscape phones — never drop below FEEL-BAR floors */
@media (max-height: 640px) {
  :root {
    --stick-h: 80px;
    --chrome-min: 64px;
  }
  .fine, .keys { display: none; }
  /* Keep title-screen hints on phones even in short CRT stages */
  #screen-title .fine { display: block; }
  #screen-title .keys { display: flex; }
  .lede { font-size: 1.05rem; }
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.6rem; }
  .choices button { min-height: 72px; padding: 12px 14px; }
  .choices strong { font-size: 1.15rem; }
  .coach, .toast { font-size: 1.05rem; padding: 8px 12px; }
  #flight-name { font-size: 1.25rem; }
  #goal { font-size: 1rem; }
  .stick { font-size: 1.2rem; }
  .feel { padding: 8px 12px; font-size: 1rem; }
  .topbar { padding: 10px; }
  .arcade-link { min-height: 44px; min-width: 96px; font-size: 0.98rem; }
}

@media (max-height: 520px) {
  :root {
    --stick-h: 64px;
    --chrome-min: 64px;
  }
  .stripe { display: none; }
  .eyebrow { font-size: 0.78rem; }
  .feel { display: none; }
  .card { max-height: 42vh; padding: 12px 14px; }
  .stick-icon { display: none; }
  .mission { padding: 10px 12px; }
}

@media (max-width: 420px) {
  :root {
    --stick-h: 88px;
  }
  .sticks { gap: var(--stick-gap); }
  .stick { width: calc(50% - 11px); min-width: 0; }

  /* Title screen: fit keys + fine print in stage, no scroll/clip (390×844) */
  #screen-title.card {
    bottom: 1vh;
    top: auto;
    max-height: min(78vh, calc(100% - 12px));
    overflow: hidden;
    padding: 12px 14px 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0;
  }
  #screen-title h1 { font-size: clamp(1.6rem, 7vw, 2.1rem); margin: 0.1rem 0; }
  #screen-title .stripe { width: 72px; height: 7px; margin: 0 0 6px; }
  #screen-title .lede { font-size: 0.98rem; margin: 0.15rem 0 0; }
  #screen-title .choices { margin-top: 10px; gap: 10px; flex-direction: column; }
  #screen-title .choices button { min-height: 64px; padding: 10px 12px; }
  #screen-title .choices strong { font-size: 1.1rem; }
  #screen-title .choices small { font-size: 0.9rem; }
  #screen-title .keys {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 8px;
    font-size: 0.92rem;
  }
  #screen-title .fine {
    display: block;
    font-size: 0.85rem;
    line-height: 1.3;
    margin-top: 6px;
  }
  #screen-title .arcade-link { min-height: 40px; min-width: 0; padding: 8px 12px; font-size: 0.9rem; }
  #screen-title .eyebrow { font-size: 0.75rem; }
}

/* Tall phones: don't hide keys/fine just because chrome makes stage short —
   the 420px rules above keep them visible and fitted. */
@media (max-width: 420px) and (max-height: 900px) {
  #screen-title .fine,
  #screen-title .keys { display: flex; }
  #screen-title .fine { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .stick,
  .choices button,
  .topbar button {
    transition: none;
  }
  .stick.is-held,
  .stick:active,
  .choices button:active,
  .topbar button:active {
    transform: none;
  }
}

/* Portrait phones: cover+bias via JS; title card sits mid-frame over action */
@media (max-width: 520px) and (orientation: portrait) {
  #stage { overflow: hidden; place-items: start center; }
  #view {
    max-width: none;
    max-height: none;
  }
  #screen-title.card {
    top: 6%;
    bottom: auto;
    max-height: min(82vh, calc(100% - 16px));
    width: min(100% - 12px, 760px);
    padding: 12px 14px 10px;
  }
  #screen-title .lede { font-size: 0.95rem; }
  #screen-title .choices button { min-height: 56px; }
  #screen-title .fine { font-size: 0.82rem; }
}
