/* =====================================================================
   HANKY DROP — THE GAME   ·   style.css

   1. COLOURS & FONTS  ← change these and the whole game updates
      (the game reads the --c-* colours below for the canvas too, so
       there is only ONE place to edit a colour.)
   2. Page lock (no scrolling while you play)
   3. Playfield + score bar
   4. Menus (start / paused / game over)
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. COLOURS & FONTS
   --------------------------------------------------------------------- */
:root {
  /* Brand */
  --c-ink: #223349;          /* main dark navy: text, outlines */
  --c-ink-soft: #4a5a70;     /* secondary text */
  --c-cream: #fcf5ea;        /* background top */
  --c-rose: #f5ded4;         /* background bottom */
  --c-clay: #e8b8a8;         /* accent */
  --c-label: #8c6f63;        /* small uppercase labels */

  /* Things that fall */
  --c-hanky: #edaea3;        /* the hanky pink (from the logo) — used for effects; the hanky itself is assets/hanky.png */
  --c-gold: #f6c944;         /* golden hanky + sparkles */
  --c-gold-edge: #b8912f;
  --c-flag: #e0483f;         /* red-flag red */

  /* Power-ups */
  --c-shield: #4aa3ff;       /* "Boundaries" */
  --c-magnet: #c26bff;       /* "Chemistry" */
  --c-slow: #3fd6a4;         /* "Take your time" */
  --c-life: #ff5c7a;         /* extra life */

  /* The bucket */
  --c-bucket: #2b4263;
  --c-bucket-light: #4a6a99;
  --c-bucket-rim: #3a5578;

  /* UI bits */
  --c-heart: #ff5c7a;
  --c-good: #2e9d6f;

  /* Fonts — system fonts so it loads instantly anywhere. If your site already loads
     Playfair Display / DM Sans they're used; otherwise Georgia / the phone's own font. */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------------
   2. PAGE LOCK — nothing scrolls, zooms or pulls-to-refresh while playing
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #17212f;                 /* shows either side of the playfield on wide screens */
  font-family: var(--font-body);
  color: var(--c-ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------
   3. PLAYFIELD + SCORE BAR
   --------------------------------------------------------------------- */
.stage {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 560px;                    /* on desktop the game stays a phone-shaped column */
  height: 100vh;
  height: 100dvh;                      /* the visible height on phones (ignores the URL bar) */
  overflow: hidden;
  background: var(--c-cream);
  touch-action: none;
  cursor: none;
}
.stage.is-menu { cursor: default; }

#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* glass "pill" used by the score bar */
.pill {
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 14px rgba(34, 51, 73, 0.1);
  border-radius: 99px;
}

.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(10px, env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
  color: var(--c-ink);
  transition: color 0.6s;
}
.hud-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; }
.hud-lives { justify-self: start; display: flex; gap: 3px; padding: 6px 10px; font-size: 18px; line-height: 1; }
.hud-heart { display: block; width: 20px; height: 20px; transition: transform 0.25s, filter 0.25s, opacity 0.25s; }
.hud-heart svg { width: 100%; height: 100%; display: block; }
.hud-heart.is-lost { filter: grayscale(1); opacity: 0.25; transform: scale(0.75); }
.hud-heart.is-new { animation: heartpop 0.5s ease-out; }
@keyframes heartpop { 40% { transform: scale(1.6); } }
.hud-score { text-align: center; position: relative; }
.hud-score-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 50px;
  line-height: 0.95;
  font-variant-numeric: lining-nums tabular-nums;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.hud-score-num.is-bump { animation: bump 0.2s ease-out; }
@keyframes bump { 50% { transform: scale(1.22); } }
.hud-mult {
  position: absolute;
  left: 100%; top: 4px; margin-left: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--c-ink);
  color: var(--c-gold);
  font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
  box-shadow: 0 3px 10px rgba(34, 51, 73, 0.3);
  animation: multpulse 0.9s ease-in-out infinite;
}
@keyframes multpulse { 50% { transform: scale(1.12); } }
.hud-best { justify-self: end; padding: 5px 12px; margin-right: 40px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-label); text-align: right; }
.hud-best b { display: block; font-family: var(--font-display); font-size: 17px; letter-spacing: 0; color: var(--c-ink); font-variant-numeric: lining-nums; line-height: 1.05; }

