:root {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: #e9e5d2;
  background: #0a1f22;
  font-synthesis: none;
  --aqua: #5eead4;
  --aqua-bright: #7af5e3;
  --gold: #f6d365;
  --gold-soft: rgba(246, 211, 101, 0.22);
  --danger: #fb7185;
  --muted: #9fbfbc;
  --cream: #ece6d2;
  --panel-bg: rgba(11, 25, 25, 0.8);
  --panel-border: rgba(138, 212, 196, 0.34);
}

* { box-sizing: border-box; }

html, body, #world, #app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body { user-select: none; }

#world { position: fixed; inset: 0; }
#world canvas { display: block; width: 100%; height: 100%; }

#vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(4, 14, 16, 0.34) 115%);
}

.hidden { display: none !important; }

/* Loading */
.loading-screen {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #173633 0%, #0b1c1c 100%);
  color: #bbd5c3;
  transition: opacity 0.35s ease;
}
.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.loading-screen img { width: min(260px, 54vw); filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45)); }
.loading-screen p { font-size: 14px; letter-spacing: 0.14em; margin: 22px 0 12px; color: #b9ded5; }
.loading-track {
  width: 230px;
  height: 4px;
  background: rgba(94, 234, 212, 0.16);
  border-radius: 999px;
  overflow: hidden;
}
.loading-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #5eead4);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.65);
  transition: width 0.2s ease;
}

/* Overlays & Panels */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  background: rgba(3, 14, 16, 0.32);
  animation: overlay-in 0.28s ease both;
}
.overlay.visible { display: grid; }

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 12px 36px rgba(3, 14, 16, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.enter { animation: panel-in 0.35s cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.leaving { pointer-events: none !important; animation: fade-away 0.16s ease both !important; }

/* Main Menu */
.menu-card {
  position: relative;
  width: min(500px, calc(100vw - 36px));
  padding: 32px 44px 28px;
  border-radius: 24px;
  text-align: center;
}
.menu-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--aqua);
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.28);
  margin-bottom: 12px;
}
.title-wrap { height: 104px; display: flex; align-items: center; justify-content: center; }
.title-wrap img { display: block; width: 256px; height: auto; max-height: 104px; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45)); }
.subtitle {
  color: #b4d1c7;
  font-size: 15px;
  letter-spacing: 0.06em;
  margin: 8px 0 14px;
  text-shadow: 0 2px 4px #102421;
}
.menu-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.5), transparent);
  margin: 0 0 18px;
}
.menu-actions { display: grid; gap: 11px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

.button {
  appearance: none;
  cursor: pointer;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(124, 190, 176, 0.38);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(6, 22, 20, 0.56);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(41, 88, 76, 0.72);
  border-color: var(--aqua);
  box-shadow: 0 4px 16px rgba(94, 234, 212, 0.16);
}
.button:active:not(:disabled) { transform: scale(0.98); }
.button:focus-visible, .tab:focus-visible, .upgrade-card:focus-visible, .close-button:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 3px;
}
.button:disabled { opacity: 0.44; cursor: not-allowed; }
.button.primary {
  background: linear-gradient(135deg, rgba(38, 96, 80, 0.9), rgba(24, 72, 68, 0.9));
  color: var(--aqua-bright);
  border-color: rgba(94, 234, 212, 0.75);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(94, 234, 212, 0.35);
}
.button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(48, 118, 98, 0.96), rgba(29, 88, 82, 0.96));
  box-shadow: 0 6px 20px rgba(94, 234, 212, 0.28);
}
.menu-row .button { font-size: 14px; min-height: 40px; }

