:root {
  --bg-deep: #070b16;
  --ink: #121824;
  --card-bg: rgba(18, 25, 42, 0.88);
  --dock-bg: rgba(14, 21, 36, 0.52);
  --dock-border: rgba(85, 185, 243, 0.42);
  --card-light: #f7f9fc;
  --blue-primary: #1472e8;
  --blue-bright: #55b9f3;
  --blue-glow: rgba(85, 185, 243, 0.45);
  --btn-grad: linear-gradient(180deg, #5ec2ff 0%, #1472e8 100%);
  --amber-gold: #ffbe3b;
  --text-light: #f4f8ff;
  --text-muted: #c2d4ec;
  --border-cartoon: 2.5px solid #101622;
}

body[data-theme="pink"] {
  --bg-deep: #241030;
  --ink: #2a1136;
  --card-bg: rgba(48, 20, 64, 0.86);
  --dock-bg: rgba(46, 18, 62, 0.50);
  --dock-border: rgba(255, 158, 222, 0.55);
  --blue-primary: #d9469f;
  --blue-bright: #ff94d6;
  --blue-glow: rgba(255, 148, 214, 0.55);
  --btn-grad: linear-gradient(180deg, #ff9ee0 0%, #d9469f 100%);
  --amber-gold: #ffe082;
  --text-light: #fff5fc;
  --text-muted: #f2c9e6;
}

body[data-theme="cyan"] {
  --bg-deep: #051829;
  --ink: #072036;
  --card-bg: rgba(8, 34, 56, 0.86);
  --dock-bg: rgba(8, 34, 56, 0.50);
  --dock-border: rgba(102, 247, 255, 0.48);
  --blue-primary: #0097b2;
  --blue-bright: #66f7ff;
  --blue-glow: rgba(102, 247, 255, 0.5);
  --btn-grad: linear-gradient(180deg, #66f7ff 0%, #0088a8 100%);
  --amber-gold: #ffe169;
  --text-light: #f0fdff;
  --text-muted: #b3e8f2;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-light);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  touch-action: none;
}

#space-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
}
#space-canvas:active {
  cursor: grabbing;
}

/* Cozy Screen-Space Floating Dust & Warm Vignette VFX */
.cozy-dust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* 3D World-Space Projected Station Badges */
#world-markers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.world-marker {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 7px;
  background: rgba(15, 22, 38, 0.9);
  border: 2px solid var(--blue-bright);
  border-radius: 999px;
  box-shadow: 0 3px 0 #090e1a, 0 0 14px rgba(85, 185, 243, 0.35);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.world-marker:hover,
.world-marker.near {
  background: var(--blue-primary);
  border-color: #fff;
  box-shadow: 0 4px 0 #090e1a, 0 0 20px rgba(85, 185, 243, 0.75);
}
.world-marker::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--blue-bright);
}
.world-marker .marker-num {
  background: var(--blue-bright);
  color: #0c1424;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
}
.world-marker.near .marker-num {
  background: var(--amber-gold);
}
.world-marker .marker-dist {
  color: var(--blue-bright);
  font-size: 11px;
  font-weight: 700;
}
.world-marker.near .marker-dist {
  color: #ffe38f;
}

/* Dynamic Touch Analog Joystick */
.joystick {
  position: fixed;
  left: 0;
  top: 0;
  width: 116px;
  height: 116px;
  margin-left: -58px;
  margin-top: -58px;
  pointer-events: none;
  z-index: 18;
}
.joystick-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 114, 232, 0.18) 0%, rgba(12, 20, 38, 0.65) 100%);
  border: 3px solid rgba(85, 185, 243, 0.85);
  box-shadow: 0 4px 0 rgba(8, 12, 22, 0.8), 0 0 22px rgba(85, 185, 243, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.joystick-ring::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1.5px dashed rgba(85, 185, 243, 0.45);
}
.joystick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, #67c6ff 0%, #1472e8 100%);
  border: 3px solid #0e1524;
  box-shadow: 0 3px 0 #090e1a, 0 0 14px rgba(85, 185, 243, 0.8);
  transform: translate(0px, 0px);
  transition: transform 0.03s linear;
}

