/* ============================================================
   Sweat Match — Liquid I.V.® kiosk game
   Palette verified from Liquid I.V. Evergreen Vis ID brand file.
   ============================================================ */

/* ---------- fonts (self-hosted; swap in when files arrive) ----------
   Chromatic Pro = display / headline / body voice.
   GT Pressura Mono = the "Hydrascience" technical voice
   (token labels, HUD stats, timer, multiplier badge, staff panel).
   Until the licensed WOFF2 files land in /assets/fonts/, the
   @font-face blocks below stay commented and the fallback stacks
   in --font-display / --font-mono are used. */

/*
@font-face {
  font-family: "Chromatic Pro";
  src: url("../assets/fonts/ChromaticPro-Geometric-Semibold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Chromatic Pro";
  src: url("../assets/fonts/ChromaticPro-Geometric-Bold.woff2") format("woff2");
  font-weight: 700 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Chromatic Pro";
  src: url("../assets/fonts/ChromaticPro-Grotesque-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Chromatic Pro";
  src: url("../assets/fonts/ChromaticPro-Grotesque-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "GT Pressura Mono";
  src: url("../assets/fonts/GTPressuraMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
*/

:root {
  --blue: #0077C8;       /* Liquid I.V. Blue, PMS 3005 (verified from brand file) */
  --blue-deep: #09344D;  /* Dark Blue, PMS 3035 */
  --blue-light: #00A9E0; /* Light Blue, PMS 2995 */
  --navy: #003F6A;       /* Navy, PMS 3025 */
  --lime: #C7FF41;       /* Neon Green, PMS 375 */
  --lime-hot: #C7FF41;
  --teal: #00A9E0;
  --white: #FFFFFF;
  --cream: #FFFDF5;      /* Off White */

  /* Chromatic Pro roles fall back to this stack until webfonts arrive. */
  --font-display: "Chromatic Pro", "Helvetica Neue", -apple-system, Arial, sans-serif;
  /* GT Pressura Mono (technical layer) fallback per spec. */
  --font-mono: "GT Pressura Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--blue);
  font-family: var(--font-display);
  color: var(--white);
  touch-action: manipulation;
  overscroll-behavior: none;   /* kill iOS rubber-band scrolling */
}
#game {
  position: fixed; inset: 0;
  background: var(--blue);
  touch-action: none;
  overflow: hidden;
}

/* lime squiggle — the site's signature vertical wave */
#squiggle {
  position: absolute; top: -5%; right: 18%;
  height: 110%; width: 60px;
  pointer-events: none; z-index: 1; opacity: .9;
  animation: sway 7s ease-in-out infinite;
}
@keyframes sway { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- brand backdrops ---------- */
/* glucose-molecule wireframe: subtle large-scale attract backdrop */
#wireframe {
  position: absolute; top: 50%; left: 50%;
  width: min(120vh, 130vw); height: auto;
  transform: translate(-50%, -50%);
  opacity: .06; z-index: 0; pointer-events: none;
  display: none;
}
#wireframe.on { display: block; }
/* halftone radial texture: blown-up, cropped — never full-bleed */
#halftone {
  position: absolute; bottom: -14%; left: 50%;
  width: min(760px, 92vw); height: auto;
  transform: translateX(-50%);
  opacity: .16; z-index: 4; pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- brand tokens ---------- */
.tok {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);   /* technical "Hydrascience" voice */
  font-weight: 700; letter-spacing: .02em;
  line-height: 1;
  background-size: cover; background-position: center;
}
.tok.circle-solid {   /* H2O — solid white circle, blue text */
  background: var(--white); color: var(--blue);
  border-radius: 50%;
}
.tok.circle-line {    /* GLC, Na+ — outlined circle */
  background: transparent; color: var(--white);
  border: 3px solid var(--white); border-radius: 50%;
}
.tok.square-line {    /* A, AA — outlined rounded square */
  background: transparent; color: var(--white);
  border: 3px solid var(--white); border-radius: 12px;
}
.tok.lime { border-color: var(--lime); color: var(--lime); }
/* when a token is backed by an image asset, hide its text + chrome */
.tok.has-img { border: none !important; background-color: transparent; color: transparent; }

