/* Online UI: single layout/theme source. animation.css owns motion and scene mechanics. */
:root{color-scheme:dark;--bg:#100e0d;--panel:#201913;--line:#705334;--text:#e8dfcd;--muted:#b2a493;--gold:#c9a268;--danger:#d99587;--s1:8px;--s2:12px;--s3:16px;--s4:24px}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 50% 0,#60432433,transparent 60%),repeating-linear-gradient(115deg,#ffffff01 0 1px,transparent 1px 5px),var(--bg);color:var(--text);font:15px/1.6 'Segoe UI','Microsoft YaHei',sans-serif}header,main,footer{max-width:1320px;margin:auto;padding-left:24px;padding-right:24px}[hidden]{display:none!important}h1,h2,h3,p{margin:0;overflow-wrap:anywhere}h1,h2,h3,.brand,.hp{font-family:'Palatino Linotype','Songti SC','STSong','SimSun',serif;font-weight:500}h1{font-size:28px;letter-spacing:.08em}h2{font-size:21px}h3{font-size:20px}p{line-height:1.7}a{color:inherit}button,input,select{font:inherit}button{min-height:42px;padding:9px 16px;border:1px solid #ae8751;border-radius:3px;color:#f1dfb9;background:linear-gradient(#574027,#332518);box-shadow:inset 0 0 0 2px #17100c88;cursor:pointer}button:hover:not(:disabled){background:linear-gradient(#715334,#47311d);border-color:#e0bb7c}button:disabled{opacity:.45;cursor:default}button.secondary{background:#1b1511;border-color:var(--line);color:var(--text)}button.quiet{background:transparent;border-color:transparent;box-shadow:none;color:var(--muted)}button.quiet:hover:not(:disabled){background:#a37b3712;border-color:#7c5e3b66;color:var(--text)}button.danger-action{color:var(--danger)}button:focus-visible,input:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid #dfbd7e;outline-offset:3px}input,select{min-width:0;min-height:42px;background:#100d0b;border:1px solid var(--line);border-radius:3px;color:var(--text);padding:9px 12px}label{display:flex;flex-direction:column;gap:6px;color:var(--muted);font-size:14px}summary{cursor:pointer}.small{font-size:13px;color:var(--muted)}.eyebrow{font-size:12px;letter-spacing:.08em;color:var(--muted)}.badge{display:inline-block;padding:4px 10px;border:1px solid var(--line);border-radius:2px;font-size:12px;color:#d0b587}.panel,.fighter,.rule-card,.lobby{border:1px solid var(--line);border-radius:3px;background:linear-gradient(135deg,#251d16,#17120f);box-shadow:inset 0 0 0 4px #100c0966}.panel{padding:16px}header{padding-top:14px;padding-bottom:14px;border-bottom:1px solid #7d603a66;display:flex;justify-content:space-between;align-items:center;gap:16px}.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:#bc975e;letter-spacing:.1em;font-size:21px}.brand svg{width:28px;height:34px}.brand small{display:block;font:9px/1.7 Georgia,serif;letter-spacing:.18em}.brand span{display:block}footer{padding-top:16px;padding-bottom:16px;display:flex;justify-content:space-between;font-size:12px;color:#907b5d;border-top:1px solid #70503233;margin-top:24px}
/* Home and entry */
.home{padding:24px 0;text-align:center}.home>h1{margin:8px 0}.home>p{margin:8px 0;color:var(--muted)}#home-alert:empty,#migration-note:empty,#join-error:empty{display:none}#home-alert,#join-error{color:var(--danger)}.rule-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:24px 0}.rule-card{padding:24px;color:var(--text);text-align:center;box-shadow:inset 0 0 0 5px #120e0b,inset 0 0 0 6px #73543180}.rule-card .badge{border:0}.rule-emblem{display:block;width:72px;height:72px;margin:12px auto;color:#c3a477}.rule-emblem svg{width:100%;height:100%}.rule-card h2{font-size:28px;color:#e9d8b7;margin-bottom:8px}.rule-card p{font-size:14px;color:var(--muted);max-width:290px;margin:auto}.rule-note{display:block;margin-top:12px;font-size:12px;color:var(--muted)}.rule-card strong{display:block;margin-top:16px;padding-top:12px;border-top:1px solid #71533066;color:#dec292;font-size:15px;font-weight:400}.room-directory{margin:24px 0;text-align:left;min-width:0}.history-title{display:flex;align-items:center;justify-content:space-between;gap:12px}.history-title h2{font-size:20px}#rooms-status{font-size:13px;margin:12px 0;color:var(--muted)}#room-list{max-height:330px;overflow:auto;scrollbar-gutter:stable}.room-list-item{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid #70503266}.room-list-item>div{flex:1;min-width:0;font-size:14px}.lobby{max-width:760px;margin:24px auto;padding:24px}.lobby>h1{margin:8px 0}.lobby>p{color:var(--muted)}.entry-profile{display:flex;gap:16px;flex-wrap:wrap;margin:24px 0 16px}.entry-profile>label{flex:1}.entry-profile>p{flex-basis:100%;font-size:13px}.lobby-actions{display:flex;gap:12px;margin:16px 0}.join{display:flex;gap:12px;margin-top:8px}.join input{flex:1;width:0}#join-form{margin:24px 0}#join-error{margin-top:8px}.intro{display:none}.lobby>p:last-child{display:none}
/* Room header: identity left, invitations and navigation right. */
.room-head{display:grid;grid-template-columns:minmax(160px,1fr) auto;align-items:center;gap:24px;margin:24px 0 12px}.room-head h1{margin-top:4px}.room-buttons{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;max-width:780px}.room-buttons button{font-size:14px}.room-buttons #home-button{order:2}.room-buttons #leave{order:3}.room-meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px}#connection{font-size:12px;color:var(--muted);letter-spacing:0}.room-buttons button{height:44px;white-space:nowrap}.invite-tools{display:flex;align-items:center;flex-wrap:wrap;gap:12px;position:relative}.invite-tools label{flex-direction:row;align-items:center;font-size:12px;gap:8px;white-space:nowrap}.invite-tools input{font:13px/1.4 Consolas,monospace;width:210px;height:44px;min-height:44px}.invite-link{position:relative;font-size:12px;color:var(--muted)}.invite-link summary{display:flex;align-items:center;min-height:44px;white-space:nowrap}.invite-link summary::before{content:"▸";margin-right:6px}.invite-link[open] summary::before{content:"▾"}.invite-link input{position:absolute;right:0;top:100%;width:min(460px,80vw);z-index:10;background:#17120f;box-shadow:0 6px 18px #0009}#invite-status{position:absolute;left:0;top:100%;padding-top:4px;font-size:12px;max-width:450px;z-index:3;background:var(--bg)}#invite-status:empty{display:none}#room-expiry{font-size:13px;color:var(--muted);margin-bottom:16px}.expiry-warning{color:var(--danger)!important}#migration-note{margin-bottom:16px;font-size:13px}
/* Battle and side column */
.layout{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:24px;align-items:start}.battle-main,.room-sidebar{min-width:0}.battle-status{margin-bottom:16px}.battle-status h2{font-size:22px}.battle-status p{margin-top:6px;color:var(--muted);font-size:14px}.fighters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;margin-bottom:24px}.fighter{padding:16px 20px;min-width:0;display:flex;flex-direction:column}.fighter:not(.empty-seat) .fighter-actions{margin-top:auto;padding-top:12px}.fighter-title{min-height:64px;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.fighter-title .player-name{min-width:0;flex:1;margin:0;font-size:20px}.fighter-status{flex:none;white-space:nowrap;font-size:13px;color:var(--muted);padding-top:4px}.fighter-status>span:not(:empty){margin-right:5px}.you-label{display:inline-block;font:12px/1.6 'Segoe UI',sans-serif;color:var(--muted);margin-left:8px;border:1px solid #705334;padding:0 5px;border-radius:3px}.fighter.state-pending{background:linear-gradient(135deg,#211a15,#17120f);border-color:#65503d}.fighter.state-done{background:linear-gradient(135deg,#30261b,#211a13);border-color:#b18c57}.state-done .fighter-status{color:#dfc293}.fighter.state-empty{background:#17130f;border-color:#4e4033}.fighter.state-neutral{border-color:var(--line)}.player-name{margin:8px 0;line-height:1.5;overflow-wrap:anywhere}.readiness{color:var(--muted);margin:8px 0}.empty-seat{display:flex;flex-direction:column;justify-content:space-between;min-height:130px}.empty-seat>button{margin-top:16px;align-self:flex-start;min-width:100px}.fighter-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.hp{font-size:38px;line-height:1.2;margin:8px 0}.hp small{font:13px 'Segoe UI',sans-serif;color:var(--muted)}progress{appearance:none;width:100%;height:8px;border:1px solid #75533e;background:#130d0b}progress::-webkit-progress-bar{background:#130d0b}progress::-webkit-progress-value{background:linear-gradient(90deg,#621f22,#a14b42);transition:width .4s}progress::-moz-progress-bar{background:linear-gradient(90deg,#621f22,#a14b42)}.dice-row{display:flex;gap:12px;flex-wrap:wrap;color:var(--muted);font-size:13px;margin-top:10px}.dice-row strong{font:17px Georgia,serif;color:var(--text)}.role{font-size:12px;color:var(--muted)}.stage{padding:20px}.stage-top{margin-bottom:12px;color:var(--muted);font-size:13px}.roll-actions{display:flex;gap:12px;flex-wrap:wrap}.roll-actions>button{min-width:120px}.choice-box{flex:1;min-width:0}.choice-label{margin-bottom:8px}.choice-option{margin:0 8px 8px 0;background:#211912;border-color:#6e553a;box-shadow:none;color:var(--text)}.choice-option.selected{border-color:#d2ad70;background:#493424;box-shadow:inset 0 0 0 1px #b88e51}.choice-option.defend.selected{background:#33332d;border-color:#b4b6ab}.choice-confirm{border-top:1px solid #70503266;padding-top:12px;margin-top:4px}.choice-confirm p{font-size:13px;color:var(--muted);margin-bottom:12px}.choice-confirm button{margin-right:8px}.result-box{margin:12px 0;padding:12px 0}.result-box strong{display:block;font-size:16px;margin-bottom:8px}.result-box p{font-size:14px;color:var(--muted)}#next{margin-top:4px}#approval{margin-top:16px;border-color:#a4804c}#approval button{margin:12px 8px 0 0}.more-actions{margin-top:16px;color:var(--muted);font-size:14px}.utility{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.room-sidebar{display:grid;gap:16px}.room-sidebar .history-title{font-family:'SimSun',serif;font-size:19px}#member-count{font:13px 'Segoe UI',sans-serif;color:var(--muted)}#spectator-list{max-height:210px;overflow:auto;scrollbar-gutter:stable;margin-top:12px}.member{display:flex;gap:12px;justify-content:space-between;padding:8px 0;border-top:1px solid #70503255;font-size:13px}.member>span:first-child{min-width:0;overflow-wrap:anywhere}.member>span:last-child{white-space:nowrap;color:var(--muted);font-size:12px}.own-member>span:first-child{color:#dfc38f}.room-lifetime-note{margin-top:8px;font-size:12px;color:var(--muted)}.history summary{list-style-position:inside}.history summary::before{content:'▸';font:14px sans-serif;color:var(--muted)}.history[open] summary::before{content:'▾'}.history summary>span:first-of-type{flex:1}.history summary .small{font:12px 'Segoe UI',sans-serif}.history[open] .history-title{padding-bottom:12px;border-bottom:1px solid #70503266}#history{max-height:320px;overflow:auto;scrollbar-gutter:stable}.record{padding:12px 0;border-bottom:1px solid #70503266}.record strong{font-size:14px;font-weight:500}.record p{font-size:13px;color:var(--muted);margin-top:4px}.record .loss{color:var(--danger)}.empty{font-size:14px;color:var(--muted);padding-top:12px}.rules{margin-top:24px;padding-top:16px;border-top:1px solid #70503266;color:var(--muted);font-size:14px}.rules p{margin-top:12px}.rules summary{color:var(--text)}#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);z-index:20;max-width:calc(100vw - 32px);width:max-content;padding:12px 16px;background:#292016;border:1px solid #a4804c;color:var(--text);box-shadow:0 8px 30px #0007;font-size:14px}
/* Preserve original dice and weapon artwork; only scene placement belongs here. */
.fx-shell{border:1px solid #ac814c;border-radius:2px;padding:6px;background:#16110d;box-shadow:inset 0 0 0 3px #0d0b09;overflow:hidden;margin:0}.fx-shell .fx-stage{min-height:220px;border:1px solid #674d30;border-radius:0;background:radial-gradient(ellipse at 50% 65%,#70503525,transparent 63%),repeating-radial-gradient(ellipse at 50% 60%,transparent 0 45px,#bc8d4412 46px 47px,transparent 48px 67px),linear-gradient(#100d0b,#1d150e)}.has-docks .fx-stage{min-height:280px}.fx-idle,.fx-caption{color:#c9b38f;font-family:'SimSun',serif}.fx-controls{justify-content:flex-end;gap:8px;margin:4px 0 12px}.fx-controls button{font-size:12px;min-height:36px;padding:6px 8px}.dice-theatre{gap:24px}.poly-die{width:100px;height:112px;filter:drop-shadow(0 9px 10px #000c)}.poly-die b{font-family:Georgia,serif;font-size:34px;color:#f6e1b6;text-shadow:0 1px 1px #000;padding-bottom:5px}.docked-die b{color:#f0d5a6;font-family:Georgia,serif}.initiative-dock{top:14px}.initiative-dock>span{color:#b29e7f}.initiative-dock>strong{color:#d3b17c}.weapon{filter:drop-shadow(0 5px 4px #000b)}.weapon svg{overflow:visible}.weapon-label{color:#beaa8c}.choice-option svg{width:38px;height:28px;filter:drop-shadow(0 2px 2px #0008)}.hurt{color:#e19a88}.safe{color:#c2b8a3}.impact i{height:2px;background:linear-gradient(90deg,#fff1cb,#cca06488,transparent);box-shadow:0 0 8px #d8ad6444}
@media(min-width:1100px){.home{display:grid;grid-template-columns:1.15fr 1fr;gap:0 24px}.home>.eyebrow,.home>h1,.home>p{grid-column:1/-1}.home>.eyebrow{grid-row:1}.home>h1{grid-row:2}.home>p:not(#home-alert):not(#home-note){grid-row:3}.home>.rule-grid{grid-column:1;grid-row:4}.home>.room-directory{grid-column:2;grid-row:4}.home>#resume{grid-column:1;justify-self:center}.home>#home-alert{grid-row:7}.stage.with-actions:not(.without-animation){display:grid;grid-template-columns:minmax(280px,1.2fr) minmax(200px,1fr);gap:0 20px;align-items:start}.stage.with-actions .stage-top{grid-column:1/-1}.stage.with-actions .fx-shell{grid-column:1;grid-row:2/5}.stage.with-actions .fx-controls{grid-column:1;grid-row:5}.stage.with-actions #roll-actions{grid-column:2;grid-row:2}.stage.with-actions #result{grid-column:2;grid-row:3}.stage.with-actions #next{grid-column:2;grid-row:4}}
@media(max-width:1099px){.room-head{grid-template-columns:1fr;gap:12px}.room-buttons{justify-content:flex-start;max-width:none}.layout{grid-template-columns:minmax(0,1fr) 240px;gap:20px}.stage{padding:16px}.room-sidebar .panel{padding:14px}}
@media(max-width:800px){header,main,footer{padding-left:16px;padding-right:16px}.layout{grid-template-columns:1fr}.room-sidebar{grid-template-columns:1fr 1fr}.room-head{margin-top:16px}.room-buttons{gap:8px}.invite-tools{flex-basis:100%}.fighters{margin-bottom:20px}.lobby{margin:20px auto}.invite-link input{left:0;right:auto}.room-list-item{align-items:flex-start}}
@media(max-width:540px){header{padding-top:12px;padding-bottom:12px}.brand{font-size:19px}.brand small{display:none}header>.badge{font-size:11px}.room-sidebar{grid-template-columns:1fr}.room-head h1{font-size:25px}.room-buttons button{padding:8px 10px}.invite-tools{display:grid;grid-template-columns:auto minmax(0,1fr);width:100%;gap:8px 12px;align-items:center}.invite-tools label{grid-column:1/-1;grid-row:1;min-width:0}.invite-tools label input{flex:1;width:0}.invite-tools>button{grid-column:1;grid-row:2}.invite-link{grid-column:2;grid-row:2;min-width:0}.invite-link input{position:static;width:100%;margin-top:8px}#invite-status{position:static;grid-column:1/-1;padding:0;max-width:none}.fighters{gap:12px}.fighter{padding:14px}.player-name{font-size:18px}.fighter-title{flex-direction:column;gap:6px;min-height:86px}.fighter-title .player-name{font-size:18px}.fighter-status{padding-top:0}.fighter-actions{gap:4px}.fighter-actions button{padding:8px 10px}.hp{font-size:32px}.dice-row{gap:8px;font-size:12px}.battle-status h2{font-size:20px}.empty-seat{min-height:130px}.stage{padding:14px}.dice-theatre{gap:16px}.poly-die{width:90px;height:104px}.initiative-dock{width:64px}.has-docks .fx-stage{min-height:280px}#spectator-list{max-height:180px}.rule-grid{gap:12px}.rule-card{padding:16px 12px}.rule-card h2{font-size:22px}.rule-card .rule-note{display:none}.rule-emblem{width:56px;height:56px}.rule-card p{font-size:13px}.lobby{padding:20px}.entry-profile{flex-direction:column}.lobby-actions{flex-wrap:wrap}.room-list-item>div{font-size:13px}footer{display:none}}

.dice-slot,.weapon-label,.initiative-dock>span{overflow-wrap:anywhere}.dice-slot{min-width:0;max-width:46%}.weapon-label{display:block;line-height:1.5}.initiative-dock>span{line-height:1.5}

.connection-warning,.disconnect-recovery{margin:12px 0;color:var(--muted)}.connection-warning{border-left:2px solid var(--danger);padding-left:12px}.disconnect-recovery button{margin:8px 8px 0 0}.disconnect-recovery p+p{margin-top:8px}.connection-warning button{margin-left:8px}#identity-note:empty{display:none}#rp-pause{margin-top:8px;grid-column:2}@media(max-width:420px){.fighters{grid-template-columns:1fr}.fighter-title{min-height:0;flex-direction:row;align-items:flex-start}.fighter-title .player-name{font-size:19px}.fighter-status{padding-top:4px}.empty-seat{min-height:110px}}
