/* Silly Hurdles (reading): a hurdles race. The sentence sits still on the sign at the top (moving
   words are hard to read); the top half of the screen is JUMP, the bottom half SLIDE. */
.hurdles .hd-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; background: linear-gradient(#7fd0ff, #cdeeff 55%, #e8f7ff);
}
.hurdles button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ---------- the stadium ---------- */
.hurdles .hd-sky { position: absolute; left: 0; right: 0; top: 0; bottom: var(--th); pointer-events: none; }
.hurdles .hd-cloud { position: absolute; width: 120px; height: 34px; background: #fff; border-radius: 999px; opacity: .85; }
.hurdles .hd-cloud::before { content: ''; position: absolute; left: 22px; top: -20px; width: 56px; height: 46px; background: #fff; border-radius: 50%; }
.hurdles .hd-cloud.c1 { left: 8%; top: 34%; }
.hurdles .hd-cloud.c2 { right: 6%; top: 46%; transform: scale(.75); }
.hurdles .hd-stands {
  position: absolute; left: 0; right: 0; bottom: 0; height: clamp(44px, 10vh, 86px); --off: 0px;
  background:
    radial-gradient(circle at 10px 12px, #ff7eb6 0 6px, transparent 7px) var(--off) 4px / 36px 22px,
    radial-gradient(circle at 28px 12px, #ffd23f 0 6px, transparent 7px) var(--off) 4px / 36px 22px,
    radial-gradient(circle at 18px 12px, #59a8ff 0 6px, transparent 7px) calc(var(--off) + 9px) 26px / 36px 22px,
    radial-gradient(circle at 4px 12px, #3ccf7a 0 6px, transparent 7px) calc(var(--off) + 9px) 26px / 36px 22px,
    linear-gradient(#8d84a3, #6f6787);
  border-top: 4px solid var(--ink);
}

/* ---------- the track: his lane in front, the rival's behind ---------- */
.hurdles .hd-track { position: absolute; left: 0; right: 0; bottom: 0; height: var(--th); background: #4cbb4a; border-top: 4px solid var(--ink); --off: 0px; }
.hurdles .hd-lane { position: absolute; left: 0; right: 0; border-top: 4px solid #fff;
  background: repeating-linear-gradient(90deg, transparent 0 116px, rgba(255, 255, 255, .28) 116px 124px) var(--off) 0 / 100% 100%, #d9643a; }
.hurdles .hd-lane.me { bottom: 0; height: calc(var(--gr) - 4px); }
.hurdles .hd-lane.them { bottom: calc(var(--gr) - 4px); height: calc(var(--th) - var(--gr) - 12px); filter: brightness(.93); }
.hurdles .hd-things { position: absolute; inset: 0; pointer-events: none; }
.hurdles .hd-h { position: absolute; left: 0; bottom: var(--gp); width: var(--hw); height: var(--hh); z-index: 3; will-change: transform; }
.hurdles .hd-h.them { bottom: var(--gr); width: calc(var(--hw) * .75); height: calc(var(--hh) * .75); z-index: 1; }
.hurdles .hd-hsvg { display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 80% 100%; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.hurdles .hd-h.down .hd-hsvg { transform: rotate(-62deg) translateY(10%); }
.hurdles .hd-finish { position: absolute; left: 0; bottom: 0; width: 20px; height: calc(var(--th) - 12px); z-index: 2; border: 3px solid var(--ink);
  background: conic-gradient(#fff 0 25%, #222 0 50%, #fff 0 75%, #222 0) 0 0 / 14px 14px; }
.hurdles .hd-finish span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 30px; padding: 0 10px;
  font-weight: 900; font-size: 18px; color: #fff; background: #ff5d73; border: 3px solid var(--ink); border-radius: 10px; white-space: nowrap; }

/* the runner */
.hurdles .hd-runner { position: absolute; left: 0; bottom: var(--gp); width: calc(var(--hr) * .622); height: var(--hr); z-index: 4; transform-origin: 50% 96%; will-change: transform; --step: .3s; }
.hurdles .hd-body { width: 100%; height: 100%; transform-origin: 50% 100%; animation: hd-bob var(--step) ease-in-out infinite alternate; }
.hurdles .hd-body svg { display: block; width: 100%; height: 100%; }
@keyframes hd-bob { from { transform: translateY(0) rotate(5deg); } to { transform: translateY(-7%) rotate(10deg); } }
.hurdles .hd-runner.still .hd-body { animation: none; }
.hurdles .hd-runner.waiting .hd-body { animation: hd-spot .32s ease-in-out infinite alternate; }
@keyframes hd-spot { from { transform: translateY(0); } to { transform: translateY(-5%); } }
.hurdles .hd-runner.jump .hd-body { animation: none; transform: rotate(6deg); }
.hurdles .hd-runner.slide .hd-body { animation: none; }
.hurdles .hd-runner.trip .hd-body { animation: hd-trip 2.2s ease-out forwards; }
@keyframes hd-trip {
  0% { transform: none; } 14% { transform: translateX(18%) rotate(70deg); } 22% { transform: translateX(26%) translateY(4%) rotate(92deg); }
  30% { transform: translateX(26%) translateY(2%) rotate(84deg); } 72% { transform: translateX(26%) translateY(4%) rotate(90deg); }
  88% { transform: translateX(10%) rotate(20deg); } 100% { transform: none; }
}
.hurdles .hd-dizzy { position: absolute; left: 70%; top: 30%; font-size: calc(var(--hr) * .26); opacity: 0; pointer-events: none; }
.hurdles .hd-runner.trip .hd-dizzy { animation: hd-dizzy 2.2s ease-out forwards; }
@keyframes hd-dizzy { 0%, 18% { opacity: 0; transform: rotate(0); } 25%, 75% { opacity: 1; } 50% { transform: translateX(10px) rotate(180deg); } 85%, 100% { opacity: 0; transform: rotate(360deg); } }
.hurdles .hd-runner.cheer .hd-body { animation: hd-cheer .35s ease-in-out infinite alternate; }
@keyframes hd-cheer { from { transform: translateY(0); } to { transform: translateY(-16%); } }
.hurdles .hd-dust { position: absolute; left: -30%; bottom: 0; width: 40%; height: 18%; opacity: 0; border-radius: 50%; background: rgba(255, 240, 220, .8); }
.hurdles .hd-runner.fast .hd-dust { animation: hd-dust .3s linear infinite; }
@keyframes hd-dust { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: translateX(-60%) scale(1.3); } }

/* the rival */
.hurdles .hd-rival { position: absolute; left: 0; bottom: var(--gr); width: var(--rh); height: var(--rh); z-index: 2; will-change: transform; }
.hurdles .hd-rival > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hurdles .hd-rival.moving > svg { animation: hd-gallop .26s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes hd-gallop { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-6%) rotate(3deg); } }
.hurdles .hd-away { position: absolute; bottom: calc(var(--gr) + 8px); z-index: 3; display: none; align-items: center; gap: 4px; padding: 2px 10px;
  font-weight: 900; font-size: 20px; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 999px; }
.hurdles .hd-away.show { display: flex; }
.hurdles .hd-away.right { right: 8px; }
.hurdles .hd-away.left { left: 8px; }

/* ---------- the race meter ---------- */
.hurdles .hd-meter { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(calc(100% - 24px), 760px); height: 40px; z-index: 6;
  display: flex; align-items: center; gap: 22px; pointer-events: none; }
.hurdles .hd-mtrack { position: relative; flex: 1; height: 14px; margin-left: 14px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; }
.hurdles .hd-mtrack i { position: absolute; top: -5px; width: 5px; height: 18px; margin-left: -2px; background: #d9643a; border: 1px solid var(--ink); border-radius: 2px; }
.hurdles .hd-mflag { position: absolute; left: 100%; top: 50%; transform: translate(-30%, -70%); font-size: 26px; }
.hurdles .hd-mme, .hurdles .hd-mthem { position: absolute; left: 0; top: 50%; transition: left .1s linear; }
.hurdles .hd-mme { z-index: 2; width: 34px; height: 34px; transform: translate(-50%, -50%); background: #fff; border: 3px solid var(--ink); border-radius: 50%; overflow: hidden; }
.hurdles .hd-mme svg { display: block; width: 100%; height: 100%; }
.hurdles .hd-mthem { z-index: 1; width: 30px; height: 30px; transform: translate(-50%, -96%); }
.hurdles .hd-mthem svg { display: block; width: 100%; height: 100%; }
.hurdles .hd-place { font-weight: 900; font-size: 18px; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 0 10px; white-space: nowrap; }
.hurdles .hd-place:empty { display: none; }
.hurdles .hd-place.first { background: #ffe27a; }

/* ---------- the sign (the sentence) ---------- */
.hurdles .hd-sign {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 7; width: max-content; max-width: min(calc(100% - 20px), 980px);
  padding: 8px 24px 12px; text-align: center; background: #fffdf6; border: 4px solid var(--ink); border-top: 16px solid var(--c, #ff5d73);
  border-radius: 20px; box-shadow: var(--shadow); opacity: 0; --c: #ff5d73;
}
.hurdles .hd-sign.show { opacity: 1; animation: hd-signin .28s ease-out; }
@keyframes hd-signin { from { transform: translateX(-50%) translateY(-14px) scale(.96); opacity: 0; } }
.hurdles .hd-words { font-size: clamp(30px, 5.2vw, 60px); font-weight: 700; line-height: 1.28; color: var(--ink); word-spacing: .1em; text-wrap: balance; }
.hurdles .hd-sign.sprint .hd-words { font-family: var(--font); font-size: clamp(24px, 3.6vw, 40px); }
.hurdles .hd-sign .w { display: inline-block; border-radius: 10px; padding: 0 2px; }
.hurdles .hd-sign.right .w.key, .hurdles .hd-sign.wrong .w.key { background: #ffe27a; box-shadow: 0 0 0 3px #ffe27a; }
.hurdles .hd-sign.chose-jump, .hurdles .hd-sign.chose-slide { box-shadow: 0 0 0 5px rgba(255, 255, 255, .8), var(--shadow); }
.hurdles .hd-stamp { position: absolute; right: -8px; bottom: -24px; display: none; padding: 1px 12px; font-size: 20px; font-weight: 900; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px; transform: rotate(-4deg); white-space: nowrap; }
.hurdles .hd-sign.right .hd-stamp, .hurdles .hd-sign.wrong .hd-stamp { display: block; animation: hd-pop .3s cubic-bezier(.2, 1.6, .4, 1); }
.hurdles .hd-sign.right .hd-stamp { background: #dcf8e3; }
.hurdles .hd-sign.wrong .hd-stamp { background: #ffe1e3; }
.hurdles .hd-sign.pulse { animation: hd-pulse 1.1s ease-in-out infinite; }
@keyframes hd-pulse { 50% { box-shadow: 0 0 0 8px #ffe27a, var(--shadow); } }
@keyframes hd-pop { from { transform: rotate(-4deg) scale(0); } }

/* ---------- jump / slide: the two halves, and a button for each ---------- */
.hurdles .hd-zone { position: absolute; left: 0; right: 0; height: 50%; z-index: 5; pointer-events: none; }
.hurdles .hd-zone.top { top: 0; border-bottom: 3px dashed rgba(255, 255, 255, .55); }
.hurdles .hd-zone.bottom { bottom: 0; }
.hurdles .hd-zone.top.flash { animation: hd-flash-up .4s ease-out; }
.hurdles .hd-zone.bottom.flash { animation: hd-flash-down .4s ease-out; }
@keyframes hd-flash-up { from { background: rgba(47, 179, 90, .3); } }
@keyframes hd-flash-down { from { background: rgba(255, 138, 31, .3); } }
.hurdles .hd-btn {
  position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); z-index: 8; width: clamp(100px, 12vw, 150px); height: clamp(84px, 13vh, 124px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0;
  font: inherit; color: #fff; border: 4px solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); cursor: pointer; transition: transform .1s;
}
.hurdles .hd-btn.jump { bottom: calc(50% + 6px); background: #2fb35a; }
.hurdles .hd-btn.slide { top: calc(50% + 6px); background: #f07a12; }
.hurdles .hd-btn .hd-arrow { font-size: 26px; line-height: 1; }
.hurdles .hd-btn b { font-size: 25px; font-weight: 900; letter-spacing: 1px; line-height: 1.1; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.hurdles .hd-btn small { font-size: 13px; font-weight: 800; }
.hurdles .hd-btn.pressed { transform: scale(.93); }

/* ---------- the cartoon of the sentence happening ---------- */
.hurdles .hd-toonbox { position: absolute; left: 58%; bottom: calc(var(--th) + 10px); z-index: 9; transform: translateX(-50%) scale(0); transition: transform .25s cubic-bezier(.2, 1.5, .4, 1); pointer-events: none; }
.hurdles .hd-toonbox.show { transform: translateX(-50%) scale(1); }
.hurdles .hd-toon { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 12px; background: #fff; border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow); }
.hurdles .hd-scene { position: relative; width: clamp(160px, 22vw, 250px); height: clamp(100px, 13vw, 150px); display: flex; align-items: center; justify-content: center; overflow: hidden; background: #e6f6ff; border-radius: 16px; }
.hurdles .hd-toon.small .hd-scene { width: 140px; height: 90px; }
.hurdles .hd-cast { display: flex; align-items: center; gap: 6px; }
.hurdles .hd-glyph { position: relative; display: inline-block; width: 1em; height: 1em; font-size: clamp(56px, 7.4vw, 92px); line-height: 1; }
.hurdles .hd-toon.small .hd-glyph { font-size: 52px; }
.hurdles .hd-glyph .hd-glyph { font-size: 1em; }
.hurdles .hd-glyph > svg { display: block; width: 100%; height: 100%; }
.hurdles .hd-emo { display: block; font-size: .84em; line-height: 1.2; text-align: center; }
.hurdles .hd-glyph.recv { font-size: clamp(44px, 5.6vw, 70px); }
.hurdles .hd-stack { display: flex; flex-direction: column; align-items: center; }
.hurdles .hd-stack .hd-glyph { font-size: clamp(40px, 5vw, 62px); }
.hurdles .hd-stack .hd-glyph.top { margin-bottom: -.3em; z-index: 1; }
.hurdles .hd-eyes { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); display: flex; gap: .03em; }
.hurdles .hd-eyes i { position: relative; width: .22em; height: .22em; background: #fff; border: 2px solid var(--ink); border-radius: 50%; }
.hurdles .hd-eyes i::after { content: ''; position: absolute; left: 30%; top: 30%; width: 45%; height: 45%; background: var(--ink); border-radius: 50%; animation: hd-look .6s ease-in-out infinite alternate; }
@keyframes hd-look { to { left: 10%; top: 40%; } }
.hurdles .hd-legs { position: absolute; left: 50%; top: 86%; transform: translateX(-50%); display: flex; gap: .16em; }
.hurdles .hd-legs i { position: relative; width: .06em; height: .26em; background: var(--ink); border-radius: 3px; transform-origin: 50% 0; animation: hd-leg .2s ease-in-out infinite alternate; }
.hurdles .hd-legs i:nth-child(2) { animation-delay: -.2s; }
.hurdles .hd-legs i::after { content: ''; position: absolute; bottom: -2px; left: -2px; width: .13em; height: .07em; background: #ff5d73; border: 2px solid var(--ink); border-radius: 6px 10px 4px 4px; }
.hurdles .hd-legs.big i { height: .3em; animation-duration: .5s; }
@keyframes hd-leg { from { transform: rotate(-25deg); } to { transform: rotate(25deg); } }
.hurdles .hd-part { position: absolute; pointer-events: none; }
.hurdles .hd-part.fins { inset: 0; }
.hurdles .hd-part.fins i { position: absolute; top: 40%; width: .38em; height: .27em; background: #3fa9f5; border: 2px solid var(--ink); border-radius: 0 100% 0 100%; animation: hd-flap .35s ease-in-out infinite alternate; }
.hurdles .hd-part.fins i:first-child { left: -.28em; transform: scaleX(-1); }
.hurdles .hd-part.fins i:last-child { right: -.28em; }
.hurdles .hd-part.wings { inset: 0; }
.hurdles .hd-part.wings i { position: absolute; top: 4%; width: .46em; height: .3em; background: #fff; border: 2px solid var(--ink); border-radius: 50%; animation: hd-flap .18s ease-in-out infinite alternate; }
.hurdles .hd-part.wings i:first-child { left: -.32em; transform-origin: 100% 50%; }
.hurdles .hd-part.wings i:last-child { right: -.32em; transform-origin: 0 50%; }
@keyframes hd-flap { from { rotate: -14deg; } to { rotate: 14deg; } }
.hurdles .hd-part.fur { inset: -.07em; border: .08em dotted #8b5a2b; border-radius: 50%; }
.hurdles .hd-part.tail { left: -.24em; top: 36%; width: .34em; height: .34em; border: .055em solid #8b5a2b; border-color: #8b5a2b transparent transparent #8b5a2b; border-radius: 50%; transform: rotate(-20deg); }
.hurdles .hd-fx { position: absolute; right: 7%; top: 6%; font-size: clamp(26px, 3.4vw, 40px); line-height: 1; animation: hd-fx .7s ease-in-out infinite alternate; }
.hurdles .hd-fx.mid { position: static; font-size: clamp(28px, 3.6vw, 44px); animation: hd-wig .3s ease-in-out infinite alternate; }
@keyframes hd-fx { to { transform: translateY(-8px) scale(1.12); } }
.hurdles .m-dash .hd-cast { animation: hd-dash 1.2s ease-in-out infinite alternate; }
.hurdles .m-swim .hd-cast { animation: hd-dash 1.6s ease-in-out infinite alternate; }
.hurdles .m-swim .hd-fx { left: 0; right: 0; top: auto; bottom: -6px; text-align: center; letter-spacing: -6px; }
.hurdles .m-bounce .hd-cast { animation: hd-hop .42s ease-in-out infinite alternate; }
.hurdles .m-snooze .hd-cast { transform: rotate(-14deg); }
.hurdles .m-wiggle .hd-cast { animation: hd-wig .35s ease-in-out infinite alternate; }
@keyframes hd-dash { from { transform: translateX(-28%); } to { transform: translateX(28%); } }
@keyframes hd-hop { from { transform: translateY(12%); } to { transform: translateY(-16%); } }
@keyframes hd-wig { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.hurdles .hd-cap { font-size: 20px; font-weight: 900; }
.hurdles .hd-toon.silly .hd-cap { color: #c2410c; }
.hurdles .hd-toon.sense .hd-cap { color: #15803d; }

/* ---------- ready, set, go / news ---------- */
.hurdles .hd-count { position: absolute; inset: 0; z-index: 11; display: none; place-items: center; pointer-events: none;
  font-size: clamp(56px, 11vw, 120px); font-weight: 900; color: #fff; text-shadow: 0 5px 0 var(--ink), 0 0 18px rgba(58, 42, 74, .5); }
.hurdles .hd-count.show { display: grid; animation: hd-zoom .4s cubic-bezier(.2, 1.6, .4, 1); }
.hurdles .hd-count.go { color: #ffe27a; }
@keyframes hd-zoom { from { transform: scale(.4); opacity: 0; } }
.hurdles .hd-news { position: absolute; left: 50%; top: 42%; z-index: 10; transform: translate(-50%, -50%); padding: 6px 18px; font-size: 30px; font-weight: 900;
  color: var(--ink); background: #ffe27a; border: 4px solid var(--ink); border-radius: 18px; opacity: 0; pointer-events: none; white-space: nowrap; }
.hurdles .hd-news.show { animation: hd-news 1.9s ease-out forwards; }
@keyframes hd-news { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 15%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }

/* ---------- how to play ---------- */
.hurdles .hd-start { position: absolute; inset: 0; z-index: 12; display: none; place-items: center; padding: 16px; background: rgba(40, 20, 70, .35); }
.hurdles .hd-start.show { display: grid; }
.hurdles .hd-card { width: 100%; max-width: 560px; padding: 14px 20px 16px; text-align: center; background: #fff; border: 4px solid var(--ink); border-radius: 26px; box-shadow: var(--shadow); }
.hurdles .hd-title { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 30px; font-weight: 900; color: var(--grape); }
.hurdles .hd-vs { display: inline-flex; align-items: center; gap: 4px; font-size: 20px; color: var(--ink-soft); }
.hurdles .hd-how { margin: 6px 0 8px; font-size: 20px; font-weight: 800; color: var(--ink); }
.hurdles .hd-eg { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0; padding: 6px 8px 6px 16px; background: #f6f2fb; border-radius: 16px; }
.hurdles .hd-eg .rd-word { font-size: 30px; font-weight: 700; color: var(--ink); text-align: left; }
.hurdles .hd-eg b { padding: 4px 12px; font-size: 18px; font-weight: 900; color: #fff; border: 3px solid var(--ink); border-radius: 12px; white-space: nowrap; }
.hurdles .hd-eg b.up { background: #2fb35a; }
.hurdles .hd-eg b.down { background: #f07a12; }
.hurdles .hd-go { margin-top: 10px; padding: 8px 40px; font-size: 30px; }
.hurdles .hd-best { margin: 10px 0 0; font-weight: 800; color: var(--ink-soft); }
.hurdles .hd-off { margin: 8px 0 0; font-weight: 700; color: var(--coral-dark); }

@media (max-width: 600px) {
  .hurdles .game-top { gap: 6px; }
  .hurdles .game-top h2 { font-size: 19px; }
  .hurdles .hud { font-size: 16px; gap: 5px; }
  .hurdles .hud span { padding: 0 7px; border-width: 2px; white-space: nowrap; }
  .hurdles .game-top h2 { white-space: nowrap; }
  .hurdles .game-top [data-back] { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
  .hurdles .hd-words { font-size: clamp(26px, 7.4vw, 40px); }
  .hurdles .hd-sign { padding: 6px 14px 10px; border-top-width: 12px; }
  .hurdles .hd-meter { gap: 16px; }
  .hurdles .hd-place { font-size: 15px; padding: 0 7px; }
  .hurdles .hd-btn { width: 96px; }
  .hurdles .hd-btn b { font-size: 21px; }
  .hurdles .hd-btn small { font-size: 11px; }
  .hurdles .hd-card { padding: 12px 12px 14px; }
  .hurdles .hd-eg { gap: 8px; padding: 6px 6px 6px 10px; }
  .hurdles .hd-eg .rd-word { font-size: 22px; }
  .hurdles .hd-eg b { padding: 3px 8px; font-size: 15px; }
  .hurdles .hd-title { font-size: 24px; }
  .hurdles .hd-toonbox { left: 62%; }
}
@media (max-width: 440px) {
  .hurdles .game-top { grid-template-columns: auto 1fr; }
  .hurdles .game-top h2 { display: none; }
}
