@import url("https://fonts.googleapis.com/css2?family=Reenie+Beanie&display=swap");

/* ============================================================
   Theme tokens
   Global colors, spacing variables, font choices, and HUD sizing.
   Change these first when you want broad visual updates.
   ============================================================ */

:root {
  --color-coconut-cream: #f4ebd9;
  --color-coconut-brown: #4c3125;
  --color-ink-deep: #24150f;
  --color-pandan: #c5d86d;
  --color-hibiscus: #d94423;
  --color-evening-amber: #e6a85c;
  --color-muted-brown: #8a7a6d;
  --color-night: #040404;
  --shadow-soft:
    0 22px 48px rgba(42, 31, 24, 0.18),
    0 0 0 1px rgba(42, 31, 24, 0.08);
  --shadow-float:
    0 34px 80px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(42, 31, 24, 0.06);
  --shadow-ink-soft:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 18px 34px rgba(42, 31, 24, 0.14);
  --font-display: "Reenie Beanie", cursive;
  --ui-ease: cubic-bezier(0.2, 0, 0, 1);
  --ui-edge-pad: clamp(22px, 3vw, 42px);
  --ui-top-anchor: max(24px, calc(env(safe-area-inset-top) + 10px));
  --ui-bottom-anchor: max(28px, calc(env(safe-area-inset-bottom) + 18px));
  --ui-center-shift: clamp(-34px, -4.2vh, -14px);
  --ui-top-gap: clamp(8px, 1vw, 16px);
  --ui-action-gap: clamp(14px, 2vw, 28px);
  --ui-center-width: min(44rem, calc(100vw - (var(--ui-edge-pad) * 2)));
  --ui-hud-top-offset: 0px;
  --ui-hud-side-width: clamp(94px, 20vw, 138px);
  --ui-hud-chip-width: clamp(148px, 30vw, 192px);
  --ui-hud-side-height: clamp(96px, 11vw, 128px);
  --ui-hud-chip-height: clamp(92px, 10vw, 112px);
}

/* ============================================================
   Base document styles
   Resets the page, hides overflow, sets the app font, and disables
   the native cursor because the app uses a custom cursor/finger input.
   ============================================================ */

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-night);
  color: var(--color-coconut-brown);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: none;
}
button, a, * {
  cursor: none !important;
}
body {
  position: relative;
}

#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
  transform: translate(-100px, -100px);
}

#custom-cursor img {
  display: block;
  width: 100%;
  height: 100%;
}

button,
input,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

/* ============================================================
   Core visual layers
   #game is the drawing canvas, #webcam is the live camera feed,
   and #environment is the optional generated/static background layer.
   ============================================================ */

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  touch-action: none;
  background: transparent;
}


#webcam {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  object-fit: cover;
  transform: scaleX(-1);
  transition: opacity 120ms ease;
}

#environment {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  object-fit: cover;
  transition: opacity 180ms ease;
}

/* ============================================================
   UI root and scene overlay
   Controls global UI dimming, scene-specific overlays, and camera
   visibility treatments for opening/loading/gameover states.
   ============================================================ */

#ui-root {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

#ui-root::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(244, 235, 217, 0.05), transparent 32%),
    linear-gradient(180deg, rgba(6, 4, 3, 0.08), rgba(6, 4, 3, 0.12));
  opacity: 0;
  transition:
    opacity 420ms var(--ui-ease),
    background-color 420ms var(--ui-ease);
}

#ui-root[data-scene="opening"]::before,
#ui-root[data-scene="countdown"]::before,
#ui-root[data-scene="mode-select"]::before,
#ui-root[data-scene="idle"]::before,
#ui-root[data-scene="error"]::before {
  opacity: 0.52;
}

#ui-root[data-scene="opening"]::before,
#ui-root[data-scene="countdown"]::before,
#ui-root[data-scene="mode-select"]::before,
#ui-root[data-scene="idle"]::before,
#ui-root[data-scene="error"]::before {
  background:
    radial-gradient(circle at 50% 14%, rgba(230, 168, 92, 0.04), transparent 34%),
    linear-gradient(180deg, rgba(6, 4, 3, 0.06), rgba(6, 4, 3, 0.12));
}

#ui-root[data-camera-visible="true"][data-scene="opening"]::before,
#ui-root[data-camera-visible="true"][data-scene="countdown"]::before,
#ui-root[data-camera-visible="true"][data-scene="mode-select"]::before,
#ui-root[data-camera-visible="true"][data-scene="idle"]::before,
#ui-root[data-camera-visible="true"][data-scene="error"]::before {
  background:
    radial-gradient(circle at 50% 18%, rgba(230, 168, 92, 0.04), transparent 36%),
    linear-gradient(180deg, rgba(6, 4, 3, 0.03), rgba(6, 4, 3, 0.08));
}

#ui-root[data-scene="calibration"]::before {
  opacity: 0;
}

#ui-root[data-scene="loading"]::before {
  opacity: 0;
}

#ui-root[data-scene="gameover"]::before {
  opacity: 0;
}

.ui-brand,
.ui-icon-button,
.ui-screen,
#play-hud,
/* ============================================================
   Share modal
   Final result screen shown after a round: backdrop, card, heading,
   bowl preview area, and action buttons.
   ============================================================ */

