/* ============================================================
   LUNAR OUTPOST — UI + boot screen styles.
   Dark glassmorphism sci-fi. Touch-first, 1024px landscape up.
   ============================================================ */

:root {
  --lo-glass: rgba(10, 14, 26, 0.82);
  --lo-glass-hi: rgba(22, 28, 46, 0.9);
  --lo-border: rgba(120, 160, 255, 0.25);
  --lo-border-hi: rgba(120, 160, 255, 0.55);
  --lo-text: #e8eaf0;
  --lo-dim: #9aa2b8;
  --lo-cyan: #06d6a0;
  --lo-blue: #4d96ff;
  --lo-amber: #ffd166;
  --lo-red: #ef476f;
  --lo-radius: 14px;
  --lo-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --lo-blur: blur(12px);
  --lo-t: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05060e;
  color: var(--lo-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* subtle top vignette over the world */
#ui-root::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(80, 120, 220, 0.10), transparent 60%),
    linear-gradient(to bottom, rgba(5, 6, 14, 0.35), transparent 18%, transparent 82%, rgba(5, 6, 14, 0.35));
}

#ui-root {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
#ui-root > * {
  pointer-events: auto;
}

/* shared glass panel look */
.lo-resbar, .lo-topright, .lo-mission, .lo-select, .lo-build,
.lo-sheet, .lo-tip, .lo-sol, .lo-speed {
  background: var(--lo-glass);
  backdrop-filter: var(--lo-blur);
  -webkit-backdrop-filter: var(--lo-blur);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  box-shadow: var(--lo-shadow);
}

.hidden { display: none !important; }

/* ============================================================
   1. TOP RESOURCE BAR
   ============================================================ */
.lo-resbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 350px; /* keep clear of sol/speed/settings cluster */
  display: flex;
  justify-content: safe center;
  gap: 6px;
  padding: 8px 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.lo-resbar::-webkit-scrollbar { display: none; }

.lo-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  min-height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  transition: background var(--lo-t);
  white-space: nowrap;
}
.lo-chip-ic {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.5));
}
.lo-chip-col { display: flex; flex-direction: column; line-height: 1.15; }
.lo-chip-val { font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }
.lo-chip-sub { font-size: 10px; display: flex; gap: 4px; color: var(--lo-dim); }
.lo-chip-rate { font-weight: 600; }
.lo-chip-cap { color: var(--lo-dim); }

.lo-batt {
  width: 46px; height: 5px;
  margin-top: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.lo-batt-fill {
  height: 100%;
  width: 0%;
  background: var(--lo-cyan);
  transition: width 300ms linear, background var(--lo-t);
}
.lo-chip.warn { background: rgba(239, 71, 111, 0.16); }

@keyframes lo-flash {
  0%, 100% { background: rgba(255, 255, 255, 0.03); }
  20%, 60% { background: rgba(239, 71, 111, 0.55); box-shadow: 0 0 16px rgba(239, 71, 111, 0.6); }
}
.lo-chip.flash { animation: lo-flash 1s ease; }

/* ============================================================
   2. TOP-RIGHT: sol / speed / settings
   ============================================================ */
.lo-topright {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  box-shadow: none;
}
.lo-sol {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 40px;
}
.lo-tod { font-size: 18px; }
.lo-tod.night { filter: drop-shadow(0 0 6px rgba(150, 190, 255, 0.7)); }
.lo-sol-txt { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--lo-amber); }

.lo-speed { display: flex; padding: 4px; gap: 2px; }
.lo-sbtn {
  min-width: 40px; min-height: 40px;
  border: none; background: transparent;
  color: var(--lo-dim);
  font-size: 14px; font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--lo-t);
}
.lo-sbtn:hover { color: var(--lo-text); background: rgba(255, 255, 255, 0.06); }
.lo-sbtn.active {
  color: #071018; background: var(--lo-cyan);
  box-shadow: 0 0 14px rgba(6, 214, 160, 0.5);
}

.lo-gear {
  width: 44px; height: 44px;
  border: 1px solid var(--lo-border);
  background: var(--lo-glass);
  backdrop-filter: var(--lo-blur);
  -webkit-backdrop-filter: var(--lo-blur);
  color: var(--lo-text);
  font-size: 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--lo-t);
}
.lo-gear:hover { border-color: var(--lo-border-hi); transform: rotate(30deg); }

