/* SelûneCraft v2 — Astral Midnight Design System (DESIGN.md tokens) */

:root {
  --selune-bg-canvas: #070b16;
  --selune-bg-surface: rgba(13, 21, 40, 0.88);
  --selune-bg-elevated: rgba(20, 34, 61, 0.94);
  --selune-border-subtle: #1e3254;
  --selune-border-strong: #35507a;
  --selune-text-primary: #f0f5fc;
  --selune-text-secondary: #a7bad4;
  --selune-text-muted: #768ead;
  --selune-silver: #dce7f5;
  --selune-moonglow: #38e8c6;
  --selune-silverfire: #38bdf8;
  --selune-amethyst: #a78bfa;
  --selune-waxing: #fbbf24;
  --selune-umbra: #ff758f;
  --font-display: "Space Grotesk", "Cinzel", system-ui, -apple-system, sans-serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--selune-bg-canvas);
  color: var(--selune-text-primary);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-user-select: none;
}

#gl-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* Underwater eye-submerged tint */
.underwater-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(14, 108, 146, 0.24), rgba(6, 36, 68, 0.58));
  z-index: 2;
}

/* Hurt vignette flash */
.hurt-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 64, 96, 0.04) 45%, rgba(255, 64, 96, 0.44) 100%);
  z-index: 3;
}

/* Confirmation / status toast */
.hud-toast {
  position: fixed;
  bottom: 132px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(13, 21, 40, 0.94);
  border: 1px solid var(--selune-waxing);
  color: var(--selune-waxing);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(3, 6, 14, 0.65);
  pointer-events: none;
  z-index: 35;
  white-space: nowrap;
}

.look-hint {
  position: fixed;
  bottom: 162px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(11, 18, 34, 0.78);
  border: 1px solid rgba(148, 184, 232, 0.28);
  color: rgba(226, 238, 255, 0.88);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  z-index: 12;
  pointer-events: none;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* Optical Crosshair + Hold-to-Break Progress Bar */
.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

.crosshair .ch-arm {
  position: absolute;
  background: rgba(220, 231, 245, 0.85);
  box-shadow: 0 0 4px rgba(7, 11, 22, 0.9);
  transition: background-color 120ms ease;
}

.crosshair .ch-h {
  top: 11px;
  left: 3px;
  width: 18px;
  height: 2px;
}

.crosshair .ch-v {
  left: 11px;
  top: 3px;
  width: 2px;
  height: 18px;
}

.crosshair .ch-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--selune-bg-canvas);
  border: 1px solid var(--selune-silver);
}

.crosshair.targeting .ch-arm {
  background: var(--selune-moonglow);
  box-shadow: 0 0 8px rgba(56, 232, 198, 0.7);
}

.mining-bar-wrap {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(7, 11, 22, 0.84);
  border: 1px solid var(--selune-border-strong);
  overflow: hidden;
}

.mining-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--selune-silverfire), var(--selune-moonglow));
  transition: width 40ms linear;
}

/* HUD Panels */
.hud-panel {
  position: fixed;
  top: 12px;
  background: var(--selune-bg-surface);
  border: 1px solid var(--selune-border-subtle);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 12px;
  z-index: 20;
  box-shadow: 0 8px 28px rgba(3, 6, 14, 0.48);
}

.hud-left {
  left: 12px;
  min-width: 244px;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--selune-border-subtle);
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--selune-silver);
}

.brand-tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--selune-moonglow);
  background: rgba(56, 232, 198, 0.12);
  border: 1px solid rgba(56, 232, 198, 0.32);
}

.hud-grid {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 3px 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}

.hud-grid .lbl {
  color: var(--selune-text-muted);
}

.hud-grid .val {
  color: var(--selune-text-primary);
  text-align: right;
  white-space: nowrap;
}