.save-status {
  margin: 22px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(8, 22, 22, 0.55);
  border: 1px solid rgba(138, 212, 196, 0.18);
  color: #a4c3b6;
  font-size: 13px;
  line-height: 1.55;
}
.menu-footnote {
  position: absolute;
  bottom: 18px;
  color: rgba(233, 228, 209, 0.85);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* HUD */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

/* Dynamic Crosshair */
.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 3px rgba(8, 20, 20, 0.8));
  transition: transform 0.15s ease;
}
.crosshair i, .crosshair b {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.crosshair i { width: 12px; height: 2px; left: 3px; top: 8px; }
.crosshair b { height: 12px; width: 2px; left: 8px; top: 3px; }
.crosshair-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.crosshair.can-pick .crosshair-ring { border-color: rgba(94, 234, 212, 0.85); transform: scale(1.15); }
.crosshair.can-pick i, .crosshair.can-pick b { background: var(--aqua-bright); }
.crosshair.charging { transform: translate(-50%, -50%) scale(0.8); }
.crosshair.charging.sweet .crosshair-ring { border-color: var(--gold); transform: scale(1.25); }
.crosshair.charging.sweet i, .crosshair.charging.sweet b { background: var(--gold); }

/* Journey & Compass Bar (Top Center) */
.journey-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 240px));
  padding: 9px 16px 11px;
  border-radius: 16px;
}
.journey-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 7px;
}
.island-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.16);
  color: var(--aqua-bright);
  font-weight: 600;
  white-space: nowrap;
}
.compass-text {
  color: #cfe0d6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.journey-track {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(135, 175, 165, 0.22);
}
.journey-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #5eead4, #f6d365);
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.45);
  transition: width 0.25s ease;
}
.island-node {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #183635;
  border: 1.5px solid rgba(167, 215, 202, 0.75);
  transform: translate(-50%, -50%);
}
.island-node.reached { background: var(--aqua); border-color: #fff; }

/* Top Right: Score + Minimap */
.hud-topright {
  position: absolute;
  right: 20px;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.score-panel {
  min-width: 176px;
  border-radius: 16px;
  padding: 10px 16px;
  font-variant-numeric: tabular-nums;
}
.score-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: #a9c7bc;
  font-size: 14px;
}
.score-row strong {
  color: var(--aqua-bright);
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(94, 234, 212, 0.25);
}
.score-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
  font-size: 12px;
  color: #d6dfd2;
}
.score-meta small { color: var(--gold); font-weight: 600; }

.minimap-box {
  width: 176px;
  border-radius: 14px;
  padding: 7px;
  overflow: hidden;
}
.minimap-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #9ec0b5;
  margin-bottom: 5px;
  padding: 0 2px;
}
.minimap-head small { color: rgba(236, 230, 210, 0.65); }
#minimap-canvas {
  display: block;
  width: 100%;
  height: 102px;
  border-radius: 8px;
  background: #0b242a;
  border: 1px solid rgba(94, 234, 212, 0.16);
}

