@import url('https://fonts.googleapis.com/css2?family=Onest:wght@300..900&display=swap');

:root {
  color-scheme: dark;
  --bg-dark: #0b1e2c;
  --ink: #f4f4f5;
  --ink-muted: #d4d4d8;
  --muted: #a1a1aa;
  --subtle: #71717a;
  --line: rgba(255, 255, 255, 0.1);
  --line-hover: rgba(255, 255, 255, 0.2);
  --surface: rgba(24, 24, 28, 0.94);
  --surface-elevated: rgba(32, 32, 38, 0.96);
  --surface-modal: linear-gradient(175deg, rgba(28, 28, 33, 0.98), rgba(18, 18, 22, 0.99));
  --gold: #fbbf24;
  --gold-hover: #f59e0b;
  --gold-subtle: rgba(251, 191, 36, 0.15);
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family:
    'Onest Variable',
    'Onest',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  background: radial-gradient(ellipse at 50% 40%, #0d2133 0%, #091724 60%, #050d15 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button,
canvas {
  touch-action: none;
}

button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

button:disabled {
  cursor: default;
}

button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button[hidden],
[hidden] {
  display: none !important;
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  opacity: 0;
  transition: opacity 1.2s ease;
  cursor: grab;
}

#world.ready {
  opacity: 1;
}

#world.dragging {
  cursor: grabbing;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 45%, #040e1b55),
    linear-gradient(to top, #04142180, transparent 28%, transparent 82%, #04142125);
  z-index: 1;
}

/* ── Topbar & Header ── */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px 32px;
  pointer-events: none;
  z-index: 5;
}

.topbar button {
  pointer-events: auto;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
}

.wordmark > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  font-size: 12px;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: #ffffff;
}

.edition {
  font-size: 8px;
  letter-spacing: 0.21em;
  color: var(--muted);
  text-transform: uppercase;
}

.planet-logo {
  width: 30px;
  height: 30px;
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: rotate(-25deg);
}