/* Top HUD */
.hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 20;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: #121824;
  border: 2.5px solid #24324d;
  border-radius: 16px;
  padding: 5px 14px 5px 7px;
  box-shadow: 0 4px 0 #080b12, 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease;
}
.brand-badge:hover {
  transform: translateY(-1px);
  border-color: var(--blue-bright);
}
.brand-mascot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #3799f5, #0e54b8);
  border: 2px solid #fff;
  object-fit: cover;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffffff;
}
.brand-title em {
  font-style: normal;
  color: var(--blue-bright);
}
.brand-sub {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  color: #cbd9ee;
  margin-top: 2px;
}
.brand-sub i {
  font-style: normal;
  color: var(--blue-bright);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cartoon-btn {
  background: #f5f8fc;
  color: #131b2b;
  border: var(--border-cartoon);
  border-radius: 12px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #101622;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.cartoon-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 #101622;
}
.cartoon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #101622;
}
.cartoon-btn .selected {
  color: var(--blue-primary);
}
.language-divider {
  width: 1.5px;
  height: 12px;
  background: #b8c6db;
}
.icon-btn {
  padding: 9px 11px;
  flex-direction: column;
  gap: 3px;
}
.icon-btn span {
  display: block;
  width: 16px;
  height: 2.5px;
  background: #131b2b;
  border-radius: 2px;
}

/* Flying Ruby Tween Layer & Top Ruby Counter */
.ruby-fly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.flying-ruby {
  position: fixed;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  pointer-events: none;
  filter: drop-shadow(0 0 12px #ff2468) drop-shadow(0 0 22px #ff85b3);
  will-change: transform, opacity;
}
.ruby-hud-btn {
  background: rgba(20, 27, 45, 0.92);
  color: #ffffff;
  border-color: #ff4785;
  box-shadow: 0 4px 0 #101622, 0 0 14px rgba(255, 36, 104, 0.35);
  transition: transform 0.18s cubic-bezier(0.22, 1.4, 0.36, 1), background 0.15s ease, box-shadow 0.18s ease;
}
.ruby-hud-btn:hover {
  background: #251535;
  border-color: #ff85b3;
}
.ruby-hud-btn.ruby-pop {
  transform: scale(1.26);
  background: #ff2468;
  border-color: #ffffff;
  box-shadow: 0 4px 0 #101622, 0 0 26px rgba(255, 36, 104, 0.95);
}
.ruby-svg-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 0 5px rgba(255, 36, 104, 0.7));
}