/* drifting tokens inside capsules — the site's box motion */
.drift { animation: drift var(--dur, 3.4s) ease-in-out infinite; }
@keyframes drift { 0%,100% { transform: translateX(calc(var(--amp, 14px) * -1)); } 50% { transform: translateX(var(--amp, 14px)); } }

.capsule {
  border: 3px solid var(--white);
  border-radius: 22px;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  overflow: hidden;
}

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  text-align: center;
  z-index: 30; padding: 24px;
}
.screen.on { display: flex; }
.stageTag {
  font-family: var(--font-mono);
  font-size: clamp(40px, 8vw, 72px); font-weight: 800;
  color: var(--lime); line-height: 1; letter-spacing: -0.01em;
}
.wordmark {
  height: clamp(20px, 3vw, 30px); width: auto;
  margin: 10px 0 2px; opacity: .95;
}
.brandMark {
  position: absolute; top: 22px; right: 24px;
  width: clamp(34px, 5vw, 52px); height: auto;
  opacity: .85; pointer-events: none; z-index: 31;
}
h1 {
  font-size: clamp(32px, 6.6vw, 58px); font-weight: 800;
  line-height: 0.9; letter-spacing: .01em; text-transform: uppercase;
  margin-top: 6px;
}
.sub {
  margin-top: 16px; font-size: clamp(14px, 2.3vw, 19px);
  color: var(--cream);
  max-width: 44ch; line-height: 1.2; font-weight: 400;
}
.sub .hl { color: var(--lime); font-weight: 700; }

/* attract recipe rows — miniature of the site's absorption diagram */
#recipes { margin-top: 26px; display: grid; gap: 12px; width: min(560px, 92vw); }
.recipeRow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.recipeRow .rLbl {
  text-align: left; font-size: clamp(11px, 1.7vw, 14px); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; line-height: 1.35;
}
.recipeRow .rLbl .speed { display: block; color: var(--lime); font-size: .85em; letter-spacing: .1em; font-family: var(--font-mono); }
.recipeRow .capsule { justify-content: center; min-width: 200px; }
.recipeRow .tok { width: 38px; height: 38px; font-size: 12px; }

.cta {
  margin-top: 30px;
  font-size: clamp(15px, 2.3vw, 19px); font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue);
  background: var(--lime);
  padding: 16px 44px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: max(12px, env(safe-area-inset-top)) 18px 8px;
  display: none;
  align-items: center; justify-content: space-between; gap: 14px;
  z-index: 20; pointer-events: none;
}
#hud.show { display: flex; }
#hydroBlock { flex: 1; max-width: 380px; }
#hydroBlock .lbl {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.6vw, 13px); font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: 6px; display: flex; justify-content: space-between;
}
#hydroBar {
  height: 22px; border-radius: 999px;
  border: 3px solid var(--white);
  overflow: hidden; background: rgba(255,255,255,0.1);
}
#hydroFill {
  height: 100%; width: 0%;
  background: var(--lime);
  border-radius: 999px; transition: width .25s;
}
#multBadge {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 3px solid var(--lime); border-radius: 18px;
  padding: 8px 18px; min-width: 130px;
}
#multBadge .big { font-family: var(--font-mono); font-size: clamp(22px, 4vw, 34px); font-weight: 800; color: var(--lime); font-variant-numeric: tabular-nums; line-height: 1; }
#multBadge .sm { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--cream); }
#multBadge.maxed { background: var(--lime); }
#multBadge.maxed .big { color: var(--blue); }
#multBadge.maxed .sm { color: var(--blue); }
#clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 3.4vw, 30px); font-weight: 800;
  border: 3px solid var(--white);
  padding: 8px 18px; border-radius: 999px;
}

/* ---------- play field ---------- */
#field { position: absolute; inset: 0; z-index: 5; }
/* Play-only elements: hidden on attract/results so the character and
   catcher never overlap the title or score in 4:3 iPad landscape.
   #game gets the .playing class during count-in + play. */