.hud-next { margin: 8px auto 0; width: min(260px, 66%); text-align: center; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-ink-soft); }
.hud-bar { margin-top: 4px; height: 7px; border-radius: 99px; background: rgba(34, 51, 73, 0.14); overflow: hidden; }
.hud-bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--c-hanky), var(--c-flag)); transition: width 0.25s ease-out; }
.hud-bar--thin { height: 4px; }
.hud-bar--thin > i { background: linear-gradient(90deg, var(--c-gold), #ff9f43); }
.hud-streak { margin: 8px auto 0; width: min(150px, 40%); text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-ink-soft); }
.hud-streak span { font-family: var(--font-display); font-size: 16px; color: var(--c-ink); }

/* running power-ups */
.hud-powers { display: flex; justify-content: center; gap: 8px; margin-top: 10px; min-height: 30px; }
.power-chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.7); border: 2px solid var(--chip, var(--c-ink)); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; box-shadow: 0 4px 12px rgba(34, 51, 73, 0.12); animation: chipin 0.3s ease-out; }
.power-chip i { width: 20px; height: 20px; border-radius: 50%; background: var(--chip); display: block; }
.power-chip .bar { width: 32px; height: 4px; border-radius: 4px; background: rgba(34, 51, 73, 0.15); overflow: hidden; }
.power-chip .bar b { display: block; height: 100%; background: var(--chip); }
@keyframes chipin { from { transform: scale(0.6); opacity: 0; } }

/* when the world turns to night (100+ points) the score bar flips to light text */
.stage.is-night .hud { color: #fff; }
.stage.is-night .hud-score-num { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.stage.is-night .hud-next, .stage.is-night .hud-streak { color: rgba(255, 255, 255, 0.8); }
.stage.is-night .hud-streak span { color: #fff; }
.stage.is-night .pill { background: rgba(23, 33, 47, 0.45); border-color: rgba(255, 255, 255, 0.18); }
.stage.is-night .hud-best b { color: #fff; }
.stage.is-night .hud-best { color: rgba(255, 255, 255, 0.7); }
.stage.is-night .hud-bar { background: rgba(255, 255, 255, 0.2); }

/* sound button */
.icon-btn {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 30;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--c-ink); display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: 0 4px 14px rgba(34, 51, 73, 0.12);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ico-off { display: none; }
.icon-btn[aria-pressed="true"] .ico-on { display: none; }
.icon-btn[aria-pressed="true"] .ico-off { display: block; }
.icon-btn:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }
.stage.is-night .icon-btn { color: #fff; background: rgba(23, 33, 47, 0.45); border-color: rgba(255, 255, 255, 0.18); }
.stage:not(.is-menu) .icon-btn { cursor: pointer; }

/* 3-2-1-GO */
.countdown {
  position: absolute; left: 0; right: 0; top: 34%;
  text-align: center; pointer-events: none;
  font-family: var(--font-display); font-weight: 800; font-size: 96px; color: var(--c-ink);
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.7), 0 10px 30px rgba(34, 51, 73, 0.25);
}
.countdown.pop { animation: cdpop 0.35s ease-out; }
@keyframes cdpop { 0% { transform: scale(0.4); opacity: 0; } 50% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

/* a faint strip at the bottom that tells thumbs where to drag */
.control-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(min(150px, 20%) + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(34, 51, 73, 0.55);
  background: linear-gradient(0deg, rgba(34, 51, 73, 0.1), rgba(34, 51, 73, 0));
  pointer-events: none; transition: opacity 0.6s;
}
.control-hint.is-gone { opacity: 0; }

/* ---------------------------------------------------------------------
   4. MENUS
   --------------------------------------------------------------------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 12px;
  padding: max(26px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  text-align: center;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.55), rgba(252, 245, 234, 0.92) 60%), rgba(252, 245, 234, 0.88);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  overflow-y: auto;                     /* only the menus may scroll */
  touch-action: pan-y pinch-zoom;       /* menus scroll and can be pinched bigger; the playfield (touch-action: none) can not */
  -webkit-user-select: text; user-select: text;
  animation: fadein 0.3s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.screen > * { max-width: 100%; flex-shrink: 0; }       /* never squash a button when a menu is taller than the screen — it scrolls instead */
/* centre the menu when it fits; when it doesn't (small phones / landscape) let it scroll from the top */
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }

.mascot { width: min(210px, 52vw); height: auto; animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 12px 18px rgba(34, 51, 73, 0.18)); }
@keyframes float { 50% { transform: translateY(-8px) rotate(-2deg); } }

.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-label); }
.title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(44px, 14vw, 66px); line-height: 0.95; color: var(--c-ink); }
.title--sm { font-size: 44px; }
.tagline { margin: 0; max-width: 19em; font-size: 17px; line-height: 1.35; color: var(--c-ink-soft); }

