:root {
  --berry: oklch(42% 0.11 343);
  --berry-soft: oklch(66% 0.12 347);
  --cream: oklch(97% 0.035 88);
  --sun: oklch(86% 0.14 91);
  --leaf: oklch(66% 0.11 145);
  --sky: oklch(88% 0.075 218);
  --ink: oklch(34% 0.075 332);
  --paper: oklch(99% 0.014 87);
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--ink);
  background: var(--cream);
  font-family: "Avenir Next Rounded", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--cream);
}

body {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
}

.game {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 28rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 9% 6%, oklch(99% 0.025 90) 0 5.5rem, transparent 5.6rem),
    var(--cream);
}

.game-header {
  z-index: 4;
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: center;
  padding:
    max(var(--space-sm), env(safe-area-inset-top))
    max(var(--space-xl), env(safe-area-inset-right))
    0
    max(var(--space-xl), env(safe-area-inset-left));
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.title-lockup h1 {
  margin: 0;
  color: var(--berry);
  font-family: "Cooper Black", "Bookman Old Style", serif;
  font-size: clamp(1.25rem, 4vmin, 2rem);
  letter-spacing: -0.035em;
}

.title-leaves {
  width: clamp(2.3rem, 7vmin, 3.4rem);
}

.title-leaves path:nth-child(-n + 2) {
  fill: var(--leaf);
}

.title-leaves path:last-child {
  fill: none;
  stroke: var(--berry);
  stroke-linecap: round;
  stroke-width: 2;
}

.play-space {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1.2fr) minmax(0, 0.9fr) auto;
  gap: clamp(0.45rem, 1.8vmin, 1rem);
  padding:
    var(--space-sm)
    max(var(--space-lg), env(safe-area-inset-right))
    max(var(--space-md), env(safe-area-inset-bottom))
    max(var(--space-lg), env(safe-area-inset-left));
}

.picnic-shape {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  opacity: 0.55;
  pointer-events: none;
}

.picnic-shape-one {
  top: 14%;
  left: -3rem;
  width: 9rem;
  height: 9rem;
  background: var(--sky);
}

.picnic-shape-two {
  right: -2rem;
  bottom: 5%;
  width: 7rem;
  height: 7rem;
  background: oklch(91% 0.07 145);
}

.friend-prompt {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(65vw, 19rem);
  min-height: 0;
  justify-self: center;
  grid-template-rows: auto minmax(0, 1fr);
  place-items: center;
  border: 0.3rem solid var(--paper);
  border-radius: 42% 47% 45% 40%;
  background: var(--sun);
  box-shadow:
    0 0.48rem 0 oklch(72% 0.11 85),
    0 1rem 2rem oklch(47% 0.06 76 / 14%);
  transform: rotate(-1deg);
  transition:
    transform 300ms var(--ease-out),
    filter 300ms var(--ease-out);
}

.friend-prompt::after {
  position: absolute;
  inset: 0.55rem;
  border: 0.13rem dashed oklch(53% 0.09 345 / 44%);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.friend-prompt p {
  z-index: 1;
  margin: 0;
  padding-top: var(--space-md);
  color: var(--berry);
  font-family: "Cooper Black", "Bookman Old Style", serif;
  font-size: clamp(1rem, 3.4vmin, 1.45rem);
}

.prompt-art {
  display: grid;
  width: min(34vmin, 11.5rem);
  height: min(34vmin, 11.5rem);
  place-items: center;
}

.friend-prompt.is-softly-highlighted {
  filter: saturate(0.85) brightness(1.04);
  animation: soft-prompt 420ms var(--ease-out);
}

.choices {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.55rem, 2.4vw, 1.5rem);
  align-items: stretch;
  justify-self: center;
  width: min(100%, 46rem);
}