.hud-lunar-val {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.lunar-glyph {
  display: inline-flex;
  width: 13px;
  height: 13px;
  vertical-align: middle;
}

.val-moonglow {
  color: var(--selune-moonglow) !important;
}

.val-silverfire {
  color: var(--selune-silverfire) !important;
}

.val-amethyst {
  color: var(--selune-amethyst) !important;
}

/* Top-Right Controls & Collapsible Bench Drawer */
.hud-right {
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  max-width: min(560px, calc(100vw - 276px));
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.hud-pill {
  appearance: none;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-elevated);
  color: var(--selune-text-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.btn-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hud-pill:hover {
  border-color: var(--selune-silverfire);
  background: rgba(28, 47, 82, 0.96);
}

.hud-pill:active {
  transform: scale(0.97);
}

.hud-pill-accent {
  border-color: rgba(56, 232, 198, 0.55);
  color: var(--selune-moonglow);
}

.hud-pill-accent.active {
  background: rgba(56, 232, 198, 0.18);
  border-color: var(--selune-moonglow);
  box-shadow: 0 0 12px rgba(56, 232, 198, 0.26);
}

.hud-pill kbd,
.controls-grid kbd,
.screen-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(7, 11, 22, 0.72);
  border: 1px solid var(--selune-border-subtle);
  color: var(--selune-text-secondary);
}

.target-strip {
  width: 100%;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--selune-text-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.target-val {
  color: var(--selune-silver);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.target-sep {
  color: var(--selune-text-muted);
  flex: 0 0 auto;
}

.target-counts {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Collapsible Real-Time Benchmark Drawer */
.bench-drawer {
  width: 344px;
  max-width: 100%;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--selune-border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 180ms ease, margin-top 180ms ease, padding-top 180ms ease;
}

.bench-drawer.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
  pointer-events: none;
}

.bench-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.bench-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--selune-moonglow);
}

.bench-rate {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--selune-text-muted);
}

.sparkline-wrap {
  background: rgba(7, 11, 22, 0.76);
  border: 1px solid var(--selune-border-subtle);
  border-radius: 7px;
  padding: 6px;
}

#bench-sparkline {
  display: block;
  width: 100%;
  height: 48px;
}

.sparkline-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.leg-moonglow { color: var(--selune-moonglow); }
.leg-silverfire { color: var(--selune-silverfire); }
.leg-ref { color: var(--selune-text-muted); }

.bench-metrics {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.bm-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.bm-k {
  color: var(--selune-text-secondary);
  white-space: nowrap;
}

.bm-v {
  color: var(--selune-text-primary);
  text-align: right;
  white-space: nowrap;
}

.micro-bench-box {
  background: rgba(7, 11, 22, 0.65);
  border: 1px solid var(--selune-border-subtle);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.btn-microbench {
  appearance: none;
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.14);
  color: var(--selune-silver);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-microbench:hover {
  background: rgba(56, 189, 248, 0.26);
  border-color: var(--selune-silverfire);
}

.microbench-results {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  line-height: 1.48;
  color: var(--selune-text-secondary);
}

.microbench-results strong {
  color: var(--selune-moonglow);
}

/* Bottom Survival Vitals + 9-Slot Hotbar */
.hotbar-wrap {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 20;
}

.hotbar-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--selune-silver);
  background: var(--selune-bg-surface);
  border: 1px solid var(--selune-border-subtle);
  padding: 2px 10px;
  border-radius: 999px;
}

.survival-vitals {
  width: 458px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(13, 21, 40, 0.78);
  border: 1px solid var(--selune-border-subtle);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

.vitals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.vitals-strip {
  display: flex;
  align-items: center;
  gap: 2px;
}

.vitals-oxygen {
  justify-content: flex-end;
}

.vital-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  filter: drop-shadow(0 1px 2px rgba(2, 5, 12, 0.75));
}

.hotbar {
  display: flex;
  gap: 6px;
  padding: 7px 9px;
  background: var(--selune-bg-surface);
  border: 1px solid var(--selune-border-strong);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(3, 6, 14, 0.6);
}

