/* npc.quest - Submerged RPG Quest Log */
/* Bioluminescent reef neomorphism */

:root {
  --bg-deep: #0e0b1a;
  --bg-mid: #1a1533;
  --surface: #2a2445;
  --nm-light: #3d3660;
  --nm-shadow: #0a0812;
  --aurora-teal: #00e5c7;
  --aurora-green: #40ff90;
  --aurora-pink: #e040a0;
  --text-primary: #e8e4f0;
  --text-secondary: #8a82a0;
  --font-display: 'Anybody', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --wdth: 100;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 500vh;
  position: relative;
}

/* Canvas layer for bubbles */
#bubbleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Aurora overlay */
#auroraOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 229, 199, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(224, 64, 160, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(64, 255, 144, 0.05) 0%, transparent 50%);
  animation: auroraShift 20s ease-in-out infinite alternate;
}

@keyframes auroraShift {
  0% { opacity: 0.6; transform: scale(1) translateY(0); }
  50% { opacity: 1; transform: scale(1.05) translateY(-2%); }
  100% { opacity: 0.7; transform: scale(0.98) translateY(1%); }
}

/* Fish layer */
#fishLayer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.fish {
  position: absolute;
  width: 50px;
  height: auto;
  opacity: 0;
  transition: opacity 2s ease;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.fish-angel {
  color: var(--aurora-teal);
  width: 60px;
  top: 20%;
  animation: swimRight 25s linear infinite;
  animation-delay: 0s;
  opacity: 0.5;
}

.fish-clown {
  color: var(--aurora-pink);
  width: 45px;
  top: 40%;
  animation: swimLeft 30s linear infinite;
  animation-delay: 5s;
  opacity: 0.4;
}

.fish-tang {
  color: var(--aurora-green);
  width: 55px;
  top: 55%;
  animation: swimRight 22s linear infinite;
  animation-delay: 8s;
  opacity: 0.45;
}

.fish-seahorse {
  color: var(--aurora-teal);
  width: 30px;
  top: 70%;
  animation: swimLeft 35s linear infinite;
  animation-delay: 12s;
  opacity: 0.35;
}

.fish-puffer {
  color: var(--aurora-pink);
  width: 42px;
  top: 30%;
  animation: swimRight 28s linear infinite;
  animation-delay: 3s;
  opacity: 0.38;
}

.fish-lion {
  color: var(--aurora-green);
  width: 55px;
  top: 80%;
  animation: swimLeft 32s linear infinite;
  animation-delay: 15s;
  opacity: 0.4;
}

@keyframes swimRight {
  0% { transform: translateX(-100px) translateY(0) scaleX(1); opacity: 0; }
  5% { opacity: 0.5; }
  50% { transform: translateX(50vw) translateY(-30px) scaleX(1); }
  95% { opacity: 0.5; }
  100% { transform: translateX(calc(100vw + 100px)) translateY(10px) scaleX(1); opacity: 0; }
}

@keyframes swimLeft {
  0% { transform: translateX(calc(100vw + 100px)) translateY(0) scaleX(-1); opacity: 0; }
  5% { opacity: 0.5; }
  50% { transform: translateX(50vw) translateY(20px) scaleX(-1); }
  95% { opacity: 0.5; }
  100% { transform: translateX(-100px) translateY(-15px) scaleX(-1); opacity: 0; }
}

/* Dive layers */
.dive-layer {
  position: relative;
  z-index: 10;
}

/* Surface layer */
#surface {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(180deg, 
    #0e0b1a 0%, 
    #1a1533 30%, 
    #2a2445 60%, 
    #1a1533 100%
  );
}

.surface-content {
  text-align: center;
  z-index: 10;
  position: relative;
}

.domain-title-wrapper {
  margin-bottom: 4rem;
}

.domain-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-weight: 700;
  font-variation-settings: 'wdth' var(--wdth);
  background: linear-gradient(135deg, var(--aurora-teal), var(--aurora-green), var(--aurora-pink));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease-in-out infinite;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.domain-subtitle {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  color: var(--text-secondary);
  margin-top: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: bobFloat 3s ease-in-out infinite;
  color: var(--text-secondary);
}

