:root {
  color-scheme: light;
  --ink: #263336;
  --muted: #66787c;
  --panel: rgba(255, 252, 242, 0.92);
  --panel-strong: #fff8e8;
  --sky: #bfe7f4;
  --sky-deep: #80bfd3;
  --water: #71b8b0;
  --water-deep: #3f8e91;
  --leaf: #417e52;
  --leaf-dark: #285a43;
  --moss: #b5c970;
  --sun: #ffd56f;
  --accent: #2f7dd3;
  --accent-dark: #1d5d9f;
  --capy: #a97748;
  --capy-dark: #73502f;
  --dog: #eeb85e;
  --danger: #d9614c;
  --shadow: 0 20px 60px rgba(27, 52, 48, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(127, 188, 165, 0.32), rgba(95, 158, 190, 0.24)),
    #f4f7ec;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.game-card {
  overflow: hidden;
  border: 1px solid rgba(45, 88, 80, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(255, 248, 232, 0.98), rgba(226, 244, 233, 0.94)),
    var(--panel-strong);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.intro {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.story-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(320px, 1.12fr);
  gap: 18px;
  padding: 18px 24px;
  border-top: 1px solid rgba(45, 88, 80, 0.14);
  background: rgba(245, 238, 206, 0.56);
}

.story-copy h2 {
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.story-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.escape-picture {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid rgba(45, 88, 80, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(to bottom, rgba(141, 203, 219, 0.88) 0 48%, rgba(128, 180, 118, 0.9) 48% 100%);
}

.escape-picture::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 8%;
  bottom: 18px;
  height: 78px;
  border-radius: 54% 46% 42% 58%;
  background: linear-gradient(160deg, #75beb5, #357f83);
}

.owner,
.escape-dog,
.escape-capy,
.escape-gate,
.speech {
  position: absolute;
}

.owner {
  left: 28px;
  bottom: 40px;
  width: 34px;
  height: 86px;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(#3d7ac1 0 54%, #253649 54%);
}

.owner::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -28px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c9895c;
}

.speech {
  left: 54px;
  top: 26px;
  border-radius: 999px;
  padding: 7px 11px;
  color: #315644;
  background: #fff8e8;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(30, 66, 60, 0.16);
}

.escape-gate {
  right: 28px;
  bottom: 58px;
  width: 112px;
  height: 78px;
  border: 7px solid #8b6133;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.escape-gate::before,
.escape-gate::after {
  content: "";
  position: absolute;
  bottom: -44px;
  width: 9px;
  height: 44px;
  background: #8b6133;
}

.escape-gate::before {
  left: 18px;
}

.escape-gate::after {
  right: 18px;
}

.escape-capy {
  width: 76px;
  height: 34px;
  border: 2px solid #5f4129;
  border-radius: 46% 36% 35% 42%;
  background: linear-gradient(180deg, #9f744e, #765135);
  box-shadow: inset 0 -5px rgba(45, 27, 16, 0.22);
}

.escape-capy::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 5px;
  width: 28px;
  height: 24px;
  border: 2px solid #5f4129;
  border-radius: 48% 36% 46% 42%;
  background: inherit;
}

.escape-capy::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 14px;
  width: 7px;
  height: 5px;
  border-radius: 50%;
  background: #2e1f16;
}

.capy-one {
  right: 136px;
  bottom: 74px;
}

.capy-two {
  right: 244px;
  bottom: 48px;
  transform: scale(0.82);
}

.capy-three {
  right: 198px;
  bottom: 112px;
  transform: scale(0.72);
}

.escape-capy.rainbow {
  background: linear-gradient(105deg, #de6859, #f0c85a, #61b96c, #58a5d8, #9a74dc);
}

.escape-dog {
  left: 84px;
  bottom: 30px;
  width: 70px;
  height: 48px;
  border: 3px solid #8d6230;
  border-radius: 45% 45% 52% 52%;
  background: linear-gradient(#f8cf76, var(--dog));
}

.escape-dog::before,
.escape-dog::after {
  content: "";
  position: absolute;
  top: 14px;
  width: 7px;
  height: 9px;
  border-radius: 50%;
  background: #4c3322;
}

.escape-dog::before {
  left: 18px;
}

.escape-dog::after {
  right: 18px;
}

.hero-dog {
  position: relative;
  flex: 0 0 auto;
  width: 112px;
  height: 104px;
  filter: drop-shadow(0 10px 16px rgba(87, 55, 20, 0.18));
}

.dog-face {
  position: absolute;
  inset: 18px 10px 0;
  border: 3px solid #8d6230;
  border-radius: 45% 45% 52% 52%;
  background:
    radial-gradient(circle at 35% 33%, rgba(255, 247, 198, 0.46), transparent 18%),
    linear-gradient(#ffd982, var(--dog));
  box-shadow:
    inset 0 -10px rgba(182, 113, 37, 0.12),
    inset 0 0 0 5px rgba(255, 240, 188, 0.15);
}

.dog-ear {
  position: absolute;
  top: 20px;
  z-index: 0;
  width: 34px;
  height: 62px;
  border: 3px solid #8d6230;
  background: #d08a43;
}

.dog-ear.left {
  left: 0;
  border-radius: 70% 30% 70% 40%;
  transform: rotate(-18deg);
}

.dog-ear.right {
  right: 0;
  border-radius: 30% 70% 40% 70%;
  transform: rotate(18deg);
}

.dog-eye,
.dog-nose {
  position: absolute;
  background: #4c3322;
}

.dog-eye {
  top: 34px;
  width: 9px;
  height: 12px;
  border-radius: 50%;
}

.dog-eye.left {
  left: 24px;
}

.dog-eye.right {
  right: 24px;
}

.dog-nose {
  left: 50%;
  bottom: 24px;
  width: 18px;
  height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 9px 0 -4px rgba(76, 51, 34, 0.42);
}

.dog-face::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 13px;
  width: 34px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 234, 176, 0.5);
  transform: translateX(-50%);
}

.controls,
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid rgba(45, 88, 80, 0.14);
}

.controls {
  background: rgba(255, 255, 255, 0.45);
}

.difficulty-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.difficulty,
.restart-button {
  min-height: 44px;
  border: 1px solid rgba(47, 125, 211, 0.25);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--accent-dark);
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.difficulty.active,
.restart-button {
  color: #ffffff;
  border-color: var(--accent);
  background: linear-gradient(180deg, #4090e7, var(--accent-dark));
}

.bonus-difficulty {
  color: #ffffff;
  border-color: #8a5ae0;
  background: linear-gradient(135deg, #e26577, #e7c65d 34%, #59b970 58%, #5b8ddd 78%, #9865d8);
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 248, 232, 0.72);
}

.status-bar div {
  min-width: 0;
}

.label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.game-stage-wrap {
  padding: 16px;
  background: rgba(55, 117, 100, 0.08);
}

.game-stage {
  position: relative;
  overflow: hidden;
  min-height: 530px;
  border: 1px solid rgba(31, 87, 85, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 70% 58%, rgba(255, 255, 255, 0.18), transparent 8%),
    linear-gradient(to bottom, var(--sky) 0 48%, #a7d9a5 48% 100%);
  touch-action: manipulation;
}

.game-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 120px),
    linear-gradient(180deg, transparent, rgba(55, 91, 63, 0.12));
  opacity: 0.65;
  z-index: 2;
}

.game-stage.feeding-mode .lagoon {
  background:
    radial-gradient(circle at 70% 28%, rgba(255, 255, 255, 0.38), transparent 20%),
    linear-gradient(160deg, #70c6d5, #277a9a);
}

.game-stage.bonus-mode {
  background:
    radial-gradient(circle at 74% 16%, rgba(255, 239, 144, 0.45), transparent 16%),
    linear-gradient(to bottom, #b7e6fb 0 48%, #aee0a4 48% 100%);
}

.sun {
  position: absolute;
  top: 34px;
  right: 48px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 18px rgba(255, 213, 111, 0.24);
}

.cloud {
  position: absolute;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  left: 18px;
  width: 40px;
  height: 40px;
}

.cloud::after {
  right: 18px;
  width: 52px;
  height: 52px;
}

.cloud-one {
  top: 70px;
  left: 60px;
  width: 150px;
}

.cloud-two {
  top: 126px;
  right: 190px;
  width: 118px;
}

.mountain {
  position: absolute;
  bottom: 250px;
  width: 380px;
  height: 190px;
  border-radius: 60% 60% 0 0;
  background: #79a86f;
  opacity: 0.7;
}

.mountain-one {
  left: -60px;
}

.mountain-two {
  right: 40px;
  width: 460px;
  background: #629b77;
}

.lagoon {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 58px;
  height: 235px;
  border: 8px solid rgba(233, 224, 165, 0.86);
  border-radius: 54% 46% 42% 58%;
  background:
    radial-gradient(circle at 70% 28%, rgba(255, 255, 255, 0.35), transparent 20%),
    linear-gradient(160deg, var(--water), var(--water-deep));
}

.path {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  background: linear-gradient(180deg, #dec98b, #b99157);
  clip-path: polygon(0 40%, 100% 0, 100% 100%, 0 100%);
}

.reeds,
.tree {
  position: absolute;
  pointer-events: none;
}

.reeds {
  width: 96px;
  height: 130px;
  background:
    linear-gradient(82deg, transparent 44%, var(--leaf-dark) 45% 48%, transparent 49%),
    linear-gradient(98deg, transparent 48%, var(--leaf) 49% 52%, transparent 53%),
    linear-gradient(68deg, transparent 52%, var(--leaf-dark) 53% 56%, transparent 57%);
}

.reeds-one {
  left: 6%;
  bottom: 84px;
}

.reeds-two {
  right: 11%;
  bottom: 126px;
}

.tree {
  width: 110px;
  height: 190px;
}

.tree::before {
  content: "";
  position: absolute;
  left: 45px;
  bottom: 0;
  width: 24px;
  height: 110px;
  border-radius: 12px;
  background: #8c6138;
}

.tree::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #6caf60, var(--leaf-dark));
}

.tree-one {
  left: 22px;
  bottom: 110px;
}

.tree-two {
  right: 26px;
  bottom: 170px;
  transform: scale(0.8);
}

.zoo-sign {
  position: absolute;
  left: 26px;
  bottom: 38px;
  min-width: 108px;
  border: 3px solid #8b6133;
  border-radius: 8px;
  padding: 8px 10px;
  color: #704a24;
  background: #f4d28c;
  font-weight: 900;
  text-align: center;
  box-shadow: inset 0 -6px rgba(113, 74, 36, 0.12);
}

.zoo-sign::before,
.zoo-sign::after {
  content: "";
  position: absolute;
  bottom: -38px;
  width: 8px;
  height: 36px;
  background: #8b6133;
}

.zoo-sign::before {
  left: 20px;
}

.zoo-sign::after {
  right: 20px;
}

.capy-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.feeding-tools {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 760;
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}

.food-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 2px solid rgba(95, 65, 41, 0.32);
  border-radius: 8px;
  padding: 6px 10px;
  color: #315644;
  background: rgba(255, 248, 232, 0.94);
  cursor: pointer;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(40, 58, 41, 0.18);
}

.food-tool.selected {
  border-color: var(--accent);
  color: #ffffff;
  background: linear-gradient(180deg, #4090e7, var(--accent-dark));
}

.bucket-art {
  position: relative;
  display: block;
  width: 42px;
  height: 34px;
  border: 2px solid rgba(77, 58, 42, 0.86);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(180deg, #d9eef2, #79aebc);
  box-shadow: inset 0 -5px rgba(29, 65, 75, 0.16);
}

.bucket-art::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: -8px;
  height: 10px;
  border: 2px solid rgba(77, 58, 42, 0.86);
  border-radius: 999px;
  background: #f8f2df;
}

.sardines-art::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  width: 24px;
  height: 8px;
  border-radius: 50%;
  background: #6eb4c5;
  box-shadow: 4px 9px 0 #558fa5, 14px -1px 0 -2px #d7eef4;
}

.octopus-art {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.24), transparent 36%),
    linear-gradient(180deg, #e6c6dd, #9b5d95);
}

.octopus-art::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  width: 18px;
  height: 16px;
  border-radius: 50%;
  background: #7f3f86;
  box-shadow:
    -6px 13px 0 -2px #7f3f86,
    2px 14px 0 -2px #7f3f86,
    10px 13px 0 -2px #7f3f86;
}

.capybara {
  position: absolute;
  width: calc(var(--capy-size) * 0.86);
  height: calc(var(--capy-size) * 0.86);
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
  touch-action: manipulation;
  filter: drop-shadow(0 10px 5px rgba(32, 47, 35, 0.2));
  animation: capyFloat 1250ms ease-in-out infinite;
}

.capybara::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 18%;
  bottom: 0;
  height: 13%;
  border-radius: 50%;
  background: rgba(40, 58, 41, 0.2);
  filter: blur(1px);
}

.capybara.found {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.18);
}