.ui-modal {
  position: absolute;
}

/* ============================================================
   Persistent corner controls
   Brand button, home/settings, sound button, and their blob styling.
   ============================================================ */

.ui-brand {
  top: var(--ui-top-anchor);
  left: var(--ui-edge-pad);
  min-width: 132px;
  min-height: 66px;
  padding: 10px 22px 12px;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 3.1vw, 3.35rem);
  line-height: 1;
  color: var(--color-coconut-brown);
  opacity: 1;
  transition:
    transform 220ms var(--ui-ease),
    filter 180ms var(--ui-ease),
    opacity 180ms var(--ui-ease);
  animation: brand-breathe 5s ease-in-out infinite;
}

.ui-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("./assets/ui/shapes/small-cream-blob.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: none;
}

.ui-brand:hover,
.ui-brand.is-finger-hovered {
  filter: brightness(1.06);
  transform: translateY(-2px) scale(1.03);
}

#ui-root[data-scene="calibration"] .ui-brand,
#ui-root[data-scene="loading"] .ui-brand {
  opacity: 0;
}

.ui-icon-button {
  --finger-progress: 0;
  width: 80px;
  height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  isolation: isolate;
  transform: translateY(calc(var(--finger-progress) * -2px))
    scale(calc(1 + var(--finger-progress) * 0.04));
  transition:
    transform 220ms var(--ui-ease),
    opacity 180ms var(--ui-ease),
    filter 180ms var(--ui-ease);
}

.ui-icon-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("./assets/ui/shapes/icon-cream-blob.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: none;
}

.ui-icon-button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: none;
}

.ui-icon-button:hover,
.ui-icon-button.is-finger-hovered {
  filter: brightness(1.06);
}

.ui-icon-button:active,
.ui-pill-button:active,
.ui-scribble-button:active,
.ui-action-swatch:active,
.ui-share-close:active {
  transform: scale(0.96);
}

#ui-home,
#ui-settings {
  top: var(--ui-top-anchor);
  right: var(--ui-edge-pad);
}

#ui-sound {
  left: var(--ui-edge-pad);
  bottom: var(--ui-bottom-anchor);
}

#ui-sound.is-muted::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 2px;
  background: var(--color-hibiscus);
  transform: rotate(-32deg);
  border-radius: 999px;
}

/* ============================================================
   Full-screen UI screens
   Shared layout for opening, countdown, idle, calibration, and error
   screens. These screens sit over the game canvas.
   ============================================================ */

.ui-screen {
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    calc(var(--ui-top-anchor) + 44px)
    var(--ui-edge-pad)
    calc(var(--ui-bottom-anchor) + 84px);
}

.ui-copy-stack {
  display: grid;
  justify-items: center;
  width: min(100%, var(--ui-center-width));
  gap: 16px;
  text-align: center;
}

.ui-copy-stack--hero {
  gap: 12px;
  transform: translateY(var(--ui-center-shift));
}

.ui-copy-stack--centered {
  gap: 12px;
}

/* ============================================================
   Text system
   Main titles, subtitles, status messages, and share/error copy.
   ============================================================ */

.ui-title,
.ui-share-title,
.ui-brand-lockup {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.92;
  text-wrap: balance;
  color: var(--color-evening-amber);
}

.ui-title {
  font-size: clamp(3.8rem, 8.6vw, 7.7rem);
  max-width: 10.8ch;
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  -webkit-text-stroke: 0.45px rgba(36, 21, 15, 0.14);
  paint-order: stroke fill;
}

.ui-subtitle,
.ui-status-line,
.ui-status-detail,
.ui-panel-note,
.ui-share-copy,
.ui-error-message {
  margin: 0;
  font-family: var(--font-display);
  line-height: 0.98;
  text-wrap: pretty;
}

.ui-subtitle {
  max-width: 18ch;
  font-size: clamp(1.6rem, 2.55vw, 2.85rem);
  color: rgba(76, 49, 37, 0.96);
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
  -webkit-text-stroke: 0.3px rgba(244, 235, 217, 0.16);
}

.ui-status-detail:empty,
.ui-panel-note:empty {
  display: none;
}

#screen-opening .ui-subtitle,
#screen-idle .ui-subtitle {
  color: rgba(244, 235, 217, 0.96);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  -webkit-text-stroke: 0.3px rgba(36, 21, 15, 0.18);
}

.ui-brand-lockup {
  font-size: clamp(5rem, 9vw, 8rem);
  color: var(--color-coconut-brown);
}

.ui-status-line {
  font-size: clamp(3rem, 4.8vw, 4.5rem);
  color: var(--color-coconut-brown);
}

.ui-status-detail {
  font-size: clamp(1.2rem, 1.7vw, 1.7rem);
  color: rgba(76, 49, 37, 0.76);
  display: none;
}

.ui-countdown-kicker,
.ui-pill-meta {
  margin: 0;
  font-family: var(--font-display);
  line-height: 0.96;
  color: rgba(244, 235, 217, 0.8);
}

.ui-countdown-kicker {
  font-size: clamp(1.9rem, 3vw, 3rem);
  color: rgba(230, 168, 92, 0.94);
}

