:root {
  color-scheme: light;
  --bg-top: #ffe7a8;
  --bg-bottom: #ff9d7a;
  --bg-noodle: rgba(255, 255, 255, 0.34);
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(104, 54, 33, 0.14);
  --text-main: #43241c;
  --text-soft: #7f5143;
  --accent: #ff5e87;
  --accent-strong: #ff2e63;
  --accent-alt: #74d26d;
  --accent-gold: #ffcf57;
  --accent-cream: #fff6e7;
  --shadow: 0 20px 60px rgba(101, 46, 25, 0.18);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next Rounded", "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.5), transparent 35%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.35), transparent 28%),
    radial-gradient(circle at 50% 110%, rgba(255, 235, 184, 0.8), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  z-index: 5;
}

.hud__group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.hud__group--center {
  flex: 1;
  justify-content: center;
}

.hud__group--end {
  justify-content: flex-end;
}

.hud-card {
  min-width: 122px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-card small {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.hud-card--mission {
  min-width: 320px;
}

.hud-card--section {
  min-width: 160px;
}

.hud-card--progress {
  min-width: 220px;
}

.hud-card--power {
  min-width: 180px;
}

.hud-card__label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.icon-button,
.primary-button,
.secondary-button,
.skin-card {
  border: 0;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.skin-card:hover {
  transform: translateY(-2px);
}

.icon-button {
  padding: 13px 20px;
  border-radius: 18px;
  background: rgba(67, 36, 28, 0.9);
  color: white;
  box-shadow: var(--shadow);
}

.primary-button,
.secondary-button {
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 28px rgba(255, 46, 99, 0.28);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  box-shadow: var(--shadow);
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.site-credit {
  align-self: center;
  padding: 8px 16px 2px;
  color: rgba(67, 36, 28, 0.78);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  text-align: center;
}

#gameCanvas {
  width: min(100%, 1180px);
  max-height: calc(100vh - 72px);
  aspect-ratio: 16 / 9;
  border-radius: 34px;
  box-shadow: 0 30px 90px rgba(84, 38, 19, 0.28);
  background: linear-gradient(180deg, #c7efff 0%, #fff8d1 100%);
  touch-action: none;
}

#livesLabel {
  display: inline-block;
  transform-origin: center;
}

#livesLabel.life-lost {
  animation: life-lost-pulse 360ms ease;
}

@keyframes life-lost-pulse {
  0% {
    transform: scale(1);
    color: inherit;
  }

  35% {
    transform: scale(1.32);
    color: #ff4158;
  }

  100% {
    transform: scale(1);
    color: inherit;
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.screen {
  background:
    linear-gradient(135deg, rgba(255, 251, 239, 0.78), rgba(255, 223, 196, 0.72)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 50%);
  border-radius: 34px;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.screen--title {
  align-content: start;
  align-items: start;
  grid-template-columns: minmax(0, 540px) minmax(0, 520px);
  gap: 22px;
  overflow-y: auto;
}

.screen--pause,
.screen--gameover {
  background: rgba(50, 21, 10, 0.38);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}

.panel-grid .panel:first-child {
  grid-column: 1 / -1;
}

.panel,
.panel--hero,
.panel--center {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel--hero {
  padding: 28px;
}

.panel--center {
  width: min(100%, 520px);
  padding: 30px;
  text-align: center;
}

.panel--hero::before,
.panel--center::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.panel--hero,
.panel--center {
  position: relative;
  overflow: hidden;
}

.eyebrow {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(116, 210, 109, 0.18);
  color: #286a2c;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Cooper Black", "Trebuchet MS", "Avenir Next Rounded", sans-serif;
  line-height: 1.02;
  margin: 12px 0 10px;
}

h1 {
  font-size: clamp(3.6rem, 8vw, 6rem);
}

h2 {
  font-size: 2rem;
}

p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.story-copy {
  font-size: 1.03rem;
  max-width: 44ch;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
  align-items: center;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  min-width: 126px;
  padding: 12px 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 231, 0.95));
  box-shadow: inset 0 0 0 1px rgba(67, 36, 28, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-pill span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.hero-scene {
  min-height: 280px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.75), transparent 34%),
    linear-gradient(180deg, #fffdf3 0%, #ffe2b8 100%);
  box-shadow:
    inset 0 0 0 1px rgba(67, 36, 28, 0.08),
    0 18px 42px rgba(125, 62, 36, 0.16);
}

.hero-scene::before {
  content: "";
  position: absolute;
  inset: auto 12% -14% 12%;
  height: 56%;
  clip-path: polygon(14% 100%, 40% 6%, 60% 6%, 86% 100%);
  background: linear-gradient(180deg, #d4efb0, #90ce64);
}

.hero-scene::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12%;
  width: 70%;
  height: 28%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(129, 88, 56, 0.2), transparent 65%);
}

.hero-scene__badge,
.hero-scene__sticker {
  position: absolute;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 10px 22px rgba(82, 41, 21, 0.16);
}

.hero-scene__badge {
  top: 18px;
  left: 18px;
  background: #ffe978;
}

.hero-scene__sticker--left {
  left: 20px;
  bottom: 20px;
  background: #ffb3c4;
}

.hero-scene__sticker--right {
  right: 20px;
  top: 60px;
  background: #8fe281;
}

.hero-scene__shelf {
  position: absolute;
  top: 88px;
  width: 96px;
  height: 184px;
  border-radius: 18px;
  background: #5ca349;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.15);
}

.hero-scene__shelf::before,
.hero-scene__shelf::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 16px;
  background: #e7ffd6;
  border-radius: 4px;
  box-shadow:
    0 46px 0 #e7ffd6,
    0 92px 0 #e7ffd6,
    0 138px 0 #e7ffd6;
}

.hero-scene__shelf::before {
  top: 20px;
}

.hero-scene__shelf::after {
  top: 28px;
  left: 24px;
  right: 24px;
  height: 28px;
  background: rgba(255, 194, 87, 0.85);
  box-shadow:
    0 46px 0 rgba(255, 194, 87, 0.85),
    0 92px 0 rgba(255, 194, 87, 0.85),
    0 138px 0 rgba(255, 194, 87, 0.85);
}

.hero-scene__shelf--left {
  left: 18px;
}

.hero-scene__shelf--right {
  right: 18px;
}

.hero-scene__shelf--right::after {
  background: rgba(132, 208, 92, 0.9);
  box-shadow:
    0 46px 0 rgba(132, 208, 92, 0.9),
    0 92px 0 rgba(132, 208, 92, 0.9),
    0 138px 0 rgba(132, 208, 92, 0.9);
}

.hero-scene__human {
  position: absolute;
  bottom: 14px;
  width: 74px;
  height: 118px;
  z-index: 2;
}

.hero-scene__human::before,
.hero-scene__human::after {
  content: "";
  position: absolute;
}

.hero-scene__human::before {
  top: 0;
  left: 16px;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: #ffdcb4;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.06);
}

.hero-scene__human::after {
  left: 6px;
  right: 6px;
  bottom: 0;
  top: 32px;
  border-radius: 18px 18px 8px 8px;
  background:
    linear-gradient(180deg, #ffb35f 0 46%, #4f347a 46% 100%);
}

.hero-scene__human--left {
  left: 110px;
  transform: scale(0.92);
}

.hero-scene__human--right {
  right: 112px;
}

.hero-scene__donut {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 140px;
  height: 140px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #d9a865;
  box-shadow:
    inset 0 0 0 20px rgba(255, 255, 255, 0.02),
    0 20px 28px rgba(107, 61, 36, 0.2);
}

.hero-scene__donut::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #9a6f4c;
}

.hero-scene__donut::after {
  content: "";
  position: absolute;
  inset: 4px 6px 40px 6px;
  border-radius: 999px 999px 44px 44px;
  background: #a66cff;
}

.hero-scene__donut-hole {
  position: absolute;
  inset: 44px;
  border-radius: 50%;
  background: #7d553d;
  z-index: 2;
}

.hero-scene__sprinkle {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 22px;
  border-radius: 999px;
}

.hero-scene__sprinkle--1,
.hero-scene__sprinkle--4 {
  background: #6add69;
}

.hero-scene__sprinkle--2,
.hero-scene__sprinkle--5 {
  background: #ffd551;
}

.hero-scene__sprinkle--3,
.hero-scene__sprinkle--6 {
  background: #ff81ac;
}

.hero-scene__sprinkle--1 {
  left: 38px;
  top: 30px;
  transform: rotate(-28deg);
}

.hero-scene__sprinkle--2 {
  left: 64px;
  top: 20px;
  transform: rotate(18deg);
}

.hero-scene__sprinkle--3 {
  right: 36px;
  top: 34px;
  transform: rotate(34deg);
}

.hero-scene__sprinkle--4 {
  left: 52px;
  top: 48px;
  transform: rotate(62deg);
}

.hero-scene__sprinkle--5 {
  right: 58px;
  top: 42px;
  transform: rotate(-24deg);
}

.hero-scene__sprinkle--6 {
  right: 26px;
  top: 56px;
  transform: rotate(-52deg);
}

.hero-actions,
.stacked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
  align-items: center;
}

.stacked-actions {
  justify-content: center;
}

.hero-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.controls-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 239, 219, 0.95), rgba(255, 247, 232, 0.95));
  color: var(--text-main);
  font-size: 0.92rem;
  box-shadow: inset 0 0 0 1px rgba(67, 36, 28, 0.08);
}

