/* DEEP DIVE: The Sunken Secrets — A Sierra-style underwater adventure */
/* Ocean theme: bioluminescent accents, deep blues, friendly for age 8 */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Nunito:ital,wght@0,400;0,600;0,700;1,400&family=Share+Tech+Mono&display=swap');

:root {
  --bg-deep: #0a1628;
  --bg-panel: #0d1f35;
  --bg-panel-light: #122a42;
  --border-teal: #00d4aa;
  --border-dim: #1a3a55;
  --text-pale: #c8e6f0;
  --text-teal: #00d4aa;
  --text-cyan: #4de8e0;
  --text-dim: #4a7a90;
  --text-coral: #ff6b4a;
  --text-gold: #ffd700;
  --text-surface: #87ceeb;
  --accent-purple: #b366ff;
  --accent-green: #44ff88;
  --hover-glow: rgba(0, 212, 170, 0.15);
  --verb-active: #00d4aa;
  --verb-bg: #091420;
  --inventory-bg: #070f1c;
}

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

body {
  background: var(--bg-deep);
  color: var(--text-pale);
  font-family: 'Quicksand', 'Nunito', 'Segoe UI', sans-serif;
  font-size: 17px;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  cursor: default;
}

#game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* === UNDERWATER SCANLINES & CAUSTICS === */
#scanlines {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 60, 100, 0.03) 3px,
      rgba(0, 60, 100, 0.03) 6px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 5px,
      rgba(0, 40, 80, 0.02) 5px,
      rgba(0, 40, 80, 0.02) 10px
    );
  pointer-events: none;
  z-index: 1000;
}

#crt-flicker {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 999;
  animation: water-caustics 6s ease-in-out infinite;
  opacity: 0;
}

@keyframes water-caustics {
  0%   { opacity: 0; }
  15%  { opacity: 0.02; background: rgba(0, 180, 200, 0.03); }
  30%  { opacity: 0; }
  50%  { opacity: 0.015; background: rgba(0, 212, 170, 0.02); }
  65%  { opacity: 0; }
  80%  { opacity: 0.025; background: rgba(0, 160, 220, 0.03); }
  100% { opacity: 0; }
}

/* === BUBBLE ANIMATION === */
@keyframes bubble-rise {
  0%   { transform: translateY(100vh) translateX(0) scale(0.3); opacity: 0; }
  10%  { opacity: 0.6; }
  50%  { transform: translateY(50vh) translateX(15px) scale(0.7); opacity: 0.5; }
  80%  { opacity: 0.3; }
  100% { transform: translateY(-20px) translateX(-10px) scale(1); opacity: 0; }
}

.bubble {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    rgba(200, 240, 255, 0.4),
    rgba(100, 200, 230, 0.15) 50%,
    transparent 70%);
  border: 1px solid rgba(150, 220, 255, 0.25);
  pointer-events: none;
  z-index: 998;
  animation: bubble-rise linear infinite;
}

.bubble:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; width: 8px; height: 8px; }
.bubble:nth-child(2) { left: 25%; animation-duration: 10s; animation-delay: 2s; width: 14px; height: 14px; }
.bubble:nth-child(3) { left: 45%; animation-duration: 12s; animation-delay: 4s; width: 10px; height: 10px; }
.bubble:nth-child(4) { left: 65%; animation-duration: 9s; animation-delay: 1s; width: 16px; height: 16px; }
.bubble:nth-child(5) { left: 80%; animation-duration: 11s; animation-delay: 3s; width: 9px; height: 9px; }
.bubble:nth-child(6) { left: 92%; animation-duration: 13s; animation-delay: 5s; width: 11px; height: 11px; }

/* === TITLE SCREEN === */
#title-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #040d1a 0%, #0a1628 40%, #0e2040 100%);
}

.title-art {
  text-align: center;
  padding: 40px;
}