/* ============================================================
   6. MISSION TRACKER + TIER
   ============================================================ */
.lo-mission {
  position: absolute;
  top: 84px;
  left: max(12px, env(safe-area-inset-left));
  width: 260px;
  max-width: 42vw;
  padding: 12px 14px;
  overflow: hidden;
}
.lo-mission-label {
  font-size: 10px; letter-spacing: 2px;
  color: var(--lo-cyan); font-weight: 700;
  margin-bottom: 3px;
}
.lo-mission-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.lo-mission-desc { font-size: 12px; color: var(--lo-dim); line-height: 1.35; }
.lo-mission-check {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: var(--lo-cyan);
  background: rgba(6, 214, 160, 0.12);
  opacity: 0; pointer-events: none;
}
@keyframes lo-pulse {
  0% { box-shadow: 0 0 0 0 rgba(6, 214, 160, 0.5), var(--lo-shadow); }
  100% { box-shadow: 0 0 0 12px rgba(6, 214, 160, 0), var(--lo-shadow); }
}
.lo-mission.pulse { animation: lo-pulse 900ms ease-out; }
@keyframes lo-checkpop {
  0% { opacity: 0; transform: scale(0.3); }
  30% { opacity: 1; transform: scale(1.1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
.lo-mission.celebrate .lo-mission-check { animation: lo-checkpop 1.4s ease; }

.lo-tier { margin-top: 10px; }
.lo-tier-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.lo-tier-name { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--lo-amber); text-transform: uppercase; }
.lo-tier-next { font-size: 10px; color: var(--lo-dim); }
.lo-tier-bar {
  height: 6px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.lo-tier-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--lo-amber), #ffb347);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.5);
  transition: width 400ms ease;
}

/* ============================================================
   5. SELECTION PANEL
   ============================================================ */
.lo-select {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  max-width: 44vw;
  padding: 14px;
}
.lo-sel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lo-sel-swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 8px rgba(0,0,0,0.4); }
.lo-sel-name { font-size: 16px; font-weight: 700; flex: 1; }
.lo-sel-close {
  width: 32px; height: 32px; border: none;
  background: rgba(255,255,255,0.06); color: var(--lo-text);
  border-radius: 8px; font-size: 14px; cursor: pointer;
  transition: background var(--lo-t);
}
.lo-sel-close:hover { background: rgba(239,71,111,0.4); }
.lo-sel-desc { font-size: 12px; color: var(--lo-dim); line-height: 1.4; margin-bottom: 10px; }
.lo-sel-stats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.lo-sel-stat {
  font-size: 12px; padding: 4px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}
.lo-sel-warn { color: var(--lo-amber); background: rgba(255,209,102,0.12); }
.lo-sel-actions { display: flex; flex-direction: column; gap: 6px; }

/* generic buttons */
.lo-btn {
  min-height: 40px;
  border: 1px solid var(--lo-border);
  background: rgba(255,255,255,0.05);
  color: var(--lo-text);
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all var(--lo-t);
  padding: 0 14px;
}
.lo-btn:hover { border-color: var(--lo-border-hi); background: rgba(255,255,255,0.09); }
.lo-btn-wide { width: 100%; }
.lo-btn-danger { border-color: rgba(239,71,111,0.5); color: #ffd6e0; }
.lo-btn-danger:hover { background: rgba(239,71,111,0.28); }

/* ============================================================
   4. BUILD BAR
   ============================================================ */
.lo-build {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 24px));
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lo-build-head { display: flex; align-items: center; gap: 8px; }
.lo-build-collapsed-label {
  display: none;
  font-size: 14px; font-weight: 700; letter-spacing: 1px;
  color: var(--lo-amber);
  cursor: pointer; padding: 6px 4px;
}
.lo-tabs {
  display: flex; gap: 4px; flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}
.lo-tab {
  display: flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 12px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.03);
  color: var(--lo-dim);
  border-radius: 10px;
  cursor: pointer; white-space: nowrap;
  font-size: 12px; font-weight: 600;
  transition: all var(--lo-t);
}
.lo-tab:hover { color: var(--lo-text); background: rgba(255,255,255,0.07); }
.lo-tab.active {
  color: var(--lo-text);
  border-color: var(--lo-border-hi);
  background: rgba(77,150,255,0.14);
}
.lo-tab-ic { font-size: 16px; }
.lo-chevron {
  width: 40px; height: 40px; flex-shrink: 0;
  border: none; background: rgba(255,255,255,0.05);
  color: var(--lo-text); font-size: 16px;
  border-radius: 10px; cursor: pointer;
  transition: background var(--lo-t);
}
.lo-chevron:hover { background: rgba(255,255,255,0.1); }