.ui-countdown-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(8.6rem, 18vw, 14.6rem);
  line-height: 0.84;
  color: var(--color-pandan);
  font-variant-numeric: normal;
  font-feature-settings: "tnum" 0, "lnum" 0;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

#screen-countdown .ui-subtitle {
  color: rgba(244, 235, 217, 0.92);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

/* ============================================================
   Shared blob components
   Base button/card pseudo-elements and hover behavior for the app UI.
   ============================================================ */

.ui-pill-button,
.ui-pill-chip,
.ui-score-card,
.ui-scribble-button,
/* ============================================================
   Error and share sheet base cards
   Shared cream-card surface used by errors and the final share modal.
   ============================================================ */

.ui-error-card,
.ui-share-sheet,
.ui-action-swatch {
  position: relative;
  isolation: isolate;
  box-shadow: none;
}

.ui-pill-button,
.ui-scribble-button,
.ui-action-swatch,
.ui-share-close {
  --finger-progress: 0;
  pointer-events: auto;
  transition:
    transform 220ms var(--ui-ease),
    background-color 180ms var(--ui-ease),
    box-shadow 180ms var(--ui-ease),
    opacity 180ms var(--ui-ease),
    filter 180ms var(--ui-ease);
}

.ui-pill-button::before,
.ui-scribble-button::before,
.ui-pill-chip::before,
.ui-score-card::before,
.ui-error-card::before,
.ui-share-sheet::before,
.ui-action-swatch::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: none;
}

/* Paper grain — unifies all UI blob surfaces into the same material */
.ui-pill-button::after,
.ui-scribble-button::after,
.ui-score-card::after,
.ui-pill-chip::after,
.ui-error-card::after,
.ui-share-sheet::after,
.ui-action-swatch::after {
  content: none;
}

.ui-pill-button:hover,
.ui-pill-button.is-finger-hovered,
.ui-action-swatch:hover,
.ui-action-swatch.is-finger-hovered,
.ui-share-close:hover,
.ui-share-close.is-finger-hovered {
  transform: translateY(calc(var(--finger-progress) * -2px))
    scale(calc(1 + var(--finger-progress) * 0.04));
}

.ui-scribble-button:hover,
.ui-scribble-button.is-finger-hovered {
  transform: scale(1.02) rotate(1.5deg);
  filter: brightness(1.06);
}

.ui-pill-button {
  position: absolute;
  top: max(52px, env(safe-area-inset-top) + 22px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 176px;
  min-height: 72px;
  padding: 10px 24px 14px;
  border: 0;
  background: transparent;
  color: var(--color-coconut-brown);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 2.6vw, 2.7rem);
  line-height: 1;
  text-align: center;
  cursor: pointer;
  isolation: isolate;
}

.ui-pill-button--static {
  pointer-events: none;
}

.ui-pill-button::before {
  background-image: url("./assets/ui/shapes/small-green-blob.svg");
}

/* ============================================================
   Mode select screen
   Layout and hover/progress feedback for Endless vs Timed selection.
   ============================================================ */

.ui-panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  gap: 18px;
  width: min(1420px, calc(100vw - 220px));
}

.ui-screen--mode-select {
  place-items: stretch;
  padding: 0;
}

.ui-screen--mode-select::before,
.ui-panel::before,
.ui-choice-row::before,
#screen-mode-select .ui-pill-button::before,
#screen-mode-select .ui-pill-button::after,
#screen-mode-select .ui-scribble-button::before,
#screen-mode-select .ui-panel::after,
#screen-mode-select .ui-choice-row::after {
  content: none !important;
  background: none !important;
  display: none !important;
}

.ui-panel--mode-grid {
  top: 44.5%;
  width: auto;
}

.ui-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 278px));
  gap: clamp(34px, 3vw, 58px);
  width: auto;
  align-items: center;
  justify-content: center;
  justify-items: stretch;
}

.ui-scribble-button {
  position: relative;
  width: 278px;
  min-width: 0;
  min-height: 122px;
  padding: 18px 28px 24px;
  border: 0;
  background: transparent;
  color: var(--color-coconut-brown);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 3.7vw, 4.2rem);
  line-height: 0.94;
  text-align: center;
  cursor: pointer;
}

.ui-scribble-button--primary {
  min-height: 128px;
  filter: saturate(1.08) brightness(1.02);
}

.ui-scribble-button::before {
  background-image: none;
}

#screen-idle .ui-scribble-button::before,
#screen-error .ui-scribble-button::before {
  background-image: url("./assets/ui/shapes/large-green-blob.svg");
}

.ui-scribble-button.is-active {
  filter: saturate(1.08) brightness(1.03);
}

#screen-mode-select .ui-scribble-button.is-active {
  filter: drop-shadow(0 18px 30px rgba(42, 31, 24, 0.16)) saturate(1.2) brightness(1.08);
}

#screen-mode-select .ui-scribble-button {
  position: relative;
  isolation: isolate;
  aspect-ratio: 280 / 120;
  background: transparent;
  background-image: url("./assets/ui/shapes/large-green-blob.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: none;
}

#screen-mode-select .ui-scribble-button {
  filter: drop-shadow(0 18px 30px rgba(42, 31, 24, 0.16));
  transition:
    transform 220ms var(--ui-ease),
    filter 180ms var(--ui-ease),
    box-shadow 180ms var(--ui-ease);
}