.title-text h1 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 56px;
  color: var(--text-teal);
  text-shadow:
    0 0 10px rgba(0, 212, 170, 0.6),
    0 0 30px rgba(0, 212, 170, 0.3),
    0 0 60px rgba(0, 180, 200, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
  letter-spacing: 10px;
  animation: bioluminescent-pulse 4s ease-in-out infinite;
}

.title-text h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  color: var(--text-surface);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 20px;
  font-style: italic;
  opacity: 0.8;
}

.title-epigraph {
  font-family: 'Nunito', sans-serif;
  font-style: italic;
  font-size: 16px;
  color: var(--text-pale);
  opacity: 0.65;
  max-width: 480px;
  margin: 0 auto 50px auto;
  line-height: 1.7;
}

@keyframes bioluminescent-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(0, 212, 170, 0.6),
      0 0 30px rgba(0, 212, 170, 0.3),
      0 0 60px rgba(0, 180, 200, 0.2);
  }
  50% {
    text-shadow:
      0 0 15px rgba(0, 212, 170, 0.8),
      0 0 40px rgba(0, 212, 170, 0.5),
      0 0 80px rgba(0, 180, 200, 0.3),
      0 0 100px rgba(77, 232, 224, 0.15);
  }
}

.title-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.title-btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-teal);
  background: transparent;
  border: 1px solid var(--border-teal);
  border-radius: 8px;
  padding: 12px 40px;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.3s;
  min-width: 240px;
  text-transform: uppercase;
}

.title-btn:hover:not(:disabled) {
  background: var(--hover-glow);
  color: #80ffe0;
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.25), inset 0 0 20px rgba(0, 212, 170, 0.06);
  border-color: var(--text-cyan);
}

.title-btn:disabled {
  color: var(--text-dim);
  border-color: var(--border-dim);
  cursor: not-allowed;
}

/* === CHARACTER CREATION === */
#char-creation {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-panel {
  max-width: 700px;
  padding: 40px;
  text-align: center;
}

.char-panel h2 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text-teal);
  margin-bottom: 20px;
  letter-spacing: 3px;
}

.char-intro {
  color: var(--text-dim);
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 30px;
  font-style: italic;
}

.skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.skill-option {
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  background: rgba(13, 31, 53, 0.6);
}

.skill-option:hover {
  border-color: var(--border-teal);
  background: rgba(0, 212, 170, 0.06);
}

.skill-option.selected {
  border-color: var(--text-teal);
  background: rgba(0, 212, 170, 0.1);
  box-shadow: 0 0 18px rgba(0, 212, 170, 0.15), inset 0 0 15px rgba(0, 212, 170, 0.05);
}

.skill-icon { font-size: 36px; margin-bottom: 8px; }
.skill-name {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-cyan);
  margin-bottom: 8px;
  letter-spacing: 2px;
}
.skill-desc {
  color: var(--text-dim);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.char-status {
  color: var(--text-teal);
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 20px;
}

/* === MAIN GAME SCREEN === */
#game-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Scene Display */
#scene-container {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #060e1a;
  display: flex;
  flex-direction: column;
}

#scene-image {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#scene-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: auto;
}

#hotspot-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

.hotspot-area {
  position: absolute;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: border-color 0.3s, background 0.3s;
}

.hotspot-area:hover {
  border-color: rgba(0, 212, 170, 0.4);
  background: rgba(0, 212, 170, 0.08);
}

.hotspot-area.exit-hotspot:hover {
  border-color: rgba(135, 206, 235, 0.5);
  background: rgba(135, 206, 235, 0.08);
}

/* Hotspot indicators */
.hotspot-indicator {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  z-index: 5;
}

.indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 auto 4px;
}

.indicator-label {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(6, 14, 26, 0.88);
  display: inline-block;
}