.scroll-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.scroll-arrow {
  animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes bobFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.water-surface {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 229, 199, 0.05) 50%, rgba(0, 229, 199, 0.1) 100%);
  pointer-events: none;
}

/* Thermocline and deeper sections */
#thermocline {
  padding: 8rem 0;
  background: linear-gradient(180deg,
    var(--bg-mid) 0%,
    var(--bg-deep) 30%,
    #0c0919 100%
  );
}

#deepReef {
  padding: 8rem 0;
  background: linear-gradient(180deg,
    #0c0919 0%,
    #080612 50%,
    #050410 100%
  );
}

#abyss {
  padding: 8rem 0 12rem;
  background: linear-gradient(180deg,
    #050410 0%,
    #030308 50%,
    #010104 100%
  );
  position: relative;
}

.abyss-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 229, 199, 0.08) 0%, transparent 70%);
  pointer-events: none;
  animation: abyssGlowPulse 6s ease-in-out infinite;
}

@keyframes abyssGlowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* Reef shelves */
.reef-shelf {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reef-shelf.visible {
  opacity: 1;
  transform: translateY(0);
}

.shelf-wide {
  width: 90%;
  max-width: 900px;
}

.shelf-narrow {
  width: 70%;
  max-width: 600px;
}

.shelf-medium {
  width: 80%;
  max-width: 750px;
}

.shelf-right {
  margin-left: auto;
  margin-right: 5%;
}

.shelf-left {
  margin-left: 5%;
  margin-right: auto;
}

/* Neomorphic panels */
.nm-panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow:
    8px 8px 20px var(--nm-shadow),
    -8px -8px 20px var(--nm-light);
  position: relative;
  overflow: hidden;
}

.nm-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--aurora-teal), var(--aurora-green), transparent);
  opacity: 0.3;
}

.nm-raised {
  background: var(--surface);
  border-radius: 16px;
  box-shadow:
    4px 4px 10px var(--nm-shadow),
    -4px -4px 10px var(--nm-light);
}

.nm-inset {
  background: var(--bg-mid);
  border-radius: 12px;
  box-shadow:
    inset 4px 4px 8px var(--nm-shadow),
    inset -4px -4px 8px var(--nm-light);
}

.nm-button {
  background: var(--surface);
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.5rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow:
    4px 4px 10px var(--nm-shadow),
    -4px -4px 10px var(--nm-light);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.nm-button:hover {
  box-shadow:
    2px 2px 5px var(--nm-shadow),
    -2px -2px 5px var(--nm-light);
  transform: translateY(1px);
}

.nm-button:active {
  box-shadow:
    inset 3px 3px 6px var(--nm-shadow),
    inset -3px -3px 6px var(--nm-light);
  transform: translateY(2px);
}

/* Quest panel */
.quest-panel {
  text-align: center;
}

.quest-marker {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aurora-pink), var(--aurora-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  animation: markerPulse 3s ease-in-out infinite;
}

.quest-icon {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bg-deep);
}

@keyframes markerPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(224, 64, 160, 0.3), 0 0 30px rgba(0, 229, 199, 0.1); }
  50% { box-shadow: 0 0 25px rgba(224, 64, 160, 0.5), 0 0 50px rgba(0, 229, 199, 0.2); }
}

.quest-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 400;
  font-variation-settings: 'wdth' 90;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--aurora-teal), var(--text-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.quest-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.quest-status {
  display: flex;
  justify-content: center;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  background: var(--bg-mid);
  box-shadow: inset 3px 3px 6px var(--nm-shadow), inset -3px -3px 6px var(--nm-light);
}

.status-badge.active {
  color: var(--aurora-green);
  border: 1px solid rgba(64, 255, 144, 0.2);
}

/* Section titles */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 2rem);
  font-weight: 400;
  font-variation-settings: 'wdth' 95;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

/* Lore panel */
.lore-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--aurora-teal);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.lore-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

