@import url('https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&family=Cinzel:wght@400;700&display=swap');

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

html, body {
  width: 100%;
  height: 100%;
  background: #050508;
  overflow: hidden;
  font-family: 'Share Tech Mono', monospace;
  color: #d8d4cc;
}

#game-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ─────────────────────────────────────────────── */
/*  HUD                                              */
/* ─────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 20px;
  color: rgba(255, 200, 120, 0.75);
  pointer-events: none;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0,0,0,0.9);
}

#inventory {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  color: rgba(255, 200, 120, 0.85);
  pointer-events: none;
  display: flex;
  gap: 18px;
  text-shadow: 0 0 8px rgba(0,0,0,0.9);
  letter-spacing: 1px;
}

#controls-hint {
  position: absolute;
  bottom: 8px;
  right: 16px;
  font-size: 15px;
  color: rgba(216, 212, 204, 0.35);
  pointer-events: none;
}

/* ─────────────────────────────────────────────── */
/*  Narrator                                         */
/* ─────────────────────────────────────────────── */
#narrator-box {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #ffcc88;
  background: rgba(8, 6, 4, 0.85);
  padding: 12px 28px;
  border-left: 2px solid #c87533;
  border-right: 2px solid #c87533;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  max-width: 80%;
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(255, 140, 60, 0.4);
}
#narrator-box.visible { opacity: 1; }

/* ─────────────────────────────────────────────── */
/*  Zone transition                                  */
/* ─────────────────────────────────────────────── */
#zone-transition {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 56px;
  color: #ffcc88;
  text-shadow: 0 0 30px rgba(0,0,0,0.95), 0 0 60px rgba(255, 140, 60, 0.5);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  letter-spacing: 6px;
  font-weight: 700;
}
#zone-transition.visible { opacity: 1; }

#zone-subtitle {
  position: absolute;
  top: 53%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: rgba(255, 200, 120, 0.7);
  text-shadow: 0 0 20px rgba(0,0,0,0.95);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  letter-spacing: 4px;
  font-style: italic;
}
#zone-subtitle.visible { opacity: 1; }

/* ─────────────────────────────────────────────── */
/*  Mode selection                                   */
/* ─────────────────────────────────────────────── */
#mode-select {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  color: #d8d4cc;
}

#menu-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #15100a 0%, #050304 70%);
  transition: background 1.5s ease;
  z-index: -1;
}

.menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

#mode-select h1 {
  font-family: 'Cinzel', serif;
  font-size: 48px;
  letter-spacing: 10px;
  margin-bottom: 28px;
  color: #ffcc88;
  text-shadow: 0 0 40px rgba(255, 140, 60, 0.6);
  font-weight: 700;
  text-align: center;
  max-width: 700px;
  line-height: 1.1;
}

#mode-select .subtitle {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: rgba(255, 200, 120, 0.55);
  margin-bottom: 40px;
  letter-spacing: 4px;
}

.menu-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#mode-select .mode-btn {
  display: block;
  width: 280px;
  padding: 13px;
  margin: 5px 5px 2px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 14, 10, 0.5);
  color: #d8d4cc;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 3px;
}

#mode-select .mode-desc {
  font-family: 'VT323', monospace;
  font-size: 19px;
  color: rgba(216, 212, 204, 0.55);
  max-width: 360px;
  text-align: center;
  margin-top: 2px;
  margin-bottom: 14px;
  letter-spacing: 3px;
}

#mode-select .mode-btn:hover {
  border-color: #c87533;
  color: #ffcc88;
  background: rgba(60, 35, 15, 0.5);
  box-shadow: 0 0 30px rgba(255, 140, 60, 0.15) inset;
}

#mode-select .mode-btn:disabled {
  opacity: 0.4;
  cursor: wait;
  pointer-events: none;
}

#mode-select .mode-btn.danger:hover {
  border-color: #cc4040;
  color: #ff6868;
  background: rgba(60, 15, 15, 0.5);
  box-shadow: 0 0 30px rgba(255, 60, 60, 0.15) inset;
}


.menu-choice-row {
  display: flex;
  gap: 10px;
}

.menu-choice-row .mode-btn {
  width: 135px;
  font-size: 16px;
  padding: 11px;
}