/* NPC: cyan breathing pulse */
.indicator-npc {
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.dot-npc {
  width: 14px; height: 14px;
  background: #4de8e0;
  box-shadow: 0 0 10px 4px rgba(77, 232, 224, 0.6), 0 0 20px 8px rgba(77, 232, 224, 0.3);
  animation: npc-pulse 2.5s ease-in-out infinite;
}

.label-npc {
  color: #a0f0ea;
  border: 1px solid rgba(77, 232, 224, 0.4);
  text-shadow: 0 0 4px rgba(77, 232, 224, 0.4);
}

@keyframes npc-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px 4px rgba(77, 232, 224, 0.5); }
  50% { transform: scale(1.3); box-shadow: 0 0 16px 6px rgba(77, 232, 224, 0.8); }
}

/* Item: yellow sparkle */
.indicator-item {
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.dot-item {
  width: 14px; height: 14px;
  background: #ffd700;
  box-shadow: 0 0 12px 5px rgba(255, 215, 0, 0.7), 0 0 24px 10px rgba(255, 200, 50, 0.35);
  animation: item-sparkle 1.5s ease-in-out infinite;
}

.label-item {
  color: #ffe680;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

@keyframes item-sparkle {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 1; }
}

/* Exit: hollow circle with arrow */
.indicator-exit {
  bottom: 50%;
  transform: translateX(-50%) translateY(50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.dot-exit {
  width: 16px; height: 16px;
  background: transparent;
  border: 3px solid rgba(135, 206, 235, 0.7);
  box-shadow: 0 0 10px 3px rgba(135, 206, 235, 0.3);
  animation: exit-pulse 2s ease-in-out infinite;
}

.label-exit {
  color: #a0d4ef;
  border: 1px solid rgba(135, 206, 235, 0.35);
  font-size: 10px;
}

@keyframes exit-pulse {
  0%, 100% { opacity: 0.4; border-color: rgba(135, 206, 235, 0.4); }
  50% { opacity: 1; border-color: rgba(135, 206, 235, 0.9); box-shadow: 0 0 14px 5px rgba(135, 206, 235, 0.5); }
}

/* Usable: blue glow */
.indicator-usable {
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.dot-usable {
  width: 10px; height: 10px;
  background: #6699ff;
  box-shadow: 0 0 8px 3px rgba(102, 153, 255, 0.5);
  animation: usable-glow 3s ease-in-out infinite;
}

.label-usable {
  color: #99bbff;
  border: 1px solid rgba(102, 153, 255, 0.3);
  font-size: 10px;
}

@keyframes usable-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* NPC hotspot border */
.hotspot-area.npc-hotspot {
  border: 1px solid rgba(77, 232, 224, 0.15);
  border-radius: 6px;
}

/* Item hotspot shimmer */
.hotspot-area.item-hotspot {
  border: 1px solid rgba(255, 215, 0, 0.2);
}

#cursor-label {
  position: fixed;
  background: rgba(6, 14, 26, 0.92);
  color: var(--text-teal);
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 4px 10px;
  border: 1px solid var(--border-teal);
  border-radius: 6px;
  pointer-events: none;
  display: none;
  z-index: 100;
  white-space: nowrap;
}

#scene-name {
  background: var(--bg-panel);
  color: var(--text-cyan);
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  padding: 6px;
  border-top: 1px solid var(--border-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* === VERB BAR === */
#verb-bar {
  display: flex;
  background: var(--bg-panel);
  border-top: 2px solid var(--border-teal);
  border-bottom: 1px solid var(--border-dim);
  padding: 4px 8px;
  gap: 4px;
  flex-shrink: 0;
}

.verb-btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-teal);
  background: var(--verb-bg);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.verb-btn:hover {
  border-color: var(--border-teal);
  color: #80ffe0;
  background: rgba(0, 212, 170, 0.08);
}

.verb-btn.active {
  background: var(--verb-active);
  color: var(--bg-deep);
  border-color: var(--text-teal);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.35);
  font-weight: 700;
}

.verb-spacer { flex: 1; }

.verb-system {
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
}

.voice-off {
  opacity: 0.4;
  text-decoration: line-through;
}

/* === INVENTORY BAR === */
#inventory-bar {
  display: flex;
  align-items: center;
  background: var(--inventory-bg);
  border-bottom: 1px solid var(--border-dim);
  padding: 4px 8px;
  min-height: 48px;
  flex-shrink: 0;
  gap: 4px;
  overflow-x: auto;
}