.lo-build-body { display: flex; gap: 8px; align-items: stretch; }
.lo-cards {
  display: flex; gap: 8px; flex: 1;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,160,255,0.4) transparent;
}
.lo-cards::-webkit-scrollbar { height: 6px; }
.lo-cards::-webkit-scrollbar-thumb { background: rgba(120,160,255,0.35); border-radius: 4px; }
.lo-cards::-webkit-scrollbar-track { background: transparent; }

.lo-card {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 92px;
  min-height: 96px;
  padding: 8px;
  border: 1px solid var(--lo-border);
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  color: var(--lo-text);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  text-align: left;
  transition: all var(--lo-t);
}
.lo-card:hover { border-color: var(--lo-border-hi); transform: translateY(-2px); background: rgba(255,255,255,0.08); }
.lo-card.active {
  border-color: var(--lo-cyan);
  box-shadow: 0 0 0 1px var(--lo-cyan), 0 0 18px rgba(6,214,160,0.4);
  background: rgba(6,214,160,0.12);
}
.lo-card.locked { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.7); }
.lo-card.locked:hover { transform: none; }
.lo-card-ic {
  width: 26px; height: 26px; border-radius: 7px;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,0.3), 0 0 10px rgba(0,0,0,0.3);
}
.lo-card-nm { font-size: 11px; font-weight: 700; line-height: 1.2; }
.lo-card-cost { font-size: 11px; color: var(--lo-amber); font-weight: 600; display: flex; gap: 6px; flex-wrap: wrap; }
.lo-card-hints { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.lo-hint {
  font-size: 9px; padding: 1px 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px; color: var(--lo-dim);
}
.lo-card-lock { font-size: 9px; color: var(--lo-amber); margin-top: auto; }

.lo-tools { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.lo-tool {
  width: 48px; height: 48px;
  border: 1px solid var(--lo-border);
  background: rgba(255,255,255,0.05);
  color: var(--lo-text);
  font-size: 20px; border-radius: 12px;
  cursor: pointer;
  transition: all var(--lo-t);
}
.lo-tool:hover { border-color: var(--lo-border-hi); background: rgba(255,255,255,0.1); }
.lo-dem.active {
  border-color: var(--lo-red);
  background: rgba(239,71,111,0.28);
  box-shadow: 0 0 16px rgba(239,71,111,0.5);
}
.lo-rot { display: none; }
.lo-rot.show { display: block; }

/* collapsed state */
.lo-build.collapsed .lo-build-body { display: none; }
.lo-build.collapsed .lo-tabs { display: none; }
.lo-build.collapsed .lo-build-collapsed-label { display: block; margin-right: auto; }

/* ============================================================
   8. TOOLTIP
   ============================================================ */
.lo-tip {
  position: absolute;
  width: 230px;
  padding: 10px 12px;
  z-index: 30;
  pointer-events: none;
}
.lo-tip-nm { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.lo-tip-desc { font-size: 11px; color: var(--lo-dim); line-height: 1.4; margin-bottom: 6px; }
.lo-tip-stats { display: flex; flex-direction: column; gap: 2px; }
.lo-tip-stat { font-size: 11px; color: var(--lo-text); }

/* ============================================================
   3. SETTINGS MODAL
   ============================================================ */
.lo-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 5, 12, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lo-sheet {
  width: 320px; max-width: calc(100vw - 32px);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  animation: lo-sheetin 200ms ease;
}
@keyframes lo-sheetin { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; } }
.lo-sheet-title {
  font-size: 14px; font-weight: 700; letter-spacing: 3px;
  color: var(--lo-cyan); text-align: center; margin-bottom: 4px;
}
.lo-setrow { display: flex; align-items: center; justify-content: space-between; }
.lo-setlabel { font-size: 13px; }
.lo-switch {
  width: 48px; height: 28px; border-radius: 16px;
  border: 1px solid var(--lo-border);
  background: rgba(255,255,255,0.08);
  position: relative; cursor: pointer;
  transition: background var(--lo-t);
  padding: 0;
}
.lo-switch.on { background: var(--lo-cyan); border-color: var(--lo-cyan); }
.lo-switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  transition: left var(--lo-t);
}
.lo-switch.on .lo-switch-knob { left: 22px; }
.lo-newwrap { display: flex; }
.lo-credits {
  font-size: 10px; text-align: center; color: var(--lo-dim);
  letter-spacing: 1px; margin-top: 2px;
}

/* ============================================================
   7. TOASTS
   ============================================================ */
.lo-toasts {
  position: absolute;
  bottom: 132px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 35;
  pointer-events: none;
  width: max-content; max-width: 90vw;
}
.lo-toast {
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px; font-weight: 600;
  background: var(--lo-glass-hi);
  backdrop-filter: var(--lo-blur);
  -webkit-backdrop-filter: var(--lo-blur);
  border: 1px solid var(--lo-border);
  box-shadow: var(--lo-shadow);
  animation: lo-toastin 350ms cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: center;
}
.lo-toast.out { animation: lo-toastout 500ms ease forwards; }
@keyframes lo-toastin { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes lo-toastout { to { opacity: 0; transform: translateY(-12px); } }
.lo-toast-good { border-color: rgba(6,214,160,0.5); color: #b8ffe9; }
.lo-toast-bad { border-color: rgba(239,71,111,0.6); color: #ffc4d2; background: rgba(60, 14, 26, 0.86); }
.lo-toast-subtle { font-size: 12px; color: var(--lo-dim); font-weight: 500; }
.lo-toast-tier {
  font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
  color: #1a1206;
  background: linear-gradient(90deg, var(--lo-amber), #ffb347);
  border-color: #ffe08a;
  box-shadow: 0 0 30px rgba(255, 209, 102, 0.6);
  animation: lo-tierin 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes lo-tierin {
  0% { opacity: 0; transform: translateY(24px) scale(0.8); }
  60% { transform: translateY(0) scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   9. KEYBOARD HINTS
   ============================================================ */
.lo-keyhints {
  position: absolute;
  right: 12px; bottom: 8px;
  font-size: 10px; color: rgba(154, 162, 184, 0.6);
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 3;
}

/* ============================================================
   BOOT SCREEN
   ============================================================ */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #05060e;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
/* layered CSS starfield */
#boot-screen::before, #boot-screen::after {
  content: '';
  position: absolute; inset: 0;
  background-repeat: repeat;
  pointer-events: none;
}
#boot-screen::before {
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #cde3ff, transparent),
    radial-gradient(1px 1px at 85% 20%, #fff, transparent),
    radial-gradient(1px 1px at 55% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 10% 70%, #dbe9ff, transparent);
  background-size: 320px 320px;
  opacity: 0.9;
  animation: lo-twinkle 4s ease-in-out infinite alternate;
}
#boot-screen::after {
  background-image:
    radial-gradient(1px 1px at 15% 50%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 60% 35%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 90% 75%, rgba(200,220,255,0.5), transparent);
  background-size: 500px 500px;
  opacity: 0.5;
}
@keyframes lo-twinkle { from { opacity: 0.55; } to { opacity: 1; } }

.boot-inner {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.boot-logo {
  font-size: clamp(40px, 9vw, 84px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fff;
  line-height: 1.05;
  text-shadow: 0 0 40px rgba(120, 160, 255, 0.35);
  display: flex; flex-direction: column;
}
.boot-logo span { color: var(--lo-amber); text-shadow: 0 0 30px rgba(255, 209, 102, 0.5); }
.boot-sub {
  font-size: 13px; letter-spacing: 0.42em;
  color: var(--lo-dim); text-transform: uppercase;
}
.boot-bar {
  width: min(340px, 70vw);
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0 4px;
}
#boot-progress {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--lo-cyan), var(--lo-blue));
  box-shadow: 0 0 12px rgba(6, 214, 160, 0.6);
  transition: width 1.2s ease;
}
#boot-start, #boot-continue {
  min-width: 240px; min-height: 52px;
  padding: 0 28px;
  font-size: 15px; font-weight: 700; letter-spacing: 2px;
  color: var(--lo-amber);
  background: rgba(255, 209, 102, 0.06);
  border: 1.5px solid var(--lo-amber);
  border-radius: 30px;
  cursor: pointer;
  transition: all var(--lo-t);
}
#boot-start:hover, #boot-continue:hover {
  background: var(--lo-amber); color: #1a1206;
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.5);
}
#boot-continue {
  color: var(--lo-text);
  border-color: var(--lo-border-hi);
  background: rgba(120,160,255,0.06);
}
#boot-continue:hover { background: var(--lo-blue); color: #fff; box-shadow: 0 0 28px rgba(77,150,255,0.5); }

.fade-out { opacity: 0; transition: opacity 0.9s; pointer-events: none; }

/* ============================================================
   RESPONSIVE — iPad landscape & short screens
   ============================================================ */
@media (max-width: 1112px) {
  .lo-chip { padding: 5px 8px; gap: 6px; }
  .lo-chip-ic { font-size: 16px; }
  .lo-chip-val { font-size: 13px; }
  .lo-chip-sub { font-size: 9px; }
  .lo-mission { width: 220px; top: 78px; }
  .lo-card { width: 78px; min-height: 88px; }
  .lo-build { width: calc(100vw - 16px); }
}

@media (max-height: 820px) {
  .lo-mission { top: 76px; }
  .lo-card { width: 74px; min-height: 84px; }
  .lo-toasts { bottom: 120px; }
}

@media (max-height: 620px) {
  .lo-resbar { padding: 5px 6px; gap: 4px; }
  .lo-chip-sub { display: none; }
  .lo-mission { display: none; }
  .lo-toasts { bottom: 96px; }
}

/* ============================================================
   10. VICTORY OVERLAY
   ============================================================ */
.lo-victory {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 6, 14, 0.55), rgba(5, 6, 14, 0.88));
  animation: lo-vic-fade 700ms ease;
  z-index: 60;
}
.lo-victory-card {
  text-align: center;
  padding: 44px 56px;
  border-radius: 22px;
  background: rgba(10, 14, 26, 0.92);
  border: 1px solid rgba(255, 209, 102, 0.45);
  box-shadow: 0 0 60px rgba(255, 209, 102, 0.18), 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: lo-vic-pop 800ms cubic-bezier(0.2, 1.6, 0.4, 1);
  max-width: min(520px, 88vw);
}
.lo-victory-rocket { font-size: 56px; animation: lo-vic-rocket 2.4s ease-in-out infinite; }
.lo-victory-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--lo-amber);
  margin: 14px 0 10px;
  text-shadow: 0 0 24px rgba(255, 209, 102, 0.5);
}
.lo-victory-sub { font-size: 14px; color: var(--lo-text); line-height: 1.5; margin-bottom: 18px; }
.lo-victory-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: var(--lo-dim);
  margin-bottom: 24px;
}
.lo-victory-stats > div {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--lo-border);
}
.lo-victory-btn {
  font: inherit;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 13px;
  color: #0a0e1a;
  background: var(--lo-amber);
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.lo-victory-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(255, 209, 102, 0.4); }
@keyframes lo-vic-fade { from { opacity: 0; } }
@keyframes lo-vic-pop { from { transform: scale(0.7); opacity: 0; } }
@keyframes lo-vic-rocket { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ============================================================
   11. DESTINATION PICKER (boot screen)
   ============================================================ */
.boot-worlds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 26px;
  max-width: 940px;
  animation: lo-vic-fade 500ms ease;
}
.boot-world {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 168px;
  padding: 18px 12px 14px;
  font: inherit;
  color: var(--lo-text);
  text-align: center;
  background: rgba(14, 18, 32, 0.85);
  border: 1px solid var(--lo-border);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.boot-world:hover, .boot-world:focus-visible {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--lo-amber);
  box-shadow: 0 12px 40px rgba(255, 209, 102, 0.22);
  outline: none;
}
.bw-emoji { font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }
.bw-name { font-size: 17px; font-weight: 800; letter-spacing: 1px; }
.bw-sub { font-size: 10px; letter-spacing: 1.5px; color: var(--lo-dim); text-transform: uppercase; }
.bw-blurb { font-size: 11px; color: var(--lo-dim); line-height: 1.4; min-height: 46px; }
.bw-hint {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--lo-amber);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 20px;
  padding: 4px 10px;
  margin-top: 2px;
}
@media (max-height: 820px) {
  .boot-worlds { gap: 10px; margin-top: 16px; }
  .boot-world { width: 150px; padding: 12px 10px 10px; }
  .bw-emoji { font-size: 32px; }
  .bw-blurb { min-height: 40px; }
}