.menu-back-link {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: rgba(216, 212, 204, 0.5);
  background: none;
  border: 1px solid rgba(216, 212, 204, 0.15);
  border-radius: 4px;
  padding: 6px 24px;
  cursor: pointer;
  letter-spacing: 3px;
  margin-top: 12px;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
  transition: color 0.2s;
}
.menu-back-link:hover {
  color: rgba(255, 200, 120, 0.9);
  border-color: rgba(255, 200, 120, 0.3);
  background: rgba(255, 200, 120, 0.05);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 30px;
  width: 260px;
}

.menu-nav-btn {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: rgba(216, 212, 204, 0.7);
  background: rgba(20, 14, 10, 0.5);
  border: 1px solid rgba(200, 117, 51, 0.3);
  cursor: pointer;
  letter-spacing: 3px;
  padding: 11px 18px;
  transition: all 0.2s;
}

.menu-nav-btn:hover {
  color: #ffcc88;
  border-color: rgba(200, 117, 51, 0.7);
  background: rgba(60, 35, 15, 0.5);
  box-shadow: 0 0 18px rgba(255, 140, 60, 0.15) inset;
}

/* ─────────────────────────────────────────────── */
/*  Confirm dialog                                   */
/* ─────────────────────────────────────────────── */
#confirm-dialog {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 2, 0.96);
  z-index: 100;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #d8d4cc;
}
#confirm-dialog.visible { display: flex; }

#confirm-dialog .confirm-text {
  font-family: 'Cinzel', serif;
  font-size: 38px;
  margin-bottom: 32px;
  color: #ff6868;
  text-shadow: 0 0 30px rgba(255, 60, 60, 0.4);
  letter-spacing: 4px;
}

#confirm-dialog .confirm-btns {
  display: flex;
  gap: 16px;
}

#confirm-dialog .confirm-btns button {
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  padding: 10px 32px;
  border: 1px solid #555;
  background: rgba(20, 14, 10, 0.6);
  color: #d8d4cc;
  cursor: pointer;
  letter-spacing: 2px;
}

#confirm-dialog .confirm-btns button:hover {
  border-color: #c87533;
  color: #ffcc88;
}

/* ─────────────────────────────────────────────── */
/*  FLUX dialog                                      */
/* ─────────────────────────────────────────────── */
#flux-dialog {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(to top, rgba(5, 8, 14, 0.97) 70%, rgba(5, 8, 14, 0.7) 100%);
  border-top: 1px solid #4488ff;
  box-shadow: 0 -20px 60px rgba(68, 136, 255, 0.15);
  padding: 18px 28px;
  pointer-events: auto;
  z-index: 15;
}
#flux-dialog.visible { display: block; }

#flux-dialog .speaker {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: #88bbff;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(68, 136, 255, 0.6);
}

#flux-dialog #flux-dialog-text {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #d8e8f8;
  line-height: 1.5;
  margin-bottom: 16px;
  max-height: 96px;
  overflow: hidden;
}

#flux-dialog .controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

#flux-dialog button {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  padding: 8px 20px;
  border: 1px solid #4488ff;
  background: rgba(10, 20, 40, 0.6);
  color: #88bbff;
  cursor: pointer;
  letter-spacing: 1px;
}

#flux-dialog button:hover {
  background: rgba(40, 80, 160, 0.4);
  color: #d8e8f8;
}

/* ─────────────────────────────────────────────── */
/*  Lore modal                                       */
/* ─────────────────────────────────────────────── */
#lore-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 8, 0.92);
  z-index: 16;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
}
#lore-modal.visible { display: flex; }

#lore-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  color: #88ccff;
  margin-bottom: 18px;
  text-shadow: 0 0 30px rgba(68, 136, 255, 0.6);
  letter-spacing: 3px;
  text-align: center;
}

#lore-modal-text {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #d8e8f8;
  line-height: 1.6;
  max-width: 700px;
  text-align: center;
  letter-spacing: 0.5px;
}

#lore-modal-close {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  padding: 8px 24px;
  border: 1px solid #88ccff;
  background: transparent;
  color: #88ccff;
  cursor: pointer;
  margin-top: 32px;
  letter-spacing: 2px;
}

/* ─────────────────────────────────────────────── */
/*  Mother choice modal                              */
/* ─────────────────────────────────────────────── */
#mother-choice-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(8, 5, 12, 0.94);
  z-index: 17;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
}
#mother-choice-modal.visible { display: flex; }

