/*
  Interface skin.

  The rule for every surface here: soft cream card, thick light border, generous
  radius, one deep shadow. It has to sit on top of a bright toy world without
  looking like a browser dialog that wandered into a game.
*/

:root {
  --cream: #fffaf0;
  --cream-2: #fff4e2;
  --ink: #2b3140;
  --ink-soft: #5d6579;
  --ink-faint: #8b93a6;
  --teal: #2fae9f;
  --teal-deep: #1c8a7e;
  --coral: #f2764e;
  --sky: #4ea3e0;
  --violet: #8f6fd0;
  --gold: #eab447;
  --line: rgba(43, 49, 64, 0.12);
  --shadow-lg: 0 18px 48px rgba(24, 32, 52, 0.28), 0 3px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 26px rgba(24, 32, 52, 0.22);
  --radius: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Segoe UI Variable",
    "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1424;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--cream);
  border: 1.5px solid rgba(43, 49, 64, 0.18);
  border-bottom-width: 3px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ loader */

.loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 8%, #6fc0ea 0%, #4a86c8 42%, #24406e 100%);
  transition: opacity 0.7s ease;
}
.loader.fade { opacity: 0; pointer-events: none; }

.loader-card {
  width: min(440px, 88vw);
  padding: 34px 30px 30px;
  border-radius: 28px;
  background: var(--cream);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.loader-mark { display: flex; gap: 7px; justify-content: center; margin-bottom: 16px; }
.loader-mark-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--teal);
  animation: bounce 1.1s infinite ease-in-out;
}
.loader-mark-dot:nth-child(2) { background: var(--coral); animation-delay: 0.14s; }
.loader-mark-dot:nth-child(3) { background: var(--gold); animation-delay: 0.28s; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); } 35% { transform: translateY(-9px); } }