/* Right-side cartoon action button (Jetpack Boost + SHIFT badge, matching Bleki button style!) */
.side-actions {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 16;
}
.side-actions[hidden] {
  display: none !important;
}
.side-actions.unlock-fx .jetpack-btn {
  animation: jetpackUnlockPop 0.85s cubic-bezier(0.22, 1.45, 0.36, 1) forwards;
  position: relative;
}
.side-actions.unlock-fx .jetpack-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  border: 3px solid var(--amber-gold);
  animation: jetpackShockwave 1.1s ease-out forwards;
  pointer-events: none;
}
@keyframes jetpackUnlockPop {
  0% {
    transform: scale(0) rotate(-25deg);
    filter: brightness(2.2);
  }
  55% {
    transform: scale(1.28) rotate(8deg);
    box-shadow: 0 6px 0 #090f1c, 0 0 38px var(--amber-gold);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}
@keyframes jetpackShockwave {
  0% {
    transform: scale(0.85);
    opacity: 1;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

/* Jetpack Unlock Celebration Toast Banner */
.unlock-toast {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffdf6b 0%, #ff9f1c 100%);
  color: #101622;
  border: 3px solid #ffffff;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 5px 0 #090f1c, 0 0 28px rgba(255, 190, 59, 0.85);
  z-index: 45;
  white-space: nowrap;
  animation: popInspect 0.3s cubic-bezier(0.22, 1.3, 0.36, 1);
}
.unlock-toast[hidden] {
  display: none !important;
}
.cartoon-square-btn {
  min-width: 58px;
  height: 58px;
  padding: 6px 10px;
  background: var(--btn-grad);
  color: #ffffff;
  border: 3px solid #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 0 #090f1c, 0 6px 18px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.cartoon-square-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.05);
}
.cartoon-square-btn:active,
.cartoon-square-btn.active {
  filter: brightness(1.15);
  border-color: var(--amber-gold);
  transform: translateY(2px);
  box-shadow: 0 2px 0 #090f1c, 0 0 22px var(--blue-glow);
}
.cartoon-square-btn.active .key-badge {
  background: var(--amber-gold);
  color: #0c1424;
  border-color: #0c1424;
}

/* Radar Menu */
.radar-menu {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  right: max(14px, env(safe-area-inset-right));
  width: 230px;
  background: rgba(16, 23, 39, 0.96);
  border: 2.5px solid var(--blue-bright);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 6px 0 #090e1a, 0 14px 32px rgba(0, 0, 0, 0.6);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radar-menu[hidden] {
  display: none !important;
}
.radar-menu p {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--blue-bright);
}
.radar-menu button {
  background: rgba(255, 255, 255, 0.06);
  color: #f0f6ff;
  border: 1.5px solid rgba(85, 185, 243, 0.25);
  border-radius: 10px;
  padding: 9px 11px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.radar-menu button:hover {
  background: var(--blue-primary);
  border-color: #fff;
}
.stop-tag {
  background: var(--blue-bright);
  color: #0b1220;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
}

/* BLEKI UI: Starts in Center as Welcome Speech Bubble, Slides to Bottom-Left when Started! */
.bleki-guide {
  position: fixed;
  left: 50%;
  bottom: calc(50% - 20px);
  transform: translate(-50%, 50%);
  z-index: 19;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              bottom 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

body.started .bleki-guide {
  left: max(14px, env(safe-area-inset-left));
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 128px);
  transform: translate(0, 0);
  flex-direction: row;
  align-items: flex-end;
}

.left-nav-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Mission Button directly above Bleki button (hidden before exploration starts) */
.mission-nav-btn {
  display: none;
  width: 56px;
  height: 56px;
  min-width: 56px;
  padding: 5px 6px;
  border-radius: 16px;
  position: relative;
}
body.started .mission-nav-btn {
  display: flex;
}


.bleki-portrait-btn {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  background: var(--btn-grad);
  border: 3px solid #ffffff;
  box-shadow: 0 5px 0 #090f1c, 0 0 26px var(--blue-glow);
  padding: 3px;
  cursor: pointer;
  position: relative;
  transition: width 0.45s ease, height 0.45s ease, border-radius 0.45s ease, transform 0.15s ease;
}
body.started .bleki-portrait-btn {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: 0 4px 0 #090f1c, 0 6px 18px rgba(0, 0, 0, 0.5);
}
.bleki-portrait-btn:hover {
  transform: scale(1.06);
}
.bleki-portrait-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.bleki-online-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #35e87a;
  border: 2.5px solid #0d1526;
}



/* Bleki Welcome Speech Card (Center Screen Initially) */
.bleki-welcome-card {
  width: min(90vw, 420px);
  background: rgba(14, 22, 39, 0.92);
  backdrop-filter: blur(10px);
  border: 2.5px solid var(--blue-bright);
  border-radius: 22px;
  padding: 18px 22px;
  text-align: center;
  box-shadow: 0 6px 0 #080d18, 0 18px 42px rgba(0, 0, 0, 0.68);
  position: relative;
  transition: opacity 0.32s ease, transform 0.32s ease;
}
/* Speech pointer arrow pointing up to Bleki's avatar */
.bleki-welcome-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--blue-bright);
}
body.started .bleki-welcome-card {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: scale(0.85);
}

.bleki-speaker-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--blue-bright);
  background: rgba(20, 114, 232, 0.22);
  border: 1.5px solid rgba(85, 185, 243, 0.45);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.speaker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35e87a;
}
.bleki-speaker-tag strong {
  color: #ffffff;
}

.bleki-welcome-card h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 4.5vw, 30px);
  line-height: 1.12;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 3px 0 #09101f;
}
.bleki-welcome-card p {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #d4e3f7;
}

.launch-button {
  background: var(--btn-grad);
  color: #ffffff;
  border: 2.5px solid #0b111e;
  border-radius: 14px;
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 0 #090f1c, 0 0 20px var(--blue-glow);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.launch-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.launch-button:active {
  transform: translateY(2px);
}
.intro-instruction {
  display: block;
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #9ec0eb;
}