#mother-choice-title {
  font-family: 'Cinzel', serif;
  font-size: 32px;
  color: #ffccaa;
  margin-bottom: 24px;
  letter-spacing: 6px;
  text-shadow: 0 0 40px rgba(255, 180, 120, 0.6);
}

#mother-choice-text {
  font-family: 'VT323', monospace;
  font-size: 24px;
  color: #e8d8c8;
  line-height: 1.6;
  max-width: 640px;
  text-align: center;
  margin-bottom: 40px;
}

.mother-choice-btns {
  display: flex;
  gap: 24px;
}

#mother-choice-continue,
#mother-choice-finish {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  padding: 12px 28px;
  border: 1px solid #ffccaa;
  background: transparent;
  color: #ffccaa;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.2s, color 0.2s;
}

#mother-choice-continue:hover,
#mother-choice-finish:hover {
  background: rgba(80, 40, 20, 0.4);
  color: #fff;
}

#mother-choice-finish {
  border-color: #ff9966;
  color: #ff9966;
}

#mother-choice-finish:hover {
  background: rgba(120, 50, 20, 0.5);
  color: #fff;
}

/* ─────────────────────────────────────────────── */
/*  Achievement detail modal                         */
/* ─────────────────────────────────────────────── */
#ach-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(12, 8, 3, 0.94);
  z-index: 16;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
}
#ach-modal.visible { display: flex; }

#ach-modal-icon {
  font-size: 52px;
  margin-bottom: 8px;
  text-shadow: 0 0 30px currentColor;
}
#ach-modal-tier {
  font-family: 'VT323', monospace;
  font-size: 14px;
  letter-spacing: 3px;
  margin-bottom: 16px;
  text-transform: uppercase;
}
#ach-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  color: #ffcc88;
  margin-bottom: 18px;
  text-shadow: 0 0 30px rgba(255, 170, 68, 0.5);
  letter-spacing: 3px;
  text-align: center;
}
#ach-modal-desc {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #d8d0c0;
  line-height: 1.6;
  max-width: 700px;
  text-align: center;
  letter-spacing: 0.5px;
}
#ach-modal-spoiler {
  margin-top: 24px;
  text-align: center;
}
#ach-modal-spoiler-text {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #887766;
  line-height: 1.6;
  margin-bottom: 14px;
}
#ach-modal-reveal {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  padding: 6px 20px;
  border: 1px solid #887766;
  background: transparent;
  color: #aa9977;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
}
#ach-modal-reveal:hover {
  border-color: #ffcc88;
  color: #ffcc88;
}
#ach-modal-close {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  padding: 8px 24px;
  border: 1px solid #ffcc88;
  background: transparent;
  color: #ffcc88;
  cursor: pointer;
  margin-top: 32px;
  letter-spacing: 2px;
}

/* ─────────────────────────────────────────────── */
/*  Pause menu                                       */
/* ─────────────────────────────────────────────── */
#pause-menu {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 2, 0.92);
  z-index: 25;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
#pause-menu.visible { display: flex; }

#pause-menu .pause-title {
  font-family: 'Cinzel', serif;
  font-size: 48px;
  color: #ffcc88;
  letter-spacing: 12px;
  margin-bottom: 24px;
  text-shadow: 0 0 30px rgba(255, 140, 60, 0.5);
  font-weight: 700;
}

#pause-menu .pause-btn {
  display: block;
  width: 260px;
  padding: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  border: 1px solid #555;
  background: rgba(20, 14, 10, 0.6);
  color: #d8d4cc;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.2s;
}

#pause-menu .pause-btn:hover {
  border-color: #c87533;
  color: #ffcc88;
  background: rgba(60, 35, 15, 0.6);
  box-shadow: 0 0 30px rgba(255, 140, 60, 0.2) inset;
}

#pause-menu .pause-hint {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: rgba(216, 212, 204, 0.35);
  margin-top: 16px;
  letter-spacing: 2px;
}

/* ─────────────────────────────────────────────── */
/*  Achievements & Lore screens                      */
/* ─────────────────────────────────────────────── */
#achievements-screen, #lore-screen, #howto-screen, #settings-screen {
  display: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #15100a 0%, #050304 70%);
  z-index: 11;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  overflow-y: auto;
}
#achievements-screen.visible, #lore-screen.visible, #howto-screen.visible, #settings-screen.visible { display: flex; }

