:root {
  --ink: #263e36;
  --muted: #61766a;
  --cream: #fffdf3;
  --line: rgba(38, 62, 54, 0.15);
  --accent: #e38961;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #cce5d6;
  overflow: hidden;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #c66743;
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
#game {
  position: relative;
  height: 100dvh;
  min-height: 360px;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(#e2f0e8, #cce5d6);
}
#animal-scene {
  position: absolute;
  inset: 0;
  z-index: -1;
}
#animal-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
#animal-status {
  position: absolute;
  top: 40%;
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}
.hud {
  position: absolute;
  inset: max(20px, env(safe-area-inset-top)) 28px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}
.hud-group {
  display: flex;
  gap: 12px;
}
.icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fffdf3b0;
  backdrop-filter: blur(10px);
}
.icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.wordmark {
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: -1px;
}
.wordmark i {
  color: #a95434;
  font-style: normal;
}
.progress {
  display: flex;
  gap: 8px;
  align-items: center;
}
.progress span {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  opacity: 0.45;
}
.progress span.current {
  background: var(--ink);
  opacity: 1;
}
.progress span.done {
  background: #62866c;
  border-color: #62866c;
  opacity: 1;
}
.prompt {
  position: absolute;
  top: max(88px, calc(env(safe-area-inset-top) + 70px));
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, calc(100% - 40px));
  text-align: center;
  z-index: 3;
  pointer-events: none;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.prompt h1 {
  font-family: Georgia, serif;
  font-weight: normal;
  font-size: clamp(27px, 4vw, 42px);
  letter-spacing: -1px;
  margin: 0 0 10px;
}
.prompt p {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}
.hero {
  position: absolute;
  left: 50%;
  top: 19%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  text-align: center;
  pointer-events: none;
}
.hero h1 {
  font-family: Georgia, serif;
  letter-spacing: -4px;
  font-size: clamp(56px, 9vw, 105px);
  font-weight: normal;
  margin: 0;
  line-height: 1;
}
.hero h1 em {
  color: #aa5839;
}
.hero p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin: 18px 0;
}
.home-bottom {
  position: absolute;
  bottom: max(40px, env(safe-area-inset-bottom));
  width: 100%;
  text-align: center;
  padding: 0 24px;
}
.primary,
.secondary {
  border-radius: 999px;
  padding: 15px 27px;
  font-weight: 700;
  font-size: 14px;
  min-height: 48px;
}
.primary {
  background: var(--ink);
  color: var(--cream);
}
.primary:not(:disabled):hover {
  background: #345346;
}
.secondary {
  background: #fffdf3d9;
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.home-bottom .primary {
  min-width: 220px;
}
.fine {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 13px 0 0;
}
.dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 28px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #f4f3e6e8 40%);
  z-index: 4;
}
.dock-inner {
  max-width: 840px;
  margin: auto;
}
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
  min-height: 48px;
}
.actions button {
  min-width: 140px;
}
.keyboard {
  display: flex;
  gap: 5px;
  height: clamp(105px, 18vh, 160px);
  padding: 7px;
  border-radius: 16px;
  background: #385046;
  box-shadow: 0 14px 28px #263e3620;
  user-select: none;
  touch-action: none;
}
.key {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 4px 4px 9px 9px;
  background: linear-gradient(#fffef8, #f1efdf);
  box-shadow: inset 0 -5px #d7dacb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 15px;
  touch-action: none;
  transition: background 0.06s;
  color: #586c5f;
}
.key b {
  font-size: 13px;
  font-weight: normal;
}
.key small {
  font-size: 9px;
  opacity: 0.55;
  margin-top: 5px;
}
.key.black:after {
  content: '';
  position: absolute;
  width: 56%;
  height: 56%;
  right: -30%;
  top: 0;
  z-index: 2;
  background: linear-gradient(#293f36, #1a3027);
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px #11241b;
  pointer-events: none;
}
.key.held {
  background: #edbd92;
  box-shadow: inset 0 -2px #b48c69;
}
.dock-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0 0;
}
.result {
  position: absolute;
  left: 50%;
  top: 15%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
  width: min(440px, calc(100% - 40px));
  padding: 24px;
  border-radius: 24px;
  background: #fffdf3e8;
  backdrop-filter: blur(14px);
  border: 1px solid #fff9;
  box-shadow: 0 12px 40px #40584410;
}
.score {
  font-family: Georgia, serif;
  font-size: 70px;
  letter-spacing: -3px;
  margin: 0;
}
.score small {
  font-family: Arial, sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  color: var(--muted);
}
.result h2 {
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: normal;
  margin: 8px 0;
}
.result p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.result button {
  margin: 6px 3px 0;
}
.reward-controls {
  position: absolute;
  bottom: max(34px, env(safe-area-inset-bottom));
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  z-index: 4;
}
.status {
  min-height: 17px;
  color: #9b452b;
  font-size: 12px;
  text-align: center;
  position: absolute;
  bottom: 5px;
  left: 20px;
  right: 20px;
  pointer-events: none;
}
.sheet {
  border: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  background: #f8f8ed;
  color: var(--ink);
  padding: 0;
}
.sheet::backdrop {
  background: #263e3655;
}
.sheet header {
  position: sticky;
  top: 0;
  background: #f8f8ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px max(24px, calc((100% - 700px) / 2));
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.sheet h2 {
  font-family: Georgia, serif;
  font-weight: normal;
  margin: 0;
  font-size: 28px;
}
.sheet article {
  max-width: 700px;
  margin: auto;
  padding: 30px 24px;
  line-height: 1.7;
}
.sheet h3 {
  margin-bottom: 5px;
}
.sheet p {
  color: var(--muted);
}
.sheet a {
  color: var(--ink);
}
.sheet .secondary {
  margin: 10px 0;
}
.stats {
  display: flex;
  justify-content: center;
  gap: 25px;
  padding: 12px 0;
}
.stats b {
  display: block;
  font-size: 22px;
}
.stats span {
  font-size: 11px;
  color: var(--muted);
}
.jingles {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 15px 0;
}
.jingles button {
  min-width: 70px;
  padding: 12px;
}
.sound-off {
  opacity: 0.65;
}
body[data-state='home'] .hud .wordmark {
  visibility: hidden;
}
@media (max-width: 600px) {
  .hud {
    inset: max(14px, env(safe-area-inset-top)) 16px auto;
  }
  .hud-group {
    gap: 8px;
  }
  .wordmark {
    font-size: 20px;
  }
  .hero {
    top: 20%;
  }
  .hero h1 {
    letter-spacing: -3px;
  }
  .hero p {
    font-size: 14px;
  }
  .dock {
    padding: 12px 12px max(18px, env(safe-area-inset-bottom));
  }
  .keyboard {
    height: 132px;
    gap: 3px;
    padding: 5px;
    border-radius: 12px;
  }
  .key {
    padding-bottom: 12px;
  }
  .key small {
    display: none;
  }
  .actions button {
    min-width: 0;
    flex: 1;
    max-width: 210px;
    padding: 13px 16px;
  }
  .prompt {
    top: 80px;
  }
  .prompt p {
    font-size: 13px;
  }
  .result {
    top: 14%;
    padding: 20px;
  }
  .reward-controls button {
    padding: 14px 20px;
  }
  .dock-note {
    font-size: 10px;
  }
  .home-bottom {
    bottom: max(35px, env(safe-area-inset-bottom));
  }
}
@media (max-height: 600px) {
  .hero {
    top: 17%;
  }
  .hero h1 {
    font-size: 50px;
  }
  .hero p {
    margin: 10px 0;
  }
  .home-bottom {
    bottom: 18px;
  }
  .prompt {
    top: 62px;
  }
  .prompt h1 {
    font-size: 26px;
  }
  .prompt .eyebrow {
    margin-bottom: 5px;
  }
  .keyboard {
    height: 85px;
  }
  .dock {
    padding-bottom: 10px;
  }
  .dock-note {
    display: none;
  }
  .actions {
    margin-bottom: 8px;
  }
  .result {
    top: 14%;
    padding: 14px;
  }
  .score {
    font-size: 45px;
  }
  .result h2 {
    font-size: 24px;
  }
  .result p {
    margin: 5px;
  }
  .reward-controls {
    bottom: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.sections {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 0 0 10px;
}
.sections button {
  font-size: 12px;
  border-radius: 999px;
  background: #fffdf3a8;
  border: 1px solid var(--line);
  padding: 8px 13px;
}
.sections button[aria-pressed='true'] {
  background: #385046;
  color: var(--cream);
}
@media (max-width: 600px) {
  .sections {
    gap: 5px;
  }
  .sections button {
    font-size: 11px;
    padding: 7px 11px;
  }
}
@media (max-height: 600px) {
  .sections {
    margin-bottom: 5px;
  }
  .sections button {
    padding: 5px 11px;
  }
}
body[data-state='win'] .result {
  top: 80px;
  padding: 16px 24px;
}
body[data-state='win'] .score {
  font-size: 54px;
}
body[data-state='win'] .result h2 {
  font-size: 26px;
  margin: 4px 0;
}
body[data-state='win'] .result p {
  margin: 6px 0;
}

#animal-scene canvas {
  touch-action: none;
}
body[data-state='win'] .result {
  max-width: 360px;
}
.sections button[aria-pressed='true'] {
  box-shadow: 0 0 0 2px #fff8;
}

@media (min-width: 900px) {
  .hero {
    top: 12%;
  }
}

.sections {
  flex-wrap: wrap;
}

.animal-part {
  position: absolute;
  z-index: 2;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fffdf3d9;
  box-shadow: 0 2px 9px #263e3614;
  font-size: 12px;
  font-weight: bold;
}
.animal-part.learned {
  background: #365b48;
  color: white;
}
.animal-part[aria-pressed='true'] {
  outline: 2px solid #577b66;
  outline-offset: 3px;
}
.animal-part:disabled {
  opacity: 0.7;
}

.animal-part {
  width: 44px;
  height: 36px;
  border-radius: 18px;
}
.animal-part::before {
  content: '▶';
  font-size: 9px;
  margin-right: 5px;
}
