/* EmberWing Web Edition — Ori/Alto Restrained Typography, Safe-Area & 390x844 Responsive Styling */

:root {
  --hiq-safe-top: 0px;
  --hiq-safe-right: 0px;
  --hiq-safe-bottom: 0px;
  --hiq-safe-left: 0px;

  --safe-top: max(var(--hiq-safe-top, 0px), env(safe-area-inset-top, 0px));
  --safe-right: max(var(--hiq-safe-right, 0px), env(safe-area-inset-right, 0px));
  --safe-bottom: max(var(--hiq-safe-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --safe-left: max(var(--hiq-safe-left, 0px), env(safe-area-inset-left, 0px));

  --bg-deep: #0b130f;
  --surface-glass: rgba(14, 22, 18, 0.78);
  --surface-card: rgba(17, 25, 22, 0.92);
  --surface-elevated: rgba(26, 38, 33, 0.94);
  --border-warm: rgba(255, 214, 134, 0.28);
  --border-soft: rgba(255, 255, 255, 0.14);

  --ink-primary: #f8f4ea;
  --ink-secondary: #cfd6cc;
  --ink-muted: #9aa79c;
  --amber-gold: #ffca57;
  --amber-deep: #e08624;
  --cyan-glow: #6ef0ff;
  --danger-coral: #ff7a66;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-display: 'Georgia', 'Iowan Old Style', 'Palatino Linotype', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--ink-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #16241d 0%, #090f0c 100%);
}

.stage-canvas-host {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.flight-input-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
  touch-action: none;
}

.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.screen-overlay[hidden],
[hidden] {
  display: none !important;
}

/* Loading Veil */
.loading-veil {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, #182b20 0%, #090e0c 100%);
  transition: opacity 0.35s ease;
}

.loading-veil.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  text-align: center;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  background: rgba(16, 26, 21, 0.85);
  border: 1px solid var(--border-warm);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.loading-crest {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff5cc 0%, #ffba42 52%, #b04f14 100%);
  box-shadow: 0 0 28px rgba(255, 196, 82, 0.65);
}

.loading-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.04em;
  color: var(--ink-primary);
}

.loading-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--ink-secondary);
}

/* Shared Pills & Buttons (>= 44px touch targets & >= 4.5:1 contrast) */
button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  color: var(--ink-primary);
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease;
}

button:active {
  transform: scale(0.97);
}

button:focus-visible {
  outline: 2px solid var(--amber-gold);
  outline-offset: 2px;
}

.amber-pill,
.hud-amber-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(16, 22, 19, 0.84);
  border: 1px solid rgba(255, 202, 87, 0.45);
  color: var(--amber-gold);
  font-weight: 700;
  font-size: 15px;
  backdrop-filter: blur(8px);
}

.amber-gem-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff4bd 0%, #ffbe3b 55%, #cf6d11 100%);
  box-shadow: 0 0 8px rgba(255, 198, 72, 0.8);
  flex-shrink: 0;
}

.icon-pill-btn,
.nav-pill-btn,
.secondary-btn-sm,
.close-btn {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  background: rgba(16, 24, 20, 0.84);
  border: 1px solid var(--border-warm);
  color: var(--ink-primary);
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.icon-pill-btn:hover,
.nav-pill-btn:hover,
.secondary-btn-sm:hover,
.close-btn:hover {
  background: rgba(30, 44, 37, 0.94);
  border-color: rgba(255, 214, 134, 0.56);
}

.primary-cta {
  pointer-events: auto;
  width: 100%;
  max-width: 360px;
  min-height: 58px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffd16b 0%, #e59029 100%);
  color: #1c1105;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 10px 28px rgba(235, 146, 40, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.primary-cta:hover {
  filter: brightness(1.06);
}

.primary-cta .cta-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.primary-cta .cta-sub {
  font-size: 12px;
  font-weight: 600;
  color: #3a2208;
}

.compact-cta {
  min-height: 48px;
  font-size: 16px;
  font-weight: 800;
}

.primary-btn-sm {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #ffd16b 0%, #e59029 100%);
  color: #1c1105;
  font-size: 14px;
  font-weight: 800;
}

.ghost-btn {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(15, 22, 19, 0.56);
  border: 1px solid var(--border-soft);
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 600;
}

.ghost-btn:hover {
  color: var(--ink-primary);
  background: rgba(25, 36, 30, 0.85);
}

.danger-btn-sm {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: rgba(156, 36, 26, 0.86);
  border: 1px solid rgba(255, 130, 110, 0.45);
  color: #fff2f0;
  font-size: 13px;
  font-weight: 700;
}

/* START SCREEN OVERLAY */
.overlay-start {
  padding:
    calc(var(--safe-top) + 14px)
    calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + 16px)
    calc(var(--safe-left) + 16px);
  justify-content: space-between;
}