.choice {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 5.8rem;
  padding: clamp(0.4rem, 1.4vmin, 0.8rem);
  place-items: center;
  border: 0.25rem solid var(--paper);
  border-radius: 34% 40% 36% 42%;
  color: var(--ink);
  background: var(--paper);
  box-shadow:
    0 0.42rem 0 oklch(73% 0.04 70),
    0 0.85rem 1.4rem oklch(45% 0.04 70 / 13%);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 230ms var(--ease-out),
    filter 230ms var(--ease-out),
    background-color 230ms var(--ease-out);
}

.choice:nth-child(2) {
  border-radius: 40% 34% 42% 36%;
  transform: rotate(1deg);
}

.choice:nth-child(3) {
  border-radius: 36% 42% 34% 40%;
  transform: rotate(-1deg);
}

.choice:hover {
  filter: brightness(1.02);
  transform: translateY(-0.12rem);
}

.choice:active {
  transform: translateY(0.25rem);
}

.choice:focus-visible {
  outline: 0.35rem solid var(--berry-soft);
  outline-offset: 0.2rem;
}

.choice .friend-art {
  width: min(24vmin, 9rem);
  height: min(24vmin, 9rem);
}

.friend-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0.25rem 0 oklch(45% 0.04 40 / 14%));
}

.friend-art .outline {
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.friend-art .thin {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 3.2;
}

.friend-art .eye {
  fill: var(--ink);
}

.choice.is-found {
  z-index: 3;
  background: color-mix(in oklch, var(--paper) 70%, var(--sun));
  animation: found-friend 650ms var(--ease-out) both;
}

.choice.is-found::before,
.choice.is-found::after {
  position: absolute;
  z-index: -1;
  width: 1rem;
  height: 1rem;
  border-radius: 50% 10% 50% 10%;
  background: var(--berry-soft);
  box-shadow:
    -3.7rem -1.1rem 0 -0.12rem var(--leaf),
    3.8rem -1.5rem 0 -0.18rem var(--sky),
    -2.8rem 2.8rem 0 -0.2rem var(--sun),
    3.4rem 2.7rem 0 -0.16rem var(--berry-soft);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: scale(0.3) rotate(0deg);
  animation: friend-bloom 650ms var(--ease-out);
}

.choice.is-found::after {
  background: var(--sky);
  box-shadow:
    -2.9rem -2.7rem 0 -0.2rem var(--sun),
    2.8rem -2.9rem 0 -0.18rem var(--berry-soft),
    -3.9rem 1.2rem 0 -0.16rem var(--sky),
    3.8rem 1.4rem 0 -0.2rem var(--leaf);
  transform: scale(0.3) rotate(45deg);
}

.friend-prompt.is-celebrating {
  animation: prompt-celebration 650ms var(--ease-out);
}

.game-status {
  z-index: 2;
  min-height: 1.5em;
  margin: 0;
  color: var(--berry);
  font-size: clamp(0.85rem, 2.8vmin, 1.15rem);
  font-weight: 800;
  text-align: center;
}

.parent-leaf {
  position: fixed;
  z-index: 10;
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  padding: 0.8rem;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--berry);
  background: transparent;
  opacity: 0.38;
  touch-action: none;
  transition:
    opacity 220ms var(--ease-out),
    transform 220ms var(--ease-out),
    background-color 220ms var(--ease-out);
}

.parent-leaf svg {
  width: 100%;
  overflow: visible;
}

.parent-leaf path:first-child {
  fill: var(--leaf);
}

.parent-leaf path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.parent-leaf-top {
  top: max(0.1rem, env(safe-area-inset-top));
  right: max(0.1rem, env(safe-area-inset-right));
}

.parent-leaf-bottom {
  bottom: max(0.1rem, env(safe-area-inset-bottom));
  left: max(0.1rem, env(safe-area-inset-left));
  transform: rotate(180deg);
}

.parent-leaf.is-held {
  opacity: 0.9;
  background: oklch(88% 0.07 145 / 72%);
  transform: scale(1.08);
}

.parent-leaf-bottom.is-held {
  transform: rotate(180deg) scale(1.08);
}