#screen-mode-select .ui-scribble-button::after {

  content: "";

  position: absolute;

  left: 16%;

  bottom: 19px;

  width: 68%;

  height: 12px;

  z-index: 1;

  pointer-events: none;

  background:

    radial-gradient(circle at 8% 55%, var(--color-coconut-brown) 0 2.4px, transparent 2.8px),

    radial-gradient(circle at 22% 48%, var(--color-coconut-brown) 0 2px, transparent 2.5px),

    radial-gradient(circle at 38% 60%, var(--color-coconut-brown) 0 2.6px, transparent 3px),

    radial-gradient(circle at 54% 45%, var(--color-coconut-brown) 0 2.2px, transparent 2.7px),

    radial-gradient(circle at 70% 56%, var(--color-coconut-brown) 0 2.5px, transparent 3px),

    radial-gradient(circle at 86% 50%, var(--color-coconut-brown) 0 2.1px, transparent 2.6px);

  transform-origin: left center;

  transform: scaleX(var(--finger-progress, 0)) rotate(-1.5deg);

  opacity: calc(0.16 + var(--finger-progress, 0) * 0.72);

  transition:

    transform 90ms linear,

    opacity 90ms linear;

}

#screen-mode-select .ui-scribble-button.is-finger-hovered {
  transform:
    translateY(calc(-2px - var(--finger-progress, 0) * 2px))
    scale(calc(1.02 + var(--finger-progress, 0) * 0.025))
    rotate(1deg);

  filter:
    drop-shadow(0 20px 32px rgba(42, 31, 24, 0.18))
    brightness(calc(1.02 + var(--finger-progress, 0) * 0.05));

  box-shadow: none;
}

#screen-mode-select .ui-pill-button {
  background-image: url("./assets/ui/shapes/small-green-blob.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: drop-shadow(0 18px 30px rgba(42, 31, 24, 0.16));
}

.ui-scribble-button--icon {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.ui-scribble-button--icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.ui-panel-note {
  margin-top: 12px;
  color: rgba(244, 235, 217, 0.88);
  font-size: clamp(1.1rem, 1.4vw, 1.6rem);
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.ui-error-card,
.ui-share-sheet {
  position: relative;
  width: min(432px, calc(100vw - 56px));
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 24px 26px;
  background: transparent;
  box-shadow: none;
}

.ui-error-card {
  min-height: 588px;
  grid-template-rows: auto auto auto 1fr auto;
}

.ui-error-card::before,
.ui-share-sheet::before {
  background-image: url("./assets/ui/shapes/cream-card-blob.svg");
  filter: drop-shadow(0 28px 54px rgba(0, 0, 0, 0.26));
}

.ui-error-card img {
  width: 48px;
  height: 48px;
  margin-top: 10px;
}

.ui-error-title {
  margin: 0;
  font-family: var(--font-display);
  max-width: 6.4ch;
  font-size: clamp(2.35rem, 3.7vw, 3.25rem);
  line-height: 0.9;
  color: var(--color-coconut-brown);
  text-align: center;
}

.ui-error-message {
  max-width: 12ch;
  font-size: clamp(1.35rem, 1.95vw, 1.85rem);
  line-height: 0.96;
  color: rgba(96, 70, 53, 0.84);
  text-align: center;
}

#screen-error .ui-scribble-button {
  width: min(312px, calc(100% - 56px));
  min-width: 0;
  min-height: 104px;
  padding: 14px 24px 18px;
  font-size: clamp(2.45rem, 3.5vw, 3.35rem);
  align-self: end;
  margin-bottom: 14px;
}

#screen-idle .ui-copy-stack--hero {
  min-height: min(68svh, 620px);
  grid-template-rows: auto auto 1fr auto;
  align-content: stretch;
  gap: 18px;
  transform: none;
}

#screen-idle .ui-title {
  max-width: 12ch;
  font-size: clamp(5.2rem, 8.4vw, 9.2rem);
  color: var(--color-evening-amber);
}

#screen-idle .ui-subtitle {
  max-width: 20ch;
  font-size: clamp(2.05rem, 2.7vw, 3rem);
}

#screen-idle .ui-scribble-button {
  width: 292px;
  padding: 18px 28px 24px;
  font-size: clamp(2.7rem, 3.8vw, 4.2rem);
  align-self: end;
}

/* ============================================================
   Play HUD — live game stats
   What this controls:
   - Score card on the left
   - Time + Mode chips in the center
   - Durian/lives card on the right
   Keep this section simple; the HUD should be readable at a glance.
   ============================================================ */

#play-hud {
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-content: start;
  align-items: start;
  column-gap: var(--ui-top-gap);
  padding:
    calc(var(--ui-top-anchor) + var(--ui-hud-top-offset))
    var(--ui-edge-pad)
    var(--ui-bottom-anchor);
  pointer-events: none;
}

/* Lower the side stats slightly so they sit under the brand/home buttons. */
.ui-score-card,
.ui-pill-chip--durian {
  margin-top: clamp(68px, 6vw, 84px);
}

/* Keep the center chips close to the top. */
#ui-timer-pill,
.ui-pill-chip--mode {
  margin-top: 0;
}