.hotbar-slot,
.inv-slot {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1.5px solid var(--selune-border-subtle);
  background: rgba(7, 11, 22, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.hotbar-slot:hover,
.inv-slot:hover {
  border-color: var(--selune-silverfire);
  background: rgba(20, 34, 61, 0.85);
}

.hotbar-slot:hover {
  transform: translateY(-2px);
}

.hotbar-slot.selected {
  border-color: var(--selune-moonglow);
  background: rgba(56, 232, 198, 0.14);
  box-shadow: 0 0 14px rgba(56, 232, 198, 0.35);
  transform: translateY(-3px);
}

.hotbar-slot img,
.inv-slot img,
.cursor-stack img {
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 3px;
  pointer-events: none;
}

.hotbar-slot .slot-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--selune-text-muted);
  pointer-events: none;
}

.hotbar-slot.selected .slot-num {
  color: var(--selune-moonglow);
}

.slot-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--selune-text-primary);
  text-shadow: 0 1px 2px #000, 1px 0 2px #000;
  pointer-events: none;
}

.slot-dur-track {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 3px;
  border-radius: 99px;
  background: rgba(5, 8, 16, 0.85);
  overflow: hidden;
  pointer-events: none;
}

.slot-dur-fill {
  height: 100%;
  border-radius: 99px;
}

/* Interactive Container & Crafting Modal Screens */
.screen-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 19, 0.74);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 45;
  padding: 16px;
}

.game-screen {
  width: min(504px, 95vw);
  max-height: 92vh;
  overflow-y: auto;
  background: rgba(13, 21, 40, 0.96);
  border: 1px solid var(--selune-border-strong);
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 22px 60px rgba(2, 5, 12, 0.82), 0 0 0 1px rgba(56, 232, 198, 0.14);
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--selune-border-subtle);
}

.screen-header h2 {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--selune-silver);
}

.screen-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--selune-text-muted);
}

.screen-close {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-elevated);
  color: var(--selune-silver);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.screen-close:hover {
  border-color: var(--selune-umbra);
  color: var(--selune-umbra);
}

.grid-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--selune-text-muted);
  margin: 10px 0 5px;
}

.slot-grid {
  display: grid;
  gap: 5px;
}

.slot-grid--9 {
  grid-template-columns: repeat(9, 44px);
  justify-content: center;
}

.slot-grid--3x3 {
  grid-template-columns: repeat(3, 44px);
}

.slot-grid--2x2 {
  grid-template-columns: repeat(2, 44px);
}

.craft-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.62);
  border: 1px solid var(--selune-border-subtle);
}

.craft-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.craft-arrow {
  font-size: 24px;
  color: var(--selune-moonglow);
  margin-top: 18px;
}

.craft-output-slot .inv-slot {
  width: 52px;
  height: 52px;
  border-color: rgba(56, 232, 198, 0.55);
  background: rgba(56, 232, 198, 0.08);
}

.craft-output-slot .inv-slot.craft-ready {
  border-color: var(--selune-moonglow);
  box-shadow: 0 0 14px rgba(56, 232, 198, 0.35);
}

/* Silverfire Furnace Layout */
.furnace-pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(118, 142, 173, 0.16);
  border: 1px solid var(--selune-border-strong);
  color: var(--selune-text-secondary);
}

.furnace-pill.burning {
  background: rgba(56, 232, 198, 0.18);
  border-color: var(--selune-moonglow);
  color: var(--selune-moonglow);
}

.furnace-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.65);
  border: 1px solid var(--selune-border-subtle);
}

.furnace-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.furnace-slot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.furnace-flame-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flame-track {
  width: 14px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--selune-border-strong);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.flame-fill {
  width: 100%;
  background: linear-gradient(0deg, #fbbf24, #38bdf8, #38e8c6);
  transition: height 120ms linear;
}

.furnace-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
}

.smelt-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--selune-border-strong);
  overflow: hidden;
}

.smelt-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--selune-silverfire), var(--selune-moonglow));
  transition: width 120ms linear;
}

.furnace-meter-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--selune-text-secondary);
}

