:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  --ink: #f7fbff;
  --navy: #07164f;
  --purple: #8b5cf6;
  --pink: #ff78c8;
  --aqua: #55e6ff;
  --yellow: #ffe56f;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #06103a;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: #0c3a86;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute;
  z-index: 4;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.brand,
.level-badge,
.fish-count,
.sound-button {
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(5, 15, 64, 0.72);
  box-shadow: 0 7px 24px rgba(0, 3, 30, 0.22), inset 0 1px rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 18px;
  color: var(--ink);
  font-size: clamp(13px, 2vw, 17px);
  font-weight: 900;
  letter-spacing: 0.01em;
}

.brand-bubble {
  font-size: 19px;
}

.fish-count {
  padding: 10px 14px;
  border-radius: 18px;
  color: white;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.level-badge {
  margin-left: auto;
  padding: 9px 14px;
  border-radius: 18px;
  color: #c9f7ff;
  font-size: clamp(11px, 1.7vw, 14px);
  font-weight: 900;
  letter-spacing: 0.025em;
  text-align: center;
}

.sound-button {
  width: 43px;
  height: 43px;
  padding: 0;
  border-radius: 50%;
  color: white;
  font-size: 19px;
  pointer-events: auto;
  cursor: pointer;
}

.helper-row {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(92%, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.challenge-hud {
  position: absolute;
  z-index: 4;
  top: max(67px, calc(env(safe-area-inset-top) + 55px));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.course-count,
.shield-count {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(5, 15, 64, 0.72);
  box-shadow: 0 7px 22px rgba(0, 4, 42, 0.22);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.shield-count {
  color: #bff7ff;
  letter-spacing: 0.06em;
}

.help-button,
.tiny-tip {
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(6, 19, 73, 0.74);
  box-shadow: 0 7px 22px rgba(0, 6, 42, 0.23);
  backdrop-filter: blur(8px);
  color: white;
}

.help-button {
  padding: 11px 17px;
  font-weight: 900;
  pointer-events: auto;
  cursor: pointer;
}

.help-button:active {
  transform: scale(0.96);
}

.tiny-tip {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
}

.card {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: min(90%, 520px);
  transform: translate(-50%, -50%);
  padding: clamp(24px, 5vw, 42px);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(20, 30, 110, 0.94), rgba(72, 42, 151, 0.92));
  box-shadow: 0 25px 80px rgba(1, 5, 46, 0.46), inset 0 1px rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(16px);
  text-align: center;
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(91, 231, 255, 0.12);
}

.card::before {
  width: 170px;
  height: 170px;
  top: -80px;
  right: -45px;
}

.card::after {
  width: 95px;
  height: 95px;
  bottom: -37px;
  left: -24px;
}

.title-creatures {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 2px;
  font-size: 40px;
}

.mini-axolotl {
  animation: floaty 2.2s ease-in-out infinite;
}

.mini-toad {
  animation: floaty 2.2s 0.45s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.eyebrow {
  margin: 9px 0 8px;
  color: var(--aqua);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card h1,
.card h2,
.card p {
  position: relative;
  z-index: 1;
}

.card h1 {
  margin: 0;
  color: white;
  font-size: clamp(35px, 8vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-shadow: 0 4px 0 rgba(26, 9, 97, 0.35);
}

.card h2 {
  margin: 8px 0 18px;
  color: #ffd8f0;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.05;
}

.story,
.win-card > p:not(.eyebrow) {
  max-width: 420px;
  margin: 0 auto 22px;
  color: #ecf7ff;
  font-size: clamp(15px, 3vw, 18px);
  line-height: 1.48;
}

.primary-button {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 15px 22px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #ff70bf, #8d63ff);
  box-shadow: 0 8px 0 #472d9c, 0 15px 30px rgba(0, 7, 50, 0.35), inset 0 1px rgba(255, 255, 255, 0.52);
  color: white;
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 900;
  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #472d9c, 0 9px 22px rgba(0, 7, 50, 0.3);
}

.control-note {
  margin: 19px 0 0 !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 12px !important;
  font-weight: 700;
}

.celebration {
  margin-bottom: 8px;
  font-size: clamp(26px, 8vw, 46px);
  letter-spacing: 0.06em;
}

.home-panel {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(13px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(94%, 800px);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 24px;
  background: rgba(8, 18, 67, 0.8);
  box-shadow: 0 14px 38px rgba(0, 4, 35, 0.32);
  backdrop-filter: blur(12px);
}

.home-message {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 1px 4px 10px;
  color: white;
  text-align: center;
}

.home-message strong {
  font-size: 17px;
}

.home-message span {
  color: #bceeff;
  font-size: 12px;
  font-weight: 700;
}

.decorations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.decor-button,
.again-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 13px;
  background: rgba(104, 76, 198, 0.8);
  color: white;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.decor-button[aria-pressed="true"] {
  background: linear-gradient(135deg, #e44fa5, #7254e8);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 17px rgba(255, 111, 206, 0.36);
}

.again-button {
  width: 100%;
  margin-top: 8px;
  background: rgba(8, 177, 202, 0.78);
}

.toast {
  position: absolute;
  z-index: 7;
  top: 76px;
  left: 50%;
  max-width: min(86%, 420px);
  transform: translate(-50%, -12px) scale(0.96);
  padding: 11px 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(5, 20, 75, 0.88);
  box-shadow: 0 10px 30px rgba(0, 4, 38, 0.3);
  color: white;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

[hidden] {
  display: none !important;
}

button:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .game-shell { min-height: 480px; }
  .brand { padding: 9px 11px; }
  .brand span:last-child { display: none; }
  .level-badge {
    position: absolute;
    top: 47px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 190px;
    padding: 7px 12px;
    white-space: nowrap;
  }
  .challenge-hud { top: 90px; }
  .course-count,
  .shield-count { padding: 6px 9px; font-size: 10px; }
  .fish-count { padding: 9px 11px; }
  .sound-button { width: 40px; height: 40px; }
  .card { border-radius: 28px; }
  .tiny-tip { display: none; }
  .home-message { display: block; }
  .home-message span { display: block; margin-top: 3px; }
  .decor-button { padding: 7px 4px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