/* Goal & Interaction */
.goal {
  position: absolute;
  left: 50%;
  top: 84px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: var(--aqua-bright);
  font-size: 15px;
  padding: 6px 18px;
  white-space: nowrap;
  transition: opacity 0.25s;
}
.pointer-hint {
  position: absolute;
  left: 50%;
  top: 126px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(11, 25, 25, 0.78);
  border: 1px solid rgba(246, 211, 101, 0.4);
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}
.interaction {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  color: #eff6ee;
  background: rgba(10, 26, 25, 0.88);
  border: 1px solid rgba(94, 234, 212, 0.4);
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.interaction.heavy-warn { border-color: rgba(251, 113, 133, 0.6); color: #fecdd3; }

/* Floating Score Popups */
.score-popups {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.score-pop {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  animation: score-float 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}
@keyframes score-float {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  18% { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(-34px) scale(0.98); }
}

/* Stamina Panel (Bottom Left) */
.stamina-panel {
  position: absolute;
  bottom: 22px;
  left: 20px;
  width: 232px;
  padding: 12px 16px;
  border-radius: 16px;
  font-variant-numeric: tabular-nums;
}
.stamina-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: #a7b9ac;
  font-size: 14px;
}
.stamina-label strong { font-weight: 700; color: var(--aqua-bright); font-size: 18px; }
.stamina-track, .charge-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(135, 164, 147, 0.24);
  margin-top: 8px;
  overflow: hidden;
}
.stamina-track i, .charge-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #5eead4);
  box-shadow: 0 0 8px rgba(77, 246, 218, 0.45);
  transition: width 0.1s linear, background 0.2s ease;
}
.stamina-panel.low .stamina-track i {
  background: linear-gradient(90deg, #f43f5e, #fb923c);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.55);
}
.stamina-panel.low .stamina-label strong { color: #fda4af; }
.stamina-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: #93afa4;
}
.regen-tag { color: var(--aqua); font-weight: 600; }

/* Charge Bar with Sweet Spot */
.charge {
  position: absolute;
  left: 50%;
  bottom: 124px;
  width: 280px;
  transform: translateX(-50%);
  border-radius: 14px;
  padding: 10px 14px;
  color: #dcebdd;
  font-size: 12px;
}
.charge-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.charge-head strong { color: var(--aqua-bright); }
.charge-track { height: 8px; margin: 7px 0; overflow: visible; }
.charge-sweet {
  position: absolute;
  left: 78%;
  width: 14%;
  top: -2px;
  bottom: -2px;
  border-radius: 3px;
  background: var(--gold-soft);
  border: 1px solid rgba(246, 211, 101, 0.85);
  z-index: 1;
}
.charge-track i { position: relative; z-index: 2; width: 0; }
.charge.in-sweet .charge-track i {
  background: linear-gradient(90deg, #5eead4, #f6d365);
  box-shadow: 0 0 12px rgba(246, 211, 101, 0.75);
}
.charge.in-sweet .charge-head strong { color: var(--gold); }
.charge small { color: #abc0b1; display: block; text-align: center; }

/* Bottom Mode Pills & Hint */
.hud-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 480px);
}
.mode-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11, 25, 25, 0.78);
  border: 1px solid rgba(138, 212, 196, 0.28);
  font-size: 12px;
  color: #cfe0d6;
  backdrop-filter: blur(6px);
}
.mode-pill kbd, .quick-help kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(94, 234, 212, 0.14);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: var(--aqua-bright);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
}
.mode-pill b { font-weight: 600; color: #f2efe0; }
.mode-pill.active { border-color: rgba(246, 211, 101, 0.55); }
.mode-pill.active b { color: var(--gold); }

.hint {
  border-radius: 999px;
  padding: 5px 16px;
  color: #b4d1c5;
  font-size: 14px;
  white-space: nowrap;
}
.hud-bottom small {
  display: block;
  font-size: 12px;
  color: rgba(242, 232, 209, 0.85);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Quick Help Overlay (H) */
.quick-help {
  position: absolute;
  left: 20px;
  top: 16px;
  width: 320px;
  border-radius: 16px;
  padding: 12px 14px;
}
.quick-help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--aqua-bright);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(138, 212, 196, 0.2);
}
.quick-help-head small { font-weight: 400; color: #9ab9ae; }
.quick-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
  font-size: 12px;
  color: #d6e4da;
}

/* Toast & Saved */
.toast, .saved {
  position: absolute;
  left: 50%;
  top: 164px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(10, 30, 28, 0.9);
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: #c6f7ea;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.22s ease both;
}
.saved { top: 68px; font-size: 12px; padding: 5px 14px; }