/* Floating Cursor Stack */
.cursor-stack {
  position: fixed;
  pointer-events: none;
  z-index: 60;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.75));
}

/* Death Screen Overlay */
.death-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(92, 16, 36, 0.72), rgba(7, 11, 22, 0.94));
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  padding: 20px;
}

.death-card {
  width: min(440px, 92vw);
  padding: 28px 26px;
  border-radius: 16px;
  background: rgba(18, 12, 26, 0.95);
  border: 1px solid rgba(255, 117, 143, 0.65);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
}

.death-title {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.12em;
  color: var(--selune-umbra);
  margin-bottom: 10px;
}

.death-cause {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--selune-text-primary);
  margin-bottom: 10px;
}

.death-note {
  font-size: 12px;
  color: var(--selune-text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Title & Esc Pause Overlay */
.title-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(20, 34, 61, 0.70), rgba(7, 11, 22, 0.92)),
    url("../assets/selunecraft-v2-keyart.png") center / cover no-repeat;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}

.title-card {
  width: min(636px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(13, 21, 40, 0.96);
  border: 1px solid var(--selune-border-strong);
  border-radius: 16px;
  padding: 20px 24px 18px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(2, 5, 12, 0.78), 0 0 0 1px rgba(56, 232, 198, 0.12);
}

.title-logo {
  display: block;
  width: min(260px, 76%);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  margin: 0 auto 10px;
  border-radius: 10px;
  border: 1px solid var(--selune-border-strong);
  box-shadow: 0 10px 28px rgba(3, 6, 14, 0.65);
}

.title-heading {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--selune-silver);
  margin-bottom: 4px;
}

.title-sub {
  font-size: 12px;
  color: var(--selune-text-secondary);
  margin-bottom: 12px;
}

/* World-Creation Presets & Mode Toggle */
.world-create-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.66);
  border: 1px solid var(--selune-border-subtle);
}

.seed-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.preset-pill {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-elevated);
  color: var(--selune-text-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.preset-pill .preset-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-bottom: 1px solid var(--selune-border-subtle);
}

.preset-pill .preset-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 4px;
}

.preset-pill small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--selune-text-muted);
}

.preset-pill:hover,
.preset-pill.active {
  border-color: var(--selune-moonglow);
  background: rgba(56, 232, 198, 0.14);
}

.preset-pill.active small {
  color: var(--selune-moonglow);
}

.mode-toggle-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  border-radius: 8px;
  padding: 2px;
  background: rgba(7, 11, 22, 0.85);
  border: 1px solid var(--selune-border-strong);
}

.seg-btn {
  appearance: none;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--selune-text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(56, 232, 198, 0.2);
  color: var(--selune-moonglow);
}

.seed-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.seed-row label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--selune-text-secondary);
}

.seed-row input {
  width: 112px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-canvas);
  color: var(--selune-text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.btn-primary {
  appearance: none;
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--selune-moonglow);
  background: linear-gradient(135deg, rgba(56, 232, 198, 0.24), rgba(56, 189, 248, 0.24));
  color: var(--selune-text-primary);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(56, 232, 198, 0.38), rgba(56, 189, 248, 0.36));
  box-shadow: 0 0 20px rgba(56, 232, 198, 0.35);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pause-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-bottom: 12px;
}

.btn-secondary {
  appearance: none;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-elevated);
  color: var(--selune-silver);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--selune-silverfire);
  color: var(--selune-text-primary);
}

.btn-danger {
  border-color: rgba(255, 117, 143, 0.55);
  color: var(--selune-umbra);
}

/* Settings Grid */
.pause-settings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.68);
  border: 1px solid var(--selune-border-subtle);
  font-size: 11.5px;
  color: var(--selune-text-secondary);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.setting-item input[type="range"] {
  width: 92px;
  accent-color: var(--selune-moonglow);
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--selune-moonglow);
  cursor: pointer;
}

.setting-val {
  min-width: 36px;
  color: var(--selune-moonglow);
  text-align: right;
}

