:root {
  color-scheme: light;
  --brown: #65452f;
  --yellow: #ffd94f;
  --cream: #fffbed;
  --sky: #bdeff4;
  --pink: #f59aba;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  font-family: "Arial Rounded MT Bold", "Pretendard", system-ui, sans-serif;
  color: var(--brown);
  background: #fff7d7;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,.9) 0 5px, transparent 6px),
    radial-gradient(circle at 84% 12%, rgba(255,255,255,.8) 0 7px, transparent 8px),
    linear-gradient(#d9f7f8, #fff4bc);
  background-size: 70px 70px, 95px 95px, auto;
}

.app {
  width: min(100vw, 900px);
  height: min(100dvh, 900px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 9px;
  padding: max(9px, env(safe-area-inset-top)) 9px max(9px, env(safe-area-inset-bottom));
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 3px solid var(--brown);
  border-radius: 22px;
  background: rgba(255, 251, 237, .95);
  box-shadow: 0 6px 0 rgba(101, 69, 47, .18);
}

h1 {
  margin: 0;
  color: #eab91f;
  font-size: clamp(19px, 4vw, 29px);
  line-height: 1;
  text-shadow: 0 2px white;
}

.brand p {
  margin: 5px 0 0;
  font-size: 12px;
  color: #8b6b50;
}

.stats {
  display: flex;
  gap: 6px;
}

.stats div {
  min-width: 65px;
  padding: 5px 8px;
  border: 2px solid var(--brown);
  border-radius: 14px;
  background: white;
  text-align: center;
}

.stats span,
.stats strong {
  display: block;
}

.stats span {
  color: #9b7d65;
  font-size: 10px;
}

.stats strong {
  font-size: 17px;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 4px solid var(--brown);
  border-radius: 27px;
  background: var(--sky);
  box-shadow: 0 8px 0 rgba(101, 69, 47, .18);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(80, 104, 91, .48);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.card {
  width: min(420px, 100%);
  padding: 20px;
  border: 4px solid var(--brown);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 8px 0 rgba(101, 69, 47, .2);
  text-align: center;
}

.mascot {
  font-size: 62px;
  line-height: 1;
}

.card h2 {
  margin: 8px 0;
  color: #dfaa14;
  font-size: clamp(23px, 6vw, 32px);
}

.card p {
  margin: 0 0 17px;
  color: #7d654f;
  line-height: 1.5;
}

button {
  border: 3px solid var(--brown);
  border-radius: 17px;
  color: var(--brown);
  background: white;
  box-shadow: 0 4px 0 var(--brown);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

button:active,
button.active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--brown);
}

.primary {
  min-width: 165px;
  padding: 12px 20px;
  background: var(--yellow);
  font-size: 18px;
}

.controls {
  width: min(500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 9px;
}

.controls button {
  height: 58px;
  font-size: 22px;
}

.controls .flap {
  background: var(--yellow);
  font-size: 18px;
}

@media (max-width: 620px) {
  .app { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .hud { padding: 8px; border-width: 2px; border-radius: 18px; }
  .brand p { display: none; }
  .stats { gap: 3px; }
  .stats div { min-width: 52px; padding: 4px; border-width: 2px; }
  .stats strong { font-size: 14px; }
  .stage { border-width: 3px; border-radius: 21px; }
  .controls button { height: 53px; }
}