/* Upgrade & Settings Panels */
.upgrade-panel, .settings-panel {
  width: min(1040px, calc(100vw - 40px));
  max-height: min(780px, calc(100vh - 38px));
  border-radius: 22px;
  padding: 26px 32px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(18, 35, 34, 0.94);
}
.section-header { display: flex; align-items: flex-start; justify-content: space-between; }
.section-header h1, .pause-panel h1, .confirm-panel h1 {
  font-size: 28px;
  margin: 4px 0 12px;
  font-weight: 600;
  color: var(--aqua-bright);
  letter-spacing: 0.03em;
}
.eyebrow { font-size: 12px; color: #9eb7ab; margin: 0; letter-spacing: 0.08em; }
.close-button {
  cursor: pointer;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(187, 219, 201, 0.28);
  border-radius: 50%;
  font: inherit;
  font-size: 24px;
  line-height: 1;
  color: #c4d4ca;
  background: rgba(8, 25, 23, 0.45);
  transition: transform 0.2s, color 0.2s, border-color 0.2s;
}
.close-button:hover { transform: rotate(90deg); color: var(--aqua-bright); border-color: var(--aqua); }

.upgrade-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin: 2px 0 14px;
}
.summary-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #b9ccc0;
  font-size: 14px;
}
.summary-chip strong { color: var(--aqua-bright); font-size: 20px; font-variant-numeric: tabular-nums; }
.summary-stats {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.2);
  color: #b7d3c6;
  font-size: 12px;
}

