@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&family=Noto+Serif+TC:wght@500;600;700&display=swap');
:root{color-scheme:dark;--ink:#f9eddf;--muted:#b8c9ce;--panel:rgba(25,42,54,.9);--line:rgba(223,235,230,.16);--pink:#f0afbf;--gold:#f2d29a;font-family:'Noto Sans TC',sans-serif;font-size:16px}*{box-sizing:border-box}body{margin:0;background:#243d51;color:var(--ink);overflow:hidden}button,input,select{font:inherit}button,a,input,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--gold);outline-offset:4px}button{color:inherit}a{color:inherit;text-decoration:none}[hidden]{display:none!important}#app{position:relative;width:100%;height:100dvh;min-height:540px;overflow:hidden}#scene{position:absolute;inset:0}#scene canvas{display:block;width:100%;height:100%;touch-action:none}.vignette{position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,rgba(12,29,41,.42),transparent 50%),linear-gradient(0deg,rgba(15,33,46,.55),transparent 24%)}header{position:absolute;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:25px 34px;z-index:5;background:linear-gradient(#1d3347b5,transparent)}.brand{display:flex;gap:12px;align-items:center;font-size:22px;font-weight:600;letter-spacing:3px}.brand-icon{font-size:43px;color:var(--pink);line-height:1}.brand small{display:block;font-size:10px;letter-spacing:2px;margin-top:5px;color:var(--muted)}.header-right{display:flex;gap:12px;align-items:center}.status{font-size:13px;color:#e7e1cf;margin-right:9px}.status:before{content:'';display:inline-block;width:6px;height:6px;margin-right:9px;background:#b8d7a3;border-radius:50%}.icon-btn,.view-tools button{width:36px;height:36px;border:1px solid var(--line);background:#1b324d66;border-radius:50%;font-size:18px}.icon-btn.enabled{color:var(--gold);border-color:var(--gold)}.text-link{font-size:14px;margin-left:8px}.panel{border:1px solid var(--line);background:var(--panel);backdrop-filter:blur(20px);box-shadow:0 20px 60px #10253133;border-radius:22px}.welcome{position:absolute;top:50%;transform:translateY(-44%);left:34px;width:330px;padding:30px;z-index:4}.eyebrow{display:block;font-size:12px;letter-spacing:2px;color:var(--gold);font-weight:500}.welcome h1{font-family:'Noto Serif TC',serif;font-size:54px;line-height:1.35;font-weight:500;letter-spacing:3px;margin:18px 0}.intro{font-size:15px;line-height:1.9;color:#d2dcdd;margin:0 0 24px}.section-label{font-size:13px;display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.section-label span{color:var(--pink)}.avatars{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.avatar-choice{border:1px solid var(--line);border-radius:11px;padding:10px 3px;background:#ffffff07;font-size:13px;transition:background .2s}.avatar-choice:before{content:'';display:block;width:16px;height:16px;background:var(--swatch);border-radius:50%;margin:0 auto 6px;box-shadow:0 0 0 4px #ffffff0a}.avatar-choice[aria-pressed=true]{border-color:var(--pink);background:#edb1c51c}.muted{font-size:12px;color:var(--muted);line-height:1.6}.primary,.secondary{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;padding:14px 15px;border-radius:11px;border:0;font-size:14px;font-weight:600}.primary{color:#253744;background:var(--gold);box-shadow:0 4px 14px #f2d29a10}.primary:hover{background:#ffe1b1}.primary span{margin-left:auto}.secondary{background:transparent;border:1px solid #d2ded52b;margin-top:10px;font-weight:400}.secondary:hover{background:#ffffff0c}.footnote{color:var(--muted);font-size:11px;line-height:1.7;margin:12px 0 0}.room-panel{position:absolute;left:28px;top:111px;width:254px;padding:22px;z-index:4}.room-panel h2{font-family:'Noto Serif TC',serif;font-weight:500;font-size:23px;margin:10px 0 19px}.player-row{display:flex;gap:10px;align-items:center;margin:7px -9px;padding:9px;border-radius:12px;cursor:pointer}.player-row.active{background:#f2d29a14;outline:1px solid #f2d29a55}.player-dot{flex-shrink:0;display:grid;place-items:center;width:33px;height:33px;border-radius:50%;font-weight:600;color:#263b45;font-size:14px}.player-row strong{display:block;font-size:13px;max-width:115px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.player-row small{display:block;font-size:10px;color:var(--muted);margin-top:4px}.heart-count{margin-left:auto;color:var(--pink);font-size:13px;white-space:nowrap}.check{display:flex;gap:9px;align-items:center;font-size:12px;margin:18px 0}.check input{accent-color:var(--gold)}.room-panel .primary{margin-top:14px}.view-tools{position:absolute;right:29px;top:115px;display:flex;flex-direction:column;gap:9px;z-index:4}.view-tools button{border-radius:10px;background:#1c3446bb;font-size:15px}.scene-caption{position:absolute;bottom:24px;left:50%;transform:translateX(-50%);color:#d7e3de9e;font-size:11px;letter-spacing:1px;pointer-events:none;white-space:nowrap}.turn-panel{position:absolute;left:50%;bottom:52px;transform:translateX(-50%);display:flex;align-items:center;gap:25px;background:#1b3044ed;border:1px solid var(--line);border-radius:20px;padding:15px 22px;min-width:370px;box-shadow:0 12px 40px #152a4544;z-index:4}.turn-panel strong{display:block;font-size:18px;margin:6px 0}.turn-panel .muted{display:block}.dice-button{display:flex;flex-direction:column;align-items:center;gap:2px;margin-left:auto;width:84px;min-height:89px;justify-content:center;background:var(--gold);border:0;color:#243b48;border-radius:15px}.dice-button #dice-face{font-size:39px;line-height:1}.dice-button #dice-label{font-size:12px;font-weight:600}.turn-caption{position:absolute;top:-30px;text-align:center;left:0;right:0;font-size:12px;color:#ffead1;text-shadow:0 2px 8px #132c3b}.chat-toggle{position:absolute;right:28px;bottom:28px;z-index:6;border:1px solid var(--line);background:#24394bee;border-radius:30px;padding:13px 20px;font-size:13px}.chat-toggle span{color:var(--pink)}.chat{position:absolute;right:28px;bottom:28px;width:310px;max-height:55vh;z-index:7;display:flex;flex-direction:column;padding:17px}.chat-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;font-size:14px}.chat-head button{font-size:22px;background:none;border:0}.chat #messages{flex:1;min-height:110px;overflow:auto;max-height:33vh;scrollbar-width:thin;scrollbar-color:#597a89 transparent}.message{margin:0 0 15px}.message small{color:var(--pink);font-size:10px}.message p{font-size:13px;line-height:1.65;margin:5px 0 0;overflow-wrap:anywhere}.message.system{background:#ffffff06;padding:9px;border-left:2px solid #d2bf9b;border-radius:4px}.message.system p{color:#c2d2d2;font-size:11px}.message.self{padding-left:20px;text-align:right}.message.self small{color:var(--gold)}#chat-form select{width:100%;font-size:11px;background:#1c3043;color:#c5d9d7;border:1px solid var(--line);padding:7px;border-radius:7px;margin:10px 0 6px}.input-row{display:flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#ffffff07}.input-row input{width:100%;min-width:0;font-size:12px;padding:11px 9px;background:none;color:var(--ink);border:0}.input-row button{width:37px;border:0;background:var(--gold);color:#21394a;font-size:21px}.chat>small{font-size:9px;margin-top:9px;color:var(--muted)}#toast{position:absolute;left:50%;top:98px;transform:translate(-50%,-12px);max-width:90%;background:#fff0dc;color:#2c4552;border-radius:13px;padding:12px 20px;font-size:14px;opacity:0;pointer-events:none;z-index:12;transition:.2s;box-shadow:0 8px 35px #18304544}#toast.show{opacity:1;transform:translate(-50%,0)}dialog{max-width:460px;width:calc(100% - 32px);border:1px solid #e7d8b72f;border-radius:24px;background:#233c4e;color:var(--ink);padding:34px;box-shadow:0 25px 90px #0008}dialog::backdrop{background:#071723a6;backdrop-filter:blur(8px)}dialog h2{font-family:'Noto Serif TC',serif;font-weight:500;line-height:1.5;font-size:27px}dialog p{font-size:14px;line-height:1.85;color:#d2dedb}.dialog-close{position:absolute;right:16px;top:13px;background:none;border:0;font-size:25px}.finish-heart{font-size:60px;text-align:center;color:var(--pink);margin-top:15px}#finish{text-align:center}#scores p{margin:4px 0;font-size:13px}#finish .primary{margin-top:20px}#fallback{position:absolute;left:290px;right:80px;top:110px;bottom:190px;z-index:2;border-radius:25px;background:#416565e8}.flat-title{text-align:center;font-size:14px;padding:15px;color:var(--gold)}#flat-board{position:absolute;inset:35px 15px 15px}.flat-tile{position:absolute;transform:translate(-50%,-50%);min-width:22px;height:22px;display:grid;place-items:center;background:#edddbd;color:#354a56;border-radius:50%;font-size:9px}.flat-tile.occupied{background:#f2a5bb;min-width:31px;height:31px;font-size:11px;z-index:2;box-shadow:0 0 0 3px #fff4}
@media(min-width:1500px){.welcome{left:5vw;width:360px;padding:34px}.welcome h1{font-size:62px}.room-panel{left:40px}.chat{right:40px}}
@media(max-height:760px) and (min-width:761px){.welcome{top:100px;transform:none;padding:22px;width:295px}.welcome h1{font-size:40px;margin:10px 0}.intro{margin-bottom:15px;font-size:13px}.avatar-choice{padding:6px}.welcome .primary,.welcome .secondary{padding:10px}.footnote{margin-top:8px}.welcome .muted{margin:8px 0}.turn-panel{bottom:35px}.scene-caption{bottom:12px}}
@media(max-width:760px){#app{min-height:500px}header{padding:15px 16px}.brand{font-size:18px;gap:8px;letter-spacing:2px}.brand-icon{font-size:31px}.brand small{font-size:8px;letter-spacing:1px}.header-right{gap:7px}.status{display:none}.text-link{font-size:11px}.icon-btn{width:29px;height:29px;font-size:15px}.welcome{left:14px;right:14px;top:auto;bottom:21px;transform:none;width:auto;padding:20px 22px;border-radius:20px;background:#1d344bea;display:grid;grid-template-columns:1fr 1fr;gap:0 18px}.welcome .eyebrow{grid-column:1/-1;font-size:10px}.welcome h1{font-size:35px;line-height:1.25;margin:10px 0;grid-column:1}.intro{font-size:11px;line-height:1.7;margin:0 0 12px;grid-column:1}.section-label{grid-column:2;grid-row:2;align-self:end;font-size:11px;margin-bottom:9px}.avatars{grid-column:2;grid-row:3/5;gap:6px;align-content:start}.avatar-choice{padding:8px 2px;font-size:10px}.avatar-choice:before{width:12px;height:12px;margin-bottom:4px}.welcome .muted{grid-column:1;font-size:10px;align-self:end;margin:0 0 10px}.welcome .primary{grid-column:1/-1;font-size:13px;padding:12px;margin-top:3px}.welcome .secondary{grid-column:1/-1;font-size:12px;padding:10px;margin-top:8px}.welcome .footnote{grid-column:1/-1;font-size:9px;margin-top:6px}.welcome #invite-note:empty{display:none}.view-tools{right:14px;top:83px;gap:7px}.view-tools button{width:30px;height:30px;font-size:12px}.room-panel{top:77px;left:14px;width:190px;padding:15px;border-radius:16px}.room-panel .eyebrow{font-size:9px;letter-spacing:1px}.room-panel h2{font-size:18px;margin:7px 0 10px}.player-row{padding:6px;margin:3px -5px;gap:7px}.player-dot{width:25px;height:25px;font-size:11px}.player-row strong{font-size:11px;max-width:90px}.player-row small{font-size:9px;margin-top:2px}.heart-count{font-size:11px}.room-panel .primary,.room-panel .secondary{font-size:11px;padding:10px}.room-panel .footnote{font-size:9px}.check{font-size:10px;margin:12px 0}.turn-panel{min-width:0;left:14px;right:14px;bottom:64px;transform:none;gap:15px;padding:12px 16px;border-radius:16px}.turn-panel strong{font-size:15px;margin:4px 0}.turn-panel .eyebrow{font-size:10px}.turn-panel .muted{font-size:10px}.dice-button{width:68px;min-height:70px;border-radius:12px}.dice-button #dice-face{font-size:32px}.dice-button #dice-label{font-size:11px}.turn-caption{font-size:10px;top:-24px}.scene-caption{bottom:17px;left:17px;transform:none;font-size:9px}.chat-toggle{bottom:14px;right:14px;padding:10px 13px;font-size:11px}.chat{right:14px;left:14px;bottom:14px;width:auto;max-height:58vh}.chat #messages{max-height:32vh}.chat .input-row input{font-size:16px}.chat small{font-size:10px}.message p{font-size:14px}#fallback{left:14px;right:14px;top:280px;bottom:180px}.flat-tile{min-width:14px;height:14px;font-size:7px}.flat-tile.occupied{min-width:22px;height:22px;font-size:9px}#toast{top:78px;font-size:12px;width:max-content;max-width:calc(100% - 28px)}dialog{padding:26px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
/* Keep frequently used controls readable at narrow widths. */
.primary,.secondary,.avatar-choice,.player-row strong,.message p,.input-row input{font-size:max(.875rem,14px)}
.footnote,.muted,.player-row small,.message small,.chat>small,.scene-caption{font-size:max(.75rem,12px)}
@media(max-width:760px){.welcome{max-height:calc(100dvh - 90px);overflow:auto}.room-panel{max-height:46vh;overflow:auto}.avatars{grid-template-columns:repeat(3,1fr)}.avatar-choice{font-size:12px}.player-row strong{font-size:12px}.player-row small{font-size:11px}.chat .input-row input{font-size:16px}.welcome .footnote{font-size:11px}.section-label{font-size:12px}.welcome h1{font-size:32px}.intro{font-size:12px}.room-panel .primary,.room-panel .secondary{font-size:12px}}
.district-nav{position:absolute;z-index:5;left:50%;transform:translateX(-50%);bottom:20px;display:flex;gap:5px;padding:7px;background:#193b47e8;border:1px solid #dce5db44;border-radius:14px;max-width:calc(100% - 350px)}.district-nav button{white-space:nowrap;background:transparent;border:0;padding:8px 13px;border-radius:8px;font-size:13px}.district-nav button:hover,.district-nav button:focus{background:#e5b8ad;color:#223d45}.scene-caption{bottom:77px}.turn-panel{bottom:108px}.event-card{position:absolute;z-index:8;top:50%;right:6%;transform:translateY(-50%);width:350px;padding:28px;border-color:#f2c8b9;background:#213e4ff5;max-height:70vh;overflow:auto}.event-card h2{font-family:'Noto Serif TC',serif;font-size:25px;font-weight:500}.event-card p{font-size:14px;line-height:1.8}.event-card input,.event-card select{width:100%;background:#102b38;color:#fff2dc;border:1px solid #d2e5df55;padding:12px;border-radius:9px;margin-bottom:10px;font-size:16px}#card-feedback{color:#f2d29a;margin:0 0 10px}.dice-button{width:105px;background:linear-gradient(145deg,#e8c99d,#bba780);min-height:120px;overflow:visible}#dice-face{display:block;width:100px;height:90px;margin-top:-15px}#dice-face canvas{width:100px;height:100px}#dice-label{margin-bottom:7px}.turn-caption{max-width:500px;left:50%;transform:translateX(-50%);width:100%;background:#203b4de0;border-radius:9px;padding:5px;top:-42px}.player-row a strong{color:#ffdbc0;text-decoration:underline;text-underline-offset:4px}.login-gate{max-width:480px;padding:45px;margin:12vh auto;background:#243e4c;border:1px solid #e6d2b744;border-radius:24px}.login-gate h1{font-size:44px;line-height:1.4}.login-gate p{line-height:1.9}.welcome{background:#1d3749ec}.vignette{background:linear-gradient(90deg,#17334577,transparent 45%),linear-gradient(0deg,#18364177,transparent 22%)}#scene canvas{outline:0}
@media(max-width:760px){.district-nav{left:14px;right:14px;bottom:16px;transform:none;max-width:none;overflow-x:auto;justify-content:flex-start}.district-nav button{font-size:12px;padding:8px 10px}.scene-caption{display:none}.turn-panel{bottom:85px;right:14px}.chat-toggle{bottom:70px}.event-card{left:14px;right:14px;top:48%;width:auto;transform:translateY(-50%);max-height:70vh;padding:22px}.dice-button{min-height:98px;width:90px}#dice-face{transform:scale(.85);height:72px}.welcome{bottom:72px;max-height:calc(100dvh - 160px)}.header-right .text-link{display:none}.room-panel{max-height:36vh;width:175px}.login-gate{margin:8vh 18px;padding:28px}.login-gate h1{font-size:36px}}

.guest-tour .tour-intro{width:320px;max-width:calc(100vw - 36px)}.tour-intro h1{font-size:34px;margin:18px 0}.tour-intro .intro{font-size:13px}.cubi-guide{width:69px;position:relative;padding-top:18px;margin-bottom:15px}.cubi-antenna{position:absolute;top:-3px;left:27px;color:#efb1bf;font-size:22px}.cubi-face{height:49px;border-radius:14px;background:#f4dca8;border:3px solid #f9edc9;display:flex;justify-content:center;gap:15px;align-items:center;box-shadow:0 5px 0 #be9b6c;position:relative}.cubi-face i{height:10px;width:6px;background:#28414d;border-radius:50%}.cubi-face b{position:absolute;bottom:2px;color:#28414d;font-size:17px}.tour-invite{position:fixed;bottom:90px;left:32px;z-index:8;border:1px solid #ead4a3;border-radius:28px;background:#243e4ded;color:#f4dca8;padding:14px 20px;font:inherit;font-size:13px;cursor:pointer}@media(max-width:720px){.guest-tour .tour-intro{top:auto;bottom:112px;padding:18px;width:285px;max-height:54dvh;overflow:auto}.tour-intro .cubi-guide{float:right;transform:scale(.75);transform-origin:top right;margin-bottom:0}.tour-intro h1{font-size:27px}.tour-intro .intro{line-height:1.65}.tour-invite{bottom:116px;left:18px}}

/* Compact welcome; economy stays readable on narrow screens. */
.welcome h1{font-size:clamp(30px,3.2vw,46px);line-height:1.35;margin:16px 0}.heart-count{font-size:12px;white-space:normal;text-align:right;max-width:108px}.player-row{gap:8px}.event-card h2{font-size:24px}

/* RC local regression: keep controls apart and short landscape scrollable. */
@media(max-width:760px){.chat-toggle{top:84px;bottom:auto;right:56px}.room-panel{overflow-y:auto}.player-row>div{min-width:0}.player-row strong{max-width:100%;overflow:hidden;text-overflow:ellipsis}.heart-count{flex-shrink:0;max-width:58px}}
@media(max-height:500px) and (min-width:761px){#app{min-height:0}.room-panel{top:90px;max-height:calc(100dvh - 150px);overflow-y:auto;width:210px;padding:12px}.turn-panel{left:auto;right:14px;bottom:65px;transform:none;min-width:0;width:300px;padding:8px 14px;gap:12px}.dice-button{min-height:72px;width:76px}#dice-face{transform:scale(.65);height:52px}.chat-toggle{top:70px;bottom:auto;right:72px;padding:8px 12px}.district-nav{bottom:8px;max-width:calc(100% - 28px);overflow-x:auto}.event-card{top:50%;max-height:calc(100dvh - 36px);padding:16px}.scene-caption{display:none}}

.route-choice{position:fixed;z-index:80;left:50%;top:50%;transform:translate(-50%,-50%);width:min(420px,calc(100vw - 28px));max-height:calc(100dvh - 40px);overflow:auto;padding:20px}.route-choice button{display:block;width:100%;margin-top:10px}.route-choice h2{margin:0;font-size:23px}@media(max-height:480px){.route-choice{padding:12px;max-height:calc(100dvh - 20px)}.route-choice h2{font-size:19px}.route-choice p{margin:6px 0}}
/* Keep map controls reachable above the landscape turn caption. */
.turn-caption{pointer-events:none}
@media(max-height:500px) and (min-width:761px){.view-tools{top:72px;right:14px;flex-direction:row;z-index:9}.chat-toggle{right:160px}.event-card{right:auto;left:50%;transform:translate(-50%,-50%);width:min(350px,calc(100vw - 460px))}}