.tab-row {
  display: flex;
  gap: 6px;
  margin: 8px 0 14px;
}
.tab-btn {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 4px;
  padding: 8px 24px;
  background: rgba(20, 14, 10, 0.5);
  border: 1px solid rgba(200, 117, 51, 0.25);
  color: rgba(216, 212, 204, 0.55);
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: #ffcc88;
  border-color: rgba(200, 117, 51, 0.7);
}
.tab-btn.active {
  color: #ffcc88;
  border-color: #c87533;
  background: rgba(60, 35, 15, 0.5);
  box-shadow: 0 0 20px rgba(255, 140, 60, 0.15) inset;
}
.tab-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lore-ach-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 720px;
  margin-bottom: 18px;
}
.lore-ach-row .ach-tile { flex: 0 1 220px; }
.lore-divider {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 6px;
  color: rgba(255, 204, 136, 0.5);
  margin: 6px 0 14px;
  padding: 6px 24px;
  border-top: 1px solid rgba(200, 117, 51, 0.2);
  border-bottom: 1px solid rgba(200, 117, 51, 0.2);
}
.lore-frag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 720px;
}

/* How to Play */
.howto-content {
  width: 100%;
  max-width: 640px;
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: rgba(216, 212, 204, 0.85);
  letter-spacing: 0.5px;
  line-height: 1.45;
  padding: 12px 4px 80px;
}
.howto-content section {
  margin-bottom: 22px;
  border-left: 2px solid rgba(200, 117, 51, 0.25);
  padding-left: 14px;
}
.howto-content h3 {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  letter-spacing: 4px;
  color: #ffcc88;
  margin: 0 0 8px 0;
  font-weight: 700;
}
.howto-content p { margin: 0 0 6px 0; }
.howto-content ul { margin: 4px 0 6px 0; padding-left: 18px; }
.howto-content li { margin: 2px 0; }
.howto-content b { color: #ffd9a0; font-weight: normal; }
.howto-content .howto-warn {
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(220, 80, 50, 0.6);
  background: rgba(60, 20, 15, 0.6);
  color: #ff9985;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(220, 80, 50, 0.4);
}
.howto-content .hk,
.setting-desc .hk {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid rgba(200, 117, 51, 0.5);
  background: rgba(40, 25, 15, 0.5);
  color: #ffcc88;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 1px;
}

/* Settings */
.settings-content {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 4px 80px;
  font-family: 'VT323', monospace;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #2a2218;
  background: rgba(15, 10, 8, 0.8);
}
.setting-row.danger-row { border-color: rgba(200, 60, 40, 0.4); }
.setting-label { flex: 1; min-width: 0; }
.setting-name {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  letter-spacing: 3px;
  color: #ffcc88;
}
.setting-desc {
  font-size: 14px;
  color: rgba(216, 212, 204, 0.55);
  margin-top: 2px;
  letter-spacing: 0.5px;
}
.setting-select {
  background: rgba(40, 25, 15, 0.7);
  border: 1px solid rgba(200, 117, 51, 0.5);
  color: #ffcc88;
  font-family: 'VT323', monospace;
  font-size: 16px;
  padding: 6px 10px;
  letter-spacing: 1px;
  cursor: pointer;
}
.setting-danger-btn {
  background: rgba(60, 20, 15, 0.8);
  border: 1px solid rgba(200, 60, 40, 0.6);
  color: #ff9080;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 3px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.setting-danger-btn:hover { background: rgba(120, 30, 20, 0.9); color: #ffcccc; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(40, 25, 15, 0.8);
  border: 1px solid rgba(200, 117, 51, 0.4);
  transition: 0.2s;
}
.toggle-slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: rgba(216, 212, 204, 0.5);
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider {
  background: rgba(200, 117, 51, 0.4);
  border-color: rgba(255, 204, 136, 0.8);
}
.toggle input:checked + .toggle-slider:before {
  transform: translateX(26px);
  background: #ffcc88;
}

/* Settings: sub-row (slider under toggle) */
.setting-row.setting-sub {
  padding: 6px 16px 10px;
  margin-top: -8px;
  border-top: none;
}
.setting-name-sm {
  font-family: 'VT323', monospace;
  font-size: 15px;
  letter-spacing: 2px;
  color: rgba(216, 212, 204, 0.55);
}
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 200px;
}