/* Shared HUD blob/card structure. */
.ui-score-card,
.ui-pill-chip {
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 0;
  min-width: 136px;
  min-height: 118px;
  padding: 12px 16px 14px;
  background: transparent;
  color: var(--color-coconut-brown);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Score card — main stat. Green blob with brown text. */
.ui-score-card {
  grid-column: 1;
  justify-self: start;
  width: var(--ui-hud-side-width);
  min-width: var(--ui-hud-side-width);
  min-height: var(--ui-hud-side-height);
  padding: 12px 10px 14px;
  align-content: center;
  gap: 2px;
  color: var(--color-coconut-brown);
}

.ui-score-card::before {
  background-image: url("./assets/ui/shapes/score-blob-green.svg");
  filter: saturate(1.25) brightness(0.92);
}

.ui-score-label,
.ui-pill-label {
  font-family: var(--font-display);
  line-height: 0.9;
  letter-spacing: 0.01em;
}

.ui-score-label {
  color: rgba(58, 39, 28, 0.68);
  font-size: clamp(1.45rem, 1.65vw, 1.9rem);
}

.ui-score-value {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 4.9vw, 5.15rem);
  line-height: 0.82;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--color-coconut-brown);
  text-shadow: 0 1px 0 rgba(244, 235, 217, 0.16);
}

/* Time + Mode chips — secondary status. */
.ui-pill-chip {
  width: var(--ui-hud-chip-width);
  min-width: var(--ui-hud-chip-width);
  min-height: var(--ui-hud-chip-height);
  padding: 14px 16px 14px;
  align-content: center;
  gap: 0;
}

.ui-pill-chip::before {
  background-image: url("./assets/ui/shapes/small-green-blob.svg");
  filter: saturate(1.25) brightness(0.92);
}

.ui-pill-label {
  font-size: clamp(1.32rem, 1.5vw, 1.75rem);
  color: rgba(58, 39, 28, 0.62);
  transform: translateY(2px);
}

.ui-pill-value {
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 3vw, 3.45rem);
  line-height: 0.82;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--color-coconut-brown);
  text-shadow: none;
  transform: translateY(0);
}

.ui-pill-chip--mode .ui-pill-value {
  font-size: clamp(2.25rem, 2.9vw, 3.35rem);
}

#ui-timer-pill {
  grid-column: 2;
  justify-self: end;
}

.ui-pill-chip--mode {
  grid-column: 3;
  justify-self: start;
}

#play-hud[data-timer-visible="false"] .ui-pill-chip--mode {
  grid-column: 2 / span 2;
  justify-self: center;
}

/* Durian card — remaining hits/lives. Keep it simple: label + dots only. */
.ui-pill-chip--durian {
  grid-column: 4;
  justify-self: end;
  width: var(--ui-hud-side-width);
  min-width: var(--ui-hud-side-width);
  min-height: var(--ui-hud-side-height);
  padding: 12px 10px 14px;
  justify-items: center;
  align-content: center;
  gap: 4px;
  color: var(--color-coconut-cream);
}

.ui-pill-chip--durian::before {
  background-image: url("./assets/ui/shapes/score-blob-dark.svg");
  filter: none;
}

.ui-pill-chip--durian .ui-pill-label {
  color: rgba(244, 235, 217, 0.86);
  text-align: center;
  width: 100%;
  font-size: clamp(1.6rem, 1.9vw, 2.25rem);
  line-height: 0.9;
  transform: none;
}

.ui-pill-chip--durian .ui-pill-value {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  color: #d7df68;
  margin-top: 2px;
  transform: none;
}

/* Hide extra helper copy in the durian card; it became too cramped. */
.ui-pill-chip--durian .ui-pill-meta {
  display: none;
}

.durian-life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d7df68;
  flex-shrink: 0;
  box-shadow: none;
}

.durian-life--lost {
  opacity: 0.18;
  box-shadow: none;
}

.ui-pill-meta {
  font-size: clamp(1.02rem, 1.2vw, 1.26rem);
  color: rgba(244, 235, 217, 0.76);
  text-align: center;
  line-height: 0.94;
  max-width: 8.6ch;
  margin-top: 4px;
}

.ui-share-actions .ui-scribble-button--primary {
  flex-grow: 1.12;
  filter: saturate(1.12) brightness(1.03);
}

.ui-modal {
  inset: 0;
  display: grid;
  place-items: center;
}

.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 34%,
    rgba(42, 31, 24, 0.64),
    rgba(42, 31, 24, 0.82)
  );
}
.ui-share-sheet {
  z-index: 1;
  position: relative;
  width: min(500px, calc(100vw - 64px));
  padding: 42px 34px 34px;
  display: grid;
  gap: 0;
  min-height: 580px;
  align-content: start;
  justify-items: center;
}

.ui-share-stamp {
  display: none;
}

.ui-share-stamp span { display: block; }
.ui-share-stamp span:nth-child(1) { font-size: 1.8rem; margin-bottom: 2px; }
.ui-share-stamp span:nth-child(2) { font-size: 2.8rem; line-height: 0.84; }
.ui-share-stamp span:nth-child(3) { font-size: 1.2rem; margin-top: 4px; opacity: 0.7; }

.ui-share-mode-select {
  position: absolute;
  top: 20px;
  right: 55px;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
  isolation: isolate;
}

