:root {
  color-scheme: light;
  --page: #f7efd9;
  --paper: #fffaf0;
  --paper-strong: #ffffff;
  --ink: #1d1a16;
  --muted: #5f5548;
  --line: #d8c8a8;
  --accent: #c98216;
  --accent-strong: #8a4b00;
  --green: #2f7b52;
  --bad: #a53624;
  --good: #176a3f;
  --blue: #dff1ff;
  --shadow: 0 22px 56px rgba(89, 66, 28, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(29, 26, 22, 0.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, #fff8e8, var(--page));
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 19px;
  line-height: 1.58;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 36px);
}

.screen {
  display: none;
  min-height: calc(100svh - 56px);
  align-content: center;
}

.screen.is-active {
  display: grid;
  gap: 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(300px, 460px) minmax(380px, 1fr);
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
  padding: clamp(18px, 3vw, 34px);
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(255, 250, 240, 0.92)),
    radial-gradient(circle at 22% 12%, rgba(201, 130, 22, 0.16), transparent 22rem);
  box-shadow: var(--shadow);
}

.portrait-wrap {
  position: relative;
  min-height: clamp(340px, 58vh, 580px);
  display: grid;
  align-items: end;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0f7fb 0%, #dff1ff 58%, #c9dfec 100%);
  overflow: hidden;
}

.portrait-wrap::after {
  content: "";
  position: absolute;
  inset: auto 8% 0;
  height: 10px;
  border-radius: 999px 999px 0 0;
  background: rgba(29, 26, 22, 0.16);
}

.portrait-art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: clamp(340px, 58vh, 580px);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 20px 28px rgba(75, 60, 38, 0.25));
}

.secret-stamp {
  position: absolute;
  z-index: 2;
  right: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  width: clamp(82px, 20%, 126px);
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 999px;
  color: #fffaf0;
  background: var(--accent-strong);
  box-shadow: 0 12px 20px rgba(75, 60, 38, 0.24);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  transform: rotate(5deg);
}

.intro-copy {
  display: grid;
  gap: 18px;
  align-content: center;
  max-width: 620px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2.65rem, 5vw, 4.9rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 22px;
  font-size: clamp(1.35rem, 2.8vw, 1.95rem);
  line-height: 1.38;
  letter-spacing: 0;
}

.lead {
  max-width: 540px;
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(1.22rem, 2.4vw, 1.48rem);
  line-height: 1.55;
}

.topbar,
.pond-status,
.pond-actions,
.parts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  padding: clamp(16px, 2.5vw, 24px);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.score-pill,
.parts span {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
  background: #fff3cc;
  font-weight: 900;
}

.primary-action,
.secondary-action,
.answer-button {
  border: 2px solid var(--ink);
  border-radius: 8px;
  min-height: 60px;
  padding: 15px 18px;
  color: var(--ink);
  background: var(--paper-strong);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action {
  justify-self: start;
  min-width: min(100%, 320px);
  color: #fffaf0;
  background: var(--ink);
  font-size: 1.16rem;
  font-weight: 900;
  box-shadow: 6px 6px 0 #d2a24b;
}

.secondary-action {
  font-weight: 900;
  background: #fff3cc;
}

.primary-action:hover,
.secondary-action:hover,
.answer-button:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 rgba(29, 26, 22, 0.16);
}

.progress {
  height: 14px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 220ms ease;
}

.case-card,
.unlock-panel {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.case-card {
  padding: clamp(22px, 4vw, 38px);
}

.case-kicker {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-weight: 900;
}

.answer-list {
  display: grid;
  gap: 12px;
}

.answer-button {
  width: 100%;
  text-align: left;
  line-height: 1.45;
}

.answer-button.is-correct {
  border-color: var(--good);
  color: #073d22;
  background: #dff6e5;
}

.answer-button.is-wrong {
  border-color: var(--bad);
  color: #6b160d;
  background: #ffe2dc;
}

.answer-button:disabled {
  cursor: default;
}

.feedback {
  min-height: 32px;
  margin: 18px 0 0;
  color: var(--ink);
  line-height: 1.55;
  font-size: 1.08rem;
}

.feedback.good {
  color: var(--good);
  font-weight: 800;
}

.feedback.bad {
  color: var(--bad);
  font-weight: 800;
}

.pond-status {
  justify-content: space-between;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
}

.pond,
.korf-court {
  position: relative;
  overflow: hidden;
  min-height: clamp(380px, 58svh, 540px);
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pond {
  background:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 52px 52px,
    linear-gradient(180deg, #b9e5f1 0%, #69bfd2 52%, #217d92 100%);
}

.water-line {
  position: absolute;
  inset: 28% 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(29, 26, 22, 0.38), transparent);
}

.swimmer {
  position: absolute;
  width: 148px;
  height: 78px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  touch-action: manipulation;
}

.swimmer.fish::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 17px;
  width: 78px;
  height: 42px;
  border: 3px solid rgba(29, 26, 22, 0.35);
  border-radius: 62% 48% 48% 62%;
  background:
    radial-gradient(circle at 34% 32%, rgba(255, 255, 255, 0.64), transparent 0.55rem),
    var(--fish-color, var(--green));
  box-shadow: 0 10px 18px rgba(17, 75, 96, 0.2);
}

.swimmer.fish::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 19px;
  width: 38px;
  height: 38px;
  clip-path: polygon(0 50%, 100% 0, 72% 50%, 100% 100%);
  background: var(--fish-color, var(--green));
  filter: brightness(0.9);
}