/* Compact Corner Speech Bubble (after started) */
.bleki-bubble {
  width: min(74vw, 290px);
  background: #f5f8fc;
  color: #131b2b;
  border: var(--border-cartoon);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: 0 5px 0 #0c121e;
  font-size: 13px;
  line-height: 1.4;
}
.bleki-bubble[hidden] {
  display: none !important;
}
.bleki-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.bleki-bubble-head strong {
  color: var(--blue-primary);
  font-size: 12px;
  letter-spacing: 0.03em;
}
.bleki-bubble-head button {
  background: #e2eaf5;
  color: #131b2b;
  border: 1.5px solid #131b2b;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  cursor: pointer;
}
.bleki-bubble p {
  margin: 0;
  font-weight: 600;
}

/* Shared Links in Station Modal */
.board-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.board-links a,
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-primary);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid #0b111e;
  box-shadow: 0 3px 0 #090e1a;
  transition: transform 0.12s ease, background 0.12s ease;
}
.board-links a:hover,
.contact-email:hover {
  background: var(--blue-bright);
  color: #0b1220;
  transform: translateY(-1px);
}

/* Proximity Inspect Station Button Popup */
.inspect-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 148px);
  transform: translateX(-50%);
  z-index: 18;
  animation: popInspect 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.inspect-prompt[hidden] {
  display: none !important;
}
@keyframes popInspect {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}
.inspect-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 999px;
  border: 2.5px solid #ffffff;
  box-shadow: 0 5px 0 #080d18, 0 0 24px var(--blue-glow);
  white-space: nowrap;
}
.inspect-station-tag {
  background: var(--amber-gold);
  color: #101622;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
}


/* Bottom Telemetry & Station Dock (Translucent Glass so 3D Moon shows through) */
.travel {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  background: var(--dock-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--dock-border);
  border-radius: 18px;
  padding: 9px 13px;
  box-shadow: 0 5px 0 rgba(8, 12, 22, 0.55), 0 10px 28px rgba(0, 0, 0, 0.38);
  z-index: 16;
}
.travel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 7px;
}
.telemetry-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
}
.telemetry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-bright);
  box-shadow: 0 0 8px var(--blue-bright);
}
.controls-pill {
  font-size: 11px;
  color: var(--blue-bright);
  background: rgba(85, 185, 243, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}
.station-dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.dock-node {
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  color: #cad9f0;
  border: 1.5px solid rgba(85, 185, 243, 0.25);
  border-radius: 10px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.dock-node:hover {
  background: rgba(20, 114, 232, 0.35);
  border-color: var(--blue-bright);
}
.dock-node.active {
  background: var(--blue-primary);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 0 #090e1a;
}
.node-num {
  font-size: 9px;
  color: var(--blue-bright);
  font-weight: 900;
}
.dock-node.active .node-num {
  color: var(--amber-gold);
}
.node-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber-gold);
  margin: 2px 0;
}
.node-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.travel-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.travel-help button {
  background: none;
  border: none;
  color: var(--blue-bright);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

/* Full Dialog Modal & Mission Board Dialog */
dialog#board,
dialog#mission-board {
  width: min(92vw, 520px);
  background: #121a2e;
  color: #f4f8ff;
  border: 3px solid var(--blue-bright);
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 8px 0 #070b14, 0 24px 60px rgba(0, 0, 0, 0.8);
}
dialog#board::backdrop,
dialog#mission-board::backdrop {
  background: rgba(5, 9, 18, 0.72);
  backdrop-filter: blur(4px);
}
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(20, 114, 232, 0.18);
  border-bottom: 2px solid rgba(85, 185, 243, 0.3);
}
#board-label,
#mission-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--amber-gold);
}
#board-title,
#mission-title {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 900;
}
#close-board,
#close-mission {
  background: #f5f8fc;
  color: #121824;
  border: 2px solid #0b111e;
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 800;
  cursor: pointer;
}
.board-body {
  padding: 18px 20px 22px;
  font-size: 14px;
  line-height: 1.55;
  color: #dce9fc;
}
.board-body h3 {
  color: var(--blue-bright);
  margin: 12px 0 4px;
}