/* Range slider (shared) */
input[type="range"].js-setting-music-vol,
input[type="range"].js-setting-sfx-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 4px;
  background: rgba(40, 25, 15, 0.9);
  border: 1px solid rgba(200, 117, 51, 0.4);
  outline: none;
  cursor: pointer;
}
input[type="range"].js-setting-music-vol::-webkit-slider-thumb,
input[type="range"].js-setting-sfx-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #ffcc88;
  border: 1px solid rgba(40, 25, 15, 0.9);
  cursor: pointer;
}
input[type="range"].js-setting-music-vol::-moz-range-thumb,
input[type="range"].js-setting-sfx-vol::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #ffcc88;
  border: 1px solid rgba(40, 25, 15, 0.9);
  cursor: pointer;
}
.slider-val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #ffcc88;
  min-width: 28px;
  text-align: right;
}

/* Pause menu audio section */
.pause-audio {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(200, 117, 51, 0.25);
  background: rgba(15, 10, 8, 0.6);
  min-width: 240px;
}
.pause-audio-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 4px;
  color: rgba(255, 204, 136, 0.7);
  margin-bottom: 8px;
  text-align: center;
}
.pause-audio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
}
.pause-audio-label {
  font-family: 'VT323', monospace;
  font-size: 15px;
  letter-spacing: 2px;
  color: rgba(216, 212, 204, 0.7);
}
.pause-slider { flex: 1; }

.screen-title {
  font-family: 'Cinzel', serif;
  font-size: 48px;
  letter-spacing: 10px;
  color: #ffcc88;
  text-shadow: 0 0 40px rgba(255, 140, 60, 0.5);
  font-weight: 700;
  margin-bottom: 4px;
}

.screen-subtitle {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: rgba(255, 200, 120, 0.5);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.screen-progress {
  width: 280px;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}
.screen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c87533, #ffcc88);
  border-radius: 2px;
}

.screen-back-btn {
  display: block;
  width: 260px;
  padding: 12px;
  margin-top: 20px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  border: 1px solid #555;
  background: rgba(20, 14, 10, 0.6);
  color: #d8d4cc;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.2s;
}
.screen-back-btn:hover {
  border-color: #c87533;
  color: #ffcc88;
  background: rgba(60, 35, 15, 0.6);
  box-shadow: 0 0 30px rgba(255, 140, 60, 0.2) inset;
}

/* ── Achievement tiles ─────────────────────────── */
#achievements-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 700px;
  padding: 4px 4px 20px;
}

.ach-tile {
  position: relative;
  border: 1px solid #1a1a1a;
  background: rgba(10, 8, 6, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 8px;
  min-height: 120px;
  transition: all 0.3s ease;
  overflow: hidden;
}

/* Locked tile */
.ach-tile.locked {
  border-color: #1a1a1a;
  cursor: pointer;
}
.ach-tile.locked:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.ach-tile.locked .ach-tile-icon {
  font-size: 28px;
  opacity: 0.15;
}
.ach-tile.locked .ach-tile-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #887766;
  margin-top: 6px;
  line-height: 1.2;
}
.ach-tile.locked .ach-tile-tier {
  font-family: 'VT323', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  margin-top: 4px;
  opacity: 0.6;
}

