/* Story and leaderboard sequences are separate modal layers; the playfield never resizes. */
.story-menu-action { margin-top:.45rem; width:100%; text-align:left; border:1px solid #e4cc9155; color:#ffefc3; background:#151b26e8; border-radius:.65rem; padding:.7rem .9rem; font-weight:600; }
.story-dialog, .leaderboard-celebration { position:fixed; inset:0; border:0; padding:0; width:min(100vw,480px); height:min(100dvh,840px); max-width:100vw; max-height:100dvh; margin:auto; color:#fff6e6; background:#070d19; border-radius:1rem; overflow:hidden; box-shadow:0 20px 80px #000e; }
.story-dialog::backdrop,.leaderboard-celebration::backdrop {background:#000d;backdrop-filter:blur(7px)}
.story-art {position:absolute;inset:0;width:100%;height:100%;object-fit:cover;filter:brightness(.77) saturate(.95)}
.story-dialog::after {content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(to bottom,#03081480,transparent 24%,#03081438 35%,#02060cef 78%,#02060cff)}
.story-layout {position:relative;z-index:1;display:flex;flex-direction:column;justify-content:space-between;height:100%;padding:env(safe-area-inset-top,18px) 1.1rem env(safe-area-inset-bottom,20px);padding-top:max(1.4rem,env(safe-area-inset-top));padding-bottom:max(1.4rem,env(safe-area-inset-bottom));}
.story-topline,.story-bottomline {display:flex;align-items:center;justify-content:space-between;gap:1rem}
.story-label {letter-spacing:.3em;color:#f8dc96;text-shadow:0 2px 6px #000;font-size:.7rem;font-weight:800}
.story-skip,.story-button,.leaderboard-done {color:#fff4de;background:#0b162acc;border:1px solid #e5d2a660;border-radius:.55rem;padding:.65rem .95rem;cursor:pointer}
.story-copy {max-width:36rem;text-shadow:0 3px 12px #000}
.story-world {letter-spacing:.32em;font-size:.8rem;color:#f4d389}
.story-copy h2 {font:normal clamp(2.15rem,8vw,3.6rem)/1.1 Georgia,serif;margin:.4rem 0;color:#fff9ed}
.story-copy h3 {font:normal clamp(1.2rem,5vw,1.6rem)/1.25 Georgia,serif;margin:.55rem 0;color:#efd49d}
.story-copy p {font-size:clamp(.94rem,3.3vw,1.05rem);line-height:1.58;max-width:37ch;margin:.8rem 0 1.9rem}
.story-button.primary {background:#d9b773;color:#0b1422;border-color:#d9b773;font-weight:800}
.leaderboard-celebration {background:radial-gradient(ellipse at top,#29334e,#07101c 65%);overflow:auto}
.leaderboard-content {text-align:center;padding:1.3rem 1.1rem 1.6rem;min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem}
.lb-eyebrow {letter-spacing:.28em;font-size:.75rem;color:#f7dfaa;font-weight:bold}
.lb-rank {font:bold clamp(5rem,23vw,8rem)/1 Georgia,serif;color:#fff3c8;text-shadow:0 0 18px #dba852,0 0 45px #b580e6;animation:leaderboard-lock 1.2s ease-out both}
.lb-lightbars {display:flex;gap:.28rem;justify-content:center}.lb-lightbars i {width:.45rem;height:.45rem;border-radius:50%;background:#f4cf7e;box-shadow:0 0 11px #ffe395;animation:lb-lamp .7s steps(2,end) infinite;animation-delay:calc(var(--n)*65ms)}
.lb-name {font:normal 2rem Georgia,serif;max-width:100%;overflow-wrap:anywhere}
.lb-preview {width:100%;max-width:420px;animation:lb-reveal .6s ease-out both}
.lb-preview h3 {font:normal 1.35rem Georgia,serif;color:#f1d595}
.lb-rows {list-style:none;padding:0;margin:1rem 0 0;text-align:left;max-height:45dvh;overflow:auto}
.lb-rows li {display:grid;grid-template-columns:3.5rem 1fr auto;gap:.6rem;align-items:center;padding:.75rem .65rem;border-bottom:1px solid #ffffff1a;font-size:.93rem}
.lb-rows li.you {background:linear-gradient(90deg,#a17c2e6e,#f6d57c20,#a17c2e6e);color:#fff3bf;border:1px solid #f4d181;box-shadow:0 0 18px #f0d17575;border-radius:.4rem;animation:lb-you 2s ease-in-out infinite}
.lb-actions {display:flex;flex-wrap:wrap;gap:.7rem;justify-content:center}.lb-actions a {color:#ffe6aa;padding:.65rem .95rem;border:1px solid #f3d18a6b;border-radius:.5rem;text-decoration:none}
@keyframes leaderboard-lock {0%{transform:scale(2.2);opacity:0;filter:blur(12px)}60%{transform:scale(.91);opacity:1;filter:blur(0)}85%{transform:scale(1.06)}100%{transform:scale(1)}}
@keyframes lb-reveal {from{opacity:0;transform:translateY(30px) scale(.88)}to{opacity:1;transform:none}}
@keyframes lb-lamp {0%,100%{opacity:.3}50%{opacity:1}}
@keyframes lb-you {0%,100%{box-shadow:0 0 10px #e9ba4566}50%{box-shadow:0 0 26px #ffdf94bd}}
@media(prefers-reduced-motion:reduce){.lb-rank,.lb-preview,.lb-rows li.you,.lb-lightbars i {animation:none}}
/* Small animated border over completed formations. The geometry and game board do not move. */
.motif-glows {pointer-events:none;filter:drop-shadow(0 0 5px #fff9)}
.motif-outline {opacity:.83;stroke-dasharray:16 13;stroke-dashoffset:0;animation:motif-drift .8s linear 1,motif-fade 1s ease-out forwards}
@keyframes motif-drift {to{stroke-dashoffset:-100}}
@keyframes motif-fade {0%,55%{opacity:.82}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){.motif-outline {animation:none;opacity:.4;stroke-dasharray:none}}

.leaderboard-celebration .lb-rank {transition:font-size .65s ease, text-shadow .65s ease;}
.leaderboard-celebration.is-revealed .lb-rank {font-size:clamp(2.5rem,12vw,3.5rem);text-shadow:0 0 10px #f4d17d;}

.guidance-choice-dialog {color:#f2eddf;background:#111b2b;border:1px solid #d6b97988;border-radius:.9rem;padding:1.1rem;width:min(92vw,460px);box-shadow:0 0 50px #000b}
.guidance-choice-dialog::backdrop {background:#000a}
.guidance-choice-dialog h2 {font:normal 1.45rem Georgia,serif;margin:.3rem 0 .7rem}
.guidance-choice-dialog p {line-height:1.5}
.guidance-choice-actions {display:flex;gap:.55rem;flex-wrap:wrap}
.guidance-choice-actions button {background:#243249;color:#f8e8bb;border:1px solid #d6b97977;border-radius:.45rem;padding:.6rem .85rem;min-height:2.7rem}
