@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800;900;1000&display=swap');
: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)}body.party{--bg:#19132e;--paper:#261e40;--ink:#fff7ef;--muted:#c0b3d3;--accent:#d9f568;--line:#594b71;--yellow:#d9f568;--pink:#ff4fa0;--water:#2d2451;--field:#362b4f;--tile-ink:#fff7ef}
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}.party .primary{color:#19132e}.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}.settings-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:24px}.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:last-child{min-width:0}.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}.board svg{width:100%;height:100%;max-height:100%;object-fit:contain}.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}.settings-row{gap:12px}.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}.settings-row{grid-template-columns:1fr}.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}.board svg[hidden]{display:none}.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:flex;align-items:center;justify-content:center;min-width:19px;height:19px;padding:0 4px;border:2px solid white;border-radius:50%;background:var(--team-color);color:#152d2c;font-size:11px;font-weight:1000;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:21px;height:21px;margin-right:6px;border-radius:50%;color:#152d2c;font-size:12px;border:1px solid #fff}.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{min-width:16px;height:16px;font-size:9px}}@media(orientation:landscape) and (max-height:599px) and (min-width:650px){.board-hint{font-size:9px;bottom:3px}.team-number{width:16px;height:16px;font-size:10px}.team-avatars>span{width:20px;height:20px}}

.world-labels{z-index:1}.board-hint{z-index:2}