.btn {
  appearance: none; border: 0; cursor: pointer;
  font: 800 17px/1 var(--font-body);
  padding: 16px 34px; border-radius: 99px;
  background: var(--c-ink); color: var(--c-cream);
  box-shadow: 0 6px 0 #16233a, 0 14px 26px rgba(34, 51, 73, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #16233a, 0 6px 12px rgba(34, 51, 73, 0.2); }
.btn:focus-visible, .input:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 3px; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--big {
  font-size: 22px; padding: 18px 52px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #ff7a8a, var(--c-flag));
  box-shadow: 0 7px 0 #a82f29, 0 16px 28px rgba(224, 72, 63, 0.4);
  animation: pulse 1.8s ease-in-out infinite;
  color: #fff;
}
.btn--big::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent); animation: shine 3.2s ease-in-out infinite; }
.btn--big:active { box-shadow: 0 2px 0 #a82f29, 0 6px 12px rgba(224, 72, 63, 0.3); }
@keyframes pulse { 50% { transform: scale(1.04); } }
@keyframes shine { 60%, 100% { left: 130%; } }
#btnAgain { margin-bottom: 14px; }                    /* room for its shadow so "Challenge a friend" never touches it */
.btn--ghost { background: transparent; color: var(--c-ink); box-shadow: none; border: 2px solid rgba(34, 51, 73, 0.25); padding: 12px 22px; font-size: 14px; }
.btn--ghost:active { transform: none; box-shadow: none; background: rgba(34, 51, 73, 0.06); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* how-to-play legend */
.legend { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 8px; width: min(350px, 100%); text-align: left; }
.legend li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.legend b { font-weight: 800; }
.legend-ico { flex: 0 0 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #fff; box-shadow: 0 3px 10px rgba(34, 51, 73, 0.1); font-size: 22px; }
.legend-ico img { width: 32px; height: auto; }
.legend small { display: block; font-weight: 500; font-size: 12.5px; color: var(--c-ink-soft); }

/* reward ladder */
.ladder { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 2px 0 0; padding: 0; list-style: none; }
.ladder li { padding: 8px 12px; border-radius: 14px; background: var(--c-ink); color: var(--c-cream); font-size: 12.5px; font-weight: 800; line-height: 1.2; min-width: 86px; }
.ladder li b { display: block; font-family: var(--font-display); font-size: 18px; color: var(--c-gold); font-variant-numeric: lining-nums; }
.ladder li.is-won { background: var(--c-good); }
.ladder li.is-won b { color: #fff; }
.ladder li.is-locked { opacity: 0.5; }

.meta-line { margin: 0; font-size: 13px; font-weight: 800; color: var(--c-label); letter-spacing: 0.03em; }
.meta-line b { color: var(--c-ink); font-family: var(--font-display); font-size: 17px; }
.foot { margin: 4px 0 0; font-size: 12px; color: var(--c-label); }

/* game over */
.rank { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 9vw, 40px); line-height: 1; color: var(--c-flag); }
.over-score { margin: 0; font-family: var(--font-display); font-size: clamp(76px, 25vw, 112px); font-weight: 800; line-height: 0.9; color: var(--c-ink); font-variant-numeric: lining-nums; }
.badge { display: inline-block; padding: 6px 14px; border-radius: 99px; background: linear-gradient(90deg, var(--c-gold), #ff9f43); color: var(--c-ink); font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; animation: pulse 1.2s ease-in-out infinite; }
.stats { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: min(360px, 100%); }
.stats div { padding: 8px 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.7); }
.stats dt { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-label); }
.stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 22px; font-weight: 800; font-variant-numeric: lining-nums; }
.nudge { margin: 0; max-width: 20em; font-size: 15px; font-weight: 700; color: var(--c-ink); }
.nudge b { color: var(--c-flag); }
.nudge--soft { font-weight: 500; font-size: 14px; color: var(--c-ink-soft); }

.reward-card { width: min(360px, 100%); padding: 18px 18px 16px; border-radius: 22px; background: #fff; box-shadow: 0 12px 34px rgba(34, 51, 73, 0.14); display: grid; gap: 10px; }
.reward-card h2 { margin: 0; font-family: var(--font-display); font-size: 25px; line-height: 1.1; }
.reward-card p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--c-ink-soft); }
.claim-form { display: grid; gap: 10px; text-align: left; }
.input { width: 100%; font: 500 16px var(--font-body); padding: 14px 16px; border-radius: 14px; border: 2px solid rgba(34, 51, 73, 0.2); background: #fff; color: var(--c-ink); -webkit-user-select: text; user-select: text; }
.consent { font-size: 12px !important; }
.form-error { margin: 0; font-size: 13px; font-weight: 800; color: var(--c-flag); }
.code-box { padding: 14px; border-radius: 14px; background: var(--c-cream); font-family: var(--font-display); font-size: 26px; letter-spacing: 0.08em; font-weight: 800; word-break: break-all; }
.demo-note { font-size: 12px !important; font-style: italic; }
.honey { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
a.btn { display: inline-block; text-decoration: none; text-align: center; }
#claimDone { display: grid; gap: 12px; }
.consent a { color: inherit; text-decoration: underline; }
.reward-card .btn { width: 100%; }
.reward-card .code-box + .btn { margin-top: 2px; }
/* the "go and find the real thing" nudge under every game over */
.irl { width: min(360px, 100%); display: grid; gap: 10px; justify-items: center; padding: 14px 16px 16px; border-radius: 18px; background: rgba(34, 51, 73, 0.07); }
.irl p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--c-ink); }
.irl .btn { padding: 11px 22px; }

/* short screens (small phones / landscape): tighten everything so more fits */
@media (max-height: 700px) {
  .screen { gap: 8px; padding-top: 14px; padding-bottom: 14px; }
  .mascot { width: min(130px, 36vw); }
  .title { font-size: clamp(34px, 10vw, 50px); }
  .tagline { font-size: 15px; }
  .over-score { font-size: 64px; }
  .legend { gap: 5px; }
  .legend-ico { flex-basis: 34px; height: 34px; }
  .btn--big { font-size: 19px; padding: 14px 44px; }
}

/* respect "reduce motion" settings */
@media (prefers-reduced-motion: reduce) {
  .screen, .mascot, .btn--big, .btn--big::after, .badge, .hud-mult, .power-chip, .countdown.pop { animation: none !important; }
}

/* The "about" text under the start screen: quiet, but real words and links. */
.about { max-width: 24em; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(34, 51, 73, 0.12); text-align: center; }
.about h2 { margin: 0 0 6px; font: 800 12px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-ink-soft); }
.about p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: var(--c-ink-soft); }
.about a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 2px; }

/* "Share to your story" on the game-over screen (Growth Stage 4) */
.share-box { margin: 14px 0 6px; padding: 14px 14px 12px; border-radius: 16px; background: rgba(232, 184, 168, 0.18); text-align: center; flex-shrink: 0; }
.share-box__line { margin: 0 0 10px; font-size: 14px; line-height: 1.45; }

/* shown on the start screen once a game controller has been picked up */
.pad-note { margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(34, 51, 73, 0.08); font-size: 13px; font-weight: 700; color: var(--c-ink); }
