@font-face { font-family: 'Fredoka'; src: url(../assets/fredoka-500.woff2) format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../assets/fredoka-700.woff2) format('woff2'); font-weight: 600 700; font-display: swap; }

:root {
  --orange: #FF5722;
  --orange-dk: #c9401a;
  --cream: #fff7ea;
  --cream-2: #f6e3c6;
  --brown: #5a3424;
  --brown-2: #8a5a3c;
  --ink: #3d2418;
  --green: #4f8a43;
  --gold: #f2b134;
  --linkedin: #0a66c2;
  --font: 'Fredoka', ui-rounded, 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #3a2218;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}
#game text { font-family: var(--font); }
#game .emoji { font-family: var(--emoji); }

/* The frame matches the SVG viewBox (720x1200) so HTML overlays line up with the art. */
#frame {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, 60vh);
  width: min(100vw, 60dvh);
  aspect-ratio: 3 / 5;
  container-type: inline-size;
  pointer-events: none;
}

/* ---------- Screens & cards ---------- */
.screen {
  position: absolute;
  inset: 0;
  /* On tall phones the frame is shorter than the screen: let overlays use the full height. */
  top: min(0px, calc((100cqw * 5 / 3 - 100dvh) / 2 + env(safe-area-inset-top, 0px)));
  bottom: min(0px, calc((100cqw * 5 / 3 - 100dvh) / 2 + env(safe-area-inset-bottom, 0px)));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4cqw;
  pointer-events: auto;
  animation: fadeIn .35s ease-out;
}
.screen[hidden] { display: none !important; }

.card {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  background: var(--cream);
  border: 1cqw solid var(--cream-2);
  border-radius: 6cqw;
  box-shadow: 0 2cqw 0 rgba(58, 34, 24, .35), 0 4cqw 10cqw rgba(0, 0, 0, .35);
  padding: 6cqw 6cqw;
  text-align: center;
  animation: popIn .45s cubic-bezier(.2, 1.4, .4, 1);
  scrollbar-width: thin;
}

.kicker {
  margin: 0 0 1.5cqw;
  font-size: 3.4cqw;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--orange-dk);
  font-weight: 600;
}
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--brown); line-height: 1.05; }
h1 { font-size: 14cqw; margin: 1cqw 0 3cqw; }
h2 { font-size: 7.2cqw; margin-bottom: 2cqw; }
h3 { font-size: 5.4cqw; margin: 2cqw 0; }
p { margin: 0; }
.sub { font-size: 4.4cqw; line-height: 1.35; margin-bottom: 5cqw; color: var(--brown-2); }
.small { font-size: 3.3cqw; color: var(--brown-2); margin-top: 3.5cqw; }
.logo { height: 6.5cqw; width: auto; display: block; margin: 0 auto 3cqw; }

#screen-title { align-items: flex-start; padding-top: 6cqw; }
.title-card { padding-top: 6cqw; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 4.6cqw;
  border: 0;
  border-radius: 999px;
  padding: 3cqw 7cqw;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 1.2cqw 0 var(--orange-dk);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .15s;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1cqw); box-shadow: 0 .2cqw 0 var(--orange-dk); }