.loader-title { margin: 0; font-size: 30px; letter-spacing: -0.02em; font-weight: 850; }
.loader-sub { margin: 4px 0 22px; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.loader-bar {
  height: 10px; border-radius: 99px; overflow: hidden;
  background: rgba(43, 49, 64, 0.1);
}
.loader-fill {
  height: 100%; width: 4%; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--sky));
  transition: width 0.35s ease;
}
.loader-step { margin: 12px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.loader-tip {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
  min-height: 2.6em;
}

/* ------------------------------------------------------------------ start card */

.startcard {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, rgba(12, 22, 42, 0.28), rgba(12, 22, 42, 0.62));
  backdrop-filter: blur(3px);
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.startcard-inner {
  width: min(520px, 92vw);
  max-height: 92vh;
  overflow: auto;
  padding: 30px 32px 26px;
  border-radius: 30px;
  background: var(--cream);
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.startcard-eyebrow {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal-deep);
}
.startcard-title { margin: 0; font-size: 38px; font-weight: 850; letter-spacing: -0.03em; }
.startcard-role { margin: 6px 0 16px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.startcard-body { margin: 0 0 20px; font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }

.startcard-keys {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
  margin-bottom: 22px; text-align: left;
}
.keyrow { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.keyrow span { margin-left: 4px; }

.btn {
  display: block; width: 100%;
  padding: 14px 20px; border-radius: 16px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.01em;
  border: none; transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: linear-gradient(180deg, #35c0af, var(--teal-deep));
  color: #fff;
  box-shadow: 0 5px 0 #14675e, var(--shadow-md);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { box-shadow: 0 3px 0 #14675e; }
.btn-ghost {
  margin-top: 10px; background: transparent; color: var(--ink-faint);
  font-size: 13px; font-weight: 700; padding: 8px;
}
.btn-ghost:hover { color: var(--ink-soft); }

/* ------------------------------------------------------------------ hud shell */

.hud {
  position: fixed; inset: 0; z-index: 20;
  pointer-events: none;
  animation: fadeIn 0.7s ease;
}
.hud > * { pointer-events: auto; }

.hud-topleft {
  position: absolute; top: calc(16px + var(--safe-t)); left: 16px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}

.place-card {
  padding: 10px 18px 11px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.94);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  min-width: 190px;
}
.place-name { font-size: 17px; font-weight: 850; letter-spacing: -0.01em; line-height: 1.15; }
.place-sub { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); margin-top: 1px; }

.clock-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 9px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.94);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
}
.clock-dial { width: 34px; height: 34px; flex: none; }
.clock-ring { fill: rgba(78, 163, 224, 0.14); stroke: rgba(43, 49, 64, 0.16); stroke-width: 2; }
.clock-arc { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.clock-sun { fill: var(--gold); stroke: #fff; stroke-width: 1.6; }
.clock-text { display: flex; flex-direction: column; line-height: 1.15; }
.clock-time { font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums; }
.clock-phase { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); }

/* ------------------------------------------------------------------ compass */

.hud-compass {
  position: absolute; top: calc(16px + var(--safe-t)); left: 50%;
  transform: translateX(-50%);
  display: none; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.95);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  max-width: min(340px, 62vw);
}
.hud-compass.on { display: flex; }
.compass-arrow { font-size: 15px; color: var(--coral); line-height: 1; transition: transform 0.08s linear; }
.compass-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.compass-name {
  font-size: 12.5px; font-weight: 800; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.compass-dist { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.compass-clear {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: none; background: rgba(43, 49, 64, 0.08); color: var(--ink-soft);
  font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.compass-clear:hover { background: rgba(242, 118, 78, 0.18); color: var(--coral); }

/* ------------------------------------------------------------------ minimap */

.hud-topright {
  position: absolute; top: calc(16px + var(--safe-t)); right: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.minimap-wrap {
  position: relative;
  width: 178px; height: 178px;
  border-radius: 26px;
  overflow: hidden;
  background: #cfe7f2;
  border: 3px solid rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
}
#minimap { width: 100%; height: 100%; display: block; cursor: crosshair; }
.minimap-ring {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 22px rgba(20, 40, 70, 0.22);
  border-radius: 22px;
}
.minimap-n {
  /* Orbits the rim: the marker sits on a full-size layer that rotates about
     the map centre, so "N" always sits on the true-north edge. */
  position: absolute; inset: 0; pointer-events: none;
  display: grid; justify-items: center; align-items: start;
  padding-top: 4px;
  font-size: 10px; font-weight: 850; color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  transform-origin: 50% 50%;
}
.minimap-expand {
  position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 9px;
  border: none; background: rgba(255, 250, 240, 0.92);
  font-size: 13px; font-weight: 800; color: var(--ink-soft);
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.minimap-expand:hover { background: #fff; color: var(--teal-deep); }
.minimap-hint {
  font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* ------------------------------------------------------------------ prompt */

.hud-prompt {
  position: absolute; bottom: calc(96px + var(--safe-b)); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px 9px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.96);
  border: 2.5px solid rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  animation: promptIn 0.2s ease;
}
@keyframes promptIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.prompt-key {
  display: grid; place-items: center;
  min-width: 28px; height: 28px; padding: 0 8px;
  border-radius: 9px;
  background: linear-gradient(180deg, #3ac6b4, var(--teal-deep));
  color: #fff; font-size: 13px; font-weight: 850;
  box-shadow: 0 3px 0 #15665d;
}
.prompt-label { font-size: 14px; font-weight: 800; }

/* ------------------------------------------------------- falling and realms */

/*
 * The falcon prompt.
 *
 * Deliberately not the standard prompt chip. That one is a quiet affordance you
 * meet while walking around; this one arrives while the ground is coming up at
 * you, so it is centred, larger, and it pulses.
 */
.skyhint {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px 14px 14px;
  border-radius: 999px;
  background: rgba(12, 18, 30, 0.62);
  border: 2px solid rgba(220, 240, 255, 0.65);
  backdrop-filter: blur(6px);
  color: #eaf4ff;
  animation: skyhintIn 0.45s ease, skyhintPulse 1.9s ease-in-out 0.45s infinite;
  pointer-events: none;
}
@keyframes skyhintIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 22px)) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes skyhintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(160, 220, 255, 0.35); }
  50% { box-shadow: 0 0 34px 6px rgba(160, 220, 255, 0.22); }
}
.skyhint-key {
  display: grid; place-items: center;
  min-width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(180deg, #7fe3ff, #2f9fd0);
  color: #05202c; font-size: 17px; font-weight: 900;
  box-shadow: 0 3px 0 #1b6b8f;
}
.skyhint-label { font-size: 17px; font-weight: 800; letter-spacing: 0.01em; }

/*
 * The scoreboard.
 *
 * Top centre rather than in a corner: during a rally your eyes are on the ball
 * in the middle of the screen, and a score you have to go looking for may as
 * well not be shown.
 */
.scoreboard {
  position: absolute; top: calc(16px + var(--safe-t)); left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  padding: 10px 20px 9px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.95);
  border: 2.5px solid rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  text-align: center;
  pointer-events: none;
}
.scoreboard-row { display: flex; align-items: center; justify-content: center; gap: 9px; }
.scoreboard-name { font-size: 12px; font-weight: 800; opacity: 0.62; }
.scoreboard-points { font-size: 25px; font-weight: 900; font-variant-numeric: tabular-nums; }
.scoreboard-dash { opacity: 0.35; font-weight: 800; }
.scoreboard-note { font-size: 12.5px; font-weight: 800; color: var(--teal-deep); min-height: 16px; }
.scoreboard-keys { margin-top: 4px; font-size: 10.5px; opacity: 0.55; font-weight: 700; }
.scoreboard-keys kbd {
  font: inherit; padding: 1px 5px; border-radius: 5px;
  background: rgba(0, 0, 0, 0.07); margin-right: 2px;
}

/*
 * The interface, while a sequence has the screen.
 *
 * Everything except the falcon prompt fades out: a minimap of the Nexus
 * floating over the inside of the corridor undoes the whole effect, and none of
 * it is readable or actionable mid-transit anyway.
 */
.hud.sequence > *:not(#skyhint) {
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.hud > * { transition: opacity 0.5s ease; }

/*
 * The transition white.
 *
 * Above the canvas, below the panels, so a sequence can wash the screen out
 * without also hiding the interface. There is no CSS transition on it by
 * design: the timing belongs to the sequence driving the opacity per frame.
 */
.flash {
  position: fixed; inset: 0; z-index: 35;
  background: #ffffff;
  pointer-events: none;
  opacity: 0;
}

/* ------------------------------------------------------------------ chips */

.hud-bottomright {
  position: absolute; right: 16px; bottom: calc(16px + var(--safe-b));
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  max-width: 46vw;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 14px;
  background: rgba(255, 250, 240, 0.94);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  font-size: 12.5px; font-weight: 800; color: var(--ink);
  transition: transform 0.12s ease;
}
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: translateY(1px); }
.chip-icon {
  min-width: 40px; justify-content: center;
  font-size: 15px; line-height: 1;
}
.chip-icon.is-off { color: var(--ink-faint); }

.chip-key {
  display: grid; place-items: center;
  width: 19px; height: 19px; border-radius: 6px;
  background: rgba(43, 49, 64, 0.1);
  font-size: 10px; font-weight: 850; color: var(--ink-soft);
}

.hud-progress {
  position: absolute; left: 16px; bottom: calc(16px + var(--safe-b));
}
.progress-pill {
  display: inline-flex; align-items: baseline; gap: 3px;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums;
}
.progress-slash { color: var(--ink-faint); }
.progress-label { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); margin-left: 4px; }

/* ------------------------------------------------------------------ touch */

.stick, .touch-action, .touch-jump { display: none; }

body.touch .stick {
  display: block;
  position: absolute; left: 22px; bottom: calc(30px + var(--safe-b));
  width: 132px; height: 132px; touch-action: none;
}
body.touch .stick-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(255, 250, 240, 0.28);
  border: 2.5px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(2px);
}
body.touch .stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.9);
  border: 2.5px solid #fff;
  box-shadow: var(--shadow-md);
}
body.touch .touch-action, body.touch .touch-jump,
body.touch .touch-falcon, body.touch .touch-leave {
  display: grid; place-items: center;
  position: absolute; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  font-weight: 850; color: #fff;
  box-shadow: var(--shadow-md);
  user-select: none;
}
body.touch .touch-action {
  right: 26px; bottom: calc(96px + var(--safe-b));
  width: 74px; height: 74px; font-size: 22px;
  background: linear-gradient(180deg, #3ac6b4, var(--teal-deep));
}
body.touch .touch-jump {
  right: 106px; bottom: calc(34px + var(--safe-b));
  width: 58px; height: 58px; font-size: 20px;
  background: linear-gradient(180deg, #7fb8e8, #3f7fc0);
}
/*
 * Falcon form, above the action button and only while you are in the air. It
 * is the one control with a deadline attached, so it is the loudest.
 */
body.touch .touch-falcon {
  right: 26px; bottom: calc(182px + var(--safe-b));
  width: 68px; height: 68px; font-size: 21px;
  background: linear-gradient(180deg, #7fe3ff, #2f9fd0);
  animation: skyhintPulse 1.9s ease-in-out infinite;
}
/* Leaving the court. Top left, well away from the swing button. */
body.touch .touch-leave {
  left: 18px; top: calc(96px + var(--safe-t));
  width: 46px; height: 46px; font-size: 17px;
  background: rgba(24, 30, 42, 0.7);
}
/* `hidden` is applied by the conductor and has to win over the display grid. */
body.touch .touch-falcon.hidden, body.touch .touch-leave.hidden { display: none; }

/*
 * At 40vw on a 375px screen the chip row wraps to three lines and lands on top
 * of the interaction prompt. Give it room to sit in two, and lift the prompt
 * clear of the tallest that stack can get.
 */
body.touch .hud-bottomright { bottom: calc(178px + var(--safe-b)); max-width: 64vw; gap: 6px; }
body.touch .chip { padding: 7px 10px; font-size: 11px; }
body.touch .hud-progress { display: none; }
body.touch .hud-prompt { bottom: calc(292px + var(--safe-b)); }

/* ------------------------------------------------------------------ dialogue */

.dialogue {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; place-items: end center;
  padding: 0 16px calc(20px + var(--safe-b));
  pointer-events: none;
}
.dialogue-box {
  pointer-events: auto;
  position: relative;
  width: min(760px, 94vw);
  padding: 26px 26px 16px;
  border-radius: 26px;
  background: rgba(255, 250, 240, 0.98);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  animation: dialogueIn 0.24s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes dialogueIn { from { opacity: 0; transform: translateY(22px) scale(0.97); } to { opacity: 1; transform: none; } }

.dialogue-tag {
  position: absolute; top: -16px; left: 22px;
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #43c8bb, var(--teal-deep));
  box-shadow: 0 4px 0 #15665d, var(--shadow-md);
}
.dialogue-name { font-size: 14px; font-weight: 850; color: #fff; }
.dialogue-title { font-size: 10.5px; font-weight: 700; color: rgba(255, 255, 255, 0.82); }

.dialogue-text {
  margin: 0; font-size: 17px; line-height: 1.55; font-weight: 600;
  color: var(--ink); min-height: 3.1em;
}
.dialogue-text .caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 1px;
  background: var(--teal); vertical-align: -0.14em;
  animation: caret 0.8s steps(2) infinite;
}
@keyframes caret { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

.dialogue-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.dialogue-dots { display: flex; gap: 5px; }
.dialogue-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(43, 49, 64, 0.18);
}
.dialogue-dots i.on { background: var(--teal); }
.dialogue-next {
  font-size: 14px; color: var(--teal-deep);
  animation: nudge 1.1s ease-in-out infinite;
}
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ------------------------------------------------------------------ panel */

.panel, .mapview {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 18px;
}
.panel-scrim {
  position: absolute; inset: 0;
  background: rgba(12, 20, 38, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.24s ease;
}
.panel-card {
  position: relative;
  width: min(720px, 96vw);
  max-height: min(86vh, 860px);
  display: flex; flex-direction: column;
  border-radius: 28px;
  background: var(--cream);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: panelIn 0.28s cubic-bezier(0.2, 1.1, 0.4, 1);
}
.panel-card-narrow { width: min(540px, 96vw); }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, var(--cream-2), var(--cream));
}
.panel-eyebrow {
  margin: 0 0 5px; font-size: 11px; font-weight: 850; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--teal-deep);
}
.panel-title { margin: 0; font-size: 26px; font-weight: 850; letter-spacing: -0.025em; line-height: 1.1; }
.panel-role { margin: 5px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-faint); }
.panel-close {
  flex: none; width: 34px; height: 34px; border-radius: 12px;
  border: none; background: rgba(43, 49, 64, 0.08);
  font-size: 14px; font-weight: 800; color: var(--ink-soft);
  display: grid; place-items: center;
}
.panel-close:hover { background: rgba(242, 118, 78, 0.16); color: var(--coral); }

.panel-body {
  padding: 20px 24px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.panel-lede { margin: 0 0 18px; font-size: 16px; line-height: 1.6; font-weight: 600; color: var(--ink); }
.panel-body p { font-size: 14.5px; line-height: 1.66; color: var(--ink-soft); }

.proof-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.proof {
  padding: 12px 18px; border-radius: 16px;
  background: #fff; border: 2px solid var(--line);
  min-width: 118px;
}
.proof-value { font-size: 24px; font-weight: 850; letter-spacing: -0.03em; color: var(--teal-deep); line-height: 1; }
.proof-label { font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-top: 5px; }

.chapter { margin-bottom: 18px; padding-left: 16px; border-left: 3px solid rgba(47, 174, 159, 0.32); }
.chapter h3 { margin: 0 0 6px; font-size: 15px; font-weight: 850; letter-spacing: -0.01em; }
.chapter p { margin: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.tag {
  padding: 5px 11px; border-radius: 999px;
  background: rgba(47, 174, 159, 0.12);
  border: 1.5px solid rgba(47, 174, 159, 0.24);
  font-size: 11.5px; font-weight: 750; color: var(--teal-deep);
}
.tag.alt { background: rgba(143, 111, 208, 0.12); border-color: rgba(143, 111, 208, 0.24); color: #6a4bab; }
.tag.warm { background: rgba(242, 118, 78, 0.12); border-color: rgba(242, 118, 78, 0.26); color: #c9532c; }

.section-label {
  margin: 22px 0 10px; font-size: 11px; font-weight: 850;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint);
}

.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 16px 8px 0 0; padding: 11px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #35c0af, var(--teal-deep));
  color: #fff; font-size: 13.5px; font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 0 #14675e;
  transition: transform 0.12s ease;
}
.link-btn:hover { transform: translateY(-1px); }
.link-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #14675e; }
.link-btn.alt { background: linear-gradient(180deg, #6ea9e8, #2f6fb5); box-shadow: 0 4px 0 #1f4c7e; }
.link-btn.warm { background: linear-gradient(180deg, #f78a63, #d9552c); box-shadow: 0 4px 0 #a03d1c; }

.faq-item {
  margin-bottom: 12px; padding: 16px 18px;
  border-radius: 18px; background: #fff; border: 2px solid var(--line);
}
.faq-q { margin: 0 0 4px; font-size: 12px; font-weight: 800; color: var(--coral); letter-spacing: 0.01em; }
.faq-h { margin: 0 0 8px; font-size: 16px; font-weight: 850; letter-spacing: -0.015em; line-height: 1.28; }
.faq-a { margin: 0; }

.skill-group { margin-bottom: 16px; }
.skill-group h4 {
  margin: 0 0 7px; font-size: 12px; font-weight: 850;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 4px 0 16px; }
.stat { padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--line); }
.stat-l { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.stat-v { font-size: 15px; font-weight: 800; margin-top: 3px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px; background: rgba(47, 174, 159, 0.26);
}
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 5px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--teal); border: 3px solid var(--cream);
}
.tl-date { font-size: 11px; font-weight: 800; color: var(--ink-faint); letter-spacing: 0.05em; }
.tl-title { margin: 2px 0 3px; font-size: 15px; font-weight: 850; }
.tl-body { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }

.poster-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 6px; }
.poster {
  border-radius: 16px; overflow: hidden; border: 2px solid var(--line);
  background: #fff;
}
.poster-art { height: 86px; display: grid; place-items: center; font-size: 26px; }
.poster-meta { padding: 10px 12px 12px; }
.poster-title { font-size: 13.5px; font-weight: 850; line-height: 1.2; }
.poster-sub { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); margin-top: 3px; }

/* ------------------------------------------------------------------ map view */

.mapview-card {
  position: relative;
  width: min(1020px, 96vw);
  max-height: 92vh;
  display: flex; flex-direction: column;
  border-radius: 28px;
  background: var(--cream);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: panelIn 0.28s cubic-bezier(0.2, 1.1, 0.4, 1);
}
.mapview-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 14px; border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, var(--cream-2), var(--cream));
}
.mapview-body {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px; padding: 18px 22px 22px; overflow: hidden; min-height: 0;
}
.mapview-canvas-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#bigmap {
  width: 100%; height: auto; aspect-ratio: 1;
  border-radius: 20px; cursor: crosshair;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  background: #cfe7f2;
}
.mapview-hint { margin: 0; font-size: 11.5px; font-weight: 700; color: var(--ink-faint); text-align: center; }
.mapview-list { overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }

.dest {
  display: block; width: 100%; text-align: left;
  margin-bottom: 8px; padding: 13px 15px;
  border-radius: 16px; background: #fff;
  border: 2px solid var(--line);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.dest:hover { transform: translateX(3px); border-color: rgba(47, 174, 159, 0.5); }
.dest-top { display: flex; align-items: center; gap: 8px; }
.dest-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dest-name { font-size: 14px; font-weight: 850; }
.dest-sub { font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-top: 2px; }
.dest-blurb { font-size: 12px; line-height: 1.45; color: var(--ink-soft); margin: 6px 0 0; }

/* ------------------------------------------------------------------ time view */

.timeview {
  position: fixed; right: 16px; bottom: calc(74px + var(--safe-b)); z-index: 45;
}
.timeview-card {
  width: min(300px, 88vw);
  padding: 16px 18px 18px;
  border-radius: 22px;
  background: rgba(255, 250, 240, 0.98);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  animation: panelIn 0.22s cubic-bezier(0.2, 1.1, 0.4, 1);
}
.timeview-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 850; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px;
}
.timeview-head .panel-close { width: 26px; height: 26px; border-radius: 9px; font-size: 12px; }
#time-slider {
  width: 100%; margin: 0; -webkit-appearance: none; appearance: none;
  height: 10px; border-radius: 99px; outline: none;
  background: linear-gradient(90deg, #16203c 0%, #7a5470 18%, #ffc38a 27%, #8ccbee 42%,
    #7dc4ee 58%, #f2925a 78%, #3a3468 86%, #0a1024 100%);
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--gold);
  box-shadow: var(--shadow-md); cursor: grab;
}
#time-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--gold);
  box-shadow: var(--shadow-md); cursor: grab;
}
.timeview-readout { text-align: center; margin-top: 10px; font-size: 16px; font-weight: 850; font-variant-numeric: tabular-nums; }
.timeview-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.timeview-presets button {
  padding: 8px 4px; border-radius: 11px; border: 2px solid var(--line);
  background: #fff; font-size: 11px; font-weight: 800; color: var(--ink-soft);
}
.timeview-presets button:hover { border-color: rgba(47, 174, 159, 0.5); color: var(--teal-deep); }
.timeview-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 12px; font-weight: 750; color: var(--ink-soft); cursor: pointer;
}
.timeview-toggle input { width: 16px; height: 16px; accent-color: var(--teal); }