.start-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.title-lockup {
  position: relative;
  max-width: 68%;
  padding: 12px 24px 18px 14px;
  margin: -12px 0 0 -14px;
  border-radius: 28px;
  /* W2-4: Soft feathered dark radial backing so top-left title holds >= 7:1 contrast over sunlit foliage on tablet/mobile */
  background: radial-gradient(
    ellipse at 28% 36%,
    rgba(9, 13, 10, 0.78) 0%,
    rgba(9, 13, 10, 0.52) 52%,
    rgba(9, 13, 10, 0.0) 82%
  );
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.88), 0 1px 3px rgba(0, 0, 0, 0.95);
}

.title-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-gold);
  margin-bottom: 4px;
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1.04;
  letter-spacing: 0.03em;
  color: #fff9ec;
}

.title-tagline {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: #e2e6dc;
}

.start-top-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.start-spacer {
  flex: 1;
}

.start-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.difficulty-row {
  pointer-events: auto;
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(12, 18, 15, 0.82);
  border: 1px solid var(--border-soft);
  gap: 4px;
  backdrop-filter: blur(8px);
}

.diff-pill {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 700;
}

.diff-pill.is-active {
  background: rgba(255, 202, 87, 0.22);
  color: var(--amber-gold);
  border: 1px solid rgba(255, 202, 87, 0.55);
}

.start-nav-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.start-nav-bar .nav-pill-btn {
  padding: 0 6px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* IN-FLIGHT HUD */
.overlay-hud {
  padding:
    calc(var(--safe-top) + 10px)
    calc(var(--safe-right) + 12px)
    calc(var(--safe-bottom) + 14px)
    calc(var(--safe-left) + 12px);
  justify-content: space-between;
}

.flight-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-score-chip {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-primary);
  background: rgba(14, 21, 18, 0.72);
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}

.hud-center {
  flex: 1;
  min-width: 0;
  max-width: 240px;
  text-align: center;
}

.hud-biome-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #f4f1e6;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-progress-track {
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: rgba(12, 18, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #6ef0ff 0%, #ffd26b 100%);
  transition: width 0.12s linear;
}

.hud-right {
  flex-shrink: 0;
}

.hud-pause-btn {
  pointer-events: auto;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(14, 21, 18, 0.78);
  border: 1px solid var(--border-soft);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .flight-hud-bar {
    gap: 6px;
  }
  .hud-left {
    gap: 5px;
  }
  .hud-amber-chip {
    min-height: 36px;
    padding: 0 9px;
    gap: 5px;
    font-size: 13.5px;
  }
  .hud-score-chip {
    padding: 5px 9px;
    font-size: 13px;
  }
  .hud-biome-label {
    font-size: 11px;
  }
  .hud-pause-btn {
    padding: 0 11px;
    font-size: 12.5px;
  }
}

.hud-friend-badge {
  align-self: center;
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(15, 42, 48, 0.88);
  border: 1px solid rgba(110, 240, 255, 0.55);
  color: var(--cyan-glow);
  font-size: 13px;
  font-weight: 700;
}

.hud-tap-hint {
  align-self: center;
  margin-top: auto;
  margin-bottom: 18px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(12, 18, 15, 0.76);
  border: 1px solid var(--border-warm);
  color: var(--amber-gold);
  font-size: 14px;
  font-weight: 600;
}

.caption-bar {
  align-self: center;
  margin-top: auto;
  max-width: min(92%, 520px);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(10, 15, 13, 0.88);
  border: 1px solid var(--border-warm);
  color: var(--ink-primary);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.caption-speaker {
  color: var(--amber-gold);
  font-weight: 800;
  margin-right: 6px;
}

/* MOTION-COMIC CUTSCENE */
.overlay-cutscene {
  pointer-events: auto;
  background: rgba(7, 11, 9, 0.94);
  padding:
    calc(var(--safe-top) + 12px)
    calc(var(--safe-right) + 14px)
    calc(var(--safe-bottom) + 14px)
    calc(var(--safe-left) + 14px);
}

.cutscene-shell {
  width: 100%;
  max-width: 680px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cutscene-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cutscene-subtitle {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-gold);
}

.cutscene-title {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
}

.cutscene-stage {
  flex: 1;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0d13;
  border-radius: var(--radius-lg);
  padding: 6px;
}

.cutscene-panel-frame {
  position: relative;
  height: 100%;
  max-height: 470px;
  aspect-ratio: 9 / 14;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 214, 134, 0.56);
  background: #0f0d13;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 240, 196, 0.18);
}