/* ============================================================
   12. CUSTOM ART ICONS
   Full-color low-poly PNGs replacing the emoji set. Sized per
   context via .lo-ic-* modifier classes. All share crisp scaling.
   ============================================================ */
.lo-icon {
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  image-rendering: auto;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}
/* inline-with-text (cost, hints, button labels, warnings) */
.lo-ic-xs  { width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
.lo-ic-btn { width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 2px; }
/* fixed-size UI slots */
.lo-ic-tab  { width: 26px; height: 26px; }
.lo-ic-tool { width: 28px; height: 28px; }
.lo-ic-tod  { width: 26px; height: 26px; }
.lo-ic-card { width: 34px; height: 34px; }
.lo-ic-toast { width: 26px; height: 26px; margin-right: 4px; }
.lo-ic-check { width: 84px; height: 84px; }
.lo-ic-victory { width: 96px; height: 96px; }

/* chip icons hold a 24px art tile */
.lo-chip-ic { display: inline-flex; align-items: center; justify-content: center; }
.lo-chip-ic .lo-icon { width: 26px; height: 26px; }

/* category tab icon wrapper */
.lo-tab-ic { display: inline-flex; align-items: center; justify-content: center; }

/* building-card icon: transparent when showing custom art */
.lo-card-ic.has-art {
  background: none !important;
  box-shadow: none !important;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* tools / gear / pause: center the art in the button */
.lo-tool, .lo-gear, .lo-sbtn, .lo-sel-close { display: inline-flex; align-items: center; justify-content: center; }

/* mission-complete check overlay art */
.lo-mission-check .lo-icon { filter: drop-shadow(0 0 12px rgba(6,214,160,0.6)); }

/* toast layout with leading icon */
.lo-toast { display: flex; align-items: center; }
.lo-toast-txt { display: inline-block; }

/* victory hero rocket */
.lo-victory-rocket .lo-icon { filter: drop-shadow(0 6px 18px rgba(255,209,102,0.4)); }

/* tier-progress inline science icon (hidden at MAX) */
.lo-tier-next.is-max .lo-icon { display: none; }

/* world-select card art */
.bw-art {
  width: 84px; height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55));
  pointer-events: none; user-select: none;
}
.btn-world-art {
  width: 1.5em; height: 1.5em;
  object-fit: contain;
  vertical-align: -0.45em;
  margin-left: 2px;
}
@media (max-height: 820px) {
  .bw-art { width: 64px; height: 64px; }
}