.ui-share-mode-select::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.ui-share-mode-select img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  margin: auto;
  transform: translateY(1px);
}

.ui-share-mode-select:hover,
.ui-share-mode-select.is-finger-hovered {
  filter: brightness(1.06);
  transform: translateY(-1px) scale(1.03);
}

.ui-share-close {
  display: none;
}

.ui-share-close span {
  font-family: var(--font-display);
  font-size: 2.8rem;
  color: var(--color-coconut-brown);
  line-height: 1;
  transform: translateY(-1px);
}

.ui-share-heading {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 32px 0;
  transform: none;
}

.ui-share-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.7rem, 5vw, 5.3rem);
  line-height: 0.88;
  color: var(--color-coconut-brown);
}

.ui-share-copy {
  margin: 16px 0 0;
  font-size: clamp(1.5rem, 2vw, 1.95rem);
  line-height: 1.05;
  color: rgba(96, 70, 53, 0.78);
  max-width: 18ch;
  text-align: center;
}

.ui-share-divider {
  display: none;
}

.ui-share-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
  transform: none;
}

.ui-share-score-blob {
  display: none;
}

.ui-share-score-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: rgba(244, 235, 217, 0.78);
  text-align: center;
}

.ui-share-score-value {
  display: block;
  font-family: var(--font-display);
  font-size: 5.6rem;
  line-height: 0.84;
  color: var(--color-durian-glow);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ui-share-preview {
  width: 420px;
  height: 300px;
  margin-top: 10px;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-share-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ui-share-doodle {
  display: none;
}

.ui-share-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  padding-top: 18px;
  transform: none;
}

.ui-share-actions .ui-scribble-button {
  flex: 0 0 168px;
  width: 168px;
  min-width: 0;
  min-height: 76px;
  padding: 12px 18px 16px;
  font-size: clamp(1.95rem, 2.7vw, 2.45rem);
}

.ui-share-actions .ui-scribble-button::before {
  background-image: url("./assets/ui/shapes/large-green-blob.svg");
}

.ui-action-swatch {
  width: 208px;
  height: 88px;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.ui-action-swatch img {
  width: 30px;
  height: 30px;
}

.ui-action-swatch--warm {
  color: var(--color-coconut-brown);
}

.ui-action-swatch--brand {
  color: var(--color-coconut-brown);
}

.ui-action-swatch--warm::before {
  background-image: url("./assets/ui/shapes/small-green-blob.svg");
  background-color: rgba(237, 174, 89, 0.9);
  background-blend-mode: multiply;
}

.ui-action-swatch--brand::before {
  background-image: url("./assets/ui/shapes/small-green-blob.svg");
}

#dev-toggle,
#dev-panel,
#dev-panel input,
#dev-panel button {
  font-family: inherit;
}

#dev-toggle,
#dev-panel {
  display: none !important;
}

#dev-toggle {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  border: 1px solid rgba(42, 31, 24, 0.12);
  background: rgba(244, 235, 217, 0.88);
  color: var(--color-coconut-brown);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

#dev-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 20;
  border-radius: 18px;
  background: rgba(12, 12, 12, 0.86);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  padding: 18px;
}

#dev-panel[hidden] {
  display: none;
}