.feature-list {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--text-main);
}

.panel-note {
  margin-top: 2px;
  font-size: 0.92rem;
}

.feature-list li + li {
  margin-top: 8px;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.skin-card {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 248, 240, 0.95);
  box-shadow: inset 0 0 0 1px rgba(67, 36, 28, 0.08);
  text-align: left;
}

.skin-card:disabled {
  cursor: not-allowed;
}

.skin-card.is-selected {
  box-shadow:
    inset 0 0 0 3px rgba(255, 46, 99, 0.45),
    0 16px 28px rgba(255, 46, 99, 0.18);
}

.skin-card.is-locked {
  filter: grayscale(0.5);
  opacity: 0.72;
}

.skin-card__swatch {
  height: 70px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}

.skin-card__sprinkles {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(120deg, transparent 0 12%, rgba(104, 220, 117, 0.95) 12% 18%, transparent 18% 34%, rgba(255, 207, 87, 0.92) 34% 40%, transparent 40% 54%, rgba(106, 164, 255, 0.92) 54% 60%, transparent 60% 74%, rgba(255, 113, 157, 0.92) 74% 80%, transparent 80%);
  opacity: 0.8;
}

.skin-card small,
.mission-card small {
  color: var(--text-soft);
}

.missions-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mission-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 248, 240, 0.95);
  box-shadow: inset 0 0 0 1px rgba(67, 36, 28, 0.08);
}

