@font-face{font-family:'Nunito';font-style:normal;font-weight:500 1000;font-display:swap;src:url(/assets/fonts/nunito-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Nunito';font-style:normal;font-weight:500 1000;font-display:swap;src:url(/assets/fonts/nunito-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
:root{--bg:#f7f4e9;--paper:#fffcf4;--ink:#164d50;--muted:#526d6d;--accent:#145d62;--line:#d6e1d6;--yellow:#f4c95d;--pink:#f27968;--water:#d9eeeb;--field:#eeeee2;--tile-ink:#426464;font-family:Nunito,ui-rounded,system-ui,sans-serif;color:var(--ink);background:var(--bg);font-synthesis:none}
*{box-sizing:border-box}body{margin:0;min-width:320px;min-height:100dvh;color:var(--ink);background:var(--bg)}
button,input,select{font:inherit}button,a,input,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer;border:0}button:disabled{opacity:.45;cursor:not-allowed}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #cb831b;outline-offset:4px}a{color:inherit}button{touch-action:manipulation}h1,h2,h3,p{margin:0}h1,h2,h3{overflow-wrap:anywhere;text-wrap:balance}p{line-height:1.55}h1{font-size:clamp(28px,3.4vw,46px);font-weight:1000;line-height:1.1;letter-spacing:-.04em}h2{font-size:clamp(24px,2.1vw,32px);line-height:1.2;letter-spacing:-.025em}h3{font-size:18px;line-height:1.25}small{font-size:13px}svg{display:block;width:100%;height:auto}main,section,aside,form,fieldset{min-width:0}
header{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;width:100%;padding:18px clamp(16px,3vw,48px)}.brand{font-size:32px;line-height:1.2;font-weight:1000;letter-spacing:-2px;text-decoration:none;white-space:nowrap}.brand span{color:var(--pink);letter-spacing:-5px;margin-left:6px}.top-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.room-chip{font-size:15px;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums}
.primary,.secondary,.ghost,.text-button{display:inline-flex;align-items:center;justify-content:center;text-align:center;gap:8px;min-height:46px;padding:11px 18px;border-radius:12px;font-weight:900;text-decoration:none}.primary{background:var(--accent);color:var(--paper);min-height:54px}.secondary{background:var(--yellow);color:#263f3d}.ghost{background:var(--field);color:var(--ink)}.text-button{background:transparent;color:var(--ink);text-decoration:underline;text-underline-offset:4px}.field-help,.small{font-size:14px;line-height:1.5;color:var(--muted)}.eyebrow{font-size:14px;font-weight:800;color:var(--muted)}label{font-size:16px;font-weight:800}input,select{width:100%;min-width:0;min-height:50px;border:1px solid var(--line);border-radius:10px;padding:12px;background:var(--bg);color:var(--ink);font-size:16px}fieldset{border:0;padding:0;margin:24px 0}legend{font-size:18px;font-weight:900;margin-bottom:12px;padding:0}input::placeholder{color:var(--muted)}
/* The start screen is a game folder: choose a role, then prepare the table. */
.welcome{max-width:1500px;margin:auto;padding:clamp(20px,4vw,64px) clamp(16px,3vw,48px) 40px;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(340px,.85fr);gap:clamp(32px,6vw,90px);align-items:start}.welcome-intro h1{font-size:clamp(44px,5.4vw,78px);line-height:1.02;max-width:12ch}.welcome-intro>p{max-width:460px;margin:20px 0;font-size:18px}.preview-board{background:var(--water);border-radius:28px;overflow:hidden;margin-top:28px;max-width:650px}.welcome-intro .welcome-caption{font-size:15px;margin:14px 0}.welcome-folder{padding-top:12px}.role-tabs{display:flex;gap:4px}.role-tabs button{flex:1;background:var(--water);color:var(--ink);padding:16px 12px;font-size:16px;font-weight:900;border-radius:18px 18px 0 0}.role-tabs button[aria-selected=true]{background:var(--paper)}.role-panel{background:var(--paper);padding:clamp(22px,3vw,40px);border-radius:0 0 24px 24px}.role-panel h2{margin-bottom:12px}.role-panel>p{margin-bottom:24px}.role-panel label{display:block;margin:0 0 8px}.role-panel form>.field-help{margin-top:8px}.role-panel .primary{width:100%;margin-top:28px}.role-panel>.field-help{margin:14px 0 0}.folder-note{padding:16px;font-size:14px;text-align:center}.role-panel #code{font-size:28px;letter-spacing:.12em;font-weight:900}
/* Host lobby: the invitation stays large while the team roster fills live. */
.host-lobby{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:clamp(24px,4vw,64px);max-width:1500px;margin:auto;padding:16px clamp(16px,3vw,48px) 36px;align-items:start}.lobby-invite{background:var(--water);border-radius:28px;padding:clamp(20px,2.5vw,40px);text-align:center}.invite>p{max-width:360px;margin:12px auto 20px}.join-qr{display:block;background:#fff;padding:12px;width:clamp(200px,27vw,360px);max-width:100%;height:auto;aspect-ratio:1;border-radius:16px;margin:20px auto}.room-label{display:block;font-size:14px;font-weight:800}.invite-code{display:block;font-size:clamp(38px,4vw,64px);line-height:1.2;letter-spacing:.1em;font-weight:1000;font-variant-numeric:tabular-nums}.join-link{display:block;font-size:14px;overflow-wrap:anywhere;margin:12px auto;max-width:100%}.invite .field-help{margin-bottom:0}.sharing-hint{font-size:14px;margin:20px auto 0;max-width:380px}.lobby-heading{margin:12px 0 22px}.lobby-heading p{margin-top:12px;color:var(--muted)}.lobby-teams{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.lobby-team{background:var(--paper);border-radius:18px;padding:18px;border-top:5px solid var(--team-color)}.team-title{display:flex;align-items:start;justify-content:space-between;gap:10px;margin-bottom:14px}.team-title>span{font-size:14px;color:var(--muted);white-space:nowrap}.member{display:flex;align-items:center;gap:12px;margin-top:12px;min-width:0}.member>span:nth-child(2){min-width:0}.member .kick{margin-left:auto;min-height:40px;padding:6px 12px;font-size:14px}.member b{display:block;overflow-wrap:anywhere;font-size:16px}.member small{display:block;color:var(--muted);margin-top:2px}.avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;font-size:30px;border-radius:14px;background:var(--field)}.empty-slot{font-size:14px;color:var(--muted);margin-top:14px;min-height:28px}.lobby-actions{margin-top:24px}.lobby-actions>.primary{width:100%}.lobby-actions>.field-help{margin:10px 0 14px}.lobby-actions>.ghost{width:100%}
/* Joining is a real profile, preserved while the roster updates. */
.profile-page{width:min(100%,760px);margin:16px auto 40px;padding:0 20px}.profile-heading{margin-bottom:28px}.profile-heading p{margin-top:12px}.profile-details{display:grid;grid-template-columns:minmax(0,1fr) 130px;gap:16px}.profile-details label{display:block;margin-bottom:8px}.character-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.character-choice,.team-choice{position:relative;cursor:pointer;display:block;min-width:0}.character-choice input,.team-choice input{position:absolute;width:1px;height:1px;min-height:0;opacity:0;inset:0}.character-choice>span{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:14px 8px;background:var(--paper);border:3px solid transparent;border-radius:18px}.character-symbol{font-size:40px;line-height:1.2}.character-choice b{font-size:14px}.character-choice input:checked+span,.team-choice input:checked+span{border-color:var(--accent);background:var(--water)}.character-choice input:focus-visible+span,.team-choice input:focus-visible+span{outline:3px solid #cb831b;outline-offset:3px}.team-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:14px}.team-choice>span{display:flex;flex-direction:column;gap:6px;min-height:120px;border:3px solid transparent;border-left:7px solid var(--team-color);border-radius:16px;background:var(--paper);padding:15px}.team-choice b{font-size:17px;overflow-wrap:anywhere}.team-choice small,.team-members{font-size:13px;color:var(--muted)}.team-members{overflow-wrap:anywhere;font-weight:600}.team-choice input:disabled+span{opacity:.5;cursor:not-allowed}.profile-page form>.primary{width:100%}.profile-page form>.field-help{margin-top:12px;text-align:center}.player-lobby{width:min(100%,900px);margin:20px auto 40px;padding:0 20px}.waiting-banner{display:flex;gap:24px;align-items:center;background:var(--water);border-radius:24px;padding:28px;margin-bottom:30px}.waiting-banner h1{font-size:clamp(26px,4vw,38px)}.waiting-banner p{margin-top:12px}.waiting-avatar{font-size:64px;flex-shrink:0}.player-lobby-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}
/* The shared board fits both the viewport width and the remaining height. */
.host-game #app{display:flex;flex-direction:column;min-height:100dvh}.game-shell{width:100%;max-width:2000px;margin:0 auto;padding:10px clamp(16px,2.5vw,48px) 14px;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:12px;flex:1;min-height:0}.game-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.game-heading h1{font-size:clamp(24px,2.4vw,40px);margin-top:4px}.game-heading p{font-size:15px}.stage{display:grid;grid-template-columns:minmax(0,2.25fr) minmax(280px,.85fr);gap:20px;min-height:0;align-items:stretch}.board{min-width:0;min-height:0;background:var(--water);border-radius:24px;overflow:hidden;display:flex;align-items:center;justify-content:center}.stage-info{background:var(--paper);border-radius:24px;padding:clamp(18px,2vw,32px);min-height:0;overflow:auto}.control{display:flex;flex-direction:column;justify-content:center;min-height:100%;gap:12px}.control h2{font-size:clamp(23px,2vw,32px);line-height:1.25}.control>p{font-size:16px}.control .small{font-size:14px}.category-icon{font-size:40px;line-height:1.1}.level{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--field);color:var(--ink);border-radius:12px;padding:16px;min-height:54px;font-weight:900;text-align:left}.level span{font-size:14px}.answers{display:grid;gap:10px}.answer{background:var(--field);color:var(--ink);border:2px solid transparent;padding:13px 15px;border-radius:12px;text-align:left;min-height:48px;font-weight:800}.answer.correct{background:#d9eedb;color:#20472b;border-color:#43865b}.answer.wrong{background:#f9e4df;color:#74372d;border-color:#c25342}.display-only button:disabled{opacity:1;cursor:default}.display-only .control>button.primary,.display-only .control>button.secondary,.display-only .control>button.ghost{display:none}.display-only .level:disabled{opacity:.75}.timer{font-size:15px;font-weight:800;display:grid;gap:8px}.timer-bar{display:block;height:12px;border-radius:999px;background:var(--field);overflow:hidden}.timer-fill{display:block;height:100%;background:var(--accent);border-radius:inherit;transform-origin:left;transition:transform .25s linear,background .3s}.timer.low .timer-fill{background:var(--pink)}.teams{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}.team{padding:10px 14px;background:var(--paper);border-radius:12px;min-width:0;border:2px solid transparent}.team.current{border-color:var(--accent)}.team>b{font-size:15px;overflow-wrap:anywhere}.team .small{display:block;font-size:13px;margin-top:3px}.team-avatars{font-size:20px;display:inline-flex;gap:3px;margin-left:5px}.pawn-dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:6px}.status{font-size:14px;color:var(--muted)}.paused{padding:10px;text-align:center;background:var(--yellow);color:#233e3c;font-weight:900}.winner{font-size:50px}.mobile-wrap{max-width:620px;margin:20px auto;padding:0 16px 30px}.controller-heading{display:flex;gap:14px;align-items:center;margin-bottom:20px}.controller-heading h1{font-size:28px;margin-top:6px}.controller-heading p{font-size:14px;overflow-wrap:anywhere}.panel{padding:24px;background:var(--paper);border-radius:20px}.mobile-wrap .teams{margin-top:20px}.mobile-wrap .control{min-height:330px}.mobile-wrap .control .primary{width:100%}.mobile-wrap .team{padding:10px}.mobile-wrap .level span{font-size:13px}
#notice{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);background:#253b39;color:white;border-radius:14px;padding:14px 20px;box-shadow:0 5px 20px #0002;display:none;z-index:20;font-size:15px}
@media(min-width:900px) and (min-height:600px){.host-game #app{height:100dvh;min-height:0}.host-game header{flex-shrink:0}.game-shell{overflow:hidden}}
@media(min-width:1500px) and (min-height:850px){.host-lobby{padding-top:32px}.invite-large .join-qr{width:410px}.lobby-team{padding:24px}.member{margin-top:16px}.lobby-heading{margin-bottom:30px}.control h2{font-size:34px}.answer,.level{font-size:20px}.team>b{font-size:18px}}
@media(max-width:1000px){.welcome{gap:28px;grid-template-columns:minmax(0,1fr) minmax(320px,.95fr)}.host-lobby{gap:24px;grid-template-columns:minmax(0,.85fr) minmax(0,1fr)}.lobby-teams{gap:10px}.lobby-team{padding:14px}.stage{gap:14px;grid-template-columns:minmax(0,1.5fr) minmax(260px,1fr)}.stage-info{padding:18px}.game-heading>p{max-width:200px}.teams{grid-template-columns:repeat(auto-fit,minmax(120px,1fr))}}
@media(max-width:720px){header{padding:16px;align-items:flex-start}.brand{font-size:27px}.top-actions{gap:6px}.top-actions .ghost{padding:8px 10px;min-height:40px;font-size:13px}.room-chip{font-size:13px;line-height:40px}.welcome{display:flex;flex-direction:column;padding:20px 16px 32px;gap:24px}.welcome-intro{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:center;width:100%}.welcome-intro h1{font-size:clamp(33px,7vw,48px)}.welcome-intro>p{font-size:16px;grid-column:1/-1;margin:0;max-width:none}.preview-board{grid-column:2;grid-row:1;margin:0;border-radius:16px}.welcome-intro .welcome-caption{display:none}.welcome-folder{padding:0;width:100%}.role-panel{padding:24px}.folder-note{padding-bottom:0}.host-lobby{display:flex;flex-direction:column;padding:8px 16px 28px;gap:24px}.lobby-invite,.lobby-roster{width:100%}.lobby-invite{padding:24px}.join-qr{width:min(66vw,320px)}.invite-code{font-size:48px}.invite>p{font-size:16px}.lobby-heading{margin-top:0}.lobby-actions{margin-top:18px}.profile-page{padding:0 16px}.profile-details{grid-template-columns:minmax(0,1fr) 100px;gap:12px}.character-grid{gap:8px}.character-choice>span{padding:12px 4px;gap:6px}.character-symbol{font-size:34px}.character-choice b{font-size:13px}.team-options{gap:10px}.team-choice>span{padding:12px;min-height:132px}.team-choice b{font-size:16px}.player-lobby{padding:0 16px}.waiting-banner{padding:22px;gap:14px;align-items:flex-start}.waiting-avatar{font-size:44px}.waiting-banner h1{font-size:27px}.waiting-banner p{font-size:15px}.player-lobby-actions{flex-direction:column}.host-game header{align-items:center;flex-wrap:wrap}.host-game .top-actions{margin-left:auto}.game-shell{padding:8px 12px 16px;gap:12px}.game-heading{align-items:flex-start}.game-heading h1{font-size:24px}.game-heading>p{max-width:120px;font-size:13px}.game-heading>div>p{font-size:13px}.stage{grid-template-columns:1fr;gap:12px}.board{aspect-ratio:780/520;border-radius:18px}.stage-info{border-radius:18px;overflow:visible;min-height:0}.control{gap:12px}.control h2{font-size:25px}.category-icon{font-size:32px}.teams{grid-template-columns:repeat(2,minmax(0,1fr))}.team{padding:10px}.team>b{font-size:14px}.game-shell .team-avatars{font-size:17px}.mobile-wrap .control{min-height:280px}.role-tabs button{font-size:15px}.role-panel h2{font-size:27px}}
@media(max-width:380px){.welcome-intro{grid-template-columns:1fr}.welcome-intro h1{font-size:38px}.preview-board{display:none}.lobby-teams{grid-template-columns:1fr}.team-options{grid-template-columns:1fr}.waiting-banner{display:block}.waiting-avatar{display:block;margin-bottom:12px}.brand{font-size:25px}.character-choice b{font-size:12px}}
@media(orientation:landscape) and (max-height:599px) and (min-width:650px){.host-game #app{height:100dvh;min-height:0}.host-game header{padding:8px 16px;flex-shrink:0}.host-game header .brand{font-size:24px}.host-game header .ghost{min-height:34px;padding:6px 9px;font-size:12px}.game-shell{padding:0 12px 6px;gap:6px;overflow:hidden}.game-heading h1{font-size:20px;margin:0}.game-heading p{font-size:12px}.stage{grid-template-columns:minmax(0,1.5fr) minmax(240px,1fr);gap:10px}.board{aspect-ratio:auto}.stage-info{overflow:auto;padding:12px}.control{justify-content:flex-start;gap:8px}.control h2{font-size:20px}.category-icon{font-size:24px}.control>p,.control .small{font-size:13px}.answer,.level{padding:8px;min-height:38px;font-size:14px}.level span{font-size:12px}.teams{grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:6px}.team{padding:5px 8px}.team>b,.team .small{font-size:11px}.team-avatars{font-size:14px}.status{font-size:12px}.game-shell .teams{max-height:76px;overflow:auto}}
@media(prefers-reduced-motion:no-preference){button,.character-choice>span,.team-choice>span{transition:transform .15s,background .15s,border-color .15s}button:active:not(:disabled){transform:scale(.98)}.character-choice:hover>span{transform:translateY(-2px)}.welcome-folder{animation:arrive .4s ease-out}.waiting-avatar{animation:arrive .4s ease-out}@keyframes arrive{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}}

@media(min-width:721px){.invite-large .join-qr{width:min(360px,27vw,36dvh)}}
@media(min-width:1500px) and (min-height:850px){.invite-large .join-qr{width:min(410px,38dvh)}}
@media(orientation:landscape) and (max-height:599px) and (min-width:650px){
 .screen-mode .stage-info{padding:10px 12px}
 .screen-mode .control{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-content:center;gap:8px}
 .screen-mode .control>*{grid-column:1/-1}
 .screen-mode .control>.category-icon,.screen-mode .control>.eyebrow{display:none}
 .screen-mode .control h2{font-size:18px;line-height:1.15}
 .screen-mode .control>.level{grid-column:auto;flex-direction:column;justify-content:center;gap:4px;padding:8px 4px;min-height:54px;font-size:14px}
 .screen-mode .answers{grid-template-columns:1fr 1fr;gap:6px}
 .screen-mode .answer{font-size:13px;padding:7px;min-height:38px}
 .screen-mode .control .timer{font-size:12px}
 .screen-mode .team-avatars{display:none}
 .screen-mode .team>b{font-size:12px}
}
/* One persistent WebGL canvas is reattached when the surrounding game UI updates. */
.board{position:relative;isolation:isolate}.world-canvas{display:block;position:absolute;inset:0;width:100%;height:100%}.world-labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}.world-team-label{position:absolute;left:0;top:0;display:block;max-width:120px;height:20px;padding:0 7px;border:2px solid white;border-radius:999px;background:var(--team-color);color:#152d2c;font-size:11px;font-weight:1000;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-shadow:0 2px 4px #163e4830}.world-team-label.is-active{outline:2px solid #164d50;outline-offset:2px}.board-hint{position:absolute;bottom:8px;left:12px;right:12px;pointer-events:none;font-size:11px;color:#244e4d;text-align:center;background:#eef7eaad;border-radius:8px;line-height:1.6}.board-hint:empty{display:none}.team-number{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;margin-right:6px;border-radius:50%;color:#152d2c;font-size:12px;border:1px solid #fff;vertical-align:-1px}.preview-board>img{display:block;width:100%;height:auto}.character-image{display:block;width:100%;height:100%;object-fit:contain}.character-symbol{display:block;width:80px;height:80px}.avatar{overflow:visible}.avatar .character-image{width:58px;height:58px;max-width:none}.waiting-avatar{display:block;width:100px;height:100px}.team-avatars>span{display:inline-block;width:32px;height:32px}.team-avatars{vertical-align:middle}.controller-heading .avatar{width:64px;height:64px}.controller-heading .avatar .character-image{width:80px;height:80px}@media(max-width:720px){.character-symbol{width:62px;height:62px}.waiting-avatar{width:72px;height:72px}.team-avatars>span{width:26px;height:26px}.board-hint{font-size:9px;bottom:4px}.world-team-label{max-width:90px;height:17px;padding:0 5px;font-size:9px;line-height:13px}}@media(orientation:landscape) and (max-height:599px) and (min-width:650px){.board-hint{font-size:9px;bottom:3px}.team-number{width:11px;height:11px;font-size:10px}.team-avatars>span{width:20px;height:20px}}

.world-labels{z-index:1}.board-hint{z-index:2}
.phone-mode #app{min-height:100dvh}.phone-game{width:100%;max-width:900px;margin:0 auto;padding:0 12px 16px;display:flex;flex-direction:column;gap:10px}.phone-heading{display:flex;gap:10px;align-items:center}.phone-heading .avatar{width:44px;height:44px}.phone-heading .avatar .character-image{width:56px;height:56px}.phone-heading p{font-size:13px;overflow-wrap:anywhere}.phone-heading h1{font-size:22px;margin-top:2px}.phone-board{display:block;overflow:visible;aspect-ratio:auto;height:calc(100dvh - 210px);min-height:470px;border-radius:18px}.phone-board .world-canvas{border-radius:inherit}.phone-board .board-hint{top:6px;bottom:auto}.world-card{position:absolute;z-index:3;left:8px;right:8px;bottom:8px;padding:8px 14px 14px;background:var(--paper);border-radius:16px;box-shadow:0 6px 24px #163e4840}.world-card .control{min-height:0;gap:10px}.world-card .control h2{font-size:21px}.world-card .category-icon{font-size:28px}.world-card .answer,.world-card .level{min-height:44px;padding:10px 12px}.world-card .answers{grid-template-columns:1fr 1fr;gap:8px}.world-card .answer{min-height:52px;padding:8px 10px;font-size:15px;overflow-wrap:anywhere}.world-card .timer{font-size:13px}.world-card.is-hidden .control{display:none}.card-toggle{display:block;margin:0 auto 6px;padding:4px 12px;min-height:32px;background:transparent;color:var(--muted);font-size:13px;font-weight:800}.world-card.is-hidden .card-toggle{margin-bottom:0}.phone-game .teams{grid-template-columns:repeat(auto-fit,minmax(130px,1fr));margin:0}.phone-game .team{padding:8px 10px}
@media(orientation:landscape) and (max-height:599px){.phone-mode header{padding:6px 16px}.phone-mode header .brand{font-size:22px}.phone-mode header .ghost{min-height:32px;padding:5px 9px;font-size:12px}.phone-mode .room-chip{line-height:32px}.phone-game{padding-bottom:8px;gap:6px}.world-card .eyebrow{font-size:12px}.world-card .control>p,.world-card .small{font-size:12px}.world-card .primary{min-height:40px;padding:8px 14px}.phone-heading{display:none}.phone-board{height:calc(100dvh - 58px);min-height:260px}.world-card{left:auto;top:8px;bottom:auto;width:min(46%,400px)}.world-card.is-hidden{top:auto;bottom:8px}.world-card .control h2{font-size:17px}.world-card .category-icon{font-size:22px}.world-card .answer,.world-card .level{min-height:36px;padding:7px 10px;font-size:14px}.world-card .answer{min-height:40px;font-size:13px}.phone-game .teams,.phone-game .status{display:none}}

/* The intro accompanies setup; all game choices remain usable during playback. */
#welcome-film-host{width:100%;max-width:650px;margin-top:28px}
.welcome-film-picture{display:block;width:100%;padding:0;position:relative;aspect-ratio:16/9;overflow:hidden;border-radius:24px;background:var(--water)}
.welcome-film-picture:disabled{opacity:1;cursor:default}
.welcome-film-picture>img,.welcome-film-picture>video{display:block;width:100%;height:100%;object-fit:contain}
.welcome-film [hidden]{display:none}
@media(max-width:720px){
 .welcome-intro{display:flex;flex-direction:column;align-items:flex-start;gap:12px}
 .welcome-intro h1{font-size:clamp(36px,8vw,48px)}
 #welcome-film-host{margin-top:4px;max-width:none}
 .welcome-film-picture{border-radius:16px}
}
.turn-banner{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:16px;pointer-events:none;visibility:hidden;opacity:0}
.turn-banner.is-shown{visibility:visible;opacity:1}
.turn-banner-card{display:flex;flex-direction:column;align-items:center;gap:6px;min-width:min(280px,100%);padding:20px 28px 22px;background:var(--paper);border-top:8px solid var(--team-color);border-radius:22px;box-shadow:0 12px 40px #163e4859;text-align:center}
.turn-banner-card b{font-size:30px;line-height:1.1}.turn-banner-card small{color:var(--muted);font-size:14px;font-weight:800}
.turn-banner-card .avatar{width:76px;height:76px}.turn-banner-card .avatar .character-image{width:92px;height:92px}
/* While the turn banner shows, the card waits out of sight and comes in as the banner leaves. */
.world-card{transition:opacity .3s,visibility .3s}
html[data-announcing] .tv-card,html[data-announcing] .world-card{opacity:0;visibility:hidden;pointer-events:none}
html[data-game-intro] .tv-card,html[data-game-intro] .world-card{opacity:0;visibility:hidden;pointer-events:none;transition:none}
html[data-game-intro] .world-bubble,html[data-game-intro] .phone-heading{visibility:hidden}

@media(prefers-reduced-motion:no-preference){.turn-banner{transition:opacity .25s,visibility .25s}.turn-banner.is-shown .turn-banner-card{animation:banner-in .35s cubic-bezier(.2,1.4,.4,1)}}
@keyframes banner-in{from{transform:scale(.8);opacity:0}to{transform:none;opacity:1}}
.my-turn .phone-board{box-shadow:0 0 0 4px var(--turn-color)}.my-turn .phone-heading h1{color:var(--accent)}
.world-card.is-waiting{padding:10px 12px}.world-card.is-waiting .control{margin-top:10px;opacity:.85}
.watch-status{display:flex;align-items:center;gap:10px}.watch-status p{flex:1;margin:0;font-weight:800;font-size:15px;line-height:1.3;overflow-wrap:anywhere}
.watch-status .avatar{flex:none;width:40px;height:40px}.watch-status .avatar .character-image{width:50px;height:50px}
.watch-toggle{flex:none;min-height:40px;padding:6px 12px;font-size:14px}
.world-bubble{position:absolute;left:0;top:0;display:none;align-items:center;justify-content:center;min-width:30px;height:26px;padding:0 7px;border-radius:13px;background:#fffcf4;color:#164d50;font-size:15px;font-weight:1000;box-shadow:0 2px 6px #163e4840}
.world-bubble[data-mood]{display:flex}.world-bubble[data-mood=right]{background:#d9eedb;color:#20472b}.world-bubble[data-mood=wrong]{background:#fbe0da;color:#8a2f22}
@media(prefers-reduced-motion:no-preference){.world-bubble[data-mood=thinking]{animation:bubble-think 1.4s ease-in-out infinite}}
@keyframes bubble-think{50%{opacity:.55}}
/* Tv-läge: the host's view as a tv picture. Fullscreen where allowed; on a landscape phone the board gets the full height. */
.tv-mode header .brand{display:none}
.tv-mode header{justify-content:flex-end}
/* Host game on a shared screen, with or without tv-läge: the island fills the window, the question card floats in the middle
   and the teams sit along the bottom. The card steps aside while a pawn moves and when the turn simply passes, so the board
   is seen. */
.host-game #app{height:100dvh;min-height:0;overflow:hidden;position:relative;display:block}
.host-game header{position:absolute;z-index:4;top:0;right:0;width:auto;padding:clamp(6px,1.2vh,14px) clamp(8px,1.2vw,18px);justify-content:flex-end}
.host-game header .brand{display:none}
.tv-mode.host-game .room-chip{display:none}
.host-game .game-shell{max-width:none;padding:0;display:block;height:100%}
.host-game .tv-board{position:relative;width:100%;height:100%;border:0;border-radius:0;box-shadow:none;aspect-ratio:auto}
.host-game .tv-board .board-hint{left:clamp(8px,1.2vw,18px);right:auto;top:clamp(8px,1.2vh,14px);bottom:auto;width:auto;padding:0 8px}
/* The card is centred in the room between the host's buttons and the teams. */
.host-game .tv-card{position:absolute;z-index:3;left:50%;top:var(--top-room,clamp(60px,9vh,84px));bottom:var(--teams-room,clamp(76px,11vh,104px));height:fit-content;margin-block:auto;width:min(560px,calc(100% - 32px));max-height:calc(100% - var(--top-room,clamp(60px,9vh,84px)) - var(--teams-room,clamp(76px,11vh,104px)));overflow:auto;padding:clamp(14px,1.6vw,28px);border-radius:24px;box-shadow:0 6px 0 var(--panel-edge),0 18px 50px #163e4855;transform:translateX(-50%);transition:opacity .3s,transform .3s,visibility .3s}
.host-game .tv-card .control{min-height:0}
/* The event card on the shared board is a small note, not a full question card: it leaves the island and the medal in view. */
.host-game .tv-card:has(>.control[data-event]){width:min(280px,calc(100% - 32px));padding:8px;border-radius:20px}
.host-game .tv-card .control[data-event]{gap:6px}
.host-game .tv-card .event-card{gap:3px;padding:10px 12px 11px;border-radius:16px;border-width:2px;box-shadow:0 3px 0 var(--event-edge)}
.host-game .tv-card .event-card h2{font-size:22px}.host-game .tv-card .event-card p{font-size:14px}
.host-game .tv-card .event-kicker{font-size:9px;letter-spacing:1.2px;padding:2px 8px}
.host-game .tv-card .event-icon{width:42px;height:42px;font-size:22px;border-width:2px;box-shadow:0 2px 0 #00000018}
.host-game .tv-card .control[data-event]>p.small{font-size:12px;margin:0;text-align:center}
.host-game .tv-board.is-moving:not(.is-telling) .tv-card,.host-game .tv-card.event-told,.host-game .tv-card.is-held,.host-game .tv-card:has(>.control[data-phase=turn-end]:not([data-event])){opacity:0;visibility:hidden;transform:translate(-50%,16px) scale(.96);pointer-events:none}
.host-game .tv-board .teams{position:absolute;z-index:3;left:clamp(10px,1.5vw,28px);right:clamp(10px,1.5vw,28px);bottom:clamp(10px,2vh,28px);display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:center;gap:8px;margin:0}
.host-game .tv-board .team{width:clamp(150px,15vw,240px);padding:6px 10px;box-shadow:0 3px 0 var(--panel-edge),0 8px 20px #163e4830}
.host-game .tv-board .team.current{box-shadow:0 3px 0 var(--accent),0 8px 20px #163e4830}
.host-game .tv-board .team-avatars{display:none}
.host-game .paused{position:absolute;z-index:4;top:clamp(8px,1.2vh,14px);left:50%;transform:translateX(-50%);padding:6px 14px;border-radius:999px}
@media(prefers-reduced-motion:reduce){.host-game .tv-card{transition:none}}
/* Narrow screens: the buttons wrap to two rows, so the card starts lower and the board's caption gives way. */
@media(max-width:720px){.host-game .tv-card{--top-room:clamp(96px,14vh,118px);--teams-room:84px}.host-game .tv-board .board-hint{display:none}}
/* Low landscape (a phone shared to the tv): a wider, tighter card with two answers per row. */
@media(orientation:landscape) and (max-height:599px){.host-game .tv-card{--top-room:46px;--teams-room:72px;width:min(680px,calc(100% - 24px));padding:10px 14px;border-radius:18px}.host-game .tv-card .category-icon,.host-game .tv-card .eyebrow,.host-game .tv-card .scene-companion{display:none}.host-game .tv-card .answers{grid-template-columns:1fr 1fr}.host-game .tv-board .teams{bottom:8px}.host-game .tv-board .team{padding:4px 8px}}
/* Larger maps reserve a side of the picture for the card so the followed pawn stays visible. */
.host-game .follow-board .tv-card{left:auto;right:18px;transform:none;width:min(440px,42vw)}
.host-game .follow-board.is-moving:not(.is-telling) .tv-card,.host-game .follow-board .tv-card.event-told,.host-game .follow-board .tv-card.is-held,.host-game .follow-board .tv-card:has(>.control[data-phase=turn-end]:not([data-event])){transform:translateY(16px) scale(.96)}
@media(max-width:899px) and (orientation:portrait){.host-game .follow-board .tv-card{left:16px;right:16px;top:auto;bottom:var(--teams-room,104px);width:auto;max-height:42%;margin:0}}
.rotate-hint{display:none}
@media(orientation:portrait) and (max-width:720px){.tv-mode .rotate-hint{display:block;position:sticky;top:0;z-index:5;margin:0;padding:10px 16px;background:var(--yellow);color:#233e3c;font-weight:900;text-align:center}}
@media(orientation:landscape) and (max-height:599px){
 .tv-mode #app{height:100dvh;min-height:0;overflow:hidden}
 .tv-mode header{padding:6px 8px 0;gap:6px}
 .tv-mode .top-actions{gap:4px}
 .tv-mode header .ghost{min-height:30px;padding:4px 8px;font-size:12px}
 .tv-mode .room-chip{font-size:13px;line-height:30px}
 /* Lobby: invitation and roster side by side, each scrolling on its own if needed. */
 .tv-mode:not(.host-game) #app{display:flex;flex-direction:column}
 .tv-mode .host-lobby{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:12px;padding:6px 10px 10px;max-width:none;width:100%}
 .tv-mode .lobby-invite,.tv-mode .lobby-roster{max-height:100%;overflow:auto}
 .tv-mode .lobby-invite{padding:10px;border-radius:18px;display:flex;flex-direction:column;justify-content:center}
 .tv-mode .invite h2{font-size:18px}
 .tv-mode .invite>p,.tv-mode .invite .field-help,.tv-mode .sharing-hint{display:none}
 .tv-mode .invite-large .join-qr{width:min(48dvh,70%);padding:6px;margin:6px auto;border-radius:10px}
 .tv-mode .invite-code{font-size:32px}
 .tv-mode .join-link{font-size:11px}
 .tv-mode .lobby-heading{margin:0 0 8px}
 .tv-mode .lobby-heading h1{font-size:22px}
 .tv-mode .lobby-heading p{margin-top:2px;font-size:13px}
 .tv-mode .lobby-teams{gap:6px}
 .tv-mode .lobby-team{padding:8px 10px}
 .tv-mode .lobby-actions{margin-top:8px}
 .tv-mode .lobby-actions .primary,.tv-mode .lobby-actions .ghost{min-height:38px;padding:6px 12px}
 .tv-mode .lobby-actions>.field-help{margin:4px 0 6px;font-size:12px}
}

/* Keep the board's layout while its 3D resources load. */
.board-loading{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:24px;text-align:center;color:var(--ink);font-size:clamp(28px,4vw,64px);font-weight:1000;line-height:1.2;letter-spacing:-.025em}
.board-loading picture{display:block;width:min(100px,22vw,18dvh);flex-shrink:0;line-height:0;pointer-events:none}
.board-loading img{display:block;width:100%;height:auto;object-fit:contain}
.board:not([data-renderer])>:not(.board-loading){visibility:hidden}
.board[data-renderer]>.board-loading{display:none}

.game-ended{width:min(100%,640px);margin:auto;padding:clamp(24px,8vh,96px) 16px;text-align:center}.game-ended .panel{display:grid;gap:24px}.game-ended h1{font-size:clamp(28px,5vw,42px)}.game-ended .primary{justify-self:center}

/* Flood event: the warning precedes the surf; the game remains paused underneath. */
#flood-warning{position:fixed;inset:0;z-index:21;display:flex;align-items:center;justify-content:center;padding:24px;pointer-events:none;background:#092f4560;transition:background .5s}
.flood-warning-card{display:flex;align-items:center;gap:24px;max-width:720px;padding:30px 38px;border:3px solid #ffe8a1;border-radius:24px;background:#fff8df;color:#173e50;box-shadow:0 10px 0 #0f435e,0 28px 80px #052c4560;transform:rotate(-2deg)}
.flood-warning-symbol{display:grid;place-items:center;flex:0 0 84px;height:84px;border-radius:50%;background:#f2b83d;color:#173e50;font-size:64px;font-weight:1000;border:4px solid #173e50}
.flood-warning-kicker{font-size:12px;font-weight:900;letter-spacing:.16em}.flood-warning-card h2{font-size:clamp(24px,4vw,44px);line-height:1.12;margin:8px 0 12px}.flood-warning-card p{font-size:16px}
#flood-warning.is-wave{align-items:flex-start;padding-top:18px;background:transparent}.is-wave .flood-warning-card{padding:12px 22px;gap:12px;transform:none;border-width:2px;border-radius:16px;box-shadow:0 4px 0 #0f435e}.is-wave .flood-warning-symbol{flex-basis:36px;height:36px;font-size:26px;border-width:2px}.is-wave .flood-warning-kicker{display:none}.is-wave .flood-warning-card h2{font-size:18px;margin:0 0 4px}.is-wave .flood-warning-card p{font-size:12px}
body[data-flood] .turn-banner,body[data-flood] .tv-card,body[data-flood] .world-card,body[data-flood] .paused{visibility:hidden!important}
body[data-flood] .world-bubble{visibility:hidden!important}

@media(max-width:600px){.flood-warning-card{padding:22px;gap:14px}.flood-warning-symbol{flex-basis:48px;height:48px;font-size:36px}.flood-warning-card p{font-size:14px}#flood-warning.is-wave{padding:10px}.is-wave .flood-warning-card h2{font-size:16px}}
@media(prefers-reduced-motion:reduce){#flood-warning{transition:none}.flood-warning-card{transform:none}}

.board-error{position:absolute;inset:0;z-index:7;display:grid;place-items:center;padding:24px;background:var(--water);text-align:center}
.board-error>div{display:grid;gap:18px;max-width:480px}.board-error h2{font-size:clamp(24px,4vw,36px)}.board-error button{justify-self:center;min-height:44px}
.board[data-renderer=error]>:not(.board-error){visibility:hidden!important}