.fish-eye {
  position: absolute;
  z-index: 2;
  left: 47px;
  top: 28px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
}

.swimmer.junk {
  width: 112px;
  height: 76px;
}

.swimmer.junk::before {
  content: "";
  position: absolute;
  inset: 12px 22px 20px;
  border: 3px solid rgba(29, 26, 22, 0.28);
  border-radius: 8px;
  background: #fff3cc;
  box-shadow: 0 10px 18px rgba(75, 60, 38, 0.18);
}

.junk-symbol {
  position: absolute;
  z-index: 2;
  inset: 15px 22px auto;
  color: var(--accent-strong);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  pointer-events: none;
}

.swimmer-name {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 0;
  min-width: 72px;
  padding: 3px 7px;
  border: 2px solid rgba(29, 26, 22, 0.28);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 250, 240, 0.92);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.korf-court {
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(255, 255, 255, 0.42) 50%, transparent 50.3%),
    linear-gradient(180deg, #cce8c9, #75bd78);
}

.korf-post {
  position: absolute;
  left: 50%;
  top: 17%;
  width: 14px;
  height: 200px;
  border-radius: 999px;
  background: #fffaf0;
  border: 2px solid var(--ink);
  transform: translateX(-50%);
}

.korf-basket {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 96px;
  height: 36px;
  border: 8px solid var(--accent-strong);
  border-radius: 50%;
  transform: translateX(-50%) rotateX(62deg);
  box-shadow: 0 8px 18px rgba(75, 60, 38, 0.2);
}

.korf-ball {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 76px;
  height: 76px;
  border: 2px solid rgba(29, 26, 22, 0.58);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, rgba(29, 26, 22, 0.22) 48%, rgba(29, 26, 22, 0.22) 52%, transparent 53%),
    radial-gradient(circle at 34% 28%, #f6cd70, #d88735 66%, #9f5725);
  box-shadow: 0 16px 28px rgba(75, 60, 38, 0.28);
  transform: translateX(-50%);
  cursor: pointer;
}

.korf-ball.is-shot {
  animation: korf-shot 620ms ease-in forwards;
}

@keyframes korf-shot {
  0% {
    bottom: 18%;
    transform: translateX(-50%) scale(1);
  }
  72% {
    bottom: 73%;
    transform: translateX(-50%) scale(0.72);
  }
  100% {
    bottom: 69%;
    transform: translateX(-50%) scale(0.52);
  }
}

.aim-meter {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: min(82%, 520px);
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
  transform: translateX(-50%);
}

.aim-zone,
.aim-marker {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.aim-zone {
  left: 43%;
  width: 14%;
  height: 100%;
  border-radius: inherit;
  background: rgba(47, 123, 82, 0.62);
}

.aim-marker {
  left: 0%;
  width: 8px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent-strong);
}

.unlock-panel {
  width: min(780px, 100%);
  justify-self: center;
  padding: clamp(24px, 5vw, 46px);
}

.unlock-art {
  display: block;
  width: min(300px, 72vw);
  max-height: 270px;
  object-fit: contain;
  object-position: center bottom;
  margin: 0 auto 18px;
  filter: drop-shadow(0 18px 24px rgba(75, 60, 38, 0.22));
}

.password {
  overflow-wrap: anywhere;
  margin: 24px 0 14px;
  padding: clamp(16px, 4vw, 28px);
  border: 3px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: #fff3cc;
  font-size: clamp(1.7rem, 6vw, 3.7rem);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.parts {
  margin-bottom: 22px;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .portrait-wrap {
    min-height: 330px;
  }

  .portrait-art {
    min-height: 330px;
    max-height: 440px;
  }

  .intro-copy {
    padding: 4px;
  }

  .primary-action {
    justify-self: stretch;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 20px;
  }

  .app-shell {
    padding: 12px;
  }

  h1 {
    font-size: clamp(2.25rem, 11vw, 4rem);
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