/* ------------------------------------------------------------------ help */

.help-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center;
}
.help-grid > div { display: flex; gap: 4px; }
.help-grid p { margin: 0; font-size: 13.5px; }
.help-note {
  margin: 20px 0 0; padding: 14px 16px; border-radius: 14px;
  background: rgba(78, 163, 224, 0.09); border: 2px solid rgba(78, 163, 224, 0.2);
  font-size: 13px !important; line-height: 1.55;
}

/* ------------------------------------------------------------------ noscript */

.noscript {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-content: center; gap: 10px;
  padding: 40px; text-align: center;
  background: var(--cream); color: var(--ink);
}
.noscript a { color: var(--teal-deep); font-weight: 800; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .mapview-body { grid-template-columns: 1fr; overflow-y: auto; }
  .mapview-list { max-height: 30vh; }
}

@media (max-width: 640px) {
  .minimap-wrap { width: 118px; height: 118px; border-radius: 20px; }
  .minimap-hint { display: none; }
  .place-card { min-width: 0; padding: 8px 14px 9px; }
  .place-name { font-size: 14px; }
  .place-sub { font-size: 10px; }
  .clock-card { padding: 6px 12px 6px 7px; }
  .clock-dial { width: 28px; height: 28px; }
  .chip { padding: 8px 11px; font-size: 11.5px; }
  .chip-icon {
  min-width: 40px; justify-content: center;
  font-size: 15px; line-height: 1;
}
.chip-icon.is-off { color: var(--ink-faint); }

.chip-key { display: none; }
  .dialogue-text { font-size: 15px; }
  .panel-title { font-size: 21px; }
  .startcard-keys { grid-template-columns: 1fr; }
  .startcard-title { font-size: 30px; }
  .hud-compass { max-width: 54vw; padding: 6px 6px 6px 11px; }

  /* The scoreboard has to clear the place card on a narrow screen, and the
     keyboard hints below it are meaningless on a phone. */
  .scoreboard { top: calc(74px + var(--safe-t)); padding: 7px 15px 6px; border-radius: 14px; }
  .scoreboard-points { font-size: 20px; }
  .scoreboard-name { font-size: 10.5px; }
  .scoreboard-note { font-size: 11px; }
  .scoreboard-keys { display: none; }

  .skyhint { padding: 11px 19px 11px 11px; gap: 10px; }
  .skyhint-key { min-width: 32px; height: 32px; font-size: 15px; }
  .skyhint-label { font-size: 14px; }
}

/* On a phone the falcon has its own button, so the keyboard card is noise. */
body.touch .skyhint { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.05s !important; }
}