.parent-leaf:focus-visible {
  outline: 0.3rem solid var(--berry-soft);
  outline-offset: -0.3rem;
  opacity: 1;
}

.parent-dialog {
  width: min(91vw, 31rem);
  max-height: min(90vh, 42rem);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 2rem 1.6rem 2.2rem 1.75rem;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1.5rem 5rem oklch(28% 0.06 335 / 34%);
  user-select: text;
}

.parent-dialog::backdrop {
  background: oklch(27% 0.055 334 / 60%);
}

.parent-sheet {
  display: grid;
  gap: var(--space-xl);
  padding:
    clamp(1.25rem, 5vw, 2rem)
    clamp(1.2rem, 5vw, 2.1rem)
    clamp(1.5rem, 6vw, 2.4rem);
}

.parent-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.parent-heading h2 {
  margin: 0.1rem 0 0;
  color: var(--berry);
  font-family: "Cooper Black", "Bookman Old Style", serif;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  letter-spacing: -0.035em;
  line-height: 1;
}

.eyebrow {
  margin: 0;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.close-parent {
  display: grid;
  width: 2.9rem;
  height: 2.9rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0.15rem solid oklch(79% 0.035 335);
  border-radius: 50%;
  color: var(--berry);
  background: var(--cream);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.parent-note {
  max-width: 38ch;
  margin: 0;
  color: oklch(43% 0.065 334);
  font-size: 1rem;
  line-height: 1.55;
}

.sound-setting {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-lg);
  border: 0.14rem solid oklch(85% 0.045 89);
  border-radius: 1.2rem 1.45rem 1.15rem 1.35rem;
  background: var(--cream);
}

.sound-setting span {
  display: grid;
  gap: var(--space-xs);
}

.sound-setting strong {
  color: var(--berry);
}

.sound-setting small {
  color: oklch(48% 0.06 334);
}

.sound-setting input {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  accent-color: var(--leaf);
}

.parent-playland-link {
  display: inline-flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: 0.15rem solid var(--berry-soft);
  border-radius: 999px;
  color: var(--berry);
  background: var(--paper);
  font-weight: 900;
  text-decoration: none;
}

.close-parent:focus-visible,
.sound-setting:has(input:focus-visible),
.parent-playland-link:focus-visible {
  outline: 0.3rem solid var(--sun);
  outline-offset: 0.2rem;
}

@keyframes soft-prompt {
  50% {
    transform: rotate(-1deg) scale(1.035);
  }
}

@keyframes found-friend {
  45% {
    transform: translateY(-0.5rem) rotate(2deg) scale(1.06);
  }
}

@keyframes prompt-celebration {
  45% {
    transform: rotate(1deg) scale(1.025);
  }
}

@keyframes friend-bloom {
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.15) rotate(32deg);
  }
}

@media (orientation: landscape) {
  .game {
    grid-template-rows: 3.4rem minmax(0, 1fr);
    min-height: 0;
  }

  .play-space {
    grid-template:
      "prompt choices" minmax(0, 1fr)
      "status status" auto
      / minmax(12rem, 0.85fr) minmax(20rem, 1.8fr);
    gap: var(--space-md) clamp(1rem, 4vw, 3rem);
    padding-top: 0;
  }

  .friend-prompt {
    grid-area: prompt;
    align-self: center;
    width: min(34vw, 18rem, 100%);
    height: min(72vh, 20rem);
  }

  .choices {
    grid-area: choices;
    align-self: center;
  }

  .game-status {
    grid-area: status;
  }
}

@media (max-width: 23rem) {
  .play-space {
    padding-right: var(--space-sm);
    padding-left: var(--space-sm);
  }

  .choices {
    gap: 0.4rem;
  }

  .choice {
    min-height: 5.2rem;
    border-width: 0.18rem;
  }
}

@media (max-height: 34rem) {
  .parent-dialog {
    max-height: 94vh;
  }

  .parent-sheet {
    gap: var(--space-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