#inventory-label {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-dim);
  margin-right: 8px;
  white-space: nowrap;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#inventory-slots {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.inventory-item {
  background: var(--bg-panel-light);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.inventory-item:hover {
  border-color: var(--border-teal);
  background: rgba(0, 212, 170, 0.08);
}

.inventory-item.selected {
  border-color: var(--text-teal);
  background: rgba(0, 212, 170, 0.12);
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.2);
}

.inventory-item .item-icon { font-size: 18px; }
.inventory-item .item-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text-cyan);
}

/* === TEXT OUTPUT === */
#text-output {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-dim);
  padding: 10px 16px;
  min-height: 80px;
  max-height: 120px;
  overflow-y: auto;
  flex-shrink: 0;
}

#text-content {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-pale);
}

#text-content .text-description { color: var(--text-pale); }
#text-content .text-action { color: #ffffff; font-weight: 600; }
#text-content .text-danger {
  color: var(--text-coral);
  animation: danger-flash 0.6s ease-out;
}
#text-content .text-skill { color: var(--text-teal); }
#text-content .text-item { color: var(--text-gold); font-weight: 600; }
#text-content .text-failure { color: #607080; }

@keyframes danger-flash {
  0% { background: rgba(255, 107, 74, 0.3); }
  100% { background: transparent; }
}

#text-content .text-discovery {
  color: var(--accent-green);
  text-shadow: 0 0 8px rgba(68, 255, 136, 0.4), 0 0 20px rgba(68, 255, 136, 0.15);
  font-weight: 600;
}

/* === DIALOGUE OVERLAY === */
#dialogue-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 14, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#dialogue-box {
  background: var(--bg-panel);
  border: 2px solid var(--border-teal);
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  padding: 24px;
  box-shadow:
    0 0 30px rgba(0, 212, 170, 0.1),
    inset 0 1px 0 rgba(0, 212, 170, 0.06);
  position: relative;
}

/* Decorative wave corners */
#dialogue-box::before,
#dialogue-box::after {
  content: '~';
  position: absolute;
  font-size: 24px;
  color: var(--text-teal);
  opacity: 0.3;
  font-family: 'Quicksand', sans-serif;
}
#dialogue-box::before { top: 4px; left: 10px; }
#dialogue-box::after { bottom: 2px; right: 10px; }

#dialogue-speaker {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-cyan);
  margin-bottom: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#dialogue-text {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-pale);
  margin-bottom: 16px;
}

#dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-choice {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  color: var(--text-teal);
  background: transparent;
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 8px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.dialogue-choice:hover {
  border-color: var(--border-teal);
  background: var(--hover-glow);
  color: #80ffe0;
}

.dialogue-choice .choice-skill-tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--accent-purple);
  margin-left: 8px;
}

.dialogue-choice:disabled {
  color: var(--text-dim);
  border-color: #0f2030;
  cursor: not-allowed;
}

/* === STATUS BAR === */
#status-bar {
  display: flex;
  background: var(--bg-deep);
  border-top: 1px solid var(--border-dim);
  padding: 4px 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  gap: 20px;
  flex-shrink: 0;
}

#status-skills { color: var(--text-surface); }
#status-depth { color: var(--text-cyan); }
#status-air { color: var(--text-coral); }
#status-species { color: var(--accent-green); }

/* === SPECIES CATALOG OVERLAY === */
#species-catalog-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 14, 26, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  overflow-y: auto;
  padding: 20px;
}

.species-catalog {
  max-width: 720px;
  width: 100%;
}

.species-catalog h2 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text-teal);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 3px;
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.species-card {
  background: var(--bg-panel-light);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  transition: all 0.3s;
  cursor: default;
}

.species-card:hover {
  border-color: var(--border-teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.12);
}