#runner, #catcher, #halftone { display: none; }
#game.playing #runner { display: block; }
#game.playing #catcher { display: flex; }
#game.playing #halftone { display: block; }
#runner {
  position: absolute; top: 12%; left: 50%;
  width: clamp(76px, 11vw, 110px);
  transform: translateX(-50%);
  z-index: 6; pointer-events: none;
}
#runner svg { width: 100%; animation: jog .55s ease-in-out infinite; }
@keyframes jog { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }

.fall {
  position: absolute; z-index: 7;
  width: 54px; height: 54px; margin-left: -27px;
  font-size: 15px;
  pointer-events: none;
}
#catcher {
  position: absolute; z-index: 8;
  width: 190px; height: 88px; margin-left: -95px;
  border: 4px solid var(--white);
  border-radius: 26px;
  background: rgba(9, 52, 77, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  /* display is controlled by the .playing rule above so the catcher
     is hidden on attract/results and shown only during count-in/play. */
  align-items: center; justify-content: center; gap: 8px;
  pointer-events: none;
  overflow: hidden;
}
#catcher .tok { width: 34px; height: 34px; font-size: 11px; flex: none; }
.pop {
  position: absolute; z-index: 9; pointer-events: none;
  font-family: var(--font-mono);
  font-weight: 800; font-size: clamp(16px, 2.6vw, 22px);
  color: var(--lime);
  animation: popUp .8s ease-out forwards;
  white-space: nowrap;
}
@keyframes popUp { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-52px) scale(1.2); } }
#teachBanner {
  position: absolute; top: 33%; left: 50%; transform: translateX(-50%);
  background: var(--lime); color: var(--blue);
  font-weight: 800; font-size: clamp(13px, 2.2vw, 18px);
  letter-spacing: .02em;
  padding: 12px 26px; border-radius: 999px;
  opacity: 0; transition: opacity .3s; z-index: 25;
  max-width: 92vw; text-align: center;
}
#teachBanner.show { opacity: 1; }

/* ---------- how-to-play modal (shown before each round) ---------- */
#howto {
  position: absolute; inset: 0; z-index: 60;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 63, 106, 0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}
#howto.on { display: flex; }
#howtoCard {
  background: var(--blue-deep);
  border: 3px solid var(--white);
  border-radius: 24px;
  padding: 26px 30px 30px;
  width: min(460px, 92vw);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
#howtoCard h3 {
  font-size: clamp(20px, 4vw, 30px); font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; line-height: 1;
}
#howtoText {
  font-size: clamp(13px, 2.2vw, 16px); font-weight: 400;
  color: var(--cream); line-height: 1.35; max-width: 34ch;
}
#howtoText .hl { color: var(--lime); font-weight: 700; }
#howto .cta { margin-top: 18px; }

/* animated demo: capsule slides, drops fall in */
#howtoAnim {
  position: relative; width: 260px; height: 140px; margin: 6px auto 2px;
  overflow: hidden; border-radius: 16px;
  background: rgba(0, 169, 224, 0.12);
}
.ha-catcher {
  position: absolute; left: 50%; bottom: 20px; width: 84px; height: 30px;
  margin-left: -42px;
  border: 3px solid var(--white); border-radius: 12px;
  background: rgba(9, 52, 77, 0.4);
  animation: ha-slide 2.8s ease-in-out infinite;
}
.ha-finger {
  position: absolute; left: 50%; bottom: -13px; width: 14px; height: 14px;
  margin-left: -7px; border-radius: 50%;
  background: rgba(199, 255, 65, 0.55); border: 2px solid var(--lime);
}
@keyframes ha-slide { 0%,100% { transform: translateX(-52px); } 50% { transform: translateX(52px); } }
.ha-drop {
  position: absolute; top: -32px; width: 30px; height: 30px; font-size: 10px;
  animation: ha-fall 2.8s ease-in infinite;
}
.ha-d1 { left: 26px; animation-delay: 0s; }
.ha-d2 { left: 50%; margin-left: -15px; animation-delay: 1.4s; }
.ha-d3 { right: 26px; animation-delay: 0.7s; }
@keyframes ha-fall {
  0%   { top: -32px; opacity: 0; }
  8%   { opacity: 1; }
  32%  { top: 88px; opacity: 1; }
  40%  { top: 88px; opacity: 0; }      /* "caught" — fade at the capsule */
  100% { top: 88px; opacity: 0; }
}