.codex-decoration {
  margin-top: 1.5rem;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.coral-branch {
  width: 4px;
  height: 40px;
  background: linear-gradient(180deg, var(--aurora-teal), transparent);
  border-radius: 2px;
  opacity: 0.5;
  animation: coralGrow 4s ease-in-out infinite;
}

.branch-2 {
  height: 55px;
  animation-delay: 0.5s;
  background: linear-gradient(180deg, var(--aurora-green), transparent);
}

.branch-3 {
  height: 35px;
  animation-delay: 1s;
  background: linear-gradient(180deg, var(--aurora-pink), transparent);
}

@keyframes coralGrow {
  0%, 100% { transform: scaleY(0.8); opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 0.6; }
}

/* Stat panel */
.stat-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 400;
  font-variation-settings: 'wdth' 90;
  margin-bottom: 1.5rem;
  text-align: center;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--aurora-teal);
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Inventory panel */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1.2rem;
}

.inv-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.inv-item:hover {
  transform: translateY(-3px);
  box-shadow:
    6px 6px 15px var(--nm-shadow),
    -6px -6px 15px var(--nm-light);
}

.inv-icon {
  color: var(--aurora-teal);
  transition: color 0.3s ease;
}

.inv-item:hover .inv-icon {
  color: var(--aurora-green);
}

.inv-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-align: center;
}

/* Dialogue panel */
.dialogue-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.npc-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--aurora-teal);
  flex-shrink: 0;
}

.npc-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.npc-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--aurora-teal);
}

.npc-role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dialogue-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  border-left: 2px solid var(--nm-light);
  padding-left: 1rem;
}

.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.dialogue-choice {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.choice-marker {
  color: var(--aurora-green);
  font-weight: 700;
}

.dialogue-choice:hover .choice-marker {
  color: var(--aurora-pink);
}

/* Map panel */
.map-container {
  background: var(--bg-mid);
  border-radius: 12px;
  box-shadow: inset 4px 4px 8px var(--nm-shadow), inset -4px -4px 8px var(--nm-light);
  padding: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

#reefMapCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.map-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-item {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-teal { background: var(--aurora-teal); }
.dot-pink { background: var(--aurora-pink); }
.dot-green { background: var(--aurora-green); }

/* Abyss section */
.abyss-title {
  text-align: center;
  background: linear-gradient(135deg, var(--aurora-pink), var(--aurora-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.abyss-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: center;
  max-width: 650px;
  margin: 0 auto 2rem;
}

.abyss-quest-log {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.log-entry {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.8rem 1rem;
  background: var(--bg-mid);
  border-radius: 10px;
  box-shadow: inset 2px 2px 4px var(--nm-shadow), inset -2px -2px 4px var(--nm-light);
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.log-entry.visible {
  opacity: 1;
  transform: translateX(0);
}

.log-timestamp {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--aurora-pink);
  white-space: nowrap;
  min-width: 80px;
}

.log-message {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Final panel */
.final-panel {
  text-align: center;
  padding: 3rem;
}

.final-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 2rem;
  font-style: italic;
}

.domain-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-domain {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  font-variation-settings: 'wdth' 110;
  background: linear-gradient(135deg, var(--aurora-teal), var(--aurora-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-tagline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* Depth indicator */
.depth-indicator {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.depth-bar {
  width: 4px;
  height: 120px;
  background: var(--nm-shadow);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.5);
}

.depth-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, var(--aurora-teal), var(--aurora-green));
  border-radius: 2px;
  transition: height 0.3s ease;
}

.depth-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.1em;
}

/* Responsive */
@media (max-width: 768px) {
  .reef-shelf {
    width: 95% !important;
    padding: 0 1rem;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  .nm-panel {
    padding: 1.5rem;
  }
  
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .depth-indicator {
    right: 0.5rem;
  }
  
  .dialogue-header {
    flex-direction: column;
    text-align: center;
  }
  
  .npc-info {
    align-items: center;
  }
}

@media (max-width: 480px) {
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  
  .inv-item {
    padding: 0.8rem;
  }
  
  .map-legend {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}