.capybara.facing-left {
  scale: -1 1;
}

.capybara.facing-left .capy-name {
  scale: -1 1;
}

.capy-name {
  position: absolute;
  left: 50%;
  top: -23px;
  max-width: 130px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #315644;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 4px 12px rgba(42, 76, 68, 0.14);
}

.capybara:hover .capy-name,
.capybara:focus-visible .capy-name {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feeding-target {
  position: absolute;
  width: calc(var(--target-size) * 1.05);
  height: calc(var(--target-size) * 0.7);
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 0 rgba(32, 47, 35, 0.18));
  animation: capyFloat 900ms ease-in-out infinite;
  touch-action: manipulation;
}

.feeding-target.found {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
}

.feeding-target.facing-left {
  scale: -1 1;
}

.target-name {
  position: absolute;
  left: 50%;
  top: -24px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #143b47;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.feeding-target:hover .target-name,
.feeding-target:focus-visible .target-name {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feeding-target.facing-left .target-name {
  scale: -1 1;
}

.target-body,
.target-face,
.target-fin,
.target-shine {
  position: absolute;
  display: block;
}

.target-shine {
  left: 28%;
  top: 30%;
  width: 18%;
  height: 10%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: rotate(-12deg);
}

.score-pop {
  position: absolute;
  z-index: 900;
  pointer-events: none;
  border-radius: 999px;
  padding: 6px 10px;
  color: #ffffff;
  background: #2f7dd3;
  font-weight: 950;
  transform: translate(-50%, -50%);
  animation: scorePop 780ms ease-out forwards;
  box-shadow: 0 8px 18px rgba(29, 63, 63, 0.22);
}

.score-pop.rare {
  background: linear-gradient(135deg, #d9614c, #e8c954, #56ac61, #4f94d5, #9a6ed8);
}

.score-pop.miss {
  background: #d9614c;
}

.penguin .target-body {
  left: 24%;
  top: -2%;
  width: 48%;
  height: 88%;
  border: 2px solid rgba(11, 25, 32, 0.82);
  border-radius: 52% 52% 40% 40%;
  background:
    radial-gradient(ellipse at 50% 58%, #fbffff 0 35%, transparent 36%),
    radial-gradient(circle at 37% 25%, #f6fbfb 0 5%, transparent 6%),
    radial-gradient(circle at 63% 25%, #f6fbfb 0 5%, transparent 6%),
    radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(180deg, #2f4756, #101c25);
  box-shadow:
    inset 8px 0 rgba(255, 255, 255, 0.08),
    inset -7px -9px rgba(2, 10, 14, 0.18);
  animation: penguinWaddle 520ms ease-in-out infinite;
}

.penguin .target-face {
  left: 41%;
  top: 24%;
  width: 7%;
  height: 7%;
  border-radius: 50%;
  background: #101820;
  box-shadow: 14px 0 0 #101820, 7px 9px 0 5px #e59c31;
}

.penguin .target-fin {
  left: 18%;
  top: 46%;
  width: 18%;
  height: 30%;
  border-radius: 999px;
  background: #182b37;
  transform: rotate(18deg);
  box-shadow:
    calc(var(--target-size) * 0.42) -2px 0 #182b37,
    calc(var(--target-size) * 0.18) calc(var(--target-size) * 0.31) 0 -3px #e59c31,
    calc(var(--target-size) * 0.31) calc(var(--target-size) * 0.31) 0 -3px #e59c31;
}

.penguin .target-shine {
  left: 34%;
  top: 9%;
  width: 18%;
  height: 12%;
  background: rgba(255, 255, 255, 0.28);
}

.shark .target-body {
  left: 0;
  right: 8%;
  top: 26%;
  height: 42%;
  border: 2px solid rgba(28, 85, 112, 0.84);
  border-radius: 62% 42% 46% 58%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.44), transparent 14%),
    linear-gradient(180deg, #8ed8ec 0 44%, #f7faf7 45% 61%, #2f7898 62% 100%);
  box-shadow:
    inset 16px 0 rgba(255, 255, 255, 0.2),
    inset -10px -3px rgba(20, 77, 99, 0.22),
    0 7px 14px rgba(20, 77, 99, 0.16);
}

.shark .target-body::before {
  content: "";
  position: absolute;
  left: -16%;
  top: 16%;
  width: 26%;
  height: 60%;
  clip-path: polygon(100% 50%, 0 0, 20% 50%, 0 100%);
  background: linear-gradient(180deg, #7bc9df, #2f7898);
}

.shark .target-body::after {
  content: "";
  position: absolute;
  right: 17%;
  top: 54%;
  width: 16%;
  height: 2px;
  background:
    linear-gradient(90deg, transparent 0 20%, #16495e 20% 28%, transparent 28% 44%, #16495e 44% 52%, transparent 52% 68%, #16495e 68% 76%, transparent 76%);
}

.shark .target-face {
  right: 13%;
  top: 39%;
  width: 6%;
  height: 8%;
  border-radius: 50%;
  background: #102631;
}

.shark .target-fin {
  left: 42%;
  top: 6%;
  width: 20%;
  height: 28%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #65b8d1, #2f7898);
}

.shark .target-shine {
  left: 30%;
  top: 32%;
  width: 22%;
  height: 8%;
  background: rgba(255, 255, 255, 0.48);
}

.capy-speedy,
.capy-dancer {
  animation-duration: 780ms;
}

.capy-rainbow .capy-name,
.roster-rainbow em {
  color: #ffffff;
  background: linear-gradient(135deg, #d9614c, #e8c954, #56ac61, #4f94d5, #9a6ed8);
}

@keyframes capyFloat {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -3px;
  }
}

@keyframes dogWalk {
  0% {
    transform: translateY(0);
  }

  50%,
  100% {
    transform: translateY(4px);
  }
}

@keyframes dogTail {
  0% {
    transform: rotate(-25deg);
  }

  50%,
  100% {
    transform: rotate(15deg);
  }
}

@keyframes penguinWaddle {
  0%,
  100% {
    transform: rotate(-4deg);
  }

  50% {
    transform: rotate(5deg);
  }
}

@keyframes scorePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.75);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.08);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -145%) scale(0.92);
  }
}

.dog-marker {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 102px;
  height: 62px;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 5px rgba(32, 47, 35, 0.22));
  z-index: 620;
}

.dog-body,
.dog-head,
.dog-tail,
.dog-stage-leg,
.dog-stage-ear,
.dog-stage-eye,
.dog-stage-snout {
  position: absolute;
  display: block;
}

.dog-body {
  left: 16px;
  right: 20px;
  top: 20px;
  height: 28px;
  border: 2px solid rgba(141, 98, 48, 0.82);
  border-radius: 54% 42% 42% 48%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 245, 190, 0.5), transparent 20%),
    linear-gradient(180deg, #ffd47c 0 52%, #d9963c 52% 100%);
  box-shadow:
    inset 0 -5px rgba(123, 74, 25, 0.18),
    10px 0 0 #d28a34,
    inset 0 0 0 4px rgba(255, 236, 168, 0.12);
}

.dog-head {
  right: 2px;
  top: 7px;
  width: 38px;
  height: 35px;
  border: 2px solid rgba(141, 98, 48, 0.82);
  border-radius: 52% 46% 52% 46%;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 245, 190, 0.42), transparent 22%),
    linear-gradient(180deg, #ffd783 0 52%, #db9940 52% 100%);
  box-shadow:
    inset -5px 0 rgba(123, 74, 25, 0.16);
}