/* Mission Board Progress & Ruby Slots */
.mission-desc {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}
.mission-progress-card {
  background: rgba(9, 15, 28, 0.75);
  border: 2px solid rgba(255, 71, 133, 0.45);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.mission-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mission-status-badge {
  background: rgba(255, 36, 104, 0.22);
  color: #ff85b3;
  border: 1.5px solid #ff4785;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.mission-status-badge.done {
  background: rgba(53, 232, 122, 0.22);
  color: #5ff59b;
  border-color: #35e87a;
}
#mission-progress-text {
  font-size: 16px;
  font-weight: 900;
  color: #ffd1e2;
}
.mission-bar-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 12px;
}
.mission-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff2468 0%, #ff85b3 55%, #ffdf6b 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.mission-ruby-slots {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
.mission-slot {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px dashed rgba(255, 133, 179, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transform: scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.mission-slot.collected {
  opacity: 1;
  transform: scale(1);
  background: rgba(255, 36, 104, 0.25);
  border: 1.5px solid #ff6b9d;
  box-shadow: 0 0 10px rgba(255, 36, 104, 0.45);
}
.mission-radar-hint {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--amber-gold);
}

/* Hide keyboard shortcut badges on touch / mobile devices while keeping button contents centered */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  .key-badge,
  body.started .bleki-key-badge {
    display: none !important;
  }
}

@media (max-width: 768px), (orientation: portrait) {
  .hud {
    left: 8px;
    right: 8px;
    gap: 6px;
  }
  .brand-badge {
    padding: 4px 10px 4px 5px;
    gap: 7px;
  }
  .brand-mascot {
    width: 30px;
    height: 30px;
  }
  .brand-title {
    font-size: 14px;
  }
  .brand-sub {
    display: none;
  }
  .hud-right {
    gap: 5px;
  }
  .cartoon-btn {
    padding: 6px 9px;
    font-size: 11px;
    border-radius: 10px;
  }
  .controls-pill {
    display: none;
  }
  body.started .bleki-guide {
    left: max(10px, env(safe-area-inset-left));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 144px);
  }
  .left-nav-stack {
    gap: 10px;
  }
  body.started .bleki-portrait-btn,
  body.started .mission-nav-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 15px;
    padding: 0;
  }
  .inspect-prompt {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 147px);
    max-width: calc(100vw - 134px);
  }
  .inspect-button {
    padding: 8px 13px;
    font-size: 12px;
    gap: 6px;
    max-width: 100%;
  }
  .inspect-station-tag {
    font-size: 9.5px;
    padding: 2px 7px;
  }
  .side-actions {
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 144px);
    transform: none;
    gap: 8px;
  }
  .cartoon-square-btn.jetpack-btn {
    min-width: 48px;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    padding: 0;
    gap: 0;
  }
  .cartoon-square-btn.jetpack-btn svg {
    width: 23px;
    height: 23px;
  }
  .unlock-toast {
    font-size: 11.5px;
    padding: 7px 14px;
    max-width: 92vw;
    white-space: normal;
    text-align: center;
  }
}

