.calculation-tower[hidden]{display:none!important}
.calculation-tower,.calculation-tower *{box-sizing:border-box}
.calculation-tower{min-height:100dvh;background:#081827;color:#fff2d8;font-family:system-ui,sans-serif}
body[data-current-view="games"]:has(.games-page[data-games-screen="tower"]){overflow:hidden}
body[data-current-view="games"] .games-page[data-games-screen="tower"]{position:fixed;inset:0;z-index:1000;width:100%;max-width:none;height:100dvh;margin:0;padding:0;overflow:auto;border-radius:0;background:#071827}
.games-page[data-games-screen="tower"]::before{display:none}
.tower-top{position:relative;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:64px;padding:8px 22px;background:#071a23;color:#ffe9ba}
.tower-top strong{font-size:18px}
.tower-top button{padding:10px 15px;border:1px solid #d6b57788;border-radius:12px;background:#17353d;color:#fff2d8;font-weight:750;cursor:pointer}
.tower-map{max-width:1400px;margin:auto;padding:18px 20px 38px}
.tower-map-hero{display:flex;align-items:center;justify-content:flex-end;min-height:440px;padding:35px 6%;border:1px solid #dbba7f7a;border-radius:20px;background-image:linear-gradient(90deg,#07172508 10%,#07172555 46%,#071725ed 80%),var(--tower-image);background-size:cover;background-position:center}
.tower-map-hero>div{width:min(500px,100%)}
.tower-map-hero span{color:#f9cc74;font-size:12px;font-weight:900;letter-spacing:.15em}
.tower-map-hero h1{margin:14px 0;color:#fff5dd;font:900 clamp(34px,4vw,54px)/1.1 Georgia,serif}
.tower-map-hero p{font-size:18px;line-height:1.5}
.tower-map-hero button,.tower-end-actions button,.tower-status button{padding:13px 19px;border:0;border-radius:12px;background:linear-gradient(130deg,#f6d38d,#d59847);color:#142b30;font-weight:900;cursor:pointer}
.tower-map-hero small{display:block;margin-top:14px;color:#ffe4aa}
.tower-world-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px;margin-top:17px}
.tower-world{min-width:0;padding:22px;border:1px solid #e8c17b99;border-radius:18px;background-image:linear-gradient(180deg,#09203388,#091824f5 38%),var(--tower-image);background-size:cover;background-position:center}
.tower-world h2{margin:0;font:800 24px Georgia,serif}
.tower-world p{color:#f4d197;font-size:13px}
.tower-levels{display:grid;gap:8px;margin-top:28px}
.tower-levels button{display:flex;align-items:center;gap:10px;width:100%;padding:10px;border:1px solid #f3d99a6e;border-radius:10px;background:#102b36e8;color:#fff4da;text-align:left;cursor:pointer}
.tower-levels button:disabled{opacity:.55;cursor:default}
.tower-levels button>b{display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:50%;background:#e0aa53;color:#112a2d}
.tower-levels button>span{flex:1}
.tower-levels button>em{color:#f6c776;font-size:12px;font-style:normal}
.tower-stage{min-height:calc(100dvh - 64px)}
.tower-scene{position:relative;min-height:calc(100dvh - 64px);isolation:isolate;background-image:var(--tower-image);background-position:center;background-size:cover;background-repeat:no-repeat}
.tower-scene-shade{position:absolute;z-index:-1;inset:0;background:linear-gradient(90deg,#07192311 0%,#07192300 49%,#071923b0 80%,#071923de 100%)}
.tower-floor-progress{position:absolute;top:18px;left:22px;z-index:3;display:flex;gap:7px}
.tower-floor-progress span{display:grid;place-items:center;width:36px;height:36px;border:1px solid #f6d89f;border-radius:50%;background:#12333bcc;color:#f7daa9;font-weight:850}
.tower-floor-progress span.current,.tower-floor-progress span.done{background:#f1c36b;color:#112d31}
.tower-floor-progress span.current{outline:2px solid #fff;outline-offset:3px}
.tower-step-choice{position:absolute;z-index:4;left:var(--step-x);top:var(--step-y);transform:translate(-50%,-50%);display:grid;place-content:center;min-width:clamp(104px,10vw,158px);min-height:70px;padding:8px 12px;border:2px solid #ffdc94;border-radius:15px;background:#103942ed;color:#fff5d7;box-shadow:0 12px 30px #06151fcc,0 0 20px #ffd68266;cursor:pointer;transition:transform .2s,background .2s}
.tower-step-choice:hover:not(:disabled),.tower-step-choice:focus-visible{transform:translate(-50%,-58%) scale(1.06);background:#176451;outline:2px solid #fff;outline-offset:2px}
.tower-step-choice.is-correct{background:#287753;box-shadow:0 0 32px #f6de86}
.tower-step-choice.is-wrong{background:#8b3b36}
.tower-step-choice span{font:900 clamp(24px,2.3vw,36px) Georgia,serif;white-space:nowrap}
.tower-step-choice small{color:#ffdc96;font-size:12px}
.tower-question{position:absolute;z-index:5;top:12%;right:3%;width:min(410px,35%);max-height:82%;overflow:auto;padding:22px;border:1px solid #f5d39099;border-radius:17px;background:#081d29e8;box-shadow:0 20px 48px #06151ebb}
.tower-question>small{color:#f6c977;font-weight:900;letter-spacing:.05em}
.tower-question h1{margin:8px 0;color:#fff6db;font:850 25px Georgia,serif}
.tower-question>p{margin:3px 0 17px;color:#e4d2aa}
.tower-zh{padding:12px;border-radius:11px;background:#fff0d0;color:#1b433c;font:850 clamp(22px,2vw,29px)/1.55 Georgia,serif}
.tower-word{padding:0 2px;border:0;border-bottom:1px dotted #627f67;background:transparent;color:inherit;font:inherit;cursor:help}
.tower-word:hover,.tower-word:focus-visible{background:#f0d490;outline:2px solid #66997e}
.tower-hover-definition{min-height:32px;margin-top:8px;color:#f7d6a0;font-size:12px}
.tower-tools{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.tower-tools button{padding:8px 11px;border:1px solid #e9c87d6b;border-radius:9px;background:#1b473f;color:#fff6e2;font-weight:800;cursor:pointer}
.tower-language-aid,.tower-status{margin-top:10px;padding:10px;border:1px solid #dcb87066;border-radius:9px;background:#17443f;color:#fff3cf;font-size:13px;line-height:1.5}
.tower-status strong{color:#ffe29b}
.tower-status p{margin:6px 0 10px}
.tower-status button{padding:9px 13px}
.tower-vocab{margin-top:18px;padding-top:10px;border-top:1px solid #e8c67a66;font-size:12px}
.tower-vocab>div{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.tower-vocab button{padding:7px 10px;border:1px solid #e7ce8d70;border-radius:8px;background:#21424a;color:#f9ebcc;cursor:pointer}
.tower-vocab b{font-size:16px}
.tower-mobile-choices{display:none}
.tower-end{display:grid;place-items:center;min-height:calc(100dvh - 64px);padding:20px;background-image:linear-gradient(90deg,#071725b0,#0717258a),var(--tower-image);background-size:cover;background-position:center}
.tower-end>section{width:min(560px,100%);padding:30px;border:1px solid #f3d28c;border-radius:18px;background:#071e2ae9}
.tower-end h1{font:900 34px Georgia,serif}
.tower-end-actions{display:flex;flex-wrap:wrap;gap:8px}
@media(max-width:900px){.tower-world-list{grid-template-columns:1fr}.tower-question{width:40%;right:2%;padding:14px}.tower-step-choice{min-width:100px}}
@media(max-width:700px){
 .tower-top{min-height:55px;padding:5px 8px}.tower-top strong{font-size:12px}.tower-top button{padding:7px;font-size:11px}
 .tower-map{padding:8px}.tower-map-hero{min-height:360px;align-items:flex-end;padding:18px;background-position:32% center}.tower-map-hero h1{font-size:31px}.tower-map-hero p{font-size:14px}
 .tower-scene{min-height:0;padding:235px 10px 12px;background:#091c28}
 .tower-scene:before{content:"";position:absolute;top:0;left:0;width:100%;height:245px;background:var(--tower-image) 32% center/cover no-repeat}
 .tower-scene-shade,.tower-step-options{display:none}.tower-floor-progress{top:8px;left:8px}
 .tower-question{position:relative;top:auto;right:auto;width:100%;max-height:none;padding:15px}
 .tower-question h1{font-size:23px}.tower-zh{font-size:23px}
 .tower-mobile-choices{display:grid;gap:8px;padding:10px;background:#081827}
 .tower-mobile-choices button{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border:1px solid #f5d28c;border-radius:12px;background:#17424a;color:#ffedc5;cursor:pointer}
 .tower-mobile-choices button:disabled{opacity:.6}.tower-mobile-choices b{font:850 24px Georgia,serif}
}

/* La tour des chiffres : the game's own viewport is the scroll container.
   This also allows the map to reach its second and third sections. */
body[data-current-view="games"] .games-page[data-games-screen="tower"]{overflow:hidden!important}
body[data-current-view="games"] .games-page[data-games-screen="tower"] .calculation-tower{
 position:fixed;inset:0;z-index:1200;display:block;height:100dvh;min-height:0;
 overflow-y:auto!important;overflow-x:hidden;overscroll-behavior-y:contain;
 touch-action:pan-y;scrollbar-width:thin;scrollbar-color:#d6ab68 #09212c;
}
.calculation-tower .tower-top{position:sticky;top:0;z-index:20}
.calculation-tower .tower-map{padding-bottom:110px}
.tower-map-scroll-hint{margin:14px 4px 5px;color:#f6d597;font-size:13px;font-weight:800}
.tower-levels button>span{display:grid;gap:3px}
.tower-levels button>span strong{font-size:14px}
.tower-levels button>span small{color:#e1c69b;font-size:11px}
.tower-answer-step,.tower-clock,.tower-phone,.tower-calendar,.tower-prop{
 position:absolute;left:30%;top:52%;z-index:3;transform:translate(-50%,-50%);
}
.tower-answer-step{display:grid;place-items:center;width:250px;min-height:130px;border:2px solid #f6d282;border-radius:25px;background:#0c3343db;color:#fff1c7;box-shadow:0 0 42px #f6cb6d7a;text-align:center}
.tower-answer-step span{font-size:11px;font-weight:900;letter-spacing:.12em}
.tower-answer-step strong{font:900 67px Georgia,serif}
.tower-answer-step.lit{background:#185544;box-shadow:0 0 65px #ffe290}
.tower-clock{width:270px;height:270px;border:16px solid #d8ac59;border-radius:50%;background:radial-gradient(circle,#fff1cd 0%,#e2c590 100%);box-shadow:0 15px 44px #06141da8,inset 0 0 0 4px #69532c;color:#253f3a}
.tower-clock b{position:absolute;font:900 29px Georgia,serif}
.tower-clock .n12{top:5px;left:50%;transform:translateX(-50%)}.tower-clock .n3{right:12px;top:50%;transform:translateY(-50%)}.tower-clock .n6{bottom:5px;left:50%;transform:translateX(-50%)}.tower-clock .n9{left:12px;top:50%;transform:translateY(-50%)}
.tower-clock i{position:absolute;left:50%;bottom:50%;transform-origin:bottom center;transform:translateX(-50%) rotate(var(--angle));border-radius:8px;background:#173b3b}
.tower-clock-hour{width:9px;height:62px}.tower-clock-minute{width:6px;height:91px}
.tower-clock>span{position:absolute;left:50%;top:50%;width:16px;height:16px;transform:translate(-50%,-50%);border-radius:50%;background:#173b3b}
.tower-phone{display:grid;justify-items:center;gap:18px;width:265px;min-height:390px;padding:25px 18px;border:9px solid #1b242b;border-radius:40px;background:linear-gradient(160deg,#d5bd89,#42726d 70%,#103b44);box-shadow:0 20px 55px #051a24d9;color:#fff7d9;text-align:center}
.tower-phone-speaker{width:52px;height:5px;border-radius:10px;background:#142b30}
.tower-phone>span{align-self:end;font-weight:800}.tower-phone>strong{font:850 19px Georgia,serif;letter-spacing:.07em;line-height:1.5;overflow-wrap:anywhere}.tower-phone>small{align-self:start;font-size:12px}
.tower-calendar,.tower-prop{display:grid;justify-items:center;gap:12px;width:285px;min-height:260px;padding:24px;border:2px solid #ebca88;border-radius:20px;background:#f6e7c6;color:#213b37;box-shadow:0 18px 50px #001a23c9;text-align:center}
.tower-calendar>span,.tower-prop>span{font-size:14px;font-weight:900}.tower-calendar>strong{font:850 29px Georgia,serif}
.tower-calendar>div{display:flex;gap:16px;align-items:center}.tower-calendar>div b{padding:12px;border:2px solid #ad6540;border-radius:12px;font-size:25px}
.tower-calendar>small,.tower-prop>small{font-size:12px}
.tower-prop>strong{font:900 64px Georgia,serif}.tower-market{background:#f1d9a9}.tower-sign{background:#183f48;color:#fff0c9}
.tower-question{width:min(470px,39%);max-height:85%;overflow:auto}
.tower-question>p{margin:5px 0 12px}
.tower-answer-form{display:grid;gap:7px;margin-top:15px;padding-top:14px;border-top:1px solid #edc98566}
.tower-answer-form>label{font-size:13px;font-weight:900;color:#ffe1a5}
.tower-answer-form>input{width:100%;min-height:47px;padding:9px 12px;border:2px solid #e9ca84;border-radius:10px;background:#fff8e7;color:#143a38;font:700 19px system-ui,sans-serif}
.tower-answer-form>input:focus{outline:3px solid #82dcc3;outline-offset:2px}
.tower-answer-form>small{font-size:11px;color:#ddc8a0;line-height:1.4}
.tower-answer-form>button{padding:12px 15px;border:0;border-radius:10px;background:linear-gradient(130deg,#f5d28c,#cf9450);color:#173331;font-weight:900;cursor:pointer}
.tower-ime-candidates{min-height:45px;padding:5px;border:1px dashed #e8c88988;border-radius:9px;background:#163743}
.tower-ime-candidates>small{display:block;padding:7px;color:#d9ceaf;font-size:11px}
.tower-ime-candidates button{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:6px 10px;border:1px solid #e4c881;border-radius:8px;background:#295457;color:#fff4d6;cursor:pointer}
.tower-ime-candidates button span{font-size:11px}.tower-ime-candidates button b{font:850 23px Georgia,serif}
@media(max-width:900px){.tower-question{width:45%}.tower-answer-step,.tower-clock,.tower-phone,.tower-calendar,.tower-prop{left:27%}}
@media(max-width:700px){
 .tower-scene{padding-top:245px}.tower-scene:before{height:245px}
 .tower-answer-step,.tower-clock,.tower-phone,.tower-calendar,.tower-prop{position:relative;top:auto;left:auto;transform:none;margin:0 auto 15px}
 .tower-clock{width:230px;height:230px}.tower-clock-minute{height:76px}.tower-clock-hour{height:50px}
 .tower-phone{min-height:270px}.tower-question{width:100%;max-height:none}
 .tower-map-hero{min-height:410px}.tower-world-list{gap:12px}
}
.tower-review-badge{position:absolute;left:18px;top:76px;z-index:8;padding:8px 12px;border:1px solid #f0cb7d;border-radius:999px;background:#133e49e8;color:#ffe3a5;font-size:12px;font-weight:900;letter-spacing:.04em;box-shadow:0 8px 24px #00182066}
.tower-mastery-stars{margin:8px 0 4px;font-size:31px;letter-spacing:.12em;color:#f4cb72;text-shadow:0 2px 9px #0008}
.tower-language-aid b{color:#ffe2a5}
@media(max-width:700px){.tower-review-badge{top:64px;left:12px}}

/* A small map of six paliers: it belongs to the interface, not to the
   painted platforms, which have different shapes in each level artwork. */
.tower-top>div{display:flex;gap:8px}
.tower-ascent{position:absolute;z-index:4;left:22px;top:76px;width:150px;padding:10px 9px 8px;border:1px solid #e6c17ba8;border-radius:15px;background:#092430e8;color:#ffe6ad;box-shadow:0 12px 26px #001820aa;text-align:center;pointer-events:none}
.tower-ascent-heading{display:block;font-size:10px;font-weight:900;letter-spacing:.07em}
.tower-ascent-shaft{position:relative;display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 0}
.tower-ascent-token{position:absolute;z-index:2;left:calc((6 - var(--token-to))*8px);top:calc(8px + var(--token-to)*24px);width:30px;height:34px;object-fit:contain;filter:drop-shadow(0 2px 3px #001820)}
.tower-ascent-token.is-moving{animation:towerTokenClimb .8s ease-out both}
.tower-ascent-beacon{display:grid;place-items:center;width:28px;height:22px;color:#d8c79e;font-size:19px}
.tower-landing{display:grid;place-items:center;width:56px;height:20px;border:1px solid #9daeb477;border-radius:5px;background:#17404b;color:#d8c9aa;font-size:10px;font-weight:900;box-shadow:0 2px 4px #00182077}
.tower-landing:nth-child(2){margin-left:54px}.tower-landing:nth-child(3){margin-left:36px}.tower-landing:nth-child(4){margin-left:18px}.tower-landing:nth-child(5){margin-left:0}.tower-landing:nth-child(6){margin-left:-18px}.tower-landing:nth-child(7){margin-left:-36px}
.tower-landing.is-lit{border-color:#fff0ae;background:#a26d2e;color:#fff6d1;box-shadow:0 0 12px #ffcf6daa}
.tower-landing.just-lit{animation:towerLanding .7s ease-out both}
.tower-ascent.summit-ready .tower-ascent-beacon{color:#fff1a8;text-shadow:0 0 15px #ffd76c;animation:towerBeacon 1.3s ease-in-out infinite alternate}
.tower-ascent-caption{display:block;font-size:9px;color:#d6d9d2}
.tower-music-credit{margin:22px 4px;color:#d4c6a6;font-size:11px}.tower-music-credit a{color:#ffe4a3}
@keyframes towerLanding{40%{transform:scale(1.2);filter:brightness(1.8)}100%{transform:scale(1);filter:brightness(1)}}
@keyframes towerTokenClimb{from{left:calc((6 - var(--token-from))*8px);top:calc(8px + var(--token-from)*24px)}to{left:calc((6 - var(--token-to))*8px);top:calc(8px + var(--token-to)*24px)}}
@keyframes towerBeacon{to{filter:brightness(1.6)}}
@media(max-width:700px){.tower-top>div{gap:3px}.tower-ascent{top:48px;left:8px;width:120px;padding:5px}.tower-ascent-shaft{gap:2px;padding:2px 0}.tower-landing{height:13px;width:45px}.tower-landing:nth-child(2){margin-left:39px}.tower-landing:nth-child(3){margin-left:26px}.tower-landing:nth-child(4){margin-left:13px}.tower-landing:nth-child(6){margin-left:-13px}.tower-landing:nth-child(7){margin-left:-26px}.tower-ascent-token{width:24px;height:27px;top:calc(8px + var(--token-to)*15px)}.tower-ascent-token.is-moving{animation:towerTokenClimbMobile .8s ease-out both}.tower-ascent-caption{display:none}.tower-ascent-heading{font-size:8px}}
@keyframes towerTokenClimbMobile{from{left:calc((6 - var(--token-from))*8px);top:calc(8px + var(--token-from)*15px)}to{left:calc((6 - var(--token-to))*8px);top:calc(8px + var(--token-to)*15px)}}
@media(prefers-reduced-motion:reduce){.tower-ascent *{animation:none!important}}
