:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  --ink: #173b2a;
  --muted: #527063;
  --green-900: #174f2e;
  --green-700: #247b41;
  --green-600: #2e9550;
  --green-300: #99dfa0;
  --cream: #fffced;
  --yellow: #ffd85c;
  --blue: #4eb9dc;
  --red: #db5d55;
  --white: #ffffff;
  --shadow: 0 14px 0 rgba(20, 73, 43, 0.16), 0 22px 44px rgba(20, 55, 35, 0.22);
  --soft-shadow: 0 7px 0 rgba(20, 73, 43, 0.15), 0 13px 26px rgba(20, 55, 35, 0.16);
}

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

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background: #68bf61 url("../../assets/garden-background.svg") center / cover fixed no-repeat;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(180deg, rgba(8, 64, 65, 0.05), rgba(20, 65, 32, 0.16));
  pointer-events: none;
}

.mole-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.mole-button {
  pointer-events: all;
  cursor: pointer;
}

.mole-body {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: transform 240ms cubic-bezier(.25, .75, .35, 1), opacity 110ms ease;
}

.mole-button:hover .mole-body,
.mole-button:focus .mole-body {
  opacity: 0;
  transform: translateY(24px) scale(.9);
}

.mole-button:focus-visible .mole-hole {
  stroke: #fff4a8;
  stroke-width: 6px;
}

.bee-button {
  pointer-events: all;
  cursor: pointer;
}

button {
  font: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 5px solid #1d4ed8;
  outline-offset: 4px;
}

h1[tabindex="-1"]:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 12px 18px;
  color: white;
  background: #123c26;
  border-radius: 12px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.utility-controls {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 30;
  display: flex;
  gap: 10px;
}

.icon-button {
  display: grid;
  width: 54px;
  height: 54px;
  padding: 0;
  place-items: center;
  color: white;
  font-size: 1.65rem;
  line-height: 1;
  background: rgba(17, 61, 42, 0.9);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(8, 41, 28, 0.25);
}

.icon-button:hover {
  transform: translateY(-2px);
}

.brand-bar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 30;
}

.brand-home {
  display: flex;
  min-height: 54px;
  padding: 6px 18px 6px 8px;
  align-items: center;
  gap: 10px;
  color: var(--green-900);
  font-weight: 900;
  font-size: clamp(1rem, 2vw, 1.35rem);
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid white;
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(16, 65, 35, 0.18);
}

.brand-home img {
  width: 40px;
  height: 40px;
}

main {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.screen {
  min-height: 100dvh;
  padding: 94px clamp(14px, 4vw, 54px) 28px;
}

.screen--launch {
  display: none;
  padding: 72px 20px;
  place-items: center;
}

.screen--launch.is-active {
  display: grid;
}

.launch-logo {
  display: flex;
  width: min(440px, 88vw);
  min-height: 330px;
  padding: 26px 28px 24px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--green-900);
  background: rgba(255, 255, 255, 0.94);
  border: 5px solid white;
  border-radius: 42px;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.launch-logo:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 18px 0 rgba(20, 73, 43, 0.16), 0 28px 50px rgba(20, 55, 35, 0.26);
}

.launch-logo:active {
  transform: translateY(4px);
}

.launch-logo img {
  width: 138px;
  height: 138px;
  margin-bottom: 10px;
}

.launch-title {
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  font-weight: 1000;
  line-height: 0.98;
}

.launch-subtitle {
  margin-top: 8px;
  color: var(--green-600);
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 800;
}

.launch-hint {
  margin-top: 24px;
  color: #4a6659;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.screen--menu {
  display: grid;
  align-content: center;
  gap: 20px;
}

.menu-heading {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding: 4px 220px 4px 0;
  color: white;
  text-shadow: 0 3px 12px rgba(13, 67, 35, 0.5);
}

.eyebrow {
  margin: 0 0 4px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  line-height: 1.06;
}