/* Unlocked tile */
.ach-tile.unlocked {
  background: rgba(20, 15, 10, 0.9);
}
.ach-tile.unlocked::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background: radial-gradient(circle at center, currentColor, transparent 70%);
}
.ach-tile.unlocked .ach-tile-icon {
  font-size: 28px;
  text-shadow: 0 0 16px currentColor;
}
.ach-tile.unlocked .ach-tile-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #ffcc88;
  margin-top: 6px;
  line-height: 1.2;
}
.ach-tile.unlocked .ach-tile-desc {
  font-family: 'VT323', monospace;
  font-size: 11px;
  color: rgba(216, 212, 204, 0.45);
  margin-top: 3px;
  line-height: 1.2;
}
.ach-tile.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Tier colors on tiles */
.ach-tile.tier-1 { border-color: #333; color: #a0a0a0; }
.ach-tile.tier-2 { border-color: #2a4a30; color: #55cc77; }
.ach-tile.tier-3 { border-color: #1a2a4a; color: #5588ff; }
.ach-tile.tier-4 { border-color: #4a2a10; color: #ff8830; }
.ach-tile.unlocked.tier-1 { border-color: #555; }
.ach-tile.unlocked.tier-2 { border-color: #55cc77; }
.ach-tile.unlocked.tier-3 { border-color: #5588ff; }
.ach-tile.unlocked.tier-4 { border-color: #ff8830; box-shadow: 0 0 20px rgba(255, 136, 48, 0.1); }

/* ── Lore tiles ────────────────────────────────── */
#lore-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
  padding: 4px 4px 20px;
}

.lore-tile {
  position: relative;
  aspect-ratio: 0.75;
  border: 1px solid #1a1a1a;
  background: rgba(10, 8, 6, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 12px;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: default;
}

.lore-tile.locked .lore-tile-num {
  font-family: 'Cinzel', serif;
  font-size: 36px;
  color: rgba(216, 212, 204, 0.08);
  font-weight: 700;
}
.lore-tile.locked .lore-tile-label {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: rgba(216, 212, 204, 0.15);
  margin-top: 8px;
  letter-spacing: 2px;
}

.lore-tile.unlocked {
  border-color: #2a3a55;
  background: rgba(10, 15, 25, 0.9);
  cursor: pointer;
}
.lore-tile.unlocked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(68, 136, 255, 0.08), transparent 70%);
}
.lore-tile.unlocked:hover {
  border-color: #4488ff;
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(68, 136, 255, 0.15);
}
.lore-tile.unlocked .lore-tile-num {
  font-family: 'Cinzel', serif;
  font-size: 32px;
  color: #4488ff;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(68, 136, 255, 0.5);
}
.lore-tile.unlocked .lore-tile-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #d8e8f8;
  margin-top: 8px;
  line-height: 1.3;
}
.lore-tile.unlocked .lore-tile-preview {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: rgba(216, 232, 248, 0.35);
  margin-top: 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Zone select (pause menu) ──────────────────── */
#zone-select-container {
  width: 280px;
  margin: 4px 0;
}

.zone-select-label {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: rgba(255, 200, 120, 0.4);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}

#zone-select-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.zone-select-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  font-family: 'Share Tech Mono', monospace;
  border: 1px solid #333;
  background: rgba(20, 14, 10, 0.6);
  color: rgba(216, 212, 204, 0.6);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 52px;
}

.zone-select-btn .zone-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  font-family: 'Cinzel', serif;
}

.zone-select-btn .zone-name {
  font-size: 9px;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-top: 2px;
  text-align: center;
  line-height: 1.1;
}

.zone-select-btn:hover {
  background: rgba(60, 35, 15, 0.6);
  box-shadow: 0 0 20px rgba(255, 140, 60, 0.15) inset;
  color: #ffcc88;
}

.zone-select-btn.current {
  border-color: var(--zone-color, #c87533);
  color: #ffcc88;
  box-shadow: 0 0 12px rgba(255, 140, 60, 0.2) inset;
}

.zone-select-btn.locked {
  opacity: 0.2;
  pointer-events: none;
  border-color: #222;
}

/* ─────────────────────────────────────────────── */
/*  Tutorial overlay                                 */
/* ─────────────────────────────────────────────── */
#tutorial-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 2, 0.88);
  z-index: 12;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
#tutorial-overlay.visible { display: flex; }

#tutorial-overlay .tut-title {
  font-family: 'Cinzel', serif;
  font-size: 36px;
  color: #ffcc88;
  letter-spacing: 10px;
  margin-bottom: 20px;
  text-shadow: 0 0 30px rgba(255, 140, 60, 0.5);
  font-weight: 700;
}

#tutorial-overlay .tut-row {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: rgba(216, 212, 204, 0.8);
  letter-spacing: 1px;
}

#tutorial-overlay .tut-key {
  display: inline-block;
  background: rgba(200, 117, 51, 0.25);
  border: 1px solid rgba(200, 117, 51, 0.5);
  padding: 2px 10px;
  border-radius: 3px;
  color: #ffcc88;
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  min-width: 30px;
  text-align: center;
}

#tutorial-overlay .tut-hint {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: rgba(216, 212, 204, 0.35);
  margin-top: 24px;
  letter-spacing: 3px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

/* ─────────────────────────────────────────────── */
/*  Achievement popup                                */
/* ─────────────────────────────────────────────── */
#achievement-popup {
  position: absolute;
  top: 60px;
  right: -400px;
  width: 320px;
  background: rgba(5, 3, 2, 0.92);
  border: 1px solid #c87533;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: right 0.5s ease;
  box-shadow: 0 0 30px rgba(255, 140, 60, 0.3);
  z-index: 18;
}
#achievement-popup.visible { right: 16px; }