.mission-card.is-complete {
  background: rgba(226, 255, 220, 0.95);
  box-shadow: inset 0 0 0 2px rgba(73, 173, 83, 0.28);
}

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

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 24px;
}

.result-card {
  padding: 18px 14px;
  border-radius: 20px;
  background: rgba(255, 248, 240, 0.96);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-card span {
  color: var(--text-soft);
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.reward-banner,
.mission-recap {
  margin-top: 18px;
  border-radius: 20px;
}

.reward-banner {
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 232, 128, 0.96), rgba(255, 184, 87, 0.96));
  color: #533315;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(255, 184, 87, 0.22);
}

.mission-recap {
  display: grid;
  gap: 10px;
  text-align: left;
}

.mission-recap__item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 248, 240, 0.96);
  box-shadow: inset 0 0 0 1px rgba(67, 36, 28, 0.08);
}

.mission-recap__item.is-complete {
  background: rgba(231, 255, 218, 0.96);
  box-shadow: inset 0 0 0 2px rgba(73, 173, 83, 0.22);
}

.mission-recap__item strong {
  display: block;
  margin-bottom: 4px;
}

.progress-track {
  margin: 4px 0;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(67, 36, 28, 0.08);
  overflow: hidden;
}

.progress-track__fill {
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-alt), var(--accent-gold), var(--accent));
  transition: width 140ms ease;
}

.unlock-toast {
  position: absolute;
  right: 30px;
  bottom: 30px;
  max-width: 360px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(67, 36, 28, 0.92);
  color: white;
  box-shadow: var(--shadow);
  animation: toast-in 280ms ease;
  z-index: 6;
}

@keyframes toast-in {
  from {
    transform: translateY(14px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1080px) {
  .hud {
    flex-wrap: wrap;
  }

  .screen--title {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-grid .panel:first-child {
    grid-column: auto;
  }

  .hero-scene {
    min-height: 280px;
  }
}

@media (max-height: 760px) and (min-width: 1081px) {
  .screen--title {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    gap: 18px;
    padding: 18px;
  }

  .panel--hero,
  .panel {
    padding: 20px;
  }

  h1 {
    font-size: clamp(2.7rem, 4.4vw, 4.3rem);
  }

  .hero-grid {
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .hero-copy {
    gap: 10px;
  }

  .story-copy {
    font-size: 0.94rem;
    max-width: 34ch;
  }

  .status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-pill {
    min-width: 0;
  }

  .hero-actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .hero-scene {
    min-height: 205px;
  }

  .controls-card {
    font-size: 0.86rem;
    padding: 12px 14px;
  }

  .feature-list li + li {
    margin-top: 6px;
  }

  .missions-list {
    gap: 8px;
  }

  .mission-card,
  .skin-card {
    padding: 12px;
  }

  .skin-card__swatch {
    height: 56px;
  }
}

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

  .site-credit {
    padding-top: 2px;
    font-size: 0.84rem;
  }

  .hud__group,
  .hud__group--center,
  .hud__group--end {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .hud-card,
  .hud-card--mission,
  .hud-card--section,
  .hud-card--power {
    min-width: 0;
    flex: 1 1 160px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .stacked-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-action-buttons {
    width: 100%;
  }

  .status-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-scene {
    min-height: 240px;
  }

  .hero-scene__human--left {
    left: 76px;
  }

  .hero-scene__human--right {
    right: 76px;
  }

  .unlock-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}