.audio-unlock-banner {
  position: fixed;
  top: calc(50% + 56px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 38;
  appearance: none;
  min-height: 44px;
  padding: 9px 20px;
  border-radius: 10px;
  border: 1px solid var(--selune-moonglow);
  background: #112037;
  color: var(--selune-moonglow);
  font: 600 0.9rem var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(2, 5, 12, 0.52);
}

.audio-unlock-banner:hover {
  background: rgba(20, 34, 61, 0.98);
  border-color: var(--selune-moonglow);
}

/* 10-Track Soundtrack Album Player ("The Silk of Seven Stars") */
.ost-player {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 26, 48, 0.84), rgba(10, 15, 30, 0.88));
  border: 1px solid rgba(56, 232, 198, 0.28);
  text-align: left;
}

.ost-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ost-cover-thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(56, 232, 198, 0.42);
  box-shadow: 0 4px 14px rgba(2, 5, 12, 0.65);
}

.ost-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 180px;
  min-width: 0;
}

.ost-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--selune-silverfire);
}

.ost-now-playing {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--selune-silver);
}

.ost-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 232, 198, 0.12);
  border: 1px solid rgba(56, 232, 198, 0.36);
  color: var(--selune-moonglow);
  white-space: nowrap;
}

.ost-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ost-mode-btn {
  flex: 0 0 auto;
}

.ost-step-btn {
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
}

.ost-select {
  flex: 1 1 220px;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--selune-border-strong);
  background: var(--selune-bg-canvas);
  color: var(--selune-text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.ost-chapter-note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--selune-text-secondary);
  font-style: italic;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 12px;
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.68);
  border: 1px solid var(--selune-border-subtle);
  font-size: 11px;
  color: var(--selune-text-secondary);
  margin-bottom: 10px;
}

.status-banner {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--selune-moonglow);
}

.play-recovery {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(76, 16, 32, 0.85);
  border: 1px solid #ff758f;
  color: #ffd6de;
  font-size: 12px;
  line-height: 1.5;
}

.play-recovery a,
.play-footer-links a {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-weight: 600;
}

.play-footer-links {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--selune-text-secondary);
}

@media (max-width: 960px) {
  .hud-left { min-width: 204px; padding: 8px 10px; }
  .hud-right { max-width: calc(100vw - 230px); }
  .hud-actions { flex-wrap: wrap; }
  .hud-pill kbd { display: none; }
  .target-val { max-width: 190px; }
  .bench-drawer { width: 292px; }
}

@media (max-width: 640px) {
  .seed-presets { grid-template-columns: repeat(2, 1fr); }
  .pause-settings, .controls-grid { grid-template-columns: 1fr; }
  .slot-grid--9 { grid-template-columns: repeat(9, 34px); }
  .hotbar-slot, .inv-slot { width: 34px; height: 34px; }
  .hotbar-slot img, .inv-slot img { width: 22px; height: 22px; }
  .survival-vitals { width: 344px; }
  .vital-icon { width: 11px; height: 11px; flex: 0 0 11px; }
}

/* Survival objective and destination */
.journey {
  position: absolute;
  z-index: 20;
  bottom: clamp(180px, 25vh, 238px);
  left: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(305px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--selune-border-subtle);
  border-radius: 10px;
  background: rgba(10, 16, 30, 0.9);
  color: var(--selune-silver);
  pointer-events: none;
}

.journey-copy strong {
  font-size: 0.88rem;
  color: var(--selune-moonglow);
}

.journey-copy p {
  margin: 3px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.journey-destination {
  display: none;
  flex: none;
  min-width: 40px;
  justify-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.journey.has-destination .journey-destination {
  display: grid;
}

.journey-arrow {
  width: 20px;
  height: 20px;
  color: var(--selune-moonglow);
  transform: rotate(var(--destination-bearing, 0rad));
}

.journey-instruction {
  margin: 8px 0;
  max-width: 65ch;
  font-size: 0.875rem;
  color: var(--selune-moonglow);
}