.species-card .species-icon { font-size: 32px; margin-bottom: 6px; }
.species-card .species-name {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-pale);
  margin-bottom: 4px;
}
.species-card .species-location {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.species-unknown {
  opacity: 0.35;
  border-style: dashed;
}
.species-unknown .species-icon { filter: grayscale(100%); }
.species-unknown .species-name { color: var(--text-dim); }

/* Rarity badges */
.rarity-badge {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rarity-common { background: rgba(100, 160, 180, 0.2); color: #80b8cc; border: 1px solid rgba(100, 160, 180, 0.3); }
.rarity-uncommon { background: rgba(0, 212, 170, 0.15); color: var(--text-teal); border: 1px solid rgba(0, 212, 170, 0.3); }
.rarity-rare { background: rgba(179, 102, 255, 0.15); color: var(--accent-purple); border: 1px solid rgba(179, 102, 255, 0.3); }
.rarity-legendary { background: rgba(255, 215, 0, 0.15); color: var(--text-gold); border: 1px solid rgba(255, 215, 0, 0.3); }

/* === DEATH OVERLAY === */
.death-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center,
    rgba(180, 30, 20, 0.6) 0%,
    rgba(80, 10, 10, 0.85) 60%,
    rgba(20, 0, 0, 0.95) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: death-fade-in 1s ease-out;
}

.death-overlay h2 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 36px;
  color: var(--text-coral);
  text-shadow: 0 0 20px rgba(255, 107, 74, 0.5);
  margin-bottom: 16px;
  letter-spacing: 6px;
}

.death-overlay p {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  color: #e0a0a0;
  max-width: 400px;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

@keyframes death-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === ALT VIEWER (for ?alts=1 mode) === */
#alt-viewer {
  position: absolute;
  top: 0; right: 0;
  background: rgba(6, 14, 26, 0.94);
  border-left: 1px solid var(--border-dim);
  border-bottom: 1px solid var(--border-dim);
  border-radius: 0 0 0 10px;
  padding: 10px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.alt-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border: 2px solid var(--border-dim);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.6;
}

.alt-thumb:hover {
  border-color: var(--text-cyan);
  opacity: 0.9;
}

.alt-thumb.alt-active {
  border-color: var(--text-teal);
  opacity: 1;
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
}

/* === END SCREEN === */
#end-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #040d1a 0%, #0a1628 50%, #0e2040 100%);
}

.end-panel {
  max-width: 600px;
  padding: 40px;
  text-align: center;
  border: 1px solid var(--border-teal);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 0 40px rgba(0, 212, 170, 0.08);
  position: relative;
}

.end-panel h2 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--text-teal);
  margin-bottom: 20px;
  letter-spacing: 4px;
  text-shadow: 0 0 15px rgba(0, 212, 170, 0.4);
}

.end-panel p {
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-pale);
  margin-bottom: 30px;
}

