/* The board is a rope bridge above the river; its twenty planks stay independent. */
.bridge-world{border-color:#c2d8bd;background:#f1f7e8}
.bridge-map{height:320px;min-width:1040px}
.bridge-river{object-position:center 55%}
.jungle-rails{position:absolute;left:1%;top:10px;width:98%;height:254px;object-fit:fill;z-index:0;pointer-events:none}
.bridge-log{top:153px;width:4.6%;height:74px;z-index:1}
.bridge-log b{top:57px}
.bridge-hama{bottom:137px;width:112px;height:130px;z-index:3}
.bridge-hama>img{position:absolute;inset:0;animation:none;object-fit:contain}
.bridge-hama .bridge-great-pose,.bridge-hama .bridge-oops-pose{opacity:0}
.bridge-bank{top:18px;z-index:1}
.bridge-bank-start{left:5%}.bridge-bank-goal{left:95%}
.jungle-croc{position:absolute;left:18%;bottom:3px;width:116.2px;height:58.1px;z-index:0;pointer-events:none;transform:translateX(-50%)}
.jungle-croc-2{left:39%;bottom:14px;transform:translateX(-50%) scaleX(-1)}
.jungle-croc-3{left:61%;bottom:2px}
.jungle-croc-4{left:82%;bottom:12px;transform:translateX(-50%) scaleX(-1)}
.jungle-croc>span{position:absolute;inset:0;background-image:url('./assets/crocodile-teeth-v2.webp');background-repeat:no-repeat;background-size:209% 418%;background-position:var(--croc-closed-x) var(--croc-closed-y)}
.jungle-croc-body{clip-path:polygon(0 0,48% 0,48% 84%,100% 84%,100% 100%,0 100%)}
.jungle-croc-face{clip-path:inset(0 0 16% 48%)}
.jungle-croc-closed{animation:jungle-mouth-close var(--croc-cycle) steps(1,end) var(--croc-delay) infinite}
.jungle-croc>span.jungle-croc-open{background-position:var(--croc-open-x) var(--croc-open-y);opacity:0;animation:jungle-mouth-open var(--croc-cycle) steps(1,end) var(--croc-delay) infinite}
.jungle-splash{position:absolute;bottom:3px;width:200px;height:126px;object-fit:contain;transform:translateX(-50%);z-index:4;opacity:0;pointer-events:none}
.bridge-cheer,.bridge-oops-cue{position:absolute;left:50%;top:-16px;transform:translateX(-50%);white-space:nowrap;padding:5px 14px;border:2px solid #bed687;border-radius:20px;background:#ffffed;color:#3e632f;font-size:1.05rem;font-weight:800;opacity:0;box-shadow:0 3px 8px #4e725322}
.bridge-oops-cue{border-color:#e6b388;background:#fff2d9;color:#965524}
.bridge-hama.forward .bridge-walker{animation:jungle-hide-pose .5s linear}
.bridge-hama.forward .bridge-great-pose{animation:jungle-happy-hop .5s ease}
.bridge-hama.forward .bridge-cheer{animation:bridge-cheer .5s ease-out both}
.bridge-hama.trip .bridge-walker{animation:jungle-hide-pose 1.5s linear}
.bridge-hama.trip .bridge-oops-pose{animation:jungle-trip 1.5s ease}
.bridge-hama.trip .bridge-oops-cue{animation:jungle-oops 1.5s ease-out both}
.outcome-pass .bridge-hama .bridge-walker,.outcome-pass .bridge-hama .bridge-oops-pose{opacity:0;animation:none}
.outcome-pass .bridge-hama .bridge-great-pose{opacity:1;animation:none}
.animate-outcome.outcome-pass .bridge-hama .bridge-great-pose{animation:bridge-arrive 1.7s ease-in-out both}
.outcome-fail .bridge-hama>img{opacity:0;animation:none}
.animate-outcome.outcome-fail .bridge-hama .bridge-walker{opacity:0;animation:none}
.animate-outcome.outcome-fail .bridge-hama .bridge-oops-pose{animation:jungle-fall 2.6s ease-in both}
.animate-outcome.outcome-fail .jungle-splash{animation:jungle-splash 1.35s ease-out 1.4s both}
.animate-outcome .bridge-log.missing{animation:jungle-plank-break .85s ease-in calc(.6s + var(--sink-delay,0s)) both}
.bridge-world[hidden]{display:none}
.bridge-game.is-retry .bridge-heading{display:none}
.bridge-not-crossed{border:0;box-shadow:none;background:transparent;padding:5px 20px 18px;margin-top:0}
.bridge-not-crossed .bridge-result-main{flex-direction:column;text-align:center;gap:4px}
.bridge-not-crossed .bridge-result-hama{width:176px;height:184px;animation:jungle-determined .55s ease-out both}
.bridge-not-crossed .bridge-result-main h2.bridge-result-score{justify-content:center;font-size:2.8rem;margin:9px 0 12px}
.bridge-not-crossed .bridge-result-main h3{font-size:1.7rem;color:#3c633d}
.bridge-result-main p.bridge-again-words{color:#647146;font-size:.95rem;font-weight:700;margin-top:4px}
.bridge-capture{min-height:50px;font-size:1rem}
.bridge-capture-hint{text-align:center;margin-top:11px;color:#756b4b;font-size:.875rem;line-height:1.6}
.bridge-capture-dialog{width:min(620px,calc(100% - 28px));max-height:calc(100dvh - 36px);overflow:auto;margin:auto;padding:22px;border:1px solid #d5dfc9;border-radius:22px;background:#fffdf6;color:#3f5140;box-shadow:0 16px 70px #19372650}
.bridge-capture-dialog::backdrop{background:#183a326e;backdrop-filter:blur(3px)}
.bridge-capture-dialog header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:8px}
.bridge-capture-dialog h2{font-size:1.35rem;margin:0}
.bridge-capture-dialog header .btn{min-height:42px;padding:8px 13px;font-size:.875rem}
.bridge-capture-dialog>p{font-size:.95rem;line-height:1.6;color:#68715c;margin-bottom:14px}
.bridge-capture-preview{display:block;width:100%;max-height:52dvh;object-fit:contain;border:1px solid #e1e7d8;border-radius:12px;background:#f8faf2}
.bridge-capture-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:17px}
.bridge-capture-actions .btn{flex:1;min-height:48px;justify-content:center}
.bridge-capture-dialog p.bridge-capture-save-help{font-size:.85rem;margin:13px 0 0;color:#767b6d}
.bridge-capture-dialog [hidden]{display:none}
.bridge-question-status{display:flex;align-items:center;gap:20px;flex-wrap:wrap}
.bridge-question-meta{align-items:center}
.bridge-timer{--clock-progress:1;--clock-angle:0deg;display:flex;align-items:center;gap:8px;flex:none;color:#547951;padding:4px 10px 4px 5px;background:#edf4e6;border:1px solid #d6e4c8;border-radius:13px;min-width:101px;font-variant-numeric:tabular-nums}
.bridge-clock-icon{width:40px;height:40px;flex:none;transform-origin:50% 65%}
.bridge-clock-track{stroke:#d4e1c8;stroke-width:3}
.bridge-clock-ring{stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-dasharray:113.098;stroke-dashoffset:calc(113.098 * (1 - var(--clock-progress)))}
.bridge-clock-marks,.bridge-clock-hand,.bridge-clock-short{stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.bridge-clock-hand{transform:rotate(var(--clock-angle));transform-origin:22px 22px;transition:transform .1s linear}
.bridge-timer>div{display:flex;flex-direction:column;line-height:1.1;gap:2px}
.bridge-timer>div>span{font-size:.875rem;white-space:nowrap}
.bridge-timer strong{font-size:1.35rem;line-height:1.05;font-weight:800}
.bridge-timer strong b{font-size:inherit}.bridge-timer small{font-size:.875rem;margin-left:3px;font-weight:400}
.bridge-timer.is-running .bridge-clock-icon{animation:bridge-clock-tock 1s ease-in-out infinite}
.bridge-timer.is-urgent{color:#b86638;background:#fff0de;border-color:#ebc4a0}
.bridge-timer.is-urgent .bridge-clock-icon{animation-duration:.5s}
.bridge-timer.is-paused,.bridge-timer.is-finished{color:#7c806f;background:#f2f3eb;border-color:#e0e3d6}
@keyframes bridge-clock-tock{0%,35%,50%,85%,100%{transform:rotate(0)}10%{transform:rotate(-5deg)}60%{transform:rotate(5deg)}}
@media(max-width:650px){.bridge-question-meta{gap:9px}.bridge-question-status{width:100%;justify-content:space-between;gap:8px}.bridge-clock-icon{width:36px;height:36px}.bridge-timer{min-width:96px;padding:3px 8px 3px 4px;gap:6px}.bridge-timer strong{font-size:1.2rem}}
@media(prefers-reduced-motion:reduce){.bridge-clock-icon{animation:none!important}.bridge-clock-hand{transition:none}}
@keyframes jungle-mouth-open{0%,100%{opacity:0}35%,62%{opacity:1}70%{opacity:0}}
@keyframes jungle-mouth-close{0%,100%{opacity:1}35%,62%{opacity:0}70%{opacity:1}}
@keyframes jungle-hide-pose{0%,99%{opacity:0}100%{opacity:1}}
@keyframes jungle-happy-hop{0%{opacity:1;transform:translateY(0) rotate(0)}38%{opacity:1;transform:translateY(-28px) rotate(-7deg)}67%{opacity:1;transform:translateY(0) scale(1.05,.94)}88%{opacity:1;transform:translateY(-3px)}99%{opacity:1}100%{opacity:0;transform:none}}
@keyframes jungle-trip{0%{opacity:1;transform:translate(0,-7px) rotate(-12deg)}20%{opacity:1;transform:translate(10px,10px) rotate(5deg)}34%{opacity:1;transform:translate(8px,5px) rotate(-2deg)}46%,80%{opacity:1;transform:translate(10px,7px) rotate(0)}99%{opacity:1;transform:translate(6px,7px)}100%{opacity:0;transform:translate(0,0)}}
@keyframes jungle-oops{0%{opacity:0;transform:translate(-50%,8px) scale(.85)}18%,78%{opacity:1;transform:translate(-50%,-3px) scale(1)}100%{opacity:0;transform:translate(-50%,-12px)}}
@keyframes jungle-fall{0%,24%{opacity:1;transform:translateY(0) rotate(0)}34%{opacity:1;transform:translateY(7px) rotate(14deg)}44%{opacity:1;transform:translateY(1px) rotate(-12deg)}65%{opacity:1;transform:translateY(95px) rotate(23deg) scale(.82)}74%,100%{opacity:0;transform:translateY(130px) rotate(30deg) scale(.7)}}
@keyframes jungle-splash{0%{opacity:0;transform:translateX(-50%) scale(.25)}25%{opacity:1;transform:translateX(-50%) scale(1.05)}65%{opacity:.85;transform:translateX(-50%) scale(1)}100%{opacity:0;transform:translateX(-50%) scale(1.15)}}
@keyframes jungle-plank-break{0%{opacity:1;transform:translateX(-50%) rotate(0)}22%{opacity:1;transform:translate(-50%,3px) rotate(-13deg)}42%{opacity:1;transform:translate(-50%,18px) rotate(20deg)}100%{opacity:0;transform:translate(-50%,95px) rotate(39deg) scale(.7)}}
@keyframes jungle-determined{0%{opacity:0;transform:translateY(12px) scale(.9)}65%{opacity:1;transform:translateY(-3px) scale(1.02)}100%{opacity:1;transform:none}}
@media(max-width:650px){.bridge-map{height:294px}.jungle-rails{top:0;height:236px}.bridge-log{top:135px;height:73px}.bridge-hama{bottom:132px;width:102px;height:120px}.bridge-bank{top:10px}.jungle-croc{bottom:0;width:105px;height:52.5px}.jungle-croc-2,.jungle-croc-4{bottom:9px}.jungle-splash{width:174px;height:112px;bottom:0}.bridge-capture{width:100%}.bridge-not-crossed .bridge-result-hama{width:158px;height:166px}.bridge-capture-dialog{padding:18px}.bridge-capture-dialog h2{font-size:1.2rem}.bridge-capture-dialog .btn{font-size:.95rem}}
@media(prefers-reduced-motion:reduce){.jungle-croc>span,.bridge-hama>img,.bridge-cheer,.bridge-oops-cue,.jungle-splash,.bridge-not-crossed .bridge-result-hama{animation:none!important}.jungle-croc>span.jungle-croc-open{opacity:0}.jungle-croc-closed{opacity:1}.bridge-hama.forward .bridge-walker,.bridge-hama.trip .bridge-walker{opacity:0}.bridge-hama.forward .bridge-great-pose,.bridge-hama.trip .bridge-oops-pose{opacity:1}.bridge-hama.forward .bridge-cheer,.bridge-hama.trip .bridge-oops-cue{opacity:1}.bridge-log.missing{animation:none!important;opacity:0}.outcome-pass .bridge-hama .bridge-great-pose{opacity:1!important}.outcome-pass .bridge-hama .bridge-oops-pose{opacity:0!important}}

/* Missed answers teach the correct word: circle it, rather than the chosen distractor. */
.bridge-options .bridge-choice-word{position:relative;display:inline-block;min-width:0;padding:2px 6px;line-height:1.35}
.bridge-options .option.missed-correct{background:#fff9f0;border-color:#e5b4a9;color:#463d36;opacity:1}
.bridge-options .missed-correct .bridge-choice-word::after{content:'';position:absolute;inset:-5px -4px;border:3px solid #d83e3b;border-radius:50%;transform:rotate(-6deg);pointer-events:none}
.bridge-options .option.missed-choice{background:#f3f3ee;border-color:#d9dbd2;color:#818379}
.bridge-options .bridge-correction-label{font-size:.875rem;color:#c63132;font-weight:700;white-space:nowrap;flex:none;margin-left:auto}
.bridge-retry-icon{width:44px;height:48px;object-fit:contain;flex:none;filter:drop-shadow(0 1px 1px #273e3a25)}
.bridge-retry-invite .btn{padding-block:8px;gap:12px}
.bridge-retry-invite .btn>span{text-align:left}
@media(max-width:650px){.bridge-retry-invite .btn{gap:9px}.bridge-retry-icon{width:42px;height:46px}.bridge-options .bridge-correction-label{font-size:.875rem}.bridge-options .option.missed-correct{flex-wrap:wrap}.bridge-options .bridge-choice-word{padding-inline:3px}.bridge-options .missed-correct .bridge-choice-word::after{inset:-4px}}

/* A missed answer wakes the crocodiles: lip-licking and angry upward jaws.
   Only the clipped face changes. Original bodies and their river positions stay fixed. */
.jungle-croc>span.jungle-croc-reaction{background-image:url('./assets/crocodile-reactions-v3.webp');opacity:0;animation:none}
.jungle-croc>span.jungle-croc-reaction-open{background-position:var(--croc-open-x) var(--croc-open-y)}
.crocodiles-alert .jungle-croc>span.jungle-croc-closed,.crocodiles-alert .jungle-croc>span.jungle-croc-open{animation:none;opacity:0}
.crocodiles-alert .jungle-croc>span.jungle-croc-reaction-closed{animation:jungle-alert-close 1.25s steps(1,end) var(--croc-delay) infinite}
.crocodiles-alert .jungle-croc>span.jungle-croc-reaction-open{animation:jungle-alert-open 1.25s steps(1,end) var(--croc-delay) infinite}
.crocodiles-alert .jungle-croc-2>span.jungle-croc-reaction,.crocodiles-alert .jungle-croc-4>span.jungle-croc-reaction{animation-duration:1.8s}
@keyframes jungle-alert-open{0%,100%{opacity:0}18%,74%{opacity:1}82%{opacity:0}}
@keyframes jungle-alert-close{0%,100%{opacity:1}18%,74%{opacity:0}82%{opacity:1}}
@media(prefers-reduced-motion:reduce){.crocodiles-alert .jungle-croc>span.jungle-croc-reaction-closed{opacity:0}.crocodiles-alert .jungle-croc>span.jungle-croc-reaction-open{opacity:1}}