.mode-grid {
  display: grid;
  width: min(1120px, 100%);
  margin-inline: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mode-card {
  position: relative;
  display: grid;
  min-height: 126px;
  padding: 18px;
  grid-template-columns: 68px 1fr;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: var(--card-color, #fff);
  border: 4px solid rgba(255, 255, 255, 0.94);
  border-radius: 25px;
  box-shadow: var(--soft-shadow);
  transition: transform 150ms ease, filter 150ms ease;
}

.mode-card:not(:disabled):hover {
  z-index: 2;
  transform: translateY(-5px) rotate(-0.5deg);
  filter: saturate(1.08);
}

.mode-card:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55);
  opacity: 0.82;
}

.mode-card__icon {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  font-size: 2.35rem;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 20px;
}

.mode-card__copy {
  min-width: 0;
}

.mode-card strong {
  display: block;
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  line-height: 1.1;
}

.mode-card small {
  display: block;
  margin-top: 6px;
  color: #345846;
  font-size: 0.87rem;
  font-weight: 700;
  line-height: 1.2;
}

.mode-card__lock {
  position: absolute;
  top: 9px;
  right: 11px;
  padding: 4px 8px;
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: #355c4b;
  border-radius: 999px;
  text-transform: uppercase;
}

.screen--game {
  display: grid;
  padding-top: 86px;
  place-items: center;
}

.game-shell {
  display: flex;
  width: min(1180px, 100%);
  min-height: min(720px, calc(100dvh - 114px));
  flex-direction: column;
  gap: 10px;
}

.game-toolbar {
  display: grid;
  min-height: 54px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.back-button,
.score-pill {
  min-height: 52px;
  color: white;
  font-weight: 900;
  background: rgba(22, 76, 49, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(11, 51, 31, 0.22);
}

.back-button {
  padding: 0 18px;
  font-size: 1rem;
}

.score-pill {
  display: flex;
  min-width: 82px;
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink);
  font-size: 1.12rem;
  background: white;
}

.progress-group {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 10px;
}

.round-label {
  color: white;
  font-weight: 1000;
  text-shadow: 0 2px 8px rgba(12, 57, 35, 0.55);
  text-transform: uppercase;
}

.progress-track {
  height: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  border: 4px solid white;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(11, 51, 31, 0.18);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ffd955, #ffb441);
  border-radius: inherit;
  transition: width 260ms ease;
}

.game-card,
.results-card {
  background: rgba(255, 255, 255, 0.94);
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px);
}

.game-card {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  padding: clamp(18px, 3vw, 32px);
  flex-direction: column;
  align-items: stretch;
}

.mode-heading {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-badge {
  display: inline-flex;
  min-height: 38px;
  padding: 6px 14px;
  align-items: center;
  color: white;
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  background: var(--green-700);
  border-radius: 999px;
}

.listen-button {
  min-height: 44px;
  padding: 7px 14px;
  color: white;
  font-weight: 900;
  background: #286db6;
  border: 0;
  border-radius: 14px;
}

.game-card h1 {
  margin: 8px 0 2px;
  font-size: clamp(1.45rem, 3.5vw, 2.65rem);
  line-height: 1.08;
  text-align: center;
}

.game-helper {
  min-height: 1.3em;
  margin: 3px 0 5px;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.6vw, 1.1rem);
  font-weight: 700;
  text-align: center;
}

.mode-content {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.feedback {
  display: flex;
  min-height: 58px;
  margin-top: 8px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--green-900);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 900;
  text-align: center;
}

.feedback.is-correct,
.feedback.is-try {
  padding: 9px 14px;
  border-radius: 16px;
}

.feedback.is-correct {
  background: #d9f6d8;
}

.feedback.is-try {
  color: #744024;
  background: #fff0c7;
}

.next-button,
.primary-button,
.secondary-button {
  min-height: 54px;
  padding: 10px 22px;
  font-weight: 1000;
  white-space: nowrap;
  border-radius: 17px;
}

.next-button,
.primary-button {
  color: white;
  background: var(--green-700);
  border: 3px solid #16552e;
  box-shadow: 0 5px 0 #124525;
}