.cutscene-panel-frame.is-landscape {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.cutscene-panel-frame.is-square-top {
  width: auto;
  max-width: 100%;
  max-height: 440px;
  aspect-ratio: 1 / 1;
}

@media (max-width: 480px) {
  .cutscene-panel-frame.is-square-top {
    width: 100%;
    height: auto;
    max-width: min(100%, 440px);
    max-height: 100%;
  }
}

.cutscene-panel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.02);
  animation: kenBurnsPush 9s ease-in-out infinite alternate;
}

/* Crop baked 14.5% blurry pillarbars on narrative_prologue_panel_* cleanly */
.cutscene-panel-img.is-prologue-crop {
  transform: scale(1.44);
  animation: kenBurnsPushPrologue 9s ease-in-out infinite alternate;
}

/* Crop baked 44% empty bottom slab on Ch 3 & Ch 4 top-square panels cleanly */
.cutscene-panel-img.is-square-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform-origin: center 28%;
}

[data-reduce-motion='true'] .cutscene-panel-img {
  animation: none !important;
  transform: none !important;
}

[data-reduce-motion='true'] .cutscene-panel-img.is-prologue-crop {
  animation: none !important;
  transform: scale(1.44) !important;
}

@keyframes kenBurnsPush {
  from { transform: scale(1.0); }
  to { transform: scale(1.06); }
}

@keyframes kenBurnsPushPrologue {
  from { transform: scale(1.43); }
  to { transform: scale(1.50); }
}

.cutscene-panel-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink-secondary);
  background: radial-gradient(circle at 45% 35%, #243b2c 0%, #0d1511 100%);
}

.cutscene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.65);
}

.cutscene-caption-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border-warm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cutscene-visual-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

.cutscene-dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-line {
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-primary);
}

.dialogue-line strong {
  color: var(--amber-gold);
  margin-right: 6px;
}

.cutscene-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.cutscene-step-label {
  font-size: 13px;
  color: var(--ink-secondary);
  font-weight: 600;
}

/* OASIS SUMMARY (Sits gracefully in lower half so Oasis scene shines above!) */
.overlay-oasis {
  padding:
    calc(var(--safe-top) + 16px)
    calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + 16px)
    calc(var(--safe-left) + 16px);
  justify-content: space-between;
  align-items: center;
}

.oasis-top-banner {
  text-align: center;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.85);
}

.oasis-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(16, 28, 22, 0.82);
  border: 1px solid var(--border-warm);
  color: var(--amber-gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.oasis-heading {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 26px;
  color: #fffaf0;
}

.oasis-spacer {
  flex: 1;
}

.oasis-summary-card {
  pointer-events: auto;
  width: 100%;
  max-width: 440px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(14, 22, 19, 0.88);
  border: 1px solid var(--border-warm);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary-stat {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  display: block;
  margin-top: 4px;
  font-size: 19px;
  font-weight: 800;
}

.amber-text {
  color: var(--amber-gold);
}

.oasis-mastery-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.mastery-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.mastery-pill.is-earned {
  background: rgba(255, 202, 87, 0.14);
  border-color: rgba(255, 202, 87, 0.55);
  color: var(--amber-gold);
}

.summary-reward-line {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-glow);
  text-align: center;
}

.summary-shop-goal {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-secondary);
  text-align: center;
}

.summary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* CENTERED MODALS (Game Over / Pause) */
.overlay-modal-center {
  pointer-events: auto;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 8, 0.72);
  padding: 18px;
}

.modal-card {
  width: 100%;
  max-width: 390px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border-warm);
  text-align: center;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.65);
}

.modal-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-gold);
}

.modal-title {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: 24px;
}

.modal-sub {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-secondary);
}

.modal-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.modal-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* FULL SHEETS (Map, Shop, Journal, Settings) */
.overlay-sheet {
  pointer-events: auto;
  background: rgba(6, 10, 8, 0.80);
  backdrop-filter: blur(8px);
  padding:
    calc(var(--safe-top) + 12px)
    calc(var(--safe-right) + 12px)
    calc(var(--safe-bottom) + 12px)
    calc(var(--safe-left) + 12px);
  align-items: center;
  justify-content: center;
}

.sheet-card {
  width: 100%;
  max-width: 720px;
  height: 100%;
  max-height: 820px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border-warm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.68);
}

.compact-sheet {
  max-width: 520px;
  height: auto;
  max-height: 92%;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.sheet-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-title {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 22px;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* MAP CHAPTER CARDS WITH PAINTED BIOME BANNER STRIPS & GLOWING ROUTE SPINE (W-5) */
.map-route-container {
  position: relative;
  padding-left: 22px;
}

.map-route-spine {
  position: absolute;
  left: 8px;
  top: 22px;
  bottom: 92px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 204, 88, 0.85) 0%, rgba(110, 240, 255, 0.55) 45%, rgba(164, 146, 122, 0.32) 100%);
  box-shadow: 0 0 12px rgba(255, 204, 88, 0.45);
}