/* Mission 02: recovery rover. Controls share the established cartoon HUD. */
[hidden] { display: none !important; }
.rover-hud-btn { gap: 5px; background: #c7f8ff; color: #14293e; }
.mission-complete { box-shadow: inset 0 -3px 0 #65d7bd; }
.rover-btn { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 1px; background: #b8f7ff; color: #17354c; }
.rover-btn > span { font: 800 8px/1.3 system-ui, sans-serif; letter-spacing: .7px; }

.rover-btn:disabled { opacity: .52; cursor: default; }
.rover-btn.active { background: #ffce79; box-shadow: 0 0 18px #69f6ff70; }
.rover-direction { position: fixed; z-index: 18; left: 50%; top: 100px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: min(82vw, 470px); padding: 8px 15px; border: 2px solid #182b40; border-radius: 30px; background: #101e32ed; color: #defbff; box-shadow: 0 4px 0 #07101b; pointer-events: none; }
.rover-direction span { font: 800 11px/1.4 system-ui, sans-serif; letter-spacing: .5px; }
.rover-direction svg { flex-shrink: 0; }
.rover-notice { position: fixed; z-index: 40; left: 50%; top: 166px; transform: translateX(-50%); width: max-content; max-width: min(86vw, 540px); box-sizing: border-box; padding: 12px 19px; background: #e8fbff; color: #16374d; border: 3px solid #16283d; border-radius: 18px; box-shadow: 0 5px 0 #07101b; font: 750 13px/1.5 system-ui, sans-serif; text-align: center; pointer-events: none; }
.rover-marker { position: fixed; z-index: 7; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 12px; border: 1px solid #69f6ff88; border-radius: 10px; background: #10213bdf; color: #c5fbff; font: 800 9px/1.3 system-ui, sans-serif; letter-spacing: .7px; pointer-events: none; white-space: nowrap; }
.rover-marker::after { content: ''; position: absolute; bottom: -9px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid #69f6ff; }
.rover-marker strong { font-size: 11px; color: #ffcf74; }
.rover-slot.collected { background: #13596c; border-color: #69f6ff; }
.rover-slot.carrying { border-color: #ffcf74; box-shadow: 0 0 10px #ffcf7460; }
@media (max-width: 600px) {
  .hud-right { gap: 5px; }
  .rover-hud-btn { padding: 6px 7px; min-width: 0; font-size: 11px; }
  .rover-hud-btn svg { width: 16px; height: 16px; }
  .rover-direction { top: 87px; padding: 6px 10px; max-width: 88vw; }
  .rover-direction span { font-size: 9px; }
  .rover-notice { top: 143px; font-size: 11px; padding: 9px 12px; }
  .cartoon-square-btn.rover-btn { min-width: 48px; width: 48px; height: 48px; border-radius: 15px; padding: 0; }
  .rover-btn svg { width: 22px; height: 22px; }
  .rover-mission-active .brand-text { display: none; }
  .rover-mission-active .brand-badge { padding-right: 5px; }
  .rover-mission-active .hud { gap: 4px; }
  .rover-mission-active .hud-right { gap: 4px; }
}

/* General mission navigation, timed guidance, and the final Senior Solar Guard award. */
.mission-nav-btn svg { filter: none; }
.mission-assist { border-color: #ffcf7490; }
.mission-assist[data-kind="ruby"] { color: #ffd9e5; }
.completion-dialog { position: fixed; inset: 0; width: min(460px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); margin: auto; padding: 28px 30px 22px; overflow-y: auto; overflow-x: hidden; box-sizing: border-box; border: 2px solid #ffcf74; border-radius: 28px; color: #effaff; text-align: center; background: radial-gradient(ellipse at 50% 0%, #24577b 0, #122b48 35%, #0b192e 80%); box-shadow: 0 0 0 7px #ffcf7410, 0 20px 80px #000a, 0 0 80px #69f6ff20; }
.completion-dialog::backdrop { background: #030a18b8; backdrop-filter: blur(5px); }
.completion-dialog[open] { animation: completion-arrival .55s cubic-bezier(.18,.85,.25,1.15); }
.completion-medal { position: relative; height: 150px; display: grid; place-items: center; margin: -4px auto 5px; filter: drop-shadow(0 0 22px #ffcf7445); }
.completion-orbit { position: absolute; pointer-events: none; width: 280px; height: 280px; border: 1px solid #69f6ff20; border-radius: 50%; left: 50%; top: -67px; transform: translateX(-50%); box-shadow: 0 0 0 25px #69f6ff05, 0 0 0 55px #69f6ff04; }
.completion-dialog .completion-kicker { color: #69f6ff; letter-spacing: 2.5px; font-size: 10px; font-weight: 850; margin: 10px 0 8px; }
.completion-dialog h2 { color: #fff4d9; font: 850 clamp(23px, 5vw, 30px)/1.15 system-ui, sans-serif; margin: 8px 0 14px; }
.completion-dialog #completion-body { color: #bcd1e6; font-size: 13px; line-height: 1.65; margin: 0 auto 20px; }
.completion-rank { padding: 13px 6px 15px; margin-bottom: 21px; border-top: 1px solid #ffcf7444; border-bottom: 1px solid #ffcf7444; background: linear-gradient(90deg, transparent, #ffcf740c, transparent); }
.completion-rank span { display: block; font-size: 9px; letter-spacing: 2px; color: #d5b276; margin-bottom: 7px; }
.completion-rank strong { display: block; font: 900 clamp(17px, 4.4vw, 22px)/1.3 system-ui, sans-serif; letter-spacing: 1px; color: #ffdc94; text-shadow: 0 0 22px #ffcf7455; }
.completion-dialog .launch-button { margin: 0 auto; width: 100%; justify-content: center; }
.completion-dialog .completion-footer { font-size: 10px; line-height: 1.5; color: #8eaac5; margin: 15px 0 0; }
@keyframes completion-arrival { from { opacity: 0; transform: translateY(22px) scale(.9); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .completion-dialog { padding: 20px 22px 18px; border-radius: 23px; } .completion-medal { height: 126px; } .completion-medal svg { width: 124px; height: 124px; } }
@media (max-width: 420px) { .brand-text { display: none; } .brand-badge { padding-right: 5px; } }
@media (prefers-reduced-motion: reduce) { .completion-dialog[open] { animation: none; } }

#travel-toggle { flex: 0 0 30px; width: 30px; height: 28px; padding: 3px; display: grid; place-items: center; border: 1px solid #79bde977; border-radius: 8px; background: #142640c9; color: #cfedff; cursor: pointer; }
#travel-toggle:hover { background: #23649d; }
.travel .telemetry-left { min-width: 0; flex: 1; }
.travel #location { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.travel.minimized #travel-content, .travel.minimized #controls-hint { display: none; }
.travel.minimized .travel-label { margin-bottom: 0; }
.travel.minimized #travel-toggle svg { transform: rotate(180deg); }
@media (max-width: 768px), (orientation: portrait) {
  body.travel-minimized.started .bleki-guide, body.travel-minimized .side-actions { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px); }
}

/* Keyboard hints share one bottom-center placement; touch devices never show them. */
.key-badge {
  display: none !important;
  position: absolute;
  top: calc(100% + 5px);
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  box-sizing: border-box;
  min-width: 24px;
  padding: 2px 6px;
  border: 1.5px solid var(--blue-bright);
  border-radius: 5px;
  background: #0d1526;
  color: var(--blue-bright);
  font-family: inherit;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: 0 2px 0 #080d18;
  white-space: nowrap;
  pointer-events: none;
}
#close-board, #boost-btn { position: relative; }
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
  body .key-badge { display: block !important; }
  body .key-badge[hidden],
  body:not(.started) .bleki-key-badge,
  body .world-marker:not(.near) .key-badge { display: none !important; }
  .side-actions, .left-nav-stack { gap: 30px; }
  .world-marker.near::after, .rover-marker:has(.key-badge:not([hidden]))::after { display: none; }
}

/* Playground remains visible while its upcoming games are prepared. */
button.coming-soon { cursor: default; }
.station-coming-soon { display: block; font: 800 9px/1.25 system-ui, sans-serif; color: #ffda75; white-space: nowrap; letter-spacing: .02em; }
.world-marker.coming-soon { flex-wrap: wrap; justify-content: center; max-width: 185px; border-color: #ffda75; background: #152137; }
.world-marker.coming-soon .station-coming-soon { order: 2; flex-basis: 100%; }
.station-dock .coming-soon { opacity: .75; gap: 1px; }
.station-dock .coming-soon .node-name { font-size: 10px; }
.radar-menu .coming-soon { opacity: .75; }


.audio-toggle { min-width: 40px; height: 36px; padding: 6px 8px; justify-content: center; flex-shrink: 0; }
.audio-toggle .sound-off { display: none; }
.audio-toggle[aria-pressed="true"] .sound-on { display: none; }
.audio-toggle[aria-pressed="true"] .sound-off { display: inline; }
.audio-toggle[aria-pressed="true"] { color: #67768b; background: #e5ebf4; }
.audio-toggle:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: 3px; }
@media (max-width: 480px) {
  .hud { gap: 4px; }
  .brand-text { display: none; }
  .brand-badge { padding: 4px; flex-shrink: 0; }
  .hud-right { gap: 4px; min-width: 0; }
  .audio-toggle { min-width: 32px; width: 32px; height: 34px; padding: 4px; }
  #mood, #language-toggle { font-size: 10px; padding: 6px; white-space: nowrap; }
  #menu-toggle { padding: 8px; }
  .ruby-hud-btn, .rover-hud-btn { padding: 6px; gap: 4px; font-size: 10px; }
}
@media (max-width: 360px) {
  .hud-right { gap: 3px; }
  .brand-badge { padding: 3px; }
  #language-toggle { gap: 3px; padding: 6px 4px; }
  #mood { max-width: 66px; overflow: hidden; text-overflow: ellipsis; display: block; font-size: 9px; padding: 7px 5px; }
  #menu-toggle { width: 32px; height: 34px; padding: 5px; flex-shrink: 0; }
}