.secondary-button {
  color: var(--green-900);
  background: white;
  border: 3px solid var(--green-700);
  box-shadow: 0 5px 0 rgba(23, 79, 46, 0.18);
}

.screen--results {
  display: grid;
  place-items: center;
}

.results-card {
  width: min(620px, 100%);
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
}

.results-sprout {
  font-size: 4.5rem;
}

.results-card h1 {
  margin: 4px 0 14px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.result-stars {
  min-height: 1.3em;
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  letter-spacing: 0.06em;
}

.result-score {
  margin: 12px 0;
  color: var(--green-700);
  font-size: 1.3rem;
  font-weight: 800;
}

.result-score strong {
  font-size: 2.2rem;
}

.result-message {
  margin: 10px auto 24px;
  font-size: 1.22rem;
  font-weight: 800;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.celebration,
.rain,
.smile-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -8vh;
  width: 13px;
  height: 22px;
  border-radius: 4px;
  animation: confetti-fall 2.5s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translate(var(--drift), 112vh) rotate(760deg);
  }
}

.rain-drop {
  position: absolute;
  top: -12vh;
  width: 5px;
  height: 25px;
  background: #4caee8;
  border-radius: 999px;
  animation: rain-fall 1.1s linear infinite;
}

@keyframes rain-fall {
  to { transform: translate(-34px, 120vh); }
}

.smile-panel {
  inset: 50% auto auto 50%;
  width: min(420px, 84vw);
  padding: 42px 30px;
  color: #263f2e;
  font-size: clamp(3.8rem, 14vw, 7rem);
  text-align: center;
  background: white;
  border: 5px solid #d6ead8;
  border-radius: 30px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  animation: smile-pop 500ms ease-out;
}

@keyframes smile-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
}

@media (max-width: 900px) {
  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-heading {
    padding-right: 120px;
  }
}

@media (max-width: 640px) {
  .utility-controls {
    gap: 7px;
  }

  .icon-button {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .brand-home {
    min-height: 48px;
    padding-right: 12px;
  }

  .brand-home img {
    width: 34px;
    height: 34px;
  }

  .screen {
    padding: 82px 10px 14px;
  }

  .screen--launch {
    padding: 80px 16px 24px;
  }

  .launch-logo {
    min-height: 300px;
    border-radius: 34px;
  }

  .menu-heading {
    padding: 0 0 4px;
  }

  .menu-heading h1 {
    font-size: 2rem;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .mode-card {
    min-height: 92px;
    padding: 12px;
    grid-template-columns: 56px 1fr;
    border-radius: 20px;
  }

  .mode-card__icon {
    width: 56px;
    height: 56px;
    font-size: 1.9rem;
  }

  .game-shell {
    min-height: calc(100dvh - 96px);
  }

  .game-toolbar {
    grid-template-columns: auto 1fr auto;
    gap: 7px;
  }

  .back-button {
    min-width: 50px;
    padding: 0 12px;
  }

  .back-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .progress-group {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .round-label {
    font-size: 0.72rem;
  }

  .progress-track {
    height: 15px;
    border-width: 3px;
  }

  .score-pill {
    min-width: 65px;
    padding: 0 10px;
  }

  .game-card {
    padding: 14px 11px;
    border-radius: 25px;
  }

  .mode-badge {
    max-width: 62%;
    font-size: 0.66rem;
  }

  .listen-button {
    min-height: 42px;
    padding-inline: 10px;
  }

  .feedback {
    min-height: 52px;
    margin-top: 5px;
  }
}

@media (max-height: 720px) and (min-width: 700px) {
  .screen--game {
    padding-top: 70px;
    padding-bottom: 12px;
  }

  .game-shell {
    min-height: calc(100dvh - 82px);
  }

  .game-card {
    padding-block: 15px;
  }

  .game-card h1 {
    margin-top: 2px;
  }

  .feedback {
    min-height: 48px;
    margin-top: 2px;
  }
}

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

}
