:root {
  --black-water: #07090B;
  --cold-silt: #151A1F;
  --glow-orange: #FF7A18;
  --glow-warm: #FFC24D;
  --bone: #E8DCC0;
  --cyan: #4FD8E8;
  --danger: #C4361B;
  --font-display: "Fjalla One", "Arial Narrow", sans-serif;
  --font-marker: "Permanent Marker", cursive;
  --font-mono: "DM Mono", "Courier New", monospace;
  --font-body: "Karla", "Segoe UI", sans-serif;
  --depth-p: 0;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--black-water);
  color: var(--bone);
  font-family: var(--font-body);
  overflow-x: hidden;
  scroll-behavior: auto;
}
body { cursor: auto; }
main { cursor: none; position: relative; z-index: 1; }
a { color: var(--glow-warm); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

[hidden] { display: none !important; }

/* ---------- overlay canvas: the darkness itself ---------- */
#lightCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 40;
  pointer-events: none;
}

/* ---------- teaser fish (fixed, self-luminous, above canvas) ---------- */
.teaser-fish {
  position: fixed;
  top: 38%;
  left: -20vw;
  width: min(34vw, 320px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 26px rgba(255, 122, 24, 0.55));
}
.teaser-fish.swim {
  animation: teaserSwim 5.4s ease-in-out forwards;
}
@keyframes teaserSwim {
  0%   { opacity: 0; left: -20vw; transform: scaleX(1); }
  10%  { opacity: 0.9; }
  50%  { opacity: 0.85; }
  88%  { opacity: 0.7; }
  100% { opacity: 0; left: 108vw; }
}
@media (prefers-reduced-motion: reduce) {
  .teaser-fish.swim { animation-duration: 2.2s; }
}

/* ---------- instrument panel ---------- */
.instrument-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(7, 9, 11, 0.82);
  border-right: 1px solid rgba(79, 216, 232, 0.3);
  border-bottom: 1px solid rgba(79, 216, 232, 0.3);
  border-bottom-right-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(2px);
}
.instrument-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  transition: opacity 0.9s ease;
}
.instrument-row.is-off { opacity: 0.08; }
.i-label { color: var(--cyan); letter-spacing: 0.06em; }
.i-value { color: var(--bone); font-weight: 500; }
.sound-toggle {
  margin-top: 6px;
  background: none;
  border: 1px solid rgba(79, 216, 232, 0.4);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 4px;
  align-self: flex-start;
}
.sound-toggle[aria-pressed="true"] { background: rgba(79, 216, 232, 0.18); }