.btn:focus-visible { outline: .8cqw solid var(--gold); outline-offset: .8cqw; }
.btn.big { font-size: 5.6cqw; padding: 3.6cqw 9cqw; }
.btn.secondary { background: #fff; color: var(--brown); box-shadow: 0 1.2cqw 0 #d9c3a2; border: .5cqw solid #ead7b8; }
.btn.secondary:active { box-shadow: 0 .2cqw 0 #d9c3a2; }
.btn.linkedin { background: var(--linkedin); box-shadow: 0 1.2cqw 0 #084d93; width: 100%; }
.btn.linkedin:active { box-shadow: 0 .2cqw 0 #084d93; }

.mute {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid var(--cream-2);
  background: var(--cream);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  touch-action: manipulation;
}

/* ---------- Dialog (grandma) ---------- */
.dlg-body { display: flex; align-items: center; gap: 3cqw; margin: 2cqw 0 4cqw; text-align: left; }
.dlg-portrait { flex: 0 0 30cqw; }
.dlg-portrait svg { width: 100%; height: auto; display: block; }
.speech {
  position: relative;
  flex: 1;
  background: #fff;
  border: .6cqw solid #ead7b8;
  border-radius: 4cqw;
  padding: 3.2cqw 3.6cqw;
  font-size: 4.2cqw;
  line-height: 1.35;
  color: var(--ink);
}
.speech::before {
  content: '';
  position: absolute;
  left: -2.6cqw;
  top: 40%;
  border: 1.4cqw solid transparent;
  border-right: 1.6cqw solid #ead7b8;
}
.speech small { display: block; margin-top: 1.5cqw; font-size: 3.3cqw; color: var(--brown-2); }

#dlg-extra:empty { display: none; }
#dlg-extra { margin-bottom: 4cqw; }

.hint {
  display: inline-flex;
  align-items: center;
  gap: 2.5cqw;
  background: var(--cream-2);
  border-radius: 999px;
  padding: 1.6cqw 4.5cqw 1.6cqw 2cqw;
  font-size: 4cqw;
  font-weight: 600;
  color: var(--brown);
}
.hint .hand { display: inline-block; font-family: var(--emoji); font-size: 7cqw; }
.hint-rub .hand { animation: rub .45s ease-in-out infinite alternate; }
.hint-trace .hand { animation: trace 1.6s ease-in-out infinite; }
.hint-drag .hand { animation: drag 1.4s ease-in-out infinite; }
.hint-rotate .hand { animation: rotate 1.6s linear infinite; }
.hint-tap .hand { animation: tap .8s ease-in-out infinite; }
.hint-swipe .hand { animation: swipe 1.1s ease-in infinite; }

.stamp {
  display: inline-block;
  font-size: 9cqw;
  font-weight: 700;
  color: #fff;
  padding: 1cqw 6cqw;
  border-radius: 3cqw;
  transform: rotate(-4deg);
  box-shadow: 0 1cqw 0 rgba(0, 0, 0, .2);
  animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1);
}
.stamp-pct { display: block; font-size: 5cqw; color: var(--brown-2); margin-top: 3cqw; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 2.5cqw;
  left: 4cqw;
  right: 4cqw;
  pointer-events: none;
  background: rgba(255, 247, 234, .94);
  border: .6cqw solid var(--cream-2);
  border-radius: 4cqw;
  padding: 2cqw 3.5cqw 2.4cqw;
  box-shadow: 0 1cqw 0 rgba(58, 34, 24, .3);
}
.hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 2cqw; font-size: 4.2cqw; font-weight: 700; color: var(--brown); }
#hud-extra { color: var(--orange-dk); white-space: nowrap; }
.hud-timer { height: 2.2cqw; margin-top: 1.6cqw; background: #ead7b8; border-radius: 99px; overflow: hidden; }
.hud-timer[hidden] { display: none; }
#hud-bar { height: 100%; width: 100%; background: var(--green); border-radius: 99px; transform-origin: left; }
#hud-bar.low { background: var(--orange); }

.bubble {
  position: absolute;
  left: 24cqw;
  bottom: 13cqw;
  max-width: 58cqw;
  background: #fff;
  border: .6cqw solid #ead7b8;
  border-radius: 4cqw;
  padding: 2.2cqw 3.4cqw;
  font-size: 3.9cqw;
  line-height: 1.25;
  pointer-events: none;
  box-shadow: 0 1cqw 0 rgba(58, 34, 24, .25);
  animation: popIn .3s cubic-bezier(.2, 1.4, .4, 1);
}
.bubble::after {
  content: '';
  position: absolute;
  left: -2.6cqw;
  bottom: 3cqw;
  border: 1.4cqw solid transparent;
  border-right: 1.6cqw solid #ead7b8;
}

.flash {
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  text-align: center;
  font-size: 14cqw;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 1.6cqw var(--brown);
  paint-order: stroke fill;
  text-shadow: 0 1.4cqw 0 rgba(58, 34, 24, .45);
  pointer-events: none;
  animation: flash 1s ease-out forwards;
}

/* ---------- Results ---------- */
.results-card { padding-top: 5cqw; }
.res-turkey { width: 62cqw; margin: 0 auto -2cqw; }
.res-turkey svg { width: 100%; height: auto; display: block; }
.res-score { font-size: 17cqw; font-weight: 700; color: var(--orange); line-height: 1; }
.res-score small { display: block; font-size: 3.4cqw; color: var(--brown-2); letter-spacing: .1em; text-transform: uppercase; margin-top: .5cqw; }
#res-title { margin-top: 3cqw; }
.quip { font-size: 4.2cqw; color: var(--brown-2); line-height: 1.35; margin-bottom: 4cqw; }
.res-list { list-style: none; padding: 0; margin: 0 0 5cqw; text-align: left; }
.res-list li { display: grid; grid-template-columns: 1fr 26cqw 11cqw; align-items: center; gap: 2cqw; font-size: 3.7cqw; padding: 1.1cqw 0; }
.res-list .bar { height: 2.4cqw; background: #ead7b8; border-radius: 99px; overflow: hidden; }
.res-list .bar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.res-list b { text-align: right; color: var(--brown); }

.share { display: grid; gap: 3cqw; margin-bottom: 6cqw; }

.thanks {
  background: #fff;
  border: .6cqw dashed #e7c9a0;
  border-radius: 4cqw;
  padding: 5cqw 5cqw 4.5cqw;
  margin-bottom: 5cqw;
}
.thanks .logo { height: 5.5cqw; margin-bottom: 1cqw; }
.thanks p { font-size: 4cqw; line-height: 1.45; color: var(--ink); }
.thanks .sig { margin-top: 2.5cqw; font-weight: 600; color: var(--orange-dk); }
.foot a { color: var(--orange-dk); }

/* ---------- SVG animation helpers ---------- */
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .5s ease-in-out infinite alternate; }
.flame.b { animation-duration: .37s; animation-delay: -.2s; }
.flame.c { animation-duration: .61s; animation-delay: -.1s; }
.glow { animation: glow 1.8s ease-in-out infinite alternate; }
.leaf { transform-box: fill-box; transform-origin: center; animation: leafFall 7s linear infinite; }
.bubble-fx { transform-box: fill-box; transform-origin: center; animation: soap .7s ease-out forwards; }
.float-up { animation: floatUp .9s ease-out forwards; }
.steam { transform-box: fill-box; transform-origin: center bottom; animation: steam 2.4s ease-out infinite; }
.march { animation: march .6s linear infinite; }
.pulse { transform-box: fill-box; transform-origin: center; animation: pulse 1s ease-in-out infinite; }
.drip { animation: drip .6s ease-in forwards; }
.confetti { transform-box: fill-box; transform-origin: center; animation: confetti linear forwards; }
.water { animation: march .35s linear infinite; }

@keyframes flicker { from { transform: scale(1, 1) skewX(-2deg); } to { transform: scale(.92, 1.12) skewX(3deg); } }
@keyframes glow { from { opacity: .75; } to { opacity: 1; } }
@keyframes leafFall { 0% { transform: translate(0, -40px) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(-60px, 300px) rotate(540deg); opacity: 1; } }
@keyframes soap { from { transform: scale(.4); opacity: .95; } to { transform: translateY(-30px) scale(1.25); opacity: 0; } }
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }
@keyframes steam { 0% { transform: translateY(0) scale(.6); opacity: 0; } 30% { opacity: .6; } 100% { transform: translateY(-70px) scale(1.4); opacity: 0; } }
@keyframes march { to { stroke-dashoffset: -26; } }
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes drip { to { transform: translateY(70px); opacity: 0; } }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); } 100% { transform: translate(var(--dx), 1500px) rotate(var(--rot)); } }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }
@keyframes stamp { from { transform: rotate(-4deg) scale(2.2); opacity: 0; } }
@keyframes flash { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.1); opacity: 1; } 35% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
@keyframes rub { from { transform: translateX(-3cqw) rotate(-10deg); } to { transform: translateX(3cqw) rotate(10deg); } }
@keyframes trace { 0% { transform: translate(-3cqw, 1cqw); } 25% { transform: translate(0, -2cqw); } 50% { transform: translate(3cqw, 1cqw); } 75% { transform: translate(0, 2cqw); } 100% { transform: translate(-3cqw, 1cqw); } }
@keyframes drag { 0% { transform: translate(0, -2cqw); } 60%, 100% { transform: translate(3cqw, 2cqw); } }
@keyframes rotate { from { transform: rotate(0) translateX(2cqw) rotate(0); } to { transform: rotate(360deg) translateX(2cqw) rotate(-360deg); } }
@keyframes tap { 50% { transform: scale(.75) translateY(1cqw); } }
@keyframes swipe { 0% { transform: translate(-3cqw, -2cqw); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(3cqw, 2cqw); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .leaf, .glow, .steam, .confetti { animation: none !important; }
  .leaf, .confetti { display: none; }
  .flame { animation-duration: 2s !important; }
}

/* Tall phones: keep cards clear of the mute button. */
@media (max-aspect-ratio: 3/5) {
  .screen, #screen-title { padding-top: calc(env(safe-area-inset-top, 0px) + 66px); }
}
