:root {
  color-scheme: light;
  --paper: #f6f1e8;
  --paper-2: #fffdf8;
  --ink: #241c16;
  --muted: #6b5c50;
  --teal: #1f6f66;
  --teal-press: #18584f;
  --line: rgba(36, 28, 22, 0.08);
  --shadow:
    0 1px 2px rgba(36, 28, 22, 0.06),
    0 16px 40px rgba(36, 28, 22, 0.08);
  --radius: 28px;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #8ec8ef;
  color: var(--ink);
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

.menu-sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
}

.brand {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
}

.mute {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--paper-2);
  box-shadow: 0 1px 2px rgba(36, 28, 22, 0.08);
  cursor: pointer;
  font-weight: 700;
  transition-property: transform, background-color;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.mute:active {
  transform: scale(0.96);
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  overflow: auto;
}

.screen[hidden] {
  display: none;
}

.screen-story {
  justify-content: flex-start;
  overflow: auto;
}

.poster-block,
.howto-demo {
  display: block;
  image-rendering: pixelated;
}

.poster-block {
  width: min(100%, 40rem);
  height: min(38vh, 16rem);
  flex: none;
  margin-bottom: 14px;
  border-radius: 28px;
}

.howto-stage {
  position: relative;
  margin: 0 0 16px;
}

.howto-demo {
  width: 100%;
  height: 11rem;
  margin: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(36, 28, 22, 0.08);
}

.treats {
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
  color: #9a3412;
}

.treats::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 5px;
  border-radius: 999px;
  background: #f0b429;
  box-shadow: 0 0 0 2px #7a4510;
}

#score.is-up {
  display: inline-block;
  animation: score-pop 280ms cubic-bezier(0.2, 0, 0, 1);
}

@keyframes score-pop {
  50% {
    transform: scale(1.16);
  }
}

.panel {
  width: min(100%, 28rem);
  background: var(--paper-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px 22px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

h1 {
  font-size: clamp(3.2rem, 14vw, 5.4rem);
}

h2 {
  font-size: clamp(2rem, 8vw, 2.8rem);
}

.lead,
.fine {
  color: var(--muted);
  text-wrap: pretty;
  line-height: 1.45;
}

.lead {
  margin: 14px 0 22px;
}

.fine {
  margin: 12px 0 18px;
  font-size: 0.92rem;
}

.btn {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--teal);
  color: #f7f3ec;
  font-weight: 800;
  cursor: pointer;
  transition-property: transform, background-color;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.btn:active {
  transform: scale(0.96);
  background: var(--teal-press);
}

.btn:disabled {
  background: #d9d3c8;
  color: #8a7d72;
  cursor: default;
  transform: none;
}

.pet-start {
  margin-top: 16px;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(36, 28, 22, 0.14);
}

.btn:focus-visible,
.mute:focus-visible,
.pet:focus-visible,
.dot:focus-visible,
input:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions .btn {
  flex: 1;
}

.dots {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.dot {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.dot::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(36, 28, 22, 0.22);
}

.dot[aria-current="true"]::after {
  background: var(--teal);
  width: 22px;
  left: 11px;
}

.pets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 10px 10px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 800;
  transition-property: transform, background-color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.pet[data-pet="dog"] {
  background: #f6d7a8;
}

.pet[data-pet="cat"] {
  background: #e4d0f2;
}

.pet:active {
  transform: scale(0.96);
}

.pet[aria-pressed="true"] {
  box-shadow: inset 0 0 0 3px var(--teal);
}

.pet[data-pet="dog"][aria-pressed="true"] {
  background: #f0c078;
}

.pet[data-pet="cat"][aria-pressed="true"] {
  background: #d3b3e8;
}

.pet-hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

#screen-avatar .kicker {
  margin-bottom: 12px;
}

#screen-avatar h2 {
  margin-bottom: 20px;
  line-height: 1.05;
}

#screen-avatar label {
  margin-bottom: 10px;
}

#screen-avatar .pet-hint {
  margin: 6px 0 20px;
  line-height: 1.45;
}

.hud-pet {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.pet-preview {
  width: 100%;
  height: 7.5rem;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
}

label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 0.92rem;
}

input[type="text"],
input[type="email"],
input:not([type]) {
  width: 100%;
  min-height: 48px;
  margin: 0 0 14px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px rgba(36, 28, 22, 0.12);
  font-size: 1rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 18px;
  font-weight: 600;
  line-height: 1.35;
}

.check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 2px;
  accent-color: var(--teal);
  flex: none;
}

#prize-result {
  text-align: center;
}

.code {
  display: inline-block;
  margin: 8px 0 14px;
  padding: 10px 16px;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  background: #f4efe4;
  border: 2px dashed var(--teal);
  border-radius: 14px;
}

.qr {
  width: min(220px, 72%);
  height: auto;
  aspect-ratio: 1;
  display: block;
  margin: 0 auto 12px;
  padding: 12px;
  background: #fff;
  border-radius: 22px;
  box-shadow:
    0 0 0 8px #f3e2b8,
    0 14px 28px rgba(36, 28, 22, 0.12);
}

.screen-play {
  display: block;
  padding: 0;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.screen-play canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 14px 0;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hearts {
  display: flex;
  gap: 4px;
  min-width: 4.6rem;
}

.heart {
  width: 22px;
  height: 22px;
  fill: rgba(36, 28, 22, 0.16);
}

.heart.is-on {
  fill: #e11d48;
}

.hud-level {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.score {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  min-width: 4.6rem;
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.track {
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(36, 28, 22, 0.12);
  overflow: hidden;
}

#progress {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--teal);
}

.bubble-wrap {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.2);
  overflow: hidden;
}

.bubble-wrap[hidden] {
  display: none;
}

#bubble-bar {
  display: block;
  height: 100%;
  width: 0;
  background: #0284c7;
}

.season-card {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(18rem, calc(100% - 40px));
  padding: 22px 20px 18px;
  text-align: center;
  background: rgba(255, 253, 248, 0.94);
  border-radius: 24px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.season-card h2 {
  font-size: 2.4rem;
}

.season-card p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .mute,
  .pet {
    transition-property: none;
  }

  #score.is-up {
    animation: none;
  }
}
