:root {
  --orange: #ff8c00;
  --yellow: #ffd23f;
  --pink: #ff6b9d;
  --green: #3cb878;
  --green-dark: #1e6b45;
  --sky: #4facfe;
  --brown: #4a3728;
  --cream: #fff8ee;
  --shadow: rgba(74, 55, 40, 0.35);
  --page-bg-image: url("https://www.milkshakelounge.com/wp-content/uploads/2025/10/milkshakeloungebackground.png");
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--cream);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background-color: #2a1f1a;
  background-image: linear-gradient(
      165deg,
      rgba(32, 26, 20, 0.82) 0%,
      rgba(42, 34, 28, 0.78) 42%,
      rgba(22, 32, 28, 0.84) 100%
    ),
    var(--page-bg-image);
  background-size: cover, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  background-repeat: no-repeat, no-repeat;
}

#app {
  width: 100%;
  max-width: 880px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.logo-link {
  display: flex;
  align-items: center;
  line-height: 0;
  border-radius: 12px;
}

.logo-link:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.site-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(52vw, 240px);
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.book-link {
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 210, 63, 0.4);
}

.book-link:hover {
  background: rgba(255, 210, 63, 0.2);
}

.panel {
  display: none;
  background: linear-gradient(180deg, rgba(28, 22, 18, 0.78) 0%, rgba(16, 14, 12, 0.82) 100%);
  border-radius: 24px;
  padding: 2rem 1.75rem;
  border: 3px solid var(--brown);
  box-shadow: 0 12px 0 var(--shadow), 0 24px 48px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.panel.screen.active {
  display: block;
}

#screen-end {
  position: relative;
}

#screen-end > *:not(.end-sparkles) {
  position: relative;
  z-index: 2;
}

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: 36rem;
  margin: 0 auto 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 210, 63, 0.25);
  font-size: 0.95rem;
  line-height: 1.45;
  cursor: pointer;
}

.option-row input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--orange);
}

.hero-art {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 200px;
  margin: 0 auto 1.25rem;
  border-radius: 16px;
  border: 3px solid var(--brown);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.35);
  background: var(--brown) var(--page-bg-image) center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  margin: 4px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.hero-logo {
  position: relative;
  z-index: 1;
  width: min(88%, 300px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));
}

.end-logo {
  display: block;
  width: min(200px, 70vw);
  height: auto;
  margin: 0 auto 0.75rem;
  object-fit: contain;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}

.title {
  text-align: center;
  font-size: clamp(1.85rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 1rem;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px var(--brown);
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 var(--shadow);
}

.title-accent {
  display: inline-block;
}

.title-sm {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.lede {
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  color: rgba(255, 248, 238, 0.95);
}

.hint {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.muted {
  color: rgba(255, 248, 238, 0.65);
}

.btn-primary {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.85rem 2.25rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: var(--brown);
  background: linear-gradient(180deg, var(--yellow) 0%, var(--orange) 100%);
  box-shadow: 0 6px 0 var(--brown), 0 10px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--brown), 0 14px 28px rgba(0, 0, 0, 0.28);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--brown), 0 8px 16px rgba(0, 0, 0, 0.22);
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.hud-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 8rem;
}

.btn-mute {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 210, 63, 0.45);
  appearance: none;
}

.btn-mute:hover {
  background: rgba(255, 210, 63, 0.18);
}

.btn-mute[aria-pressed="true"] {
  opacity: 0.75;
  border-style: dashed;
}

.label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 248, 238, 0.75);
  margin-bottom: 0.25rem;
}

.meter-wrap {
  width: min(280px, 55vw);
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--brown);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #87ceeb, var(--cream));
  transition: width 0.2s ease;
}

.hud-right .stat {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--brown);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 800px;
  min-width: 260px;
  min-height: 200px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--brown);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
}

.coach-finger {
  position: absolute;
  bottom: 26%;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.coach-finger--visible {
  opacity: 1;
}

.coach-finger-icon {
  display: block;
  font-size: clamp(2rem, 8vw, 2.75rem);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
  animation: coach-bob 0.85s ease-in-out infinite;
}

@keyframes coach-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-finger-icon {
    animation: none;
  }
}

.end-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  border-radius: 20px;
}

.end-sparkle {
  position: absolute;
  bottom: -10%;
  font-size: 1.35rem;
  opacity: 0;
  animation: end-pop 2.8s ease-out forwards;
}

@keyframes end-pop {
  0% {
    transform: translateY(0) translateX(0) scale(0.6);
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  100% {
    transform: translateY(-120%) translateX(var(--drift, 0px)) scale(1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .end-sparkle {
    animation: none;
    opacity: 0.85;
    bottom: 40%;
  }
}

#game {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  background: #4a3728;
  touch-action: manipulation;
}

.tap-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cream);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.5);
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn-secondary {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 210, 63, 0.5);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

button.btn-secondary {
  appearance: none;
}

.btn-secondary:hover {
  background: rgba(255, 210, 63, 0.2);
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll, scroll;
  }
}

@media (max-width: 600px) {
  .hero-art {
    min-height: 160px;
    padding: 1rem 0.75rem;
  }

  .site-logo {
    height: 40px;
  }

  .panel {
    padding: 1.5rem 1.1rem;
  }

  .lede {
    font-size: 1rem;
  }

  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-center {
    order: 3;
    min-width: 0;
    justify-content: stretch;
  }

  .btn-mute {
    width: 100%;
    padding: 0.5rem 0.85rem;
  }

  .hud-left,
  .hud-right {
    width: 100%;
  }

  .meter-wrap {
    width: 100%;
    max-width: none;
  }

  .hud-right {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .hud-right .label {
    margin-bottom: 0;
  }

  .tap-hint {
    font-size: 0.75rem;
    padding: 0 0.5rem;
    line-height: 1.25;
  }
}