.dev-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dev-panel__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.dev-panel__hint {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.dev-panel__section {
  margin-bottom: 18px;
}

.dev-panel__section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.dev-panel__control {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.dev-panel__control-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.dev-panel__label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
}

.dev-panel__value {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}

.dev-panel__slider {
  width: 100%;
}

.dev-panel__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dev-panel__stat {
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
}

.dev-panel__stat-label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* ============================================================
   Tablet / narrow layout adjustments
   Collapses mode selection and keeps controls usable on medium screens.
   ============================================================ */

@media (max-width: 980px) {
  .ui-choice-row {
    gap: 20px;
  }

  .ui-scribble-button {
    min-width: 0;
    min-height: 110px;
    padding: 18px 24px 24px;
  }

  .ui-choice-row {
    grid-template-columns: 1fr;
  }

  .ui-panel {
    position: static;
    transform: none;
    width: min(420px, calc(100vw - 40px));
  }

  .ui-scribble-button {
    width: 100%;
    min-height: 96px;
    font-size: clamp(2.4rem, 7vw, 3.6rem);
  }

  .ui-score-card {
    align-self: start;
  }

  #ui-timer-pill,
  .ui-pill-chip--mode,
  .ui-pill-chip--durian {
    align-self: start;
  }

}

/* ============================================================
   Phone section
   What this does:
   - Tightens edge padding and HUD sizes for phones / short screens
   - Keeps the score, time, mode, and durian chips from overflowing
   - Shrinks modal/card/button sizes so the UI fits vertically
   Edit carefully: these rules override the desktop styles above.
   ============================================================ */

@media (max-width: 720px), (max-height: 720px) {
  :root {
    --ui-edge-pad: 16px;
    --ui-top-gap: 6px;
    --ui-hud-top-offset: 52px;
    --ui-hud-side-width: 78px;
    --ui-hud-chip-width: 126px;
    --ui-hud-side-height: 84px;
    --ui-hud-chip-height: 88px;
  }

  #screen-error {
    padding: 16px;
  }

  .ui-brand {
    font-size: clamp(2.4rem, 7vw, 3.3rem);
  }

  .ui-icon-button {
    width: 68px;
    height: 68px;
  }

  #ui-home,
  #ui-settings {
    top: var(--ui-top-anchor);
    right: var(--ui-edge-pad);
  }

  #ui-sound {
    left: var(--ui-edge-pad);
    bottom: var(--ui-bottom-anchor);
  }

  .ui-icon-button img {
    width: 30px;
    height: 30px;
  }

  .ui-pill-button {
    min-width: 136px;
    min-height: 58px;
    font-size: clamp(1.8rem, 5vw, 2.4rem);
  }

  #play-hud {
    grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 6px;
    column-gap: 8px;
    padding-top: calc(var(--ui-top-anchor) + 72px);
  }

  .ui-score-card {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    margin-top: 0;
  }

  #ui-timer-pill {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .ui-pill-chip--mode {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
  }

  #play-hud[data-timer-visible="false"] .ui-pill-chip--mode {
    grid-column: 2 / span 2;
    justify-self: center;
  }

  .ui-pill-chip--durian {
    grid-column: 4;
    grid-row: 1;
    align-self: start;
    margin-top: 0;
  }


  .ui-subtitle,
  .ui-status-line,
  .ui-status-detail,
  .ui-panel-note,
  .ui-share-copy,
  .ui-error-message {
    max-width: 18ch;
  }

  .ui-copy-stack--hero {
    transform: translateY(clamp(-20px, -2.5vh, -8px));
  }

  .ui-title {
    max-width: 9.5ch;
  }

  .ui-error-card {
    width: min(322px, calc(100vw - 28px));
    min-height: 430px;
    gap: 6px;
    padding: 18px 18px 18px;
  }

  .ui-error-card img {
    width: 42px;
    height: 42px;
    margin-top: 6px;
  }

  .ui-error-title {
    max-width: 6.2ch;
    font-size: clamp(2rem, 7vw, 2.7rem);
  }

  .ui-error-message {
    max-width: 11.5ch;
    font-size: clamp(1.1rem, 4.6vw, 1.45rem);
  }

  #screen-error .ui-scribble-button {
    width: min(238px, calc(100% - 40px));
    min-height: 82px;
    padding: 12px 18px 16px;
    font-size: clamp(2rem, 7vw, 2.7rem);
    margin-bottom: 6px;
  }

  .ui-score-card,
  .ui-pill-chip {
    padding: 10px 12px 12px;
  }

  .ui-score-card,
  .ui-pill-chip--durian {
    padding: 10px 8px 12px;
  }

  .ui-score-label,
  .ui-pill-label {
    font-size: clamp(1.24rem, 3.7vw, 1.48rem);
  }

  .ui-score-label,
  .ui-pill-chip--durian .ui-pill-label {
    font-size: clamp(1.46rem, 4.5vw, 1.76rem);
  }

  .ui-score-value,
  .ui-pill-value {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .ui-score-value {
    font-size: clamp(2.25rem, 9.5vw, 3.15rem);
  }

  .ui-pill-chip--mode .ui-pill-value,
  #ui-timer-pill .ui-pill-value {
    font-size: clamp(1.95rem, 8vw, 2.8rem);
  }

  .durian-life {
    width: 11px;
    height: 11px;
  }

  .ui-pill-meta,
  .ui-countdown-kicker {
    font-size: clamp(1rem, 4vw, 1.4rem);
  }

  .ui-share-sheet {
    width: min(360px, calc(100vw - 24px));
  }

  .ui-share-preview {
    width: 112px;
    height: 112px;
  }

  .ui-action-swatch {
    width: 84px;
    height: 72px;
  }
}

/* ============================================================
   Calibration screens
   Handles camera setup messaging and staged instructional text.
   ============================================================ */

.calibration-callout {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
}

#ui-root[data-scene="calibration"] .calibration-callout {
  display: flex;
}

#ui-root[data-scene="calibration"] .calibration-slide-stage {
  display: none;
}

.calibration-callout .ui-title {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 6px 28px rgba(0, 0, 0, 0.36);
}

.calibration-callout .ui-subtitle {
  color: rgba(244, 235, 217, 0.72);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.calibration-slide-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.calibration-slide-content {
  display: grid;
  justify-items: center;
  gap: 20px;
  text-align: center;
  width: min(560px, 80vw);
}

.calibration-slide-line {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2.8vw, 3rem);
  line-height: 1;
  color: rgba(76, 49, 37, 0.62);
  animation: ui-enter 360ms var(--ui-ease) both;
  text-shadow: none;
  filter: none;
}

.calibration-slide-line--hero {
  font-size: clamp(3.4rem, 6vw, 5.5rem);
  color: var(--color-coconut-brown);
  text-shadow: none;
  filter: none;
}


@keyframes slide-fade-out {
  from { opacity: 1; transform: none; filter: blur(0); }
  to { opacity: 0; transform: translateY(-8px); filter: blur(3px); }
}

.calibration-slide-content.is-leaving {
  animation: slide-fade-out 380ms var(--ui-ease) both;
}

/* ============================================================
   Enter animations
   ============================================================ */

/* ============================================================
   Animations
   Small entrance/fade animations used across screens and HUD elements.
   ============================================================ */