#achievement-popup .ach-icon {
  font-size: 32px;
  color: #ffcc88;
  text-shadow: 0 0 20px rgba(255, 200, 100, 0.8);
}

#achievement-popup .ach-content {
  flex: 1;
}

#achievement-popup .ach-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: #ffcc88;
  letter-spacing: 1px;
}

#achievement-popup .ach-desc {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: rgba(216, 212, 204, 0.6);
}

/* ─────────────────────────────────────────────── */
/*  Victory screen                                   */
/* ─────────────────────────────────────────────── */
#victory-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse, rgba(20,15,10,0.92), rgba(5,3,2,0.98));
  pointer-events: none;
  z-index: 14;
}
#victory-screen.visible { display: flex; }

#victory-screen .vic-title {
  font-family: 'Cinzel', serif;
  font-size: 64px;
  color: #ffdd66;
  letter-spacing: 12px;
  margin-bottom: 24px;
  text-shadow: 0 0 60px rgba(255, 200, 60, 0.7);
  font-weight: 700;
}

#victory-screen .vic-stats {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #ffcc88;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

#victory-screen .vic-mode {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: rgba(216, 212, 204, 0.6);
  margin-top: 8px;
  letter-spacing: 2px;
}

/* ─────────────────────────────────────────────── */
/*  Runs screen                                      */
/* ─────────────────────────────────────────────── */
#runs-screen {
  display: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #15100a 0%, #050304 70%);
  z-index: 11;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  overflow-y: auto;
}
#runs-screen.visible { display: flex; }

#runs-list {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 4px 20px;
}

.run-entry {
  display: flex;
  flex-direction: column;
  border: 1px solid #2a2218;
  background: rgba(15, 10, 8, 0.8);
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: rgba(216, 212, 204, 0.7);
  letter-spacing: 1px;
}

.run-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.run-header:hover {
  background: rgba(255, 204, 136, 0.05);
}

.run-expand {
  color: rgba(216, 212, 204, 0.4);
  font-size: 14px;
  margin-left: 8px;
}

.run-details {
  display: none;
  padding: 6px 16px 12px 16px;
  border-top: 1px solid rgba(42, 34, 24, 0.6);
  flex-wrap: wrap;
  gap: 4px 16px;
}

.run-entry.expanded .run-details {
  display: flex;
}

.run-ach {
  font-size: 14px;
  color: rgba(216, 212, 204, 0.55);
  white-space: nowrap;
}

.run-entry .run-mode {
  color: #ffcc88;
  min-width: 90px;
}

.run-entry .run-mode.nosave {
  color: #ff6868;
}

.run-no-runs {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: rgba(216, 212, 204, 0.25);
  margin-top: 40px;
  letter-spacing: 3px;
}

#victory-screen .vic-runs-title {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: rgba(255, 200, 120, 0.4);
  letter-spacing: 3px;
  margin-top: 24px;
  margin-bottom: 6px;
}

#victory-screen .vic-run {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: rgba(216, 212, 204, 0.35);
  margin-bottom: 2px;
  letter-spacing: 1px;
}

#victory-screen .vic-menu-btn {
  display: block;
  width: 260px;
  padding: 12px;
  margin-top: 28px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  border: 1px solid #555;
  background: rgba(20, 14, 10, 0.6);
  color: #d8d4cc;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.2s;
}

#victory-screen .vic-menu-btn:hover {
  border-color: #c87533;
  color: #ffcc88;
  background: rgba(60, 35, 15, 0.6);
  box-shadow: 0 0 30px rgba(255, 140, 60, 0.2) inset;
}