/* ============================================================
   13. NARRATE BUTTON (reads the current objective aloud)
   ============================================================ */
.lo-mission-label, .lo-mission-title { padding-right: 40px; }
.lo-narrate {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: 1px solid var(--lo-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--lo-cyan);
  border-radius: 9px;
  cursor: pointer;
  transition: all var(--lo-t);
  z-index: 3;
}
.lo-narrate:hover { border-color: var(--lo-border-hi); background: rgba(6, 214, 160, 0.14); }
.lo-narrate svg { width: 20px; height: 20px; display: block; overflow: visible; }
.lo-narrate .spk-body { fill: currentColor; }
.lo-narrate .spk-wave { stroke: currentColor; fill: none; opacity: 0.9; }
.lo-narrate.unavailable { opacity: 0.4; }
.lo-narrate.unavailable .spk-wave { opacity: 0.3; }
.lo-narrate.playing {
  background: rgba(6, 214, 160, 0.18);
  border-color: var(--lo-cyan);
  box-shadow: 0 0 12px rgba(6, 214, 160, 0.4);
}
.lo-narrate.playing .spk-wave-1 { animation: spk-pulse 1s ease-in-out infinite; }
.lo-narrate.playing .spk-wave-2 { animation: spk-pulse 1s ease-in-out 0.18s infinite; }
@keyframes spk-pulse { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* ============================================================
   14. TEACHER GUIDE LINK (title screen, bottom — kid-safe spot)
   ============================================================ */
#boot-teacher {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.4px;
  color: rgba(159, 175, 210, 0.55);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid rgba(120, 160, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 14, 26, 0.4);
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
#boot-teacher:hover {
  color: var(--lo-amber);
  border-color: rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.08);
}