.upgrade-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(154, 198, 181, 0.2);
  margin-bottom: 16px;
  overflow-x: auto;
  flex-shrink: 0;
}
.tab {
  cursor: pointer;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #9db6aa;
  padding: 9px 18px;
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.18s, border-color 0.18s;
}
.tab:hover, .tab.active { color: var(--aqua-bright); border-color: var(--aqua-bright); }
.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  min-height: 0;
  gap: 12px;
  overflow: auto;
  padding: 2px 4px 6px 0;
}
.upgrade-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  color: #e3e7d8;
  cursor: pointer;
  border: 1px solid rgba(151, 199, 178, 0.25);
  border-radius: 14px;
  background: rgba(88, 118, 102, 0.16);
  font: inherit;
  padding: 15px 16px;
  transition: transform 0.16s, background 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.upgrade-card:before {
  content: "";
  position: absolute;
  inset: auto -22px -22px auto;
  width: 96px;
  height: 76px;
  background: url('assets/upgrade-art.webp') center/contain no-repeat;
  opacity: 0.1;
  pointer-events: none;
}
.upgrade-card:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(74, 134, 112, 0.24);
  border-color: var(--aqua);
}
.upgrade-card.affordable:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.14);
}
.upgrade-card.kb-selected {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.upgrade-card[disabled] { opacity: 0.5; cursor: not-allowed; }
.upgrade-card h2 {
  margin: 0;
  color: #eef1e2;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.upgrade-card p {
  margin: 8px 0 12px;
  min-height: 36px;
  line-height: 1.5;
  font-size: 13px;
  color: #b5c8bb;
}
.upgrade-card-bottom {
  display: flex;
  justify-content: space-between;
  color: var(--aqua);
  font-size: 13px;
  margin-top: auto;
}
.upgrade-card.affordable .upgrade-card-bottom span:last-child { color: var(--gold); font-weight: 600; }

.modal-footer {
  display: flex;
  justify-content: space-between;
  color: #92aa9e;
  font-size: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(154, 198, 181, 0.15);
}

/* Settings */
.setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; overflow: auto; }
.setting-card {
  background: rgba(95, 125, 108, 0.13);
  border: 1px solid rgba(160, 200, 180, 0.2);
  border-radius: 14px;
  padding: 18px 20px;
}
.setting-card h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; color: #dbe9d9; }
.setting-card dl { margin: 0; }
.setting-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(178, 211, 188, 0.08);
  font-size: 13px;
}
.setting-card dt { color: #a6bbad; }
.setting-card dd { margin: 0; color: #e4e4d3; text-align: right; }
.setting-line { display: flex; justify-content: space-between; color: #c5d4c8; font-size: 14px; margin: 16px 0 6px; }
input[type=range] { width: 100%; accent-color: #5eead4; }
.setting-check { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 14px; cursor: pointer; }
.setting-check input { accent-color: #5eead4; }
.setting-note { font-size: 12px; line-height: 1.6; color: #a4b9ac; margin: 6px 0 0; }
.settings-back { align-self: flex-end; min-width: 140px; margin-top: 16px; }

.sound-library { margin-top: 16px; color: #c7dacc; font-size: 14px; }
.sound-library summary { cursor: pointer; color: #8de4d6; }
.sound-library div { display: flex; gap: 8px; margin-top: 10px; }
.sound-library select {
  min-width: 0;
  flex: 1;
  color: #e5eee1;
  background: #1c332e;
  border: 1px solid #5e877a;
  border-radius: 10px;
  padding: 7px 10px;
}
.sound-library .button { min-height: 36px; padding: 0 14px; font-size: 13px; }
.save-tools { display: flex; gap: 8px; margin-top: 18px; }
.save-tools .button { font-size: 13px; min-height: 36px; flex: 1; }
.file-button { display: grid; place-items: center; }
.file-button input { display: none; }

/* Pause & Confirm */
.pause-panel, .confirm-panel {
  width: min(420px, calc(100vw - 36px));
  border-radius: 22px;
  padding: 30px 32px;
  text-align: center;
  display: grid;
  gap: 11px;
}
.pause-panel h1, .confirm-panel h1 { margin: 0; font-size: 26px; }
.pause-panel p, .confirm-panel p { color: #abc0af; margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.pause-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 22, 22, 0.55);
  border: 1px solid rgba(138, 212, 196, 0.2);
  text-align: left;
}
.pause-stats div { display: flex; flex-direction: column; gap: 2px; }
.pause-stats span { font-size: 11px; color: #95b3a7; }
.pause-stats strong { font-size: 14px; color: var(--aqua-bright); font-variant-numeric: tabular-nums; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }

.fatal {
  position: fixed;
  inset: 0;
  background: #142c2a;
  color: #f0ece0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.8;
  padding: 30px;
}

@keyframes overlay-in { from { opacity: 0.75; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0.85; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0.8; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 820px) {
  .journey-bar { width: calc(100vw - 24px); top: 10px; }
  .hud-topright { top: 72px; right: 12px; }
  .minimap-box { display: none; }
  .hud-bottom { max-width: calc(100vw - 24px); }
  .stamina-panel { width: 170px; left: 12px; bottom: 108px; }
  .upgrade-grid, .setting-grid { grid-template-columns: 1fr; }
  .upgrade-panel, .settings-panel { padding: 20px; }
  .summary-stats { margin-left: 0; width: 100%; }
}

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

/* Mobile Performance Mode: disable expensive CSS backdrop-filter */
body.perf-low .panel,
body.perf-low .mode-pill {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(11, 25, 25, 0.92);
}

/* FPS Badge */
.fps-badge {
  position: absolute;
  left: 20px;
  top: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 26, 25, 0.78);
  border: 1px solid rgba(94, 234, 212, 0.3);
  color: var(--aqua);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Achievement Banner & Grid */
.achievement-banner {
  position: absolute;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(22, 46, 40, 0.96), rgba(14, 30, 29, 0.96));
  border: 1px solid rgba(246, 211, 101, 0.78);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  z-index: 18;
  animation: toast-in 0.28s ease both;
}
.ach-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(246, 211, 101, 0.2);
  color: var(--gold);
  font-size: 14px;
}
.achievement-banner small { display: block; font-size: 10px; color: var(--gold); letter-spacing: 0.08em; }
.achievement-banner strong { display: block; font-size: 14px; color: #f6f3e4; }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 4px 4px 8px 0;
  margin-top: 6px;
}
.ach-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(88, 118, 102, 0.14);
  border: 1px solid rgba(151, 199, 178, 0.2);
  opacity: 0.56;
}
.ach-card.unlocked {
  opacity: 1;
  background: rgba(45, 92, 78, 0.28);
  border-color: rgba(246, 211, 101, 0.62);
}
.ach-card-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(151, 199, 178, 0.14);
  color: #9cb7ab;
  font-size: 16px;
}
.ach-card.unlocked .ach-card-badge {
  background: rgba(246, 211, 101, 0.22);
  color: var(--gold);
}
.ach-card h3 { margin: 0 0 3px; font-size: 15px; color: #eef1e2; }
.ach-card p { margin: 0; font-size: 12px; color: #abc2b6; line-height: 1.4; }

/* Settings Select Row */
.setting-select-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 14px;
  color: #c5d4c8;
}
.setting-select-row select {
  color: #e5eee1;
  background: #1c332e;
  border: 1px solid #5e877a;
  border-radius: 10px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
}

/* Mobile Touch Controls */
.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  touch-action: none;
}
.touch-look {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  left: 38%;
  pointer-events: auto;
  touch-action: none;
}
.touch-top-actions {
  position: absolute;
  left: 12px;
  top: 72px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.touch-mini-btn {
  appearance: none;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(138, 212, 196, 0.38);
  background: rgba(10, 26, 25, 0.82);
  color: #dff0e6;
  font: inherit;
  font-size: 12px;
  touch-action: manipulation;
}
.touch-mini-btn:active { background: rgba(45, 98, 84, 0.9); border-color: var(--aqua); }

.joystick-zone {
  position: absolute;
  left: 20px;
  bottom: 24px;
  width: 126px;
  height: 126px;
  pointer-events: auto;
  touch-action: none;
  display: grid;
  place-items: center;
}
.joystick-base {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(10, 26, 25, 0.56);
  border: 1.5px solid rgba(94, 234, 212, 0.36);
  position: relative;
  display: grid;
  place-items: center;
}
.joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7af5e3, #2c7a70);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transform: translate(0px, 0px);
  pointer-events: none;
}

.touch-actions {
  position: absolute;
  right: 16px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}
.touch-sub-row, .touch-main-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.touch-btn {
  appearance: none;
  min-width: 58px;
  height: 58px;
  padding: 0 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(138, 212, 196, 0.48);
  background: rgba(10, 26, 25, 0.78);
  color: #eef5ec;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  touch-action: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.touch-btn.small {
  min-width: 48px;
  height: 36px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.touch-btn.primary {
  min-width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(38, 102, 84, 0.9), rgba(22, 68, 65, 0.9));
  border-color: var(--aqua);
  color: var(--aqua-bright);
  font-size: 13px;
}
.touch-btn:active, .touch-btn.charging {
  transform: scale(0.93);
  border-color: var(--gold);
  background: rgba(56, 110, 92, 0.9);
}

@media (max-width: 820px) {
  body.has-touch .stamina-panel { left: 12px; bottom: auto; top: 112px; width: 152px; padding: 8px 11px; }
  body.has-touch .hud-bottom { bottom: 6px; pointer-events: none; }
  body.has-touch .hud-bottom small,
  body.has-touch .mode-pills,
  body.has-touch .pointer-hint { display: none !important; }
  body.has-touch .charge { bottom: 168px; width: 220px; }
  .achievements-grid { grid-template-columns: 1fr; }
}

/* Long-term Retention & Monetization UI */
.crystal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2px;
  font-size: 13px;
  color: #a9c7bc;
}
.crystal-row strong {
  color: #38bdf8;
  font-size: 16px;
  font-weight: 700;
}
.hud-action-strip {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.hud-chip-btn {
  appearance: none;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(138, 212, 196, 0.36);
  background: rgba(10, 26, 25, 0.82);
  color: #dff0e6;
  font: inherit;
  font-size: 12px;
  transition: transform 0.14s, border-color 0.16s, background 0.16s;
}
.hud-chip-btn:hover { transform: translateY(-1px); border-color: var(--aqua); background: rgba(34, 76, 68, 0.88); }
.hud-chip-btn.gold { border-color: rgba(246, 211, 101, 0.58); color: var(--gold); }
.frenzy-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--gold);
  border-color: rgba(246, 211, 101, 0.65);
  font-variant-numeric: tabular-nums;
}
.touch-mini-btn.gold { border-color: rgba(246, 211, 101, 0.6); color: var(--gold); }

/* Golden Crosshair VIP Aura */
.crosshair.vip-aura .crosshair-ring {
  border-color: rgba(246, 211, 101, 0.55);
  box-shadow: 0 0 8px rgba(246, 211, 101, 0.35);
}

/* Shop & Rebirth Content */
.shop-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rebirth-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(28, 66, 64, 0.55), rgba(16, 40, 48, 0.55));
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.rebirth-banner h2 { margin: 0 0 4px; font-size: 17px; color: #7dd3fc; }
.rebirth-banner p { margin: 0; font-size: 13px; color: #c4d8d0; }
.rebirth-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px;
  border-radius: 14px;
  background: rgba(88, 118, 102, 0.16);
  border: 1px solid rgba(151, 199, 178, 0.25);
}
.shop-card.equipped, .shop-card.owned {
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(45, 92, 78, 0.28);
}
.shop-card.vip { border-color: rgba(246, 211, 101, 0.55); }
.shop-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.shop-card-head h3 { margin: 0; font-size: 16px; color: #eef1e2; }
.shop-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(246, 211, 101, 0.18);
  color: var(--gold);
  white-space: nowrap;
}
.shop-tag.aqua { background: rgba(94, 234, 212, 0.16); color: var(--aqua-bright); }
.shop-card p { margin: 0; font-size: 13px; line-height: 1.5; color: #b5c8bb; flex: 1; }
.shop-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.shop-card-foot .button { min-height: 36px; font-size: 13px; padding: 0 14px; }
.shop-price { font-size: 14px; font-weight: 700; color: #38bdf8; }
.shop-price.gold { color: var(--gold); }

/* Offline & Sim Modals */
.offline-rewards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 22, 22, 0.6);
  border: 1px solid rgba(94, 234, 212, 0.28);
}
.offline-rewards span { display: block; font-size: 12px; color: #9db8ac; }
.offline-rewards strong { display: block; font-size: 20px; color: var(--gold); margin-top: 2px; }
.sim-timer, .sim-price {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(8, 22, 22, 0.65);
  border: 1px solid rgba(246, 211, 101, 0.35);
  color: var(--gold);
  font-size: 14px;
}
.sim-price strong { font-size: 20px; }

@media (max-width: 820px) {
  .shop-grid { grid-template-columns: 1fr; }
  .hud-action-strip { display: none; }
}

/* Wind, Challenge Mode, Battle Pass & Save Code UI */
.wind-text {
  font-size: 11px;
  color: #7dd3fc;
  white-space: nowrap;
}
.challenge-hud {
  position: absolute;
  left: 50%;
  top: 122px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  border-color: rgba(246, 211, 101, 0.65);
  color: #f6f3e4;
  font-size: 13px;
  pointer-events: auto;
  white-space: nowrap;
}
.challenge-hud strong { color: var(--gold); font-size: 15px; }
.challenge-poster {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: #0b1f22;
}
.save-code-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(138, 212, 196, 0.35);
  background: rgba(8, 22, 22, 0.75);
  color: #e5eee1;
  padding: 10px;
  font: inherit;
  font-size: 12px;
  resize: vertical;
}
.quest-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(135, 164, 147, 0.22);
  overflow: hidden;
  margin-top: 4px;
}
.quest-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #5eead4);
}
.bp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bp-row {
  display: grid;
  grid-template-columns: 74px 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(88, 118, 102, 0.14);
  border: 1px solid rgba(151, 199, 178, 0.2);
  font-size: 13px;
}
.bp-tier { font-weight: 700; color: #7dd3fc; }
.bp-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(8, 22, 22, 0.45);
}
.bp-cell.prem { border: 1px solid rgba(246, 211, 101, 0.28); }
.bp-cell .button { min-height: 28px; font-size: 12px; padding: 0 10px; }