@keyframes ui-enter {
  from {
    opacity: 0;
    translate: 0 10px;
    filter: blur(4px);
  }
  to {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
  }
}

@keyframes brand-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.008); }
}

@keyframes score-bloom {
  0% { filter: none; }
  30% { filter: brightness(1.2) saturate(1.1); }
  100% { filter: none; }
}

.ui-score-card.is-blooming::before {
  animation: score-bloom 600ms var(--ui-ease) both;
}

@keyframes ui-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Copy-stack child stagger — opening, calibration, countdown, idle */
.ui-screen:not([hidden]) .ui-copy-stack > * {
  animation: ui-enter 360ms var(--ui-ease) both;
}

.ui-screen:not([hidden]) .ui-copy-stack > *:nth-child(1) { animation-delay: 40ms; }
.ui-screen:not([hidden]) .ui-copy-stack > *:nth-child(2) { animation-delay: 140ms; }
.ui-screen:not([hidden]) .ui-copy-stack > *:nth-child(3) { animation-delay: 240ms; }

/* Error card */
#screen-error:not([hidden]) .ui-error-card {
  animation: ui-enter 360ms var(--ui-ease) 60ms both;
}

/* Mode select buttons stagger */
#screen-mode-select:not([hidden]) .ui-choice-row > *:nth-child(1) { animation: ui-enter 360ms var(--ui-ease) 80ms both; }
#screen-mode-select:not([hidden]) .ui-choice-row > *:nth-child(2) { animation: ui-enter 360ms var(--ui-ease) 160ms both; }
#screen-mode-select:not([hidden]) .ui-choice-row > *:nth-child(3) { animation: ui-enter 360ms var(--ui-ease) 240ms both; }


/* Play HUD stagger */
#play-hud:not([hidden]) > *:nth-child(1) { animation: ui-enter 300ms var(--ui-ease) 60ms both; }
#play-hud:not([hidden]) > *:nth-child(2) { animation: ui-enter 300ms var(--ui-ease) 120ms both; }
#play-hud:not([hidden]) > *:nth-child(3) { animation: ui-enter 300ms var(--ui-ease) 180ms both; }
#play-hud:not([hidden]) > *:nth-child(4) { animation: ui-enter 300ms var(--ui-ease) 240ms both; }

/* Share modal — backdrop fades, sheet slides up */
.ui-modal:not([hidden]) .ui-modal-backdrop { animation: ui-fade 220ms ease both; }
.ui-modal:not([hidden]) .ui-share-sheet { animation: ui-enter 360ms var(--ui-ease) 80ms both; }

/* ============================================================
   Noon scene background — loading + opening states
   ============================================================ */

/* ============================================================
   Opening/loading scene background
   Decorative illustrated background layer used before gameplay starts.
   ============================================================ */

#scene-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms ease;
  background: linear-gradient(
    180deg,
    #7ec5d8 0%,
    #cfe2c2 35%,
    #f2e2a0 56%,
    #3e84a0 58%,
    #27556a 76%,
    #e8c98a 80%,
    #a87a3a 100%
  );
}

#ui-root[data-scene="loading"] #scene-bg,
#ui-root[data-scene="opening"] #scene-bg {
  opacity: 1;
}

#ui-root[data-scene="opening"] .ui-title {
  color: var(--color-coconut-brown);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.36), 0 6px 28px rgba(0, 0, 0, 0.24);
}

#ui-root[data-scene="opening"] .ui-subtitle {
  color: rgba(76, 49, 37, 0.92);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.5), 0 4px 16px rgba(0, 0, 0, 0.18);
}

.scene-sun-halo {
  position: absolute;
  left: 64%;
  top: 24%;
  width: 260px;
  height: 260px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 240, 168, 0.5) 0%, rgba(0, 0, 0, 0) 60%);
  animation: sun-pulse 7s ease-in-out infinite;
  pointer-events: none;
}

.scene-sun-disc {
  position: absolute;
  left: 64%;
  top: 24%;
  width: 110px;
  height: 110px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff1c2 0%, #fff1c2 50%, rgba(255, 255, 255, 0) 80%);
  box-shadow: 0 0 90px #fff1c2, 0 0 40px #fff1c2;
  pointer-events: none;
}

.scene-cloud-a {
  animation: cloud-drift-a 60s linear infinite;
}

.scene-cloud-b {
  animation: cloud-drift-b 80s linear infinite;
}

.scene-palms {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: palm-sway 9s ease-in-out infinite;
}

.scene-gulls {
  animation: gull-drift 32s linear infinite;
}

.scene-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

@keyframes sun-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  50%       { transform: translate(-50%, -50%) scale(1.06); opacity: 0.88; }
}

@keyframes cloud-drift-a {
  from { transform: translateX(0); }
  to   { transform: translateX(1600px); }
}

@keyframes cloud-drift-b {
  from { transform: translateX(-400px); }
  to   { transform: translateX(1600px); }
}

@keyframes palm-sway {
  0%, 100% { transform: rotate(0deg); }
  35%       { transform: rotate(1.2deg); }
  65%       { transform: rotate(-0.8deg); }
}

@keyframes gull-drift {
  from { transform: translateX(-320px); }
  to   { transform: translateX(1800px); }
}