/* ---------- results ---------- */
#results .score-big {
  font-family: var(--font-mono);
  font-size: clamp(56px, 12vw, 110px); font-weight: 800;
  color: var(--lime); line-height: 1;
}
#results .score-lbl {
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.8vw, 14px); font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--cream); margin-top: 8px;
}
#verdict { margin-top: 18px; font-size: clamp(18px, 3.2vw, 26px); font-weight: 800; max-width: 26ch; line-height: 1.25; text-transform: uppercase; letter-spacing: .02em; }
#lesson {
  margin-top: 12px; font-size: clamp(13px, 2.2vw, 17px);
  color: var(--lime); font-weight: 700; max-width: 44ch; line-height: 1.5;
}
#blendWrap { margin-top: 22px; }
#blendCols { display: flex; gap: 22px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.blendCol { display: flex; flex-direction: column; align-items: center; }
#blendWrap .bLbl { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--cream); margin-bottom: 8px; }
.blendCol #idealLbl { color: var(--lime); }
#blendBox, #idealBox { justify-content: center; min-height: 70px; max-width: 46vw; flex-wrap: wrap; }
#idealBox { border-style: dashed; opacity: .92; }
#blendBox .tok, #idealBox .tok { width: 42px; height: 42px; font-size: 12px; position: relative; }
#blendMatch {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: clamp(12px, 2vw, 16px); font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--lime);
}
#blendMatch .pct { font-size: 1.15em; }
#blendMatch .tip {
  display: block; margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.7vw, 13px); font-weight: 400;
  letter-spacing: normal; text-transform: none;
  color: var(--cream); max-width: 40ch; margin-left: auto; margin-right: auto;
  line-height: 1.3;
}
#blendBox .cnt {
  position: absolute; top: -8px; right: -8px;
  background: var(--lime); color: var(--blue);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.footnote {
  position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; font-size: 10px; font-weight: 600;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: auto; z-index: 40;
}
/* Hide the copyright footer during play so it doesn't collide with the
   bottom play hint. It stays visible (and 5-tap-able) on attract/results. */
#game.playing .footnote { display: none; }
#results .footspace { height: 26px; }

/* ---------- local stats (device-only) ---------- */
#todayLine {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.8vw, 14px); font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--lime);
}
#statsPanel {
  position: absolute; inset: 0; z-index: 90;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 63, 106, 0.85); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}
#statsPanel.on { display: flex; }
#statsCard {
  background: var(--blue-deep);
  border: 3px solid var(--white);
  border-radius: 22px;
  padding: 28px;
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex; flex-direction: column; gap: 14px;
}
#statsCard h4 {
  font-size: clamp(16px, 3vw, 22px); font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
#statsCard .note { font-size: 11px; color: var(--cream); font-weight: 400; line-height: 1.4; }
#statsRows { overflow-y: auto; display: grid; gap: 8px; }
.statRow {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.8vw, 14px); font-weight: 700;
}
.statRow .d { letter-spacing: .06em; }
.statRow .v { color: var(--lime); font-variant-numeric: tabular-nums; text-align: right; }
#statsBtns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#statsBtns button {
  font-family: inherit;
  font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 18px; border-radius: 999px; border: 3px solid var(--white);
  background: transparent; color: var(--white);
}
#statsBtns button.primary { background: var(--lime); border-color: var(--lime); color: var(--blue); }

#countIn {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(90px, 20vw, 180px); font-weight: 800;
  color: var(--lime); z-index: 50;
  pointer-events: none;
}