.planet-logo:before {
  content: '';
  position: absolute;
  inset: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.planet-logo:after {
  content: '';
  position: absolute;
  inset: 9px -5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.planet-logo i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  right: -3px;
  top: 5px;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.tools {
  display: flex;
  gap: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: var(--surface-elevated);
  border-color: var(--line-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.icon-button[aria-pressed='true'] {
  color: var(--gold);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(32, 28, 22, 0.95);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.2);
}

.sound-on {
  display: none;
}
#sound-button[aria-pressed='true'] .sound-on {
  display: block;
}
#sound-button[aria-pressed='true'] .sound-off {
  display: none;
}

/* ── Weather & Synchronized Time Badge ── */
.weather-badge {
  position: absolute;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 8px 16px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  user-select: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.weather-badge:hover {
  background: var(--surface-elevated);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.weather-badge .weather-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  color: var(--gold);
}

.weather-badge .weather-icon svg {
  width: 17px;
  height: 17px;
}

.weather-badge .weather-temp {
  font-weight: 600;
  color: #ffffff;
}

.weather-badge .weather-sep {
  opacity: 0.4;
  font-size: 11px;
}

.weather-badge .weather-time {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: -0.01em;
}

/* ── Simulator Panel Styling ── */
dialog#simulator.panel,
.simulator-panel {
  width: min(520px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
}

.sim-section {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.sim-badge-val {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sim-slider {
  width: 100%;
  accent-color: #f59e0b;
  cursor: pointer;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
}

.sim-btn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .sim-btn-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sim-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.sim-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.sim-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.sim-btn-icon {
  font-size: 16px;
}

.sim-reset-btn {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-reset-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ── Journal Trigger Pill ── */
.journal-button {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 8px 18px;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.journal-button:hover {
  background: var(--surface-elevated);
  border-color: var(--line-hover);
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.journal-button svg {
  width: 17px;
  height: 17px;
  color: var(--gold);
}

#progress-number {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: #ffffff;
}

#progress-number > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.journal-caption {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* ── Region Floating Overlay (Frameless) ── */
.region,
.is-follow .region {
  position: fixed;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: 84px !important;
  transform: translateX(-50%) !important;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.region .eyebrow {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.75);
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.9),
    0 2px 10px rgba(0, 0, 0, 0.8);
  text-align: center;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.region h1,
.is-follow .region h1 {
  font-family: 'Onest Variable', 'Onest', sans-serif;
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 2px 0 6px;
  line-height: 1.1;
  text-shadow:
    0 2px 14px rgba(0, 0, 0, 0.95),
    0 4px 28px rgba(0, 0, 0, 0.85);
  text-align: center;
  color: #ffffff;
}

.region p,
.is-follow .region p {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(244, 244, 245, 0.92);
  text-shadow:
    0 1px 6px rgba(0, 0, 0, 0.95),
    0 2px 16px rgba(0, 0, 0, 0.85);
  margin: 0;
  text-align: center;
  max-width: 350px;
}

/* ── Interaction Area (Matches Image 4) ── */
.interaction-area {
  position: fixed;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  top: 78px;
  bottom: auto !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.interact-button {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: left;
  color: var(--ink);
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.18s,
    border-color 0.18s,
    box-shadow 0.18s;
}

.interact-button:hover {
  transform: translateY(-2px);
  background: var(--surface-elevated);
  border-color: var(--line-hover);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.interact-button:active {
  transform: translateY(0) scale(0.98);
}

.keycap {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.action-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.action-copy > span {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.action-copy strong {
  font-weight: 650;
  font-size: 13px;
  color: #ffffff;
  white-space: nowrap;
}

.interact-button > svg {
  margin-left: auto;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition:
    transform 0.2s,
    color 0.2s;
}

.interact-button:hover > svg {
  color: #ffffff;
  transform: translateX(2px);
}

.walk-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.tiny-spark {
  color: var(--gold);
  font-size: 11px;
}

.hint-divider {
  width: 1px;
  height: 11px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

/* ── Control Strip (Frameless Bottom Controls) ── */
.control-strip {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  z-index: 4;
  transition: opacity 0.4s ease;
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.control-keys {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.control-keys > kbd {
  margin: 0 !important;
}

kbd {
  font-family: 'Onest Variable', 'Onest', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(18, 24, 34, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-color: rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: #f4f4f5;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition:
    border-color 0.2s,
    background 0.2s,
    color 0.2s;
}

.control-label {
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: #d4d4d8;
  line-height: 1;
  font-weight: 500;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.95),
    0 2px 10px rgba(0, 0, 0, 0.8);
  transition: color 0.2s;
}

.control-item:hover .control-label {
  color: #ffffff;
}

.control-item:hover kbd {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.is-follow .control-strip {
  opacity: 0.95;
}

/* ── Journey Pill & Toast ── */
.journey {
  position: fixed;
  left: 50%;
  top: 83px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px 14px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  color: #e4e4e7;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.journey-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
  animation: breathe 2s infinite;
}

.journey button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 3px;
  transition: color 0.2s;
}

.journey button:hover {
  color: #ffffff;
}

.toast {
  position: fixed;
  left: 50%;
  top: 144px;
  transform: translate(-50%, -10px);
  z-index: 8;
  text-align: center;
  max-width: min(440px, 85vw);
  width: max-content;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast strong {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin-bottom: 3px;
  text-transform: uppercase;
}

/* ── Loading Screen ── */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  z-index: 10;
  background: #0b1e2c;
  transition: opacity 0.7s ease;
  pointer-events: none;
}

.loading p {
  font-family: 'Onest Variable', 'Onest', sans-serif;
  font-size: 22px;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: #ffffff;
}

.loading p span {
  display: block;
  font-family: 'Onest Variable', 'Onest', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 12px;
  text-transform: uppercase;
}

.loading-orb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #0284c7);
  box-shadow:
    inset -9px -6px 0 rgba(0, 0, 0, 0.4),
    0 0 42px rgba(251, 191, 36, 0.25);
  animation: breathe 1.8s infinite;
}

.loading.fade {
  opacity: 0;
}

/* ── Perfectly Centered Dialog Modals (#journal & #help) ── */
dialog.panel,
dialog#journal,
dialog#help {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: min(480px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  height: fit-content !important;
  max-height: min(720px, calc(100dvh - 48px)) !important;
  box-sizing: border-box !important;
  border-radius: 28px !important;
  background: var(--surface-modal) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(28px) !important;
  -webkit-backdrop-filter: blur(28px) !important;
  padding: 34px !important;
  color: var(--ink) !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent !important;
}

dialog.panel:not([open]),
dialog#journal:not([open]),
dialog#help:not([open]) {
  display: none !important;
}

dialog.panel::backdrop,
dialog#journal::backdrop,
dialog#help::backdrop {
  background: rgba(8, 8, 12, 0.72) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.panel h2 {
  font-family: 'Onest Variable', 'Onest', sans-serif;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 10px 0 8px;
  color: #ffffff;
}

.panel-intro {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.close-panel {
  position: absolute;
  right: 20px;
  top: 18px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-panel:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--line-hover);
  color: #ffffff;
  transform: rotate(90deg);
}

.journal-progress {
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 18px;
}

#journal-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journal-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
  padding: 11px 14px;
  border-radius: 16px;
  transition: all 0.2s ease;
}

.journal-entry:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.entry-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.journal-entry.completed .entry-number {
  background: var(--entry-color, var(--success));
  border-color: var(--entry-color, var(--success));
  color: #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
  font-weight: 700;
}

.entry-copy {
  flex: 1;
}

.entry-copy strong {
  font-size: 13.5px;
  font-weight: 650;
  color: #ffffff;
  display: block;
  margin-bottom: 2px;
}

.entry-copy span {
  font-size: 11px;
  color: var(--muted);
}

.entry-arrow {
  font-size: 16px;
  color: var(--subtle);
  transition:
    transform 0.2s,
    color 0.2s;
}

.journal-entry:hover .entry-arrow {
  color: #ffffff;
  transform: translate(2px, -2px);
}

.journal-footnote {
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.6;
  margin: 20px 0 0;
  text-align: center;
}

.help-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 13px 12px;
  font-size: 11.5px;
  align-items: center;
}

.help-grid > span:nth-child(odd) {
  color: var(--muted);
  font-weight: 500;
}

.help-grid kbd {
  height: 22px;
  font-size: 10px;
  padding: 0 6px;
}

.primary-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 13px 20px;
  background: var(--gold);
  color: #18181b;
  border: 0;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-button:hover {
  background: var(--gold-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

/* ── Fallback & Utilities ── */
.joystick,
.jump-button {
  display: none;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #0b1e2c;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 32px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
}

.fallback span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
  max-width: 340px;
}

.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;
}

.is-follow .control-strip {
  opacity: 0.9;
}

.is-follow #walk-hint {
  display: none;
}

.is-moving .region p {
  opacity: 0.7;
}

@keyframes breathe {
  50% {
    transform: scale(0.95);
    opacity: 0.75;
  }
}

/* ── Responsive Viewports ── */
@media (max-width: 950px) {
  .region,
  .is-follow .region {
    max-width: 280px;
    padding: 0;
  }
  .region h1,
  .is-follow .region h1 {
    font-size: 22px;
  }
  .region p,
  .is-follow .region p {
    font-size: 11px;
    max-width: 220px;
  }
  .topbar {
    padding: 20px 24px;
  }
  .control-strip {
    gap: 16px;
    padding: 0;
  }
}

@media (max-width: 650px) {
  .weather-badge {
    left: 16px;
    padding: 6px 12px;
    min-height: 36px;
    font-size: 11px;
    gap: 6px;
  }
  .weather-badge .weather-time,
  .weather-badge .weather-sep {
    display: none;
  }
  .topbar {
    padding: max(16px, env(safe-area-inset-top)) 16px 12px;
    gap: 8px;
  }
  .journal-button {
    left: auto;
    right: 104px;
    transform: none;
    padding: 7px 12px;
    gap: 8px;
    min-height: 36px;
  }
  .journal-button:hover {
    transform: translateY(-1px);
  }
  .journal-button svg {
    width: 15px;
    height: 15px;
  }
  .journal-caption {
    display: none;
  }
  .tools {
    gap: 6px;
  }
  .icon-button {
    width: 36px;
    height: 36px;
  }
  .icon-button svg {
    width: 18px;
    height: 18px;
  }
  .help-button {
    display: none;
  }
  .region,
  .is-follow .region {
    bottom: 74px !important;
    padding: 0;
    max-width: calc(100vw - 32px);
  }
  .region h1,
  .is-follow .region h1 {
    font-size: 20px;
    margin-bottom: 2px;
  }
  .region p,
  .is-follow .region p {
    font-size: 10px;
    max-width: 280px;
  }
  .interaction-area {
    top: 68px;
    bottom: auto !important;
    width: calc(100% - 32px);
  }
  .interact-button {
    min-width: 220px;
    gap: 11px;
    padding: 11px 14px;
  }
  .action-copy strong {
    font-size: 12px;
  }
  .toast {
    top: 134px;
    font-size: 11px;
    padding: 11px 16px;
  }
  .control-strip {
    bottom: 20px;
    font-size: 8.5px;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 36px);
    padding: 0;
  }
  .control-strip > span:nth-child(2),
  .control-strip > span:nth-child(3) {
    display: none;
  }
  .walk-hint {
    white-space: normal;
    max-width: 220px;
    line-height: 1.7;
    text-align: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .walk-hint .hint-divider {
    display: none;
  }
  .journey {
    top: 140px;
    font-size: 10px;
  }
  dialog.panel,
  dialog#journal,
  dialog#help {
    padding: 26px 20px !important;
    max-height: calc(100dvh - 36px) !important;
  }
  .panel h2 {
    font-size: 24px;
  }
  .journal-entry {
    padding: 10px 10px;
  }
  .help-grid {
    grid-template-columns: 100px 1fr;
    font-size: 10.5px;
  }
}

/* ── Mobile Touch Controls ── */
@media (pointer: coarse), (max-width: 650px) {
  .joystick {
    display: block;
    position: fixed;
    z-index: 7;
    left: max(24px, env(safe-area-inset-left));
    bottom: max(28px, env(safe-area-inset-bottom));
    width: 88px;
    height: 88px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    touch-action: none;
  }
  .joystick:before {
    content: '';
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
  }
  .joystick-cross:before,
  .joystick-cross:after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
  }
  .joystick-cross:before {
    width: 1px;
    height: 64px;
    left: 43px;
    top: 12px;
  }
  .joystick-cross:after {
    height: 1px;
    width: 64px;
    top: 43px;
    left: 12px;
  }
  #joystick-knob {
    display: block;
    position: absolute;
    left: 28px;
    top: 28px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
  }
  .jump-button {
    display: grid;
    place-items: center;
    position: fixed;
    z-index: 7;
    right: max(26px, env(safe-area-inset-right));
    bottom: max(38px, env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #f4f4f5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
  .jump-button svg {
    width: 22px;
    height: 22px;
  }
  .control-strip {
    display: none;
  }
  .interact-key {
    font-size: 0;
  }
  .interact-key:after {
    content: '✦';
    font-size: 17px;
  }
  .interaction-area {
    top: 68px;
    bottom: auto !important;
  }
  .region,
  .is-follow .region {
    bottom: 24px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 360px) {
  .brand {
    font-size: 10px;
    letter-spacing: 0.16em;
  }
  .edition {
    font-size: 6px;
  }
  .journal-button {
    right: 96px;
    padding: 7px 10px;
  }
}