.end-philosophy {
  font-family: 'Nunito', sans-serif;
  font-style: italic;
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-dim);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* === CURSOR STATES (ocean-themed SVGs) === */
/* Look: diving mask / magnifier in teal */
body.cursor-look { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='10' cy='10' r='7' fill='none' stroke='%2300d4aa' stroke-width='2'/%3E%3Cline x1='15' y1='15' x2='22' y2='22' stroke='%234de8e0' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") 10 10, pointer; }

/* Use: starfish / gear in cyan */
body.cursor-use { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 1L13.5 9H21L15 13.5L17 21L12 16.5L7 21L9 13.5L3 9H10.5Z' fill='none' stroke='%2300d4aa' stroke-width='1.5'/%3E%3Ccircle cx='12' cy='12' r='2' fill='%234de8e0'/%3E%3C/svg%3E") 12 12, pointer; }

/* Talk: speech bubble in cyan */
body.cursor-talk { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M4 4C4 4 4 2 6 2H18C20 2 20 4 20 4V16C20 16 20 18 18 18H10L5 22V18H6C4 18 4 16 4 16Z' fill='none' stroke='%234de8e0' stroke-width='1.5'/%3E%3Ccircle cx='9' cy='10' r='1.5' fill='%234de8e0' opacity='0.6'/%3E%3Ccircle cx='13' cy='10' r='1.5' fill='%234de8e0' opacity='0.6'/%3E%3Ccircle cx='17' cy='10' r='1' fill='%234de8e0' opacity='0.4'/%3E%3C/svg%3E") 6 10, pointer; }

/* Take: grabbing hand in gold */
body.cursor-take { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 13C6 13 6 9 7 7C8 5 9 5 9 7V11' fill='none' stroke='%23ffd700' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M9 11V5C9 3 11 3 11 5V11' fill='none' stroke='%23ffd700' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M11 11V4C11 2 13 2 13 4V11' fill='none' stroke='%23ffd700' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M13 11V5C13 3 15 3 15 5V11' fill='none' stroke='%23ffd700' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M15 11C15 11 17 11 18 13C19 15 18 18 16 20H8C6 18 5 16 6 13' fill='none' stroke='%23ffd700' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, pointer; }

/* Walk: swimming fins / arrow in pale blue */
body.cursor-walk { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 2L18 10H14V18H10V10H6Z' fill='none' stroke='%2387ceeb' stroke-width='1.5' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='20' r='2' fill='none' stroke='%2387ceeb' stroke-width='1'/%3E%3C/svg%3E") 12 12, pointer; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-teal); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .title-text h1 { font-size: 32px; letter-spacing: 4px; }
  .title-text h2 { font-size: 14px; }
  .title-epigraph { font-size: 14px; padding: 0 20px; }
  .skill-grid { grid-template-columns: 1fr; }
  .verb-btn { padding: 8px 10px; font-size: 10px; }
  #text-output { min-height: 60px; }
  #dialogue-box { padding: 16px; }
  .species-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 480px) {
  .title-text h1 { font-size: 24px; letter-spacing: 2px; }
  .verb-btn { padding: 6px 8px; font-size: 9px; letter-spacing: 0; }
  .species-grid { grid-template-columns: repeat(2, 1fr); }
  #alt-viewer { display: none; }
}

/* === TYPEWRITER EFFECT === */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--text-teal);
  white-space: normal;
  animation: blink-caret 0.9s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--text-teal); }
}

/* === SCENE TRANSITIONS === */
.scene-fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}
.scene-fade-in {
  animation: fadeIn 0.6s ease-in forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === ITEM FLASH (teal glow) === */
.item-flash {
  animation: itemFlash 0.7s ease-out;
}

@keyframes itemFlash {
  0% { background: rgba(0, 212, 170, 0.35); }
  100% { background: transparent; }
}

/* === SKILL CHECK ANIMATION === */
.skill-check-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 18px;
  padding: 14px 28px;
  border: 2px solid;
  border-radius: 10px;
  z-index: 60;
  animation: skillPop 1.5s ease-out forwards;
  letter-spacing: 2px;
}

.skill-check-overlay.success {
  color: var(--text-teal);
  border-color: var(--border-teal);
  background: rgba(6, 20, 32, 0.92);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.25);
}

.skill-check-overlay.failure {
  color: var(--text-coral);
  border-color: var(--text-coral);
  background: rgba(30, 10, 8, 0.92);
}

@keyframes skillPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* === BIOLUMINESCENT DISCOVERY FLASH === */
.discovery-flash {
  animation: oceanDiscovery 2s ease-out forwards;
}

@keyframes oceanDiscovery {
  0%   { box-shadow: 0 0 30px rgba(0, 212, 170, 0.4); }
  20%  { box-shadow: 0 0 30px rgba(68, 255, 136, 0.3); }
  40%  { box-shadow: 0 0 30px rgba(77, 232, 224, 0.3); }
  60%  { box-shadow: 0 0 30px rgba(179, 102, 255, 0.3); }
  80%  { box-shadow: 0 0 30px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 0 0 transparent; }
}

/* === HIDDEN STATE UTILITY === */
.hidden { display: none !important; }