/* ---------- CA dock ---------- */
.ca-dock {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(7, 9, 11, 0.82);
  border-left: 1px solid rgba(255, 122, 24, 0.35);
  border-bottom: 1px solid rgba(255, 122, 24, 0.35);
  border-bottom-left-radius: 10px;
  padding: 10px 14px;
}
.ca-label { font-family: var(--font-mono); color: var(--glow-orange); font-size: 0.72rem; }
.ca-value { font-family: var(--font-mono); font-size: 0.72rem; color: var(--bone); max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-dock button {
  background: var(--glow-orange);
  color: var(--black-water);
  border: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
}
.toast {
  position: fixed;
  top: 64px;
  right: 14px;
  z-index: 110;
  background: var(--glow-orange);
  color: var(--black-water);
  font-family: var(--font-marker);
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(255, 122, 24, 0.35);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- scenes ---------- */
.scene {
  position: relative;
  min-height: 100vh;
  padding: 90px 8vw 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.section-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  color: var(--glow-orange);
  margin: 0 0 10px;
}
.section-sub-title { color: var(--bone); font-family: var(--font-body); font-size: 0.5em; text-transform: none; }
.section-copy { max-width: 46ch; color: var(--bone); opacity: 0.85; line-height: 1.5; }

.scene.surface { align-items: center; text-align: center; }
.hero-word {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 11vw, 6rem);
  color: var(--glow-orange);
  text-shadow: 0 0 40px rgba(255, 122, 24, 0.5);
  letter-spacing: 0.02em;
  margin: 0;
}
.hero-tag { font-family: var(--font-marker); color: var(--glow-warm); font-size: clamp(1rem, 2.2vw, 1.4rem); margin: 4px 0 2px; }
.hero-sub { color: var(--bone); opacity: 0.75; max-width: 42ch; font-size: 0.92rem; }
.scroll-hint { margin-top: 22px; font-family: var(--font-mono); color: var(--cyan); opacity: 0.7; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ---------- reef props ---------- */
.prop {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
}
.prop.rock {
  width: 90px; height: 54px;
  background: radial-gradient(circle at 30% 30%, #3a3128, #14100c);
  border-radius: 46% 54% 58% 42% / 52% 48% 52% 48%;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,0.5);
}
.prop.rock.small { width: 54px; height: 34px; }
.prop.wreck {
  width: 180px; height: 70px;
  background: linear-gradient(100deg, #241a12, #100b07 70%);
  clip-path: polygon(0% 60%, 20% 10%, 55% 0%, 100% 30%, 92% 100%, 10% 100%);
  box-shadow: inset 0 0 14px rgba(0,0,0,0.6);
}
.prop.sign { display: flex; flex-direction: column; align-items: center; }
.prop.sign::before {
  content: ""; width: 6px; height: 46px; background: #2a1b10; display: block; margin: 0 auto;
}
.sign-text {
  display: block;
  background: #cbb890;
  color: #221708;
  font-family: var(--font-marker);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  padding: 8px 10px;
  border-radius: 3px;
  transform: rotate(-2deg);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.found-text { font-family: var(--font-mono); color: var(--cyan); opacity: 0.75; margin: 4px 0; max-width: 40ch; }
.found-text-2 { color: var(--bone); opacity: 0.55; }

/* ---------- encounter / fish ---------- */
.encounter { align-items: center; text-align: center; }
.trust-readout { font-family: var(--font-mono); color: var(--cyan); margin: 14px 0 30px; }
.fish-stage { position: relative; width: min(70vw, 480px); height: min(46vh, 320px); margin: 0 auto; }
.fish {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 62%;
  background: none;
  border: none;
  padding: 0;
  transition: transform 1.1s cubic-bezier(.2,.7,.3,1), filter 0.6s ease;
  filter: drop-shadow(0 0 10px rgba(255, 122, 24, 0.35));
}
.fish img { width: 100%; }
.fish.is-fleeing { filter: drop-shadow(0 0 4px rgba(255, 122, 24, 0.15)); }
.fish.is-trusting { filter: drop-shadow(0 0 34px rgba(255, 194, 77, 0.85)); }
.fish-caption {
  font-family: var(--font-marker);
  color: var(--glow-warm);
  font-size: 1.2rem;
  margin-top: 14px;
}

/* ---------- feed / rock diet ---------- */
.feed { align-items: center; text-align: center; }
.feed-stage { position: relative; width: min(84vw, 620px); margin: 24px auto; }
.feed-fish { position: relative; width: 55%; margin: 0 auto 20px; }
.feed-fish img { width: 100%; opacity: 0.92; }
.feed-mouth {
  position: absolute; left: 14%; top: 46%;
  width: 22%; height: 26%;
  border-radius: 50%;
}
.feed-floor { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.feed-item {
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--black-water);
  border-radius: 10px;
  touch-action: none;
  user-select: none;
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}
.feed-item.rock { background: radial-gradient(circle at 30% 30%, #6b5f4d, #2c2417); color: var(--bone); }
.feed-item.can { background: linear-gradient(#c7cdd2, #7c848b); }
.feed-item.boot { background: linear-gradient(#5b3a20, #2c1c0f); color: var(--bone); }
.feed-item.dragging { position: fixed; z-index: 120; pointer-events: none; }
.feed-item.spit { animation: spitOut 0.5s ease; }
@keyframes spitOut { 0% { transform: translateY(0); } 40% { transform: translateY(-24px) rotate(-8deg); } 100% { transform: translateY(0) rotate(0); } }

.feed-counters { display: flex; gap: 26px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }
.counter-block { text-align: center; }
.counter-label { display: block; font-size: 0.68rem; color: var(--cyan); font-family: var(--font-mono); opacity: 0.8; }
.counter-value { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--glow-orange); }
.counter-block.ghost .counter-value { color: rgba(255, 122, 24, 0.4); }
.counter-block.ghost .counter-label { opacity: 0.5; }

/* ---------- specimen ---------- */
.specimen { align-items: center; }
.specimen-card {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  background: rgba(21, 26, 31, 0.55);
  border: 1px solid rgba(79, 216, 232, 0.25);
  border-radius: 10px;
  padding: 30px 30px 40px;
}
.specimen-list { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 16px 0; font-family: var(--font-mono); font-size: 0.85rem; }
.specimen-list > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed rgba(232, 220, 192, 0.15); padding-bottom: 4px; }
.specimen-list dt { color: var(--cyan); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; }
.specimen-list dd { margin: 0; color: var(--bone); }
.specimen-img { width: 55%; margin: 10px auto 0; }
.specimen-note {
  position: absolute;
  font-family: var(--font-marker);
  color: var(--glow-orange);
  font-size: 0.95rem;
  transform: rotate(-4deg);
}
.note-1 { top: 24px; right: 18px; }
.note-arrow { display: inline-block; margin-left: 4px; }
.note-2 { bottom: 18px; left: 24px; transform: rotate(3deg); }

/* ---------- abyss ---------- */
.abyss { min-height: 240vh; align-items: center; text-align: center; }
.abyss-eyes { display: flex; gap: 60px; }
.eye {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-warm), var(--glow-orange) 70%, transparent 100%);
  box-shadow: 0 0 24px rgba(255, 194, 77, 0.8);
}
.eye.blink { animation: blink 0.5s ease; }
@keyframes blink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.06); } }
.abyss-end { font-family: var(--font-mono); color: var(--bone); opacity: 0.6; margin-top: 30px; max-width: 42ch; }

/* ---------- marine snow ---------- */
.snow-layer { position: fixed; inset: 0; z-index: 45; pointer-events: none; overflow: hidden; }
.snow-dot {
  position: absolute;
  top: -4%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(232, 220, 192, 0.5);
  animation: snowFall linear infinite;
}
@keyframes snowFall { to { transform: translateY(110vh); } }
@media (prefers-reduced-motion: reduce) {
  .snow-dot { animation: none; opacity: 0.15; }
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 8vw 30px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan);
  background: var(--black-water);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--glow-warm); text-decoration: none; text-transform: lowercase; }

@media (max-width: 640px) {
  .instrument-panel { padding: 8px 10px; font-size: 0.9em; }
  .instrument-row { font-size: 0.72rem; gap: 10px; }
  .ca-dock { padding: 8px 10px; }
  .ca-value { max-width: 22vw; }
  .scene { padding: 100px 6vw 50px; }
  .fish-stage { width: 88vw; height: 40vh; }
  .specimen-note { display: none; }
}