.chapter-card {
  position: relative;
  padding: 0 0 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.chapter-card::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 28px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #595249;
  border: 2px solid rgba(255, 214, 134, 0.45);
  z-index: 2;
}

.chapter-card.is-lit {
  border-color: rgba(255, 202, 87, 0.55);
}

.chapter-card.is-lit::before {
  background: var(--amber-gold);
  box-shadow: 0 0 12px rgba(255, 202, 87, 0.9);
}

.chapter-banner {
  position: relative;
  padding: 12px 14px;
  margin-bottom: 10px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(255, 214, 134, 0.22);
}

.chapter-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10, 16, 14, 0.88) 0%, rgba(10, 16, 14, 0.68) 65%, rgba(10, 16, 14, 0.84) 100%);
}

.chapter-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chapter-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chapter-swatch {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-warm);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(12, 18, 16, 0.72);
}

.chapter-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff9ec;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.chapter-biome-sub {
  font-size: 12px;
  color: #d6dcd3;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.flight-btn-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px;
}

.flight-select-btn {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.flight-select-btn.is-complete {
  border-color: rgba(110, 240, 255, 0.5);
  color: var(--cyan-glow);
}

.flight-select-btn.is-current {
  border-color: var(--amber-gold);
  background: rgba(255, 202, 87, 0.16);
}

.flight-select-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.flight-feathers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.feather-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.feather-pip.is-earned {
  background: var(--amber-gold);
  border-color: #fff2c2;
  box-shadow: 0 0 6px rgba(255, 202, 87, 0.78);
}

.endless-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(28, 52, 46, 0.92), rgba(18, 28, 36, 0.94));
  border: 1px solid rgba(110, 240, 255, 0.42);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

/* SHOP GRID */
.shop-subbar {
  padding: 12px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-tabs {
  display: flex;
  gap: 8px;
}

.shop-tab {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 700;
}

.shop-tab.is-active {
  background: rgba(255, 202, 87, 0.2);
  border-color: var(--amber-gold);
  color: var(--amber-gold);
}

.shop-recommendation {
  margin: 0;
  font-size: 13px;
  color: var(--cyan-glow);
  font-weight: 600;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  align-content: start;
}

.shop-item-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.shop-item-card.is-equipped {
  border-color: var(--amber-gold);
  box-shadow: 0 0 16px rgba(255, 202, 87, 0.22);
}

.cosmetic-swatch {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cosmetic-swatch img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.shop-item-name {
  font-size: 14px;
  font-weight: 700;
}

.shop-item-meta {
  font-size: 11px;
  color: var(--ink-muted);
}

.shop-action-btn {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-soft);
  color: var(--ink-primary);
}

.shop-action-btn.is-buy {
  background: linear-gradient(180deg, #ffd16b 0%, #e59029 100%);
  color: #1c1105;
  border: none;
}

.shop-action-btn.is-equipped {
  background: rgba(110, 240, 255, 0.16);
  border-color: rgba(110, 240, 255, 0.55);
  color: var(--cyan-glow);
}

/* JOURNAL */
.journal-section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber-gold);
}

.journal-friends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.friend-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-soft);
}

.journal-entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--border-soft);
}

.journal-entry-title {
  font-size: 14px;
  font-weight: 700;
}

.journal-entry-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* SETTINGS */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-soft);
}

.setting-help {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.text-input {
  width: 140px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-warm);
  background: rgba(10, 16, 13, 0.9);
  color: var(--ink-primary);
  font-size: 14px;
  font-weight: 600;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: '';
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background-color: var(--amber-deep);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* TOASTS — Anchored Above Bottom Dialogue Captions & Tap Hints (Zero HUD/Sheet Collision) */
.toast-region {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 112px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: max-content;
  max-width: 90%;
}

.toast-pill {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: rgba(14, 24, 20, 0.92);
  border: 1px solid var(--border-warm);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
}

@media (min-width: 768px) {
  .overlay-start {
    padding:
      calc(var(--safe-top) + 24px)
      calc(var(--safe-right) + 32px)
      calc(var(--safe-bottom) + 28px)
      calc(var(--safe-left) + 32px);
  }
  .hud-center {
    max-width: 360px;
  }
  .start-nav-bar .nav-pill-btn {
    font-size: 14px;
  }
  .oasis-summary-card {
    max-width: 500px;
  }
  .shop-grid {
    grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  }
}

@media (min-width: 1024px) {
  .overlay-hud {
    padding:
      calc(var(--safe-top) + 16px)
      calc(var(--safe-right) + 28px)
      calc(var(--safe-bottom) + 20px)
      calc(var(--safe-left) + 28px);
  }
  .hud-center {
    max-width: 440px;
  }
  .sheet-card {
    max-width: 820px;
  }
}