.dog-tail {
  left: 2px;
  top: 13px;
  width: 25px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8ca6d, #d9963c);
  transform: rotate(-25deg);
  transform-origin: right center;
  animation: dogTail 650ms steps(2, end) infinite;
}

.dog-stage-ear {
  left: 1px;
  top: 4px;
  width: 12px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #cf8537, #9f5d28);
  box-shadow: inset 0 -5px rgba(74, 42, 18, 0.22);
}

.dog-stage-eye {
  right: 9px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #392314;
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.78);
}

.dog-stage-snout {
  right: -9px;
  top: 20px;
  width: 18px;
  height: 13px;
  border-radius: 999px;
  background: #f0bd64;
  box-shadow: 9px 2px 0 -1px #392314, 3px 8px 0 -5px rgba(57, 35, 20, 0.8);
}

.dog-stage-leg {
  bottom: 3px;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b8732e, #7f481e);
  animation: dogWalk 520ms ease-in-out infinite;
}

.dog-stage-leg.front {
  right: 24px;
}

.dog-stage-leg.back {
  left: 27px;
  animation-delay: 260ms;
}

.message-panel {
  padding: 0 24px 18px;
  background: rgba(55, 117, 100, 0.08);
}

.message-panel p {
  margin: 0;
  border: 1px solid rgba(47, 125, 211, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  color: #315644;
  background: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.roster {
  padding: 20px 24px 24px;
  background: rgba(255, 252, 242, 0.92);
}

.roster-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.roster-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.roster-card {
  min-height: 92px;
  border: 1px solid rgba(45, 88, 80, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.roster-card.found {
  color: #527260;
  background: #e7f3dd;
}

.roster-card strong {
  display: block;
  margin-bottom: 4px;
}

.roster-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.roster-card em {
  display: inline-block;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #315644;
  background: #edf7e8;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 900;
}

/* Polished cozy cartoon pass */
body {
  font-family: Nunito, "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 232, 124, 0.24), transparent 28%),
    radial-gradient(circle at 78% 0%, rgba(110, 199, 214, 0.24), transparent 34%),
    linear-gradient(145deg, #e8f7e7, #f8efcf 48%, #d9f0ee);
}

.game-card,
.escape-picture,
.game-stage,
.message-panel p,
.roster-card {
  border-radius: 18px;
}

.game-card {
  border: 3px solid rgba(68, 118, 92, 0.18);
  background: linear-gradient(180deg, rgba(255, 254, 245, 0.95), rgba(245, 255, 236, 0.92));
  box-shadow: 0 24px 65px rgba(35, 70, 55, 0.22);
}

.game-header {
  background:
    radial-gradient(circle at 88% 22%, rgba(255, 217, 111, 0.38), transparent 22%),
    linear-gradient(120deg, #fff7d7, #daf2e7 58%, #d7edf7);
}

h1 {
  color: #284d3e;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.72);
}

.story-panel {
  background:
    linear-gradient(180deg, rgba(255, 249, 221, 0.82), rgba(231, 249, 230, 0.82));
}

.escape-picture {
  border: 3px solid rgba(87, 127, 80, 0.25);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 246, 190, 0.72), transparent 20%),
    linear-gradient(to bottom, #9de2f3 0 48%, #aee282 48% 100%);
  box-shadow: inset 0 -12px rgba(69, 121, 86, 0.14);
}

.escape-capy {
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 0;
  background: url("assets/capybara-sprites.svg") 0 0 / 600% 100% no-repeat;
  filter: drop-shadow(0 8px 0 rgba(51, 80, 48, 0.2));
  animation: capyMoveSprite 620ms steps(1) infinite, capyHop 840ms ease-in-out infinite;
}

.escape-capy::before,
.escape-capy::after {
  display: none;
}

.escape-capy.rainbow {
  background: url("assets/capybara-sprites.svg") 80% 0 / 600% 100% no-repeat;
  filter:
    drop-shadow(0 0 10px rgba(255, 230, 112, 0.7))
    drop-shadow(0 8px 0 rgba(51, 80, 48, 0.18))
    hue-rotate(28deg) saturate(1.24);
}

.difficulty,
.restart-button,
.food-tool {
  border-width: 2px;
  border-radius: 999px;
  box-shadow: 0 7px 0 rgba(33, 85, 82, 0.12), 0 14px 24px rgba(33, 85, 82, 0.1);
  transition: transform 130ms ease, box-shadow 130ms ease, filter 130ms ease;
}

.difficulty:hover,
.restart-button:hover,
.food-tool:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.difficulty:active,
.restart-button:active,
.food-tool:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(33, 85, 82, 0.14), 0 8px 18px rgba(33, 85, 82, 0.12);
}

.status-bar {
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 250, 225, 0.84), rgba(231, 250, 233, 0.84));
}

.status-bar div {
  border: 2px solid rgba(68, 118, 92, 0.12);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 -5px rgba(55, 117, 100, 0.06);
}

.status-bar strong {
  color: #245b74;
  font-size: 1.2rem;
}

.game-stage {
  isolation: isolate;
  border: 4px solid rgba(48, 111, 93, 0.24);
  background:
    linear-gradient(to bottom, #8fe2f8 0 46%, #afe58b 46% 100%);
  box-shadow:
    inset 0 0 0 7px rgba(255, 255, 255, 0.34),
    0 18px 34px rgba(42, 91, 71, 0.16);
}

.game-stage.screen-bump {
  animation: screenBump 260ms ease-out;
}

.sky-wash,
.canopy,
.water-sparkles,
.grass-band,
.floating-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sky-wash {
  z-index: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 251, 204, 0.52), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 36%);
}

.cloud {
  z-index: 1;
  box-shadow: 0 8px 0 rgba(102, 156, 166, 0.12);
  animation: cloudDrift 16s ease-in-out infinite alternate;
}

.cloud-two {
  animation-duration: 20s;
}

.cloud-three {
  top: 38px;
  left: 48%;
  width: 96px;
  opacity: 0.74;
  animation-duration: 18s;
}

.mountain {
  z-index: 1;
  background:
    radial-gradient(circle at 38% 20%, rgba(255, 255, 255, 0.18), transparent 18%),
    linear-gradient(180deg, #8fca7b, #579d6f);
  opacity: 0.82;
}

.canopy {
  z-index: 2;
}

.canopy-one {
  top: 128px;
  left: -8%;
  width: 52%;
  height: 150px;
  border-radius: 0 0 55% 42%;
  background: radial-gradient(circle at 32% 42%, #6abf66 0 36%, transparent 37%);
  opacity: 0.72;
  animation: leafSway 5s ease-in-out infinite;
}

.canopy-two {
  top: 154px;
  right: -12%;
  width: 58%;
  height: 168px;
  border-radius: 0 0 42% 55%;
  background: radial-gradient(circle at 64% 40%, #5aae74 0 36%, transparent 37%);
  opacity: 0.72;
  animation: leafSway 5.8s ease-in-out infinite reverse;
}

.sun {
  z-index: 1;
  background: radial-gradient(circle at 36% 34%, #fff3a8, #ffd56f 62%, #f7ad4e);
  animation: sunPulse 3.2s ease-in-out infinite;
}

.lagoon {
  z-index: 2;
  border: 10px solid rgba(255, 235, 160, 0.82);
  background:
    radial-gradient(ellipse at 28% 42%, rgba(255, 255, 255, 0.35), transparent 16%),
    radial-gradient(ellipse at 74% 30%, rgba(255, 255, 255, 0.3), transparent 18%),
    repeating-radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.16) 0 2px, transparent 3px 28px),
    linear-gradient(160deg, #8bd9cf, #3f9ca0 66%, #27767f);
  box-shadow:
    inset 0 10px rgba(255, 255, 255, 0.22),
    inset 0 -16px rgba(20, 88, 91, 0.18);
}

.lagoon::before,
.lagoon::after {
  content: "";
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  opacity: 0;
  animation: ripple 3.6s ease-out infinite;
}

.lagoon::before {
  left: 24%;
  top: 38%;
  width: 58px;
  height: 22px;
}

.lagoon::after {
  right: 22%;
  top: 54%;
  width: 76px;
  height: 28px;
  animation-delay: 1.4s;
}

.water-sparkles {
  z-index: 3;
  background:
    radial-gradient(circle at 32% 66%, #fff8c7 0 3px, transparent 4px),
    radial-gradient(circle at 68% 56%, #fff8c7 0 2px, transparent 3px),
    radial-gradient(circle at 52% 72%, #fff8c7 0 2px, transparent 3px);
  animation: sparkleDrift 2.8s ease-in-out infinite;
}

.path {
  z-index: 3;
  background:
    radial-gradient(circle at 18% 65%, rgba(255, 243, 190, 0.45) 0 10px, transparent 11px),
    radial-gradient(circle at 72% 34%, rgba(121, 84, 47, 0.16) 0 7px, transparent 8px),
    linear-gradient(180deg, #f1d991, #c49255);
}

.grass-band {
  z-index: 3;
  top: auto;
  height: 96px;
  background:
    linear-gradient(74deg, transparent 45%, rgba(45, 114, 67, 0.42) 46% 48%, transparent 49%) 0 0 / 28px 100%,
    linear-gradient(104deg, transparent 46%, rgba(97, 160, 74, 0.38) 47% 49%, transparent 50%) 0 0 / 34px 100%;
  bottom: 54px;
  animation: grassWave 2.8s ease-in-out infinite;
}

.reeds {
  z-index: 5;
  transform-origin: bottom center;
  animation: reedSway 2.6s ease-in-out infinite;
}

.reeds-two {
  animation-delay: 500ms;
}

.reeds-three {
  left: 42%;
  bottom: 92px;
  transform: scale(0.82);
  animation-delay: 900ms;
}

.tree {
  z-index: 4;
  filter: drop-shadow(0 9px 0 rgba(40, 76, 45, 0.12));
}

.floating-particles {
  z-index: 6;
  background:
    radial-gradient(circle at 16% 44%, rgba(255, 245, 164, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 38%, rgba(255, 245, 164, 0.62) 0 2px, transparent 3px),
    radial-gradient(circle at 52% 28%, rgba(255, 255, 255, 0.72) 0 2px, transparent 3px);
  animation: particleFloat 4.5s ease-in-out infinite;
}

.zoo-sign {
  z-index: 8;
  border-width: 4px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.26), transparent 18%),
    linear-gradient(180deg, #ffe09a, #e7ad5c);
  box-shadow: inset 0 -8px rgba(113, 74, 36, 0.12), 0 7px 0 rgba(82, 50, 27, 0.14);
}

.capy-layer {
  z-index: 12;
}

.capybara {
  width: var(--capy-size);
  height: var(--capy-size);
  filter: none;
  animation: capyHop 1.15s ease-in-out infinite;
  will-change: left, top, transform;
}

.capybara::before,
.capybara::after {
  display: none;
}

.capy-shadow,
.capy-aura,
.capy-sprite,
.capy-accessory {
  position: absolute;
  display: block;
  pointer-events: none;
}

.capy-shadow {
  left: 16%;
  right: 16%;
  bottom: 9%;
  height: 13%;
  border-radius: 50%;
  background: rgba(35, 63, 42, 0.2);
  filter: blur(1px);
}

.capy-aura {
  inset: -10%;
  border-radius: 50%;
  opacity: 0;
}

.capy-sprite {
  inset: 0;
  background: url("assets/capybara-sprites.svg") 0 0 / 600% 100% no-repeat;
  filter: drop-shadow(0 8px 0 rgba(45, 75, 43, 0.18));
  transform-origin: 50% 82%;
  animation: capyIdleSprite 3.8s steps(1) infinite, squashStretch 1s ease-in-out infinite;
}

.capybara.moving .capy-sprite {
  animation: capyMoveSprite 430ms steps(1) infinite, squashStretch 620ms ease-in-out infinite;
}

.capybara.celebrate .capy-sprite {
  background-position: 80% 0;
  animation: happyPop 260ms ease-out forwards;
}

.capybara.confused .capy-sprite {
  background-position: 100% 0;
  animation: confusedWobble 360ms ease-in-out;
}

.capybara.found {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.34);
}

.capy-accessory {
  inset: 0;
  z-index: 2;
}

.capy-speedy .capy-accessory::after,
.capy-dancer .capy-accessory::after {
  content: "";
  position: absolute;
  right: 12%;
  top: 46%;
  width: 24%;
  height: 9%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef5a62, #ffd96b);
  box-shadow: 0 3px 0 rgba(91, 48, 36, 0.14);
  transform: rotate(-10deg);
}

.capy-flower .capy-accessory::before,
.capy-leaf .capy-accessory::before {
  content: "";
  position: absolute;
  left: 40%;
  top: 14%;
  width: 9%;
  height: 9%;
  border-radius: 50%;
  background: #ff8eb8;
  box-shadow: 9px -2px 0 #ffe270, -8px 1px 0 #8bdc71, 1px -9px 0 #ffffff;
}

.capy-stone .capy-sprite {
  filter: drop-shadow(0 8px 0 rgba(45, 75, 43, 0.18)) saturate(0.68) brightness(0.86);
}

.capy-shy .capy-sprite {
  filter: drop-shadow(0 8px 0 rgba(45, 75, 43, 0.18)) saturate(0.78) brightness(1.06);
}

.capy-river .capy-sprite {
  filter: drop-shadow(0 8px 0 rgba(45, 75, 43, 0.18)) hue-rotate(12deg) saturate(1.04);
}

.capy-gold .capy-sprite {
  filter:
    drop-shadow(0 0 10px rgba(255, 220, 97, 0.68))
    drop-shadow(0 8px 0 rgba(45, 75, 43, 0.16))
    sepia(0.24) saturate(1.32) brightness(1.08);
}

.capy-gold .capy-accessory::before {
  content: "";
  position: absolute;
  left: 42%;
  top: 10%;
  width: 24%;
  height: 18%;
  clip-path: polygon(0 100%, 12% 26%, 32% 70%, 50% 10%, 68% 70%, 88% 26%, 100% 100%);
  background: linear-gradient(180deg, #fff096, #e9ad35);
  filter: drop-shadow(0 2px 0 rgba(89, 59, 20, 0.18));
}

.capy-rainbow .capy-aura {
  opacity: 1;
  background: conic-gradient(from 0deg, rgba(255, 115, 128, 0.38), rgba(255, 226, 112, 0.38), rgba(116, 224, 135, 0.38), rgba(112, 184, 255, 0.38), rgba(190, 144, 255, 0.38), rgba(255, 115, 128, 0.38));
  animation: rareAura 1.8s linear infinite;
}

.capy-rainbow .capy-sprite {
  filter:
    drop-shadow(0 0 14px rgba(255, 231, 112, 0.72))
    drop-shadow(0 8px 0 rgba(45, 75, 43, 0.16))
    hue-rotate(32deg) saturate(1.34) brightness(1.07);
}

.capy-name,
.target-name {
  z-index: 8;
  border: 2px solid rgba(52, 112, 89, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 0 rgba(45, 78, 58, 0.08), 0 12px 18px rgba(42, 76, 68, 0.12);
}

.feeding-target {
  filter: none;
  animation: swimBob 960ms ease-in-out infinite;
}

.feeding-target.confused {
  animation: confusedWobble 360ms ease-in-out;
}

.penguin .target-body {
  border-width: 3px;
  background:
    radial-gradient(ellipse at 50% 59%, #fbffff 0 37%, transparent 38%),
    radial-gradient(circle at 35% 19%, rgba(255, 255, 255, 0.2), transparent 20%),
    linear-gradient(180deg, #435c6e, #101a25 68%, #081017);
  box-shadow: inset 8px 0 rgba(255, 255, 255, 0.1), inset -8px -10px rgba(0, 0, 0, 0.16), 0 8px 0 rgba(35, 63, 42, 0.16);
}

.penguin .target-face {
  box-shadow: 14px 0 0 #101820, 7px 10px 0 6px #f1a337;
}

.shark .target-body {
  border-width: 3px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.48), transparent 14%),
    linear-gradient(180deg, #a4e4f2 0 43%, #fbfffb 44% 62%, #347f9f 63% 100%);
  box-shadow: inset 16px 0 rgba(255, 255, 255, 0.2), inset -10px -3px rgba(20, 77, 99, 0.22), 0 8px 0 rgba(35, 63, 42, 0.14);
}

.score-pop {
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 7px 0 rgba(35, 72, 64, 0.13), 0 13px 20px rgba(29, 63, 63, 0.22);
}

.burst-particle {
  position: absolute;
  z-index: 920;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: burstPop 620ms ease-out forwards;
}

.message-panel p {
  border-width: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 253, 236, 0.9));
  box-shadow: inset 0 -5px rgba(55, 117, 100, 0.06);
}

.roster-card {
  border-width: 2px;
  background:
    radial-gradient(circle at 94% 16%, rgba(255, 225, 112, 0.22), transparent 20%),
    #ffffff;
  box-shadow: 0 8px 0 rgba(41, 83, 62, 0.07);
  transition: transform 150ms ease, background 150ms ease;
}

.roster-card.found {
  transform: translateY(2px);
  background:
    radial-gradient(circle at 90% 20%, rgba(139, 220, 113, 0.26), transparent 22%),
    #e8f6dd;
}

@keyframes capyIdleSprite {
  0%,
  82%,
  100% {
    background-position: 0 0;
  }

  86%,
  94% {
    background-position: 20% 0;
  }
}

@keyframes capyMoveSprite {
  0%,
  100% {
    background-position: 40% 0;
  }

  50% {
    background-position: 60% 0;
  }
}

@keyframes squashStretch {
  0%,
  100% {
    transform: scale(1);
  }

  48% {
    transform: scale(1.035, 0.965) translateY(2px);
  }
}

@keyframes happyPop {
  0% {
    transform: scale(1);
  }

  55% {
    transform: scale(1.18, 0.9) translateY(-8px);
  }

  100% {
    transform: scale(1.04);
  }
}

@keyframes confusedWobble {
  0%,
  100% {
    transform: rotate(0);
  }

  30% {
    transform: rotate(-8deg);
  }

  65% {
    transform: rotate(8deg);
  }
}

@keyframes capyHop {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -4px;
  }
}

@keyframes rareAura {
  to {
    transform: rotate(1turn) scale(1.05);
  }
}

@keyframes burstPop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.65);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.18);
  }
}

@keyframes screenBump {
  0%,
  100% {
    transform: translate(0, 0);
  }

  28% {
    transform: translate(4px, -2px);
  }

  56% {
    transform: translate(-3px, 2px);
  }
}

@keyframes cloudDrift {
  to {
    transform: translateX(34px);
  }
}

@keyframes sunPulse {
  50% {
    box-shadow: 0 0 0 24px rgba(255, 213, 111, 0.2);
  }
}

@keyframes leafSway {
  50% {
    transform: translateX(8px) rotate(1deg);
  }
}

@keyframes ripple {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }

  20% {
    opacity: 0.85;
  }

  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes sparkleDrift {
  50% {
    opacity: 0.56;
    transform: translateY(-3px);
  }
}

@keyframes grassWave {
  50% {
    transform: skewX(-1deg);
  }
}

@keyframes reedSway {
  50% {
    transform: rotate(3deg);
  }
}

@keyframes particleFloat {
  50% {
    opacity: 0.62;
    transform: translateY(-12px);
  }
}

@keyframes swimBob {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -5px;
  }
}

.feeding-tools {
  left: auto;
  right: 18px;
  bottom: 18px;
  align-items: flex-end;
  flex-direction: column;
  transform: none;
}

.feeding-tools[hidden] {
  display: none;
}

.food-tool {
  width: min(205px, 42vw);
  justify-content: flex-start;
  border-color: rgba(52, 112, 89, 0.2);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.food-tool:active,
.dragging-food .food-tool.selected {
  cursor: grabbing;
}

.bucket-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.bucket-copy strong,
.bucket-copy small {
  display: block;
}

.bucket-copy small {
  margin-top: 3px;
  color: rgba(49, 86, 68, 0.78);
  font-size: 0.67rem;
  font-weight: 900;
}

.food-tool.selected .bucket-copy small {
  color: rgba(255, 255, 255, 0.82);
}

.food-ghost {
  position: absolute;
  z-index: 980;
  width: 58px;
  height: 46px;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-8deg);
  filter: drop-shadow(0 9px 0 rgba(35, 72, 64, 0.16));
  animation: foodWiggle 480ms ease-in-out infinite;
}

.sardines-ghost::before,
.sardines-ghost::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 36px;
  height: 13px;
  border: 2px solid #246c82;
  border-radius: 50% 45% 45% 50%;
  background:
    radial-gradient(circle at 72% 45%, #102b34 0 2px, transparent 3px),
    linear-gradient(180deg, #a5e9ef, #4fa8c0);
}

.sardines-ghost::before {
  top: 10px;
}

.sardines-ghost::after {
  top: 24px;
  left: 14px;
  transform: rotate(8deg);
}

.octopus-ghost::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 4px;
  width: 32px;
  height: 30px;
  border: 2px solid #64346f;
  border-radius: 50%;
  background:
    radial-gradient(circle at 37% 42%, #23132b 0 2px, transparent 3px),
    radial-gradient(circle at 62% 42%, #23132b 0 2px, transparent 3px),
    linear-gradient(180deg, #e89bd9, #9b5dba);
}

.octopus-ghost::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 29px;
  width: 42px;
  height: 16px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 10% 40%, #9b5dba 0 7px, transparent 8px),
    radial-gradient(ellipse at 34% 50%, #9b5dba 0 8px, transparent 9px),
    radial-gradient(ellipse at 61% 50%, #9b5dba 0 8px, transparent 9px),
    radial-gradient(ellipse at 88% 40%, #9b5dba 0 7px, transparent 8px);
}

.feeding-target {
  width: calc(var(--target-size) * 1.28);
  height: calc(var(--target-size) * 1.08);
  filter: none;
  animation: swimBob 960ms ease-in-out infinite;
  will-change: left, top, transform;
}

.feeding-target.shark {
  width: calc(var(--target-size) * 1.34);
  height: calc(var(--target-size) * 0.98);
}

.feeding-target::before,
.feeding-target::after {
  display: none;
}

.target-aura,
.target-shadow,
.target-sprite,
.target-splash {
  position: absolute;
  display: block;
  pointer-events: none;
}

.target-shadow {
  left: 14%;
  right: 14%;
  bottom: 5%;
  height: 13%;
  border-radius: 50%;
  background: rgba(35, 63, 42, 0.19);
  filter: blur(1px);
}

.target-aura {
  inset: -8%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 246, 176, 0.6), transparent 68%);
}

.target-sprite {
  left: 50%;
  top: 50%;
  width: var(--target-size);
  height: var(--target-size);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 8px 0 rgba(35, 72, 64, 0.16));
  transform-origin: 50% 80%;
  translate: -50% -50%;
}

.penguin .target-sprite {
  background-image: url("assets/penguin-sprite.svg");
  animation: penguinWaddleSprite 620ms ease-in-out infinite, squashStretch 860ms ease-in-out infinite;
}

.shark .target-sprite {
  width: calc(var(--target-size) * 1.24);
  height: calc(var(--target-size) * 1.02);
  background-image: url("assets/shark-sprite.svg");
  animation: sharkGlide 1s ease-in-out infinite;
}

.feeding-target.celebrate .target-aura {
  opacity: 1;
  animation: targetGlow 280ms ease-out;
}

.feeding-target.celebrate .target-sprite {
  animation: happyPop 260ms ease-out forwards;
}

.feeding-target.confused .target-sprite {
  animation: confusedWobble 360ms ease-in-out;
}

.target-splash {
  left: 18%;
  right: 18%;
  bottom: 10%;
  height: 22%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 22% 58%, rgba(255, 255, 255, 0.42) 0 6px, transparent 7px),
    radial-gradient(ellipse at 70% 50%, rgba(255, 255, 255, 0.34) 0 5px, transparent 6px);
  opacity: 0.6;
  animation: splashBlink 1.4s ease-in-out infinite;
}

.penguin .target-splash {
  bottom: 2%;
}

.shark .target-splash {
  left: 8%;
  right: 8%;
}

.feeding-target.found {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.18);
}

@keyframes sharkGlide {
  0%,
  100% {
    transform: translateY(0) scaleX(1);
  }

  50% {
    transform: translateY(-2px) scaleX(1.03);
  }
}

@keyframes penguinWaddleSprite {
  0%,
  100% {
    transform: rotate(-3deg);
  }

  50% {
    transform: rotate(4deg) translateY(-2px);
  }
}

@keyframes targetGlow {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }

  55% {
    transform: scale(1.12);
    opacity: 1;
  }

  100% {
    transform: scale(1.24);
    opacity: 0;
  }
}

@keyframes splashBlink {
  50% {
    opacity: 0.32;
    transform: scaleX(1.08);
  }
}

@keyframes foodWiggle {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-8deg) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) rotate(6deg) scale(1.05);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .game-header,
  .story-panel,
  .controls,
  .status-bar,
  .roster {
    padding-inline: 16px;
  }

  .game-header {
    align-items: flex-start;
  }

  .hero-dog {
    width: 76px;
    height: 72px;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .difficulty-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .difficulty,
  .restart-button {
    padding-inline: 10px;
  }

  .feeding-tools {
    left: auto;
    right: 12px;
    bottom: 12px;
    align-items: flex-end;
    flex-direction: column;
    justify-content: center;
    transform: none;
  }

  .food-tool {
    flex: 0 0 auto;
    width: min(188px, 48vw);
    justify-content: flex-start;
    min-width: 0;
    padding-inline: 8px;
  }

  .bucket-copy small {
    font-size: 0.62rem;
  }

  .status-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-panel {
    grid-template-columns: 1fr;
  }

  .escape-picture {
    min-height: 190px;
  }

  .game-stage {
    min-height: 430px;
  }

  .mountain {
    bottom: 214px;
  }

  .lagoon {
    left: 2%;
    right: 2%;
    bottom: 58px;
    height: 205px;
  }

  .tree-two,
  .cloud-two {
    display: none;
  }

  .roster-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #edf5ef;
    --muted: #a9beb7;
    --panel: rgba(21, 38, 36, 0.94);
    --panel-strong: #193b39;
    --sky: #476f83;
    --sky-deep: #284f65;
    --water: #347e80;
    --water-deep: #1f555d;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
  }

  body {
    background:
      linear-gradient(135deg, rgba(39, 82, 78, 0.5), rgba(36, 63, 88, 0.44)),
      #10211f;
  }

  .game-header {
    background:
      linear-gradient(120deg, rgba(23, 54, 51, 0.98), rgba(34, 74, 67, 0.94)),
      var(--panel-strong);
  }

  .controls {
    background: rgba(17, 35, 33, 0.82);
  }

  .status-bar,
  .roster {
    background: rgba(21, 38, 36, 0.92);
  }

  .difficulty,
  .roster-card {
    color: var(--ink);
    background: #1c3330;
  }

  .message-panel p {
    color: #d9f2e4;
    background: rgba(19, 38, 35, 0.82);
  }
}
