:root{--ink:#eaf0f4;--muted:#aebbc3;--gold:#e1bb70;--gold-2:#f5d391;--dark:#101724;--panel:#192638;--line:#425263;--wood:#d0a86a;--wood2:#b7864a;--blue:#80c9d1;--red:#c68379;font-family:"Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;color:var(--ink);background:#101724}
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 5% 4%,#263a46 0,transparent 34%),radial-gradient(circle at 100% 82%,#2b2a38 0,transparent 38%),#101724}button,select,input{font:inherit}button{cursor:pointer}button:disabled{opacity:.42;cursor:not-allowed}.shell{max-width:1290px;margin:auto;padding:16px 22px 36px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.brand{display:flex;align-items:center;gap:12px}.brand-mark{width:42px;height:42px;display:grid;place-items:center;color:#28313d;background:var(--gold-2);clip-path:polygon(50% 0,96% 25%,88% 100%,12% 100%,4% 25%);font-size:23px;font-weight:900}.brand h1{font-size:24px;margin:0;letter-spacing:.08em}.brand p{margin:1px 0 0;color:var(--muted);font-size:11px;letter-spacing:.08em}.quiet{border:1px solid #61717b;background:transparent;color:var(--ink);border-radius:999px;padding:7px 14px;font-size:12px}.layout{display:grid;grid-template-columns:minmax(0,670px) minmax(280px,1fr);gap:24px;align-items:start}.arena{max-width:670px}.enemy-line,.player-line{display:flex;justify-content:space-between;align-items:center;margin:4px 0 7px;padding:0 3px;font-size:13px;font-weight:800}.team-name{display:flex;align-items:center;gap:7px}.team-dot{width:9px;height:9px;border-radius:50%}.enemy-dot{background:var(--red)}.player-dot{background:var(--gold)}.turn-chip{color:var(--gold-2);font-size:12px}.hand{min-height:42px;display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin:0 0 8px;background:#1b2837;border:1px solid #3b4e5a;border-radius:9px;padding:5px 7px}.hand.empty:after{content:'持ち駒なし';font-size:11px;color:#8f9da3}.hand button{display:flex;align-items:center;gap:2px;background:#eed1a2;border:2px solid #8e6542;border-radius:5px;color:#272724;font-size:15px;font-weight:800;padding:3px 6px;min-width:38px;justify-content:center}.hand button.selected{box-shadow:0 0 0 3px var(--blue)}.hand button[disabled]{opacity:.55}.hand sup{font-size:10px}.board-frame{padding:11px;background:linear-gradient(135deg,#7e553a,#c49a5c 20%,#a46d43 78%,#674532);border:3px solid #e1b978;border-radius:12px;box-shadow:0 16px 30px #0008,0 0 0 1px #3e2924 inset}.file-labels{text-align:center;letter-spacing:.35em;height:16px;font-size:10px;color:#312619;font-weight:bold;white-space:nowrap}.board{width:100%;aspect-ratio:1;display:grid;grid-template-columns:repeat(9,minmax(0,1fr));grid-template-rows:repeat(9,minmax(0,1fr));background:#b98950;border:2px solid #4c3728;box-shadow:inset 0 0 22px #653d20}.cell{position:relative;border:1px solid rgba(63,39,27,.62);background:linear-gradient(145deg,rgba(255,233,173,.31),rgba(125,75,32,.06));padding:3px;display:grid;place-items:center;min-width:0;min-height:0;touch-action:manipulation}.cell:hover{background-color:#ffffff2c}.cell.selected{background-color:#78dce55c}.cell.last-from,.cell.last-to{box-shadow:inset 0 0 0 3px #f9e6878a}.cell.legal:after{content:'';position:absolute;width:17%;aspect-ratio:1;background:#368b91;border-radius:50%;opacity:.86}.cell.legal:has(.piece):after{width:84%;background:transparent;border:3px solid #47b9b7}.piece{width:84%;height:84%;clip-path:polygon(50% 2%,99% 26%,88% 99%,12% 99%,1% 26%);background:linear-gradient(130deg,#fce5b0,#e0bb77 70%,#ba8d53);color:#23282b;display:flex;flex-direction:column;align-items:center;justify-content:center;filter:drop-shadow(0 2px 1px #38271688);line-height:1;position:relative;z-index:1;pointer-events:none}.piece.enemy{background:linear-gradient(130deg,#d4e0e1,#9baeb4);transform:rotate(180deg)}.piece.enemy>*{transform:rotate(180deg)}.piece.special{background:linear-gradient(135deg,#fff1c6,#e5bf6c 60%,#c38c46);outline:1px solid #d69d36}.piece .glyph{font-family:serif;font-weight:900;font-size:clamp(15px,3vw,29px)}.piece .role{font-size:clamp(7px,1.1vw,10px);font-weight:900;white-space:nowrap;margin-top:1px;letter-spacing:-.04em}.piece.promoted .glyph{color:#9e3436}.board-frame+.hand{margin:8px 0 5px}.side{display:flex;flex-direction:column;gap:12px}.match-card,.moment,.roster,.sound-panel,.moves{background:linear-gradient(145deg,#1c2b3b,#172232);border:1px solid #415265;border-radius:14px;box-shadow:0 12px 24px #0002}.match-card{padding:17px}.eyebrow{font-size:10px;font-weight:900;letter-spacing:.2em;color:var(--gold)}.status{font-size:19px;font-weight:900;margin:7px 0 2px}.substatus{font-size:12px;color:var(--muted)}.controls{display:flex;gap:8px;margin-top:15px}.controls button,.sound-content>button,.dialog-actions button,.dialog-inner>button{border:1px solid #728493;background:#293b4c;color:var(--ink);border-radius:8px;padding:8px 10px;font-size:12px;font-weight:800}.controls button:hover,.sound-content>button:hover{background:#3a5264}.mode-row{display:flex;justify-content:space-between;align-items:center;margin-top:13px;border-top:1px solid #405065;padding-top:11px;color:var(--muted);font-size:12px}.mode-row select{background:#293b4c;border:1px solid #617384;color:white;border-radius:5px;padding:5px}.moment{overflow:hidden;display:grid;grid-template-columns:40% 60%;min-height:180px}.moment-stage{background:radial-gradient(circle,#405b63,#1c2a37 65%);position:relative;display:grid;place-items:center;min-height:170px}.moment-stage:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 65%,#1a2938);pointer-events:none}.stage-placeholder{font-family:serif;color:#90a6ad;font-size:17px;text-align:center;line-height:1.6}.moment video{position:absolute;width:100%;height:100%;object-fit:contain;z-index:1;display:none}.moment.active video{display:block}.moment-copy{padding:17px 14px 14px 5px;display:flex;flex-direction:column;justify-content:center}.moment-copy strong{font-size:18px;margin-top:7px;line-height:1.3}.moment-copy p{font-size:13px;margin:6px 0;color:#d8e1e3}.moment-copy small{font-size:10px;color:#9cabb4}.roster{padding:14px 16px}.roster-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:7px;margin-top:11px}.roster-grid div{border-left:2px solid #b99962;padding-left:8px;display:flex;flex-direction:column}.roster-grid b{font-size:11px;color:var(--muted)}.roster-grid span{font-size:14px;font-weight:800}.sound-panel{padding:0 15px}.sound-panel summary{padding:12px 0;cursor:pointer;font-size:13px;font-weight:800}.sound-content{display:grid;gap:11px;border-top:1px solid #435165;padding:12px 0}.switch,.volume{display:flex;align-items:center;justify-content:space-between;font-size:12px}.switch input{accent-color:#dbc17f;width:18px;height:18px}.upload{display:inline-block;width:max-content;max-width:100%;border:1px solid #8ca0a5;border-radius:7px;padding:7px 10px;color:#f0e5ca;font-size:12px;font-weight:800;cursor:pointer}.upload.secondary{color:#cbdde1}.upload input{display:none}.file-note{font-size:11px;line-height:1.5;color:var(--muted)}.volume input{width:58%;accent-color:var(--gold)}.moves{padding:13px 16px}.moves ol{margin:9px 0 0;padding-left:25px;max-height:132px;overflow:auto;font-size:12px;color:#d3dee4;line-height:1.7}.moves li:first-child{color:var(--gold-2)}dialog{border:1px solid #b7945c;border-radius:14px;color:var(--ink);background:#1d2b3b;max-width:min(90vw,420px);box-shadow:0 30px 80px #0009}dialog::backdrop{background:#050b13bb}.dialog-inner{padding:14px}.dialog-inner h2{margin:8px 0 10px;font-size:21px}.dialog-inner p{font-size:13px;line-height:1.7;color:#d3dce0}.dialog-actions{display:flex;gap:9px;margin-top:16px}.dialog-actions button{flex:1}.dialog-actions .primary,.dialog-inner>.primary{background:#cfaa67;color:#202936;border-color:#f1d191}.source-note{font-size:11px!important;color:#adbcc3!important}:focus-visible{outline:3px solid #62d2df;outline-offset:2px}
@media(max-width:850px){.shell{padding:12px 10px 26px}.layout{grid-template-columns:1fr;gap:12px}.arena{width:min(100%,610px);margin:auto}.side{display:grid;grid-template-columns:1fr 1fr;gap:10px}.match-card,.moment{min-height:170px}.roster,.sound-panel,.moves{grid-column:span 2}.board-frame{padding:8px}.file-labels{font-size:9px;height:12px}.piece .glyph{font-size:clamp(15px,5vw,25px)}.piece .role{font-size:clamp(7px,1.7vw,10px)}}
@media(max-width:570px){.brand h1{font-size:20px}.brand-mark{width:36px;height:36px;font-size:20px}.board-frame{padding:5px;border-width:2px}.board{border-width:1px}.cell{padding:1px}.piece{width:88%;height:87%}.piece .glyph{font-size:clamp(14px,5.2vw,22px)}.piece .role{font-size:clamp(6px,1.9vw,8px)}.side{display:flex}.moment{min-height:142px}.moment-stage{min-height:142px}.match-card{min-height:unset}.roster-grid{grid-template-columns:repeat(2,1fr)}.controls button{flex:1}.hand{min-height:37px;padding:3px 5px}.hand button{padding:2px 4px}.enemy-line,.player-line{font-size:12px}.turn-chip{font-size:11px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
  .online-room{margin-top:12px;padding:12px;border:1px solid #c6a363;border-radius:10px;background:#243647;color:#f4e7c8;font-size:12px;line-height:1.5}
  .online-room[hidden]{display:none}.online-room p{margin:6px 0 10px}.online-room small{display:block;margin-top:8px;color:#b9c9cc}
  .online-link{display:flex;gap:6px}.online-link input{min-width:0;flex:1;border:1px solid #627987;border-radius:6px;padding:8px;background:#152433;color:#f6e8c8;font-size:11px}
  .online-link button,#createRoomButton{border:1px solid #f4d797;border-radius:7px;background:#d6ab60;color:#1e2630;font-weight:900;padding:8px;white-space:nowrap}
  .online-guest .board{transform:rotate(180deg)}
  .online-guest .board .piece.enemy>*{transform:none}
  .online-guest .board .piece:not(.enemy)>*{transform:none}
  .online-guest #enemyHand .piece.enemy{transform:none}
  .online-guest #playerHand .piece{transform:rotate(180deg)}
  @media(max-width:570px){.controls{flex-wrap:wrap}.controls button{min-width:30%}.online-link{flex-direction:column}.online-link button{width:100%}}
.account-dialog{min-width:min(88vw,340px)}
.account-dialog #googleSignIn{min-height:44px;display:flex;justify-content:center}
.account-dialog #googleSignIn[hidden]{display:none}
.account-message{min-height:22px;color:#f4d18d!important}
.account-actions{display:flex;gap:8px;flex-wrap:wrap}
.account-actions button,.account-dialog #closeAccount{border:1px solid #728493;background:#293b4c;color:var(--ink);border-radius:8px;padding:8px 11px;font-weight:800}
.account-actions button[hidden]{display:none}
.account-dialog a,.site-footer a{color:#f2cf8b}
.site-footer{padding:14px 0;text-align:center;font-size:11px;color:#b6c3c8}
.site-footer a{margin:0 8px}
@media(max-width:570px){body:not(.tool-mode) #loginButton{max-width:122px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
.moment.active .stage-placeholder{visibility:hidden}

/* Real shogi-piece silhouette: a narrow pointed head and a broad flat base. */
.brand-mark{clip-path:polygon(50% 1%,85% 25%,98% 98%,2% 98%,15% 25%)}
.piece{width:88%;height:93%;clip-path:none;background:transparent;color:#272221;filter:drop-shadow(1px 3px 2px #4c2b1b88);overflow:visible}
.piece-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.piece-depth{fill:#866039;stroke:#5c3c25;stroke-width:2}
.piece-body{fill:#f1d7aa;stroke:#7b5331;stroke-width:2.5;stroke-linejoin:round}
.piece-bevel{fill:none;stroke:#fff2d0;stroke-opacity:.68;stroke-width:2}
.piece-grain{fill:none;stroke:#b98c57;stroke-opacity:.4;stroke-width:1.4}
.piece.special{background:transparent;outline:none}
.piece.special .piece-body{fill:#f7dfab;stroke:#8e6031}
.piece.enemy{background:transparent;transform:rotate(180deg)}
.piece.enemy>*{transform:none}
.piece.enemy .piece-body{fill:#d7cfb8;stroke:#756651}
.piece.enemy .piece-depth{fill:#706554}
.piece .glyph{z-index:1;margin-top:11%;font-family:"Yu Mincho","Hiragino Mincho ProN","Noto Serif JP",serif;font-size:clamp(17px,3vw,31px);font-weight:900;line-height:1;text-shadow:0 1px #fff4d480}
.piece .role{z-index:1;margin-top:1px;color:#705028;font-size:clamp(6px,.9vw,9px);line-height:1;font-weight:900;white-space:nowrap}
.piece.promoted .glyph{color:#ad302e}
.hand button.hand-piece{position:relative;width:50px;height:41px;min-width:50px;border:0;background:transparent;padding:0 12px 0 0;overflow:visible}
.hand button.hand-piece .piece{width:34px;height:37px}
.hand button.hand-piece .piece .glyph{font-size:17px}
.hand button.hand-piece .piece .role{display:none}
.hand button.hand-piece sup{position:absolute;right:0;bottom:1px;color:var(--gold-2);background:#253545;border:1px solid #668087;padding:1px 3px;border-radius:4px;font-size:10px;line-height:1.2}
.hand button.hand-piece.selected{box-shadow:none;filter:drop-shadow(0 0 5px #6de2eb)}
.board-frame{position:relative;overflow:hidden}
.end-panel[hidden]{display:none}
.end-panel{position:absolute;z-index:10;left:50%;top:51%;transform:translate(-50%,-50%);width:min(84%,350px);display:flex;flex-direction:column;align-items:center;gap:9px;padding:16px 12px;border:2px solid #e8bd75;border-radius:14px;background:#172638f2;box-shadow:0 14px 38px #000b;text-align:center;color:#fff4d6}
.end-panel strong{font-size:19px}
.end-panel span{font-size:12px;line-height:1.4}
.end-panel button{min-height:46px;width:100%;border:1px solid #fff0c7;border-radius:8px;background:#f0c879;color:#192634;font-size:14px;font-weight:900}
.end-panel button:active{transform:scale(.98)}
.cutout-overlay{position:absolute;inset:27px 11px 11px;z-index:6;pointer-events:none;overflow:hidden;visibility:hidden;opacity:0;transition:opacity .16s ease,visibility .16s ease}
.cutout-overlay.visible{visibility:visible;opacity:1}
.cutout-flare{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 85%,#fff3bf55 0,transparent 60%);mix-blend-mode:screen}
.cutout-overlay[data-event="capture"] .cutout-flare{background:radial-gradient(ellipse at 50% 85%,#ff5c6260 0,transparent 62%)}
.cutout-overlay[data-event="promote"] .cutout-flare{background:radial-gradient(ellipse at 50% 85%,#ffe47385 0,transparent 64%)}
.cutout-overlay video,.cutout-overlay img{position:absolute;right:0;bottom:4%;width:74%;height:86%;object-fit:cover;object-position:center center;filter:drop-shadow(0 5px 9px #0008)}
.cutout-overlay img{display:none}
.cutout-overlay.anchor-left video,.cutout-overlay.anchor-left img{right:auto;left:0}
.cutout-overlay[data-focus="left"] video,.cutout-overlay[data-focus="left"] img{object-position:left center}
.cutout-overlay[data-focus="right"] video,.cutout-overlay[data-focus="right"] img{object-position:right center}
.cutout-overlay.fallback video,.cutout-overlay.no-video video,.cutout-overlay.no-video img{display:none}
.cutout-overlay.fallback img{display:block}
.cutout-caption{position:absolute;bottom:8px;right:8px;max-width:68%;display:flex;flex-direction:column;gap:2px;color:white;background:#14202cdb;border-left:3px solid var(--gold-2);border-radius:3px;padding:5px 8px;text-shadow:0 1px 2px #000}
.cutout-overlay.anchor-left .cutout-caption{right:auto;left:8px}
.cutout-caption span{font-size:11px;font-weight:800;color:var(--gold-2)}
.cutout-caption strong{font-size:14px;line-height:1.25}
.assignments{background:#192638;border:1px solid #415265;border-radius:14px;padding:0 15px}
body:not(.tool-mode) #assignmentEditor{display:none}
.assignments summary{padding:12px 0;cursor:pointer;font-size:13px;font-weight:800}
.assignment-list{display:grid;gap:7px;padding:0 0 12px}
.assignment-row{display:grid;grid-template-columns:100px 1fr 1fr;gap:8px;border-top:1px solid #415265;padding-top:7px;font-size:11px;line-height:1.4}
.assignment-row b{color:var(--gold-2)}
.assignment-row button{background:#26394c;border:1px solid #586e7a;border-radius:6px;color:#d2dce1;font-size:11px;line-height:1.4;text-align:left;padding:5px 7px;cursor:pointer}
.assignment-row button:hover{border-color:var(--gold-2);background:#344b5f}
@media(max-width:850px){.piece .glyph{font-size:clamp(17px,4.5vw,27px)}.piece .role{font-size:clamp(6px,1.3vw,9px)}}
@media(max-width:570px){.piece{width:90%;height:94%}.piece .glyph{font-size:clamp(15px,5.3vw,21px)}.piece .role{font-size:clamp(6px,1.65vw,7px)}.cutout-overlay{inset:17px 5px 5px}.cutout-caption{max-width:75%;padding:4px 6px}.cutout-caption span{font-size:9px}.cutout-caption strong{font-size:11px}.assignment-row{grid-template-columns:1fr 1fr;gap:2px 8px}.assignment-row b{grid-column:span 2}}
.assignment-heading{font-size:12px;color:var(--gold-2);margin:9px 0 0;padding:6px 0;border-top:1px solid #70808a}
.assignment-row{grid-template-columns:100px minmax(0,1fr) minmax(0,1fr)}
.assignment-group{display:flex;flex-direction:column;gap:4px;min-width:0}
.assignment-group>span{font-size:10px;color:var(--muted);font-weight:800}
.assignment-group button{width:100%;overflow-wrap:anywhere}
@media(max-width:570px){.assignment-row{grid-template-columns:1fr 1fr}.assignment-row b{grid-column:span 2}}
/* The approved person matte grows from the square where the piece lands. */
.cutout-overlay{inset:auto;right:auto;bottom:auto;border-radius:8px;filter:drop-shadow(0 6px 7px #15212bb8)}
.cutout-overlay video{right:auto;bottom:auto;max-width:none;max-height:none;object-fit:fill;filter:none}
.cutout-overlay img{left:0;top:0;right:auto;bottom:auto;width:100%;height:100%;object-fit:contain;filter:none}
.cutout-caption{display:none}
.cutout-flare{background:radial-gradient(ellipse at 50% 90%,#fff1b166 0,transparent 67%)}

/* Media belongs to the moved piece, inside its board square. */
.cutout-overlay{clip-path:polygon(50% 2%,99% 26%,88% 99%,12% 99%,1% 26%);border-radius:0;filter:none}
.cutout-overlay img{object-fit:cover;object-position:center 18%;transform:scale(1.4);transform-origin:50% 24%}
.cutout-overlay.fallback img{animation:piece-arrive .45s ease-out both}
@keyframes piece-arrive{from{opacity:.25;transform:scale(.9)}to{opacity:1;transform:scale(1.4)}}

.phase-status{margin-top:7px;color:var(--gold-2);font-size:12px;font-weight:800}
.tactic-status{margin-top:4px;color:#c5d9df;font-size:11px;line-height:1.5}
.assignment-editor{display:grid;gap:12px;padding:0 0 16px}
.assignment-editor p{margin:0}
.assignment-selectors{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.assignment-selectors label,.clip-search-label,.endgame-setting{display:grid;gap:4px;font-size:11px;font-weight:800;color:#dbe4e6}
.assignment-selectors label:first-child{grid-column:auto}
.assignment-selectors select,.clip-search-label input,.endgame-setting input{width:100%;min-width:0;border:1px solid #71838b;border-radius:7px;background:#25394b;color:#fff;padding:8px;font:inherit}
.assignment-status{border:1px solid #596c76;border-radius:7px;padding:8px;color:var(--gold-2);font-size:11px;line-height:1.5}
.picked-clips,.clip-library{display:grid;gap:6px}
.picked-clips{max-height:240px;overflow:auto}
.clip-library{max-height:390px;overflow:auto;border-top:1px solid #465b69;padding-top:8px}
.clip-row{display:grid;grid-template-columns:48px minmax(0,1fr);gap:7px;align-items:center;padding:6px;border:1px solid #455b66;border-radius:8px;background:#223244}
.clip-row img{width:48px;height:54px;object-fit:contain;background:#a88253;border-radius:4px}
.clip-info{display:grid;gap:3px;min-width:0;line-height:1.4}
.clip-info b{font-size:11px;overflow-wrap:anywhere}
.clip-info small{font-size:10px;color:#9eb2bd;overflow-wrap:anywhere}
.clip-actions{grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:5px}
.clip-actions button,.assignment-tools button{border:1px solid #788b95;border-radius:6px;background:#304657;color:#fff;padding:6px 8px;font-size:11px;font-weight:800}
.clip-actions button:disabled{opacity:.42}
.assignment-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.endgame-setting{grid-template-columns:1fr 72px;align-items:center}
@media(max-width:570px){.assignment-selectors{grid-template-columns:1fr}.assignment-selectors label:first-child{grid-column:auto}.clip-library{max-height:50vh}}
.top-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.tool-link,.game-link{display:inline-flex;align-items:center;justify-content:center;border:1px solid #f4d28d;border-radius:999px;background:#e9c47a;color:#1e2833;padding:8px 14px;font-size:12px;font-weight:900;text-decoration:none;text-align:center}
.tool-link:hover,.game-link:hover{background:#ffe1a5}
.game-link,.tool-intro{display:none}
.tool-mode .shell{max-width:840px}
.tool-mode .layout{display:block}
.tool-mode .side{display:block}
.tool-mode .arena,.tool-mode .match-card,.tool-mode .moment,.tool-mode .roster,.tool-mode .sound-panel,.tool-mode .moves,.tool-mode #helpButton,.tool-mode .tool-link{display:none}
.tool-mode .game-link,.tool-mode .tool-intro{display:block}
.tool-intro{margin:5px 0 14px;padding:0 3px}
.tool-intro h2{margin:5px 0;font-size:25px}
.tool-intro p{margin:0;color:var(--muted);font-size:13px;line-height:1.6}
.tool-mode .assignments{padding:16px 18px}
.tool-mode .assignments summary{display:none}
.tool-mode .assignment-editor{padding-bottom:0}
.tool-mode .clip-library{max-height:none}
@media(max-width:570px){.topbar{align-items:flex-start;gap:8px}.top-actions{max-width:55%}.tool-link,.game-link{font-size:11px;padding:7px 10px}.tool-mode .assignments{padding:13px 12px}.tool-intro h2{font-size:22px}}

/* The room is intentionally subdued; the board and clocks carry the action. */
body{background:linear-gradient(90deg,#10172477,#101724ac 45%,#10172477),url('./assets/room-background-washitsu.webp') center top/cover fixed no-repeat,#101724}
.topbar{position:relative;min-height:88px;padding:13px 18px;border:1px solid #63513c;border-radius:15px;background:linear-gradient(90deg,#101b2bea 0%,#101b2bc4 48%,#101b2b8c 100%),url('./assets/hero-shogi.webp') center 55%/cover no-repeat;box-shadow:0 10px 28px #0007}
.brand{position:relative;z-index:1}.top-actions{position:relative;z-index:1}
.arena{border-radius:16px;background:#111c2d85;padding:7px;box-shadow:0 12px 30px #0005}
@media(min-width:851px){.arena{width:min(100%,max(430px,calc(100dvh - 290px)));justify-self:center}}
.clock-chip{display:flex;flex-direction:column;align-items:flex-end;gap:1px;min-width:116px;padding:4px 8px;border:1px solid #61717a;border-radius:9px;background:#172638e8;color:#e6e9e7;font-variant-numeric:tabular-nums}
.clock-chip strong{font-size:21px;line-height:1;font-weight:900;letter-spacing:.04em}
.clock-chip small{font-size:10px;white-space:nowrap;color:#b6c8ce}
.clock-chip.active{border-color:#f5d391;background:#493c2a;color:#fff2cf;box-shadow:0 0 0 2px #e9c47748}
.clock-chip.active small{color:#fff0bd}
.clock-chip.danger{border-color:#ff8c7c;background:#5a2429;color:#fff;animation:clock-alert .9s ease-in-out infinite alternate}
.clock-chip.expired{border-color:#ff8c7c;background:#5a2429;color:#fff}
@keyframes clock-alert{to{box-shadow:0 0 0 3px #ff8c7c70}}
.clock-rule{margin-top:8px;padding:6px 8px;border-left:3px solid var(--gold);background:#283748;color:#f5dca5;font-size:11px;font-weight:800}
.team-name{flex-wrap:wrap;line-height:1.25}.turn-chip{font-size:10px}
.input-hint{margin:5px 2px 1px;color:#f6e6bf;font-size:11px;line-height:1.45;min-height:16px}
.quick-audio{display:flex;align-items:center;gap:9px;margin:5px 2px 1px;color:#e7d5ac;font-size:11px;font-weight:800}
.quick-audio label{white-space:nowrap}.quick-audio output{display:inline-block;min-width:28px;text-align:right;font-variant-numeric:tabular-nums}
.quick-audio input{width:min(150px,40%);height:22px;accent-color:var(--gold-2);touch-action:manipulation}
.piece .glyph{font-size:clamp(18px,2.1vw,29px);text-shadow:0 1px #fff9dc,0 0 1px #241b16}
.piece .role{font-size:clamp(7px,1vw,10px);letter-spacing:0;background:#f5dca8b8;border-radius:2px;padding:0 2px;color:#342d21}
.piece .role{max-width:96%;overflow:hidden;text-overflow:clip}
.roster-grid{gap:10px}
.roster-grid div{min-width:0;gap:3px}
.roster-grid small{color:#b7c8d1;font-size:10px;line-height:1.45}
.piece.enemy .piece-body{fill:#d8ded9;stroke:#364852;stroke-width:3}
.piece.enemy .piece-depth{fill:#455560;stroke:#26323a}
.piece-body{stroke-width:3}
.cell{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.cell.selected{background:#f5d39177;box-shadow:inset 0 0 0 4px #ffedaa}
.cell.legal:after{width:31%;background:#145d64;border:2px solid #b9faff;box-shadow:0 0 0 2px #145d6470;opacity:1}
.cell.legal:has(.piece):after{width:84%;border:4px solid #62e3e9;box-shadow:0 0 6px #143b43;background:transparent}
.cell.capture-target:after{border-color:#ff6f67!important;box-shadow:0 0 8px #8f2424!important}
.hand{min-height:47px}.hand button.hand-piece{height:44px}
@media(max-width:570px){body{background:linear-gradient(#10172466,#101724cf 55%),url('./assets/room-background-washitsu.webp') center top/100% auto no-repeat,#101724}.topbar{min-height:72px;padding:10px 9px}.arena{padding:4px}.clock-chip{min-width:101px;padding:3px 5px}.clock-chip strong{font-size:18px}.clock-chip small{font-size:9px}.piece .glyph{font-size:clamp(17px,5.8vw,23px)}.piece .role{font-size:6px}.hand{min-height:44px}.team-name{gap:4px}.enemy-line,.player-line{gap:4px}}
@media(prefers-reduced-motion:reduce){.clock-chip.danger{animation:none}}

/* Tendo maker's wooden koma dimensions, scaled from the 31.5 x 28 mm king. */
.board .piece.type-K{width:84%;height:87%}
.board .piece.type-R,.board .piece.type-B{width:81%;height:84%}
.board .piece.type-G,.board .piece.type-S{width:78%;height:81%}
.board .piece.type-N{width:75%;height:79%}
.board .piece.type-L{width:69%;height:77%}
.board .piece.type-P{width:68%;height:75%}
.board .piece.type-P .glyph{font-size:clamp(14px,1.7vw,23px)}
.board .piece.type-L .glyph,.board .piece.type-N .glyph{font-size:clamp(15px,1.85vw,25px)}
.board .piece.type-K .role{font-size:clamp(7px,.9vw,9px)}
.board{aspect-ratio:281/306}
.cell.checked-reaction{background:#f4d7868c;box-shadow:inset 0 0 0 3px #fff2b8,0 0 18px #ffe29bbd;z-index:2}
.cell.checked-reaction:before{content:'';position:absolute;inset:3px;border:2px solid #fff5cd;border-radius:7px;animation:king-reaction .65s ease-out infinite alternate;pointer-events:none;z-index:3}
@keyframes king-reaction{to{opacity:.28;transform:scale(.86)}}

/* Keep the first viewport focused on the playable board. */
body:not(.tool-mode) .shell{padding-top:6px}
body:not(.tool-mode) .topbar{min-height:52px;padding:6px 11px;margin-bottom:6px}
body:not(.tool-mode) .brand-mark{width:31px;height:31px;font-size:18px}
body:not(.tool-mode) .brand h1{font-size:19px}
body:not(.tool-mode) .brand p{display:none}
body:not(.tool-mode) .tool-link{padding:5px 10px;font-size:11px}
body:not(.tool-mode) .quiet{padding:5px 10px;font-size:11px}
body:not(.tool-mode) .enemy-line,body:not(.tool-mode) .player-line{margin:1px 0 4px}
body:not(.tool-mode) .hand{min-height:32px;margin-bottom:5px;padding:2px 6px}
body:not(.tool-mode) .board-frame{padding:5px;border-width:2px}
body:not(.tool-mode) .file-labels{height:13px}
@media(min-width:851px){body:not(.tool-mode) .arena{width:min(100%,calc(100dvh - 270px),670px)}}
@media(max-width:570px){
  body:not(.tool-mode) .shell{padding:4px 5px 22px}
  body:not(.tool-mode) .topbar{min-height:43px;padding:4px 6px;margin-bottom:4px;align-items:center}
  body:not(.tool-mode) .brand{gap:5px}
  body:not(.tool-mode) .brand-mark{width:25px;height:25px;font-size:15px}
  body:not(.tool-mode) .brand h1{font-size:16px;letter-spacing:0}
  body:not(.tool-mode) .top-actions{max-width:none;gap:5px}
  body:not(.tool-mode) .tool-link{padding:5px 6px;font-size:10px}
  body:not(.tool-mode) .quiet{padding:5px 6px;font-size:10px}
  body:not(.tool-mode) .arena{padding:3px}
  body:not(.tool-mode) .board-frame{padding:3px}
  body:not(.tool-mode) .hand{min-height:27px}
  .board .piece .glyph{font-size:clamp(16px,5.6vw,22px)}
  .board .piece.type-P .glyph{font-size:clamp(13px,4.4vw,18px)}
  .board .piece.type-L .glyph,.board .piece.type-N .glyph{font-size:clamp(14px,5vw,20px)}
  .board .piece.type-K .role{font-size:6px}
}
@media(prefers-reduced-motion:reduce){.cell.checked-reaction:before{animation:none}}

/* Each side's captured pieces sit beside its own end of the board. */
body:not(.tool-mode) .arena{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:6px;align-items:start}
body:not(.tool-mode) .enemy-line{grid-column:1/-1;grid-row:1}
body:not(.tool-mode) .player-line{grid-column:1/-1;grid-row:5}
body:not(.tool-mode) .board-frame{grid-column:1/-1;grid-row:3}
body:not(.tool-mode) #enemyHand{grid-column:1/-1;grid-row:2}
body:not(.tool-mode) #playerHand{grid-column:1/-1;grid-row:4}
body.online-guest:not(.tool-mode) .player-line{grid-row:1}
body.online-guest:not(.tool-mode) #playerHand{grid-row:2}
body.online-guest:not(.tool-mode) #enemyHand{grid-row:4}
body.online-guest:not(.tool-mode) .enemy-line{grid-row:5}
body:not(.tool-mode) .input-hint{grid-column:1/-1;grid-row:6}
body:not(.tool-mode) .quick-audio{grid-column:1/-1;grid-row:7}
body:not(.tool-mode) .team-name{min-width:0;gap:4px}
body:not(.tool-mode) .team-identity{min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:2px}
body:not(.tool-mode) .player-profile{display:block;color:#f3ce85;font-size:10px;font-weight:700;line-height:1.2;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
body:not(.tool-mode) .team-name>span:nth-child(2){white-space:nowrap}
body:not(.tool-mode) .enemy-line,body:not(.tool-mode) .player-line{min-width:0;gap:3px;margin:0 0 5px;font-size:11px}
body:not(.tool-mode) .turn-chip{font-size:9px}
body:not(.tool-mode) .clock-chip{min-width:88px;padding:3px 5px}
body:not(.tool-mode) .clock-chip strong{font-size:17px}
body:not(.tool-mode) .clock-chip small{font-size:8px}
body:not(.tool-mode) #enemyHand,body:not(.tool-mode) #playerHand{min-width:0;margin:3px 0 5px}
body:not(.tool-mode) #enemyHand{background:#23303d;border-color:#805e59}
body:not(.tool-mode) #playerHand{background:#2d2d32;border-color:#b3915c}
body:not(.tool-mode) .hand.empty{min-height:26px}
body:not(.tool-mode) .hand.empty:after{font-size:10px}
@media(min-width:851px){body:not(.tool-mode) .arena{width:min(100%,calc(100dvh - 300px),610px)}}

@media(max-width:570px){
  body:not(.tool-mode) .player-profile{font-size:9px}
  body:not(.tool-mode) .enemy-line,body:not(.tool-mode) .player-line{font-size:10px}
  body:not(.tool-mode) .clock-chip{min-width:75px;padding:2px 3px}
  body:not(.tool-mode) .clock-chip strong{font-size:15px}
  body:not(.tool-mode) .clock-chip small{font-size:7px}
  body:not(.tool-mode) .turn-chip{font-size:8px}
}
.preview-art-link{display:inline-block;margin-top:13px;border:1px solid #e9c47a;border-radius:8px;padding:8px 12px;color:#f6d492;text-decoration:none;font-size:12px;font-weight:900}
.preview-art-link:hover{background:#3a4a51}

/* Portrait and engraved kanji are contained within the wooden koma outline. */
.piece.illustrated .piece-portrait{position:absolute;z-index:1;top:3%;left:1%;width:98%;height:72%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 1px 1px #34231588);pointer-events:none}
.board .piece.illustrated .glyph{position:absolute;z-index:2;top:auto;bottom:3%;width:100%;margin:0;padding:0;background:transparent;color:#2a201b;text-align:center;white-space:nowrap;font-family:"Yu Mincho","Hiragino Mincho ProN",serif;font-size:clamp(10px,1.05vw,12px);line-height:1;text-shadow:0 1px #fff1c2a8}
.board .piece.illustrated.promoted .glyph{color:#ad302e}
.board .piece.illustrated .role,.hand .piece.illustrated .role{display:none}
.hand .piece.illustrated .piece-portrait{top:3%;height:72%}
.hand button.hand-piece .piece.illustrated .glyph{position:absolute;z-index:2;top:auto;bottom:3%;width:100%;margin:0;padding:0;background:transparent;text-align:center;white-space:nowrap;font-size:10px;line-height:1;text-shadow:0 1px #fff1c2a8}
@media(max-width:570px){
  .board .piece.illustrated .piece-portrait{top:3%;height:72%}
  .board .piece.illustrated .glyph{font-size:10px;padding:0}
  .board .piece.type-P.illustrated .glyph,.board .piece.type-N.illustrated .glyph,.board .piece.type-L.illustrated .glyph{font-size:9px}
}
@media(max-width:360px){.board .piece.illustrated .glyph{bottom:3%;font-size:8px}.board .piece.type-P.illustrated .glyph,.board .piece.type-N.illustrated .glyph,.board .piece.type-L.illustrated .glyph{bottom:3%;font-size:7px}}

.cutout-overlay.mate-effect{clip-path:none;border:2px solid #ffe0a0;border-radius:14px;background:radial-gradient(circle at 50% 55%,#823543c9,#182b42df 75%);box-shadow:0 0 0 4px #ffcf6b80,0 0 28px 12px #ff9e5e99;overflow:hidden;z-index:9;animation:mate-flash .4s ease-out}
.cutout-overlay.mate-effect::after{content:'詰み';position:absolute;z-index:3;bottom:3px;left:0;right:0;color:#fff8da;font-size:clamp(14px,1.6vw,21px);font-weight:900;letter-spacing:.2em;text-align:center;text-shadow:0 2px 4px #170d12,0 0 6px #e75654}
.cutout-overlay.mate-effect.fallback img{object-fit:fill;transform:scale(2.8);transform-origin:center;animation:mate-face .4s ease-out both}
#cancelPromote{display:block;width:100%;margin-top:9px;border:1px solid #738596;border-radius:8px;background:transparent;color:#d9e2e4;padding:8px 10px;font-size:12px;font-weight:800}
@keyframes mate-flash{from{box-shadow:0 0 0 0 #ffcf6b00,0 0 0 0 #ff9e5e00}to{box-shadow:0 0 0 4px #ffcf6b80,0 0 28px 12px #ff9e5e99}}
@keyframes mate-face{from{opacity:.2;transform:scale(2)}to{opacity:1;transform:scale(2.8)}}
.countdown-setting{cursor:pointer}
.countdown-setting input{width:18px;height:18px;accent-color:var(--gold)}
.countdown-setting input:disabled{opacity:.45}
.mode-row:has(#timeRule) select{min-height:36px}
.sacrifice-guide{display:grid;gap:5px;margin:12px 0;padding:11px;border:1px solid #a68b5b;border-radius:10px;background:#263747}
.sacrifice-guide>strong{font-size:13px;color:#f3d58d}
.sacrifice-guide>span{font-size:10px;color:#b8c8cf}
.sacrifice-groups{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.sacrifice-group{display:grid;align-content:start;gap:5px;font-size:11px}
.sacrifice-group strong{color:#e4ebea}
.sacrifice-links{display:flex;flex-wrap:wrap;gap:4px}
.sacrifice-links button{border:1px solid #bdac81;border-radius:6px;background:#152738;color:#f2db9e;padding:5px 8px;font-size:11px;font-weight:800}
.sacrifice-links button:hover,.sacrifice-links button:focus-visible{background:#435a63}
@media(max-width:570px){.sacrifice-groups{grid-template-columns:1fr}}

/* A slow camera drift adds depth while the board stays still and readable. */
body{background:#101724;isolation:isolate}
body::before{content:'';position:fixed;inset:-5vmax;z-index:0;pointer-events:none;background-color:#101724;background-image:linear-gradient(90deg,#10172466,#10172499 45%,#10172466),var(--room-image,url('./assets/room-background-washitsu.webp'));background-position:center;background-size:cover;background-repeat:no-repeat;transform:translate3d(-3%,1.4%,0) scale(1.08);transform-origin:center;animation:room-drift 32s ease-in-out infinite alternate;will-change:transform}
.shell{position:relative;z-index:1}
@keyframes room-drift{to{transform:translate3d(3%,-1.4%,0) scale(1.16)}}
@media(max-width:570px){body{background:#101724}body::before{background-image:linear-gradient(#10172466,#101724aa 55%),var(--room-image,url('./assets/room-background-washitsu.webp'));background-position:center top;background-size:cover}}
@media(prefers-reduced-motion:reduce){body::before{animation:none;transform:none}}
.brand-mark{overflow:hidden;background:#d8b776}
.brand-mark img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 22%}
.rated-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.rated-actions button{border:1px solid #f4d797;border-radius:8px;background:#d6ab60;color:#1e2630;font-size:13px;font-weight:900;padding:9px 12px}
.rated-actions span{color:#f1d79f;font-size:12px;font-weight:800}
.matchmaking-panel{position:fixed;z-index:100;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:stretch;gap:14px;width:min(420px,calc(100vw - 32px));padding:22px;border:1px solid #d6ab60;border-radius:16px;background:#1c2c3d;box-shadow:0 0 0 100vmax #060b17c9,0 20px 48px #000b;color:#f5e8cd;text-align:center;font-size:13px}
.matchmaking-panel[hidden]{display:none}
.matchmaking-panel strong{font-size:18px;line-height:1.4}
.matchmaking-stats{margin:0;color:#f3cc82;font-size:15px;font-weight:800;line-height:1.6}
.matchmaking-panel small{color:#bfd0da;line-height:1.5}
.matchmaking-panel button{border:1px solid #a3bdc4;border-radius:8px;color:#e8f0ef;background:#294556;padding:10px 12px}
.dev-links{display:none;align-items:center;gap:6px}
body.dev-mode .dev-links{display:flex}
.header-volume{position:relative}
.volume-popover{position:absolute;right:0;top:calc(100% + 7px);z-index:20;width:210px;padding:11px 13px;border:1px solid #9c8466;border-radius:10px;background:#1c2a39;box-shadow:0 12px 22px #0008;color:#f0dfb8;font-size:12px}
.volume-popover[hidden]{display:none}
.volume-popover label{display:flex;justify-content:space-between;gap:9px}
.volume-popover input{width:100%;accent-color:var(--gold);margin-top:7px}
.volume-popover button{width:100%;margin-top:9px;padding:7px 9px;border:1px solid #9c8466;border-radius:7px;background:#2b3b49;color:#f0dfb8;font-size:12px;font-weight:800}
.sound-advanced{display:none}
body.dev-mode .sound-advanced{display:grid;gap:11px;padding-top:11px;border-top:1px solid #435165}
.phase-status,.tactic-status{display:none}
body.dev-mode .phase-status,body.dev-mode .tactic-status{display:block}
@media(max-width:570px){body:not(.tool-mode) .top-actions{max-width:none}.top-actions .quiet{padding:6px 8px;font-size:11px}.brand h1{font-size:17px}.brand p{font-size:9px}}
.start-screen{max-width:1050px;margin:18px auto 50px;color:#edf1f0}
body.start-screen-active:not(.tool-mode) .layout{display:none}
body.tool-mode .start-screen,body:not(.start-screen-active) .start-screen{display:none}
.start-intro{display:flex;align-items:center;justify-content:space-between;min-height:180px;padding:20px 30px;overflow:hidden;border:1px solid #b99a64;border-radius:17px;background:linear-gradient(100deg,#192a3af2 20%,#4c3b31de 100%);box-shadow:0 18px 40px #0005}
.start-intro h2{font-size:clamp(26px,4vw,42px);line-height:1.2;margin:8px 0}
.start-intro p{color:#d6e2e2;margin:0;font-size:14px}
.start-intro img{align-self:flex-end;width:min(24%,210px);height:170px;object-fit:cover;object-position:top;filter:drop-shadow(0 10px 9px #0008)}
.start-account{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:14px 2px;color:#ebd39c;font-size:13px}
.start-account button{border:1px solid #e5cb8d;border-radius:8px;background:#e8c780;color:#172530;padding:9px 13px;font-weight:800}
.start-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.start-options[hidden],.spectator-lobby[hidden]{display:none}
.start-tabs{display:flex;gap:7px;margin:0 0 16px;border-bottom:1px solid #667884}
.start-tabs button{border:0;border-bottom:3px solid transparent;background:transparent;color:#c0cdd0;font-size:16px;font-weight:800;padding:10px 22px;cursor:pointer}
.start-tabs button[aria-selected="true"]{color:#f1cf8b;border-bottom-color:#efc87a}
.spectator-lobby{border:1px solid #536b72;border-radius:15px;background:linear-gradient(145deg,#213445f5,#142433f8);padding:20px}
.spectator-lobby-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.spectator-lobby-head h3{margin:0;font-size:20px}
.spectator-lobby-head p,#spectatorLobbyStatus{font-size:12px;color:#bdcbd0}
.spectator-lobby-head button{border:1px solid #d6b87d;border-radius:8px;padding:8px 13px;background:#293e4e;color:#f2dbab;font-weight:800}
.spectator-games{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.spectator-game{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;border:1px solid #627989;border-radius:9px;padding:13px;color:#eaf1f1;text-decoration:none;background:#132434}
.spectator-game:hover,.spectator-game:focus-visible{border-color:#f1ca7d;background:#243c4e}
.spectator-game strong{width:100%;overflow-wrap:anywhere}
.spectator-game span{color:#c4d0d2;font-size:12px}
.spectator-game b{margin-left:auto;color:#f1cf8b;font-size:12px}
.start-card{display:flex;flex-direction:column;min-height:235px;padding:19px;border:1px solid #536b72;border-radius:15px;background:linear-gradient(145deg,#213445f5,#142433f8);box-shadow:0 12px 25px #0003}
.start-icon{width:39px;height:39px;display:grid;place-items:center;border-radius:8px;background:#cda968;color:#1b2a35;font-size:20px;font-family:serif;font-weight:900}
.start-card h3{font-size:20px;margin:12px 0 5px}
.start-card p{font-size:12px;line-height:1.65;color:#bdcbd0;min-height:42px;margin:0 0 14px}
.start-rule{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:auto}
.start-rule.single{grid-template-columns:1fr}
.start-rule button{min-height:44px;padding:7px;border:1px solid #d6b87d;border-radius:8px;background:#293e4e;color:#f2dbab;font-size:12px;font-weight:900}
.start-rule button:hover,.start-rule button:focus-visible{background:#d9b573;color:#1c2834}
.continue-button{margin-top:15px;border:1px solid #819ba3;border-radius:8px;padding:10px 15px;background:#273b4b;color:#ebf0f0;font-weight:800}
.start-message{min-height:20px;color:#f0cb88;font-size:13px}
@media(max-width:760px){.start-options{grid-template-columns:1fr}.start-intro{min-height:140px;padding:15px}.start-intro img{height:130px;width:28%}.start-card{min-height:unset}.start-card p{min-height:0}.start-screen{margin-top:10px}.start-rule button{font-size:13px}}
@media(max-width:760px){.spectator-games{grid-template-columns:1fr}.start-tabs button{flex:1}}
.name-choice{display:flex;flex-direction:column;gap:4px;min-width:min(100%,270px);font-size:12px;font-weight:800;color:#e8d8b5}
.name-choice input{width:100%;min-height:40px;padding:8px 10px;border:1px solid #93a5ad;border-radius:7px;background:#142535;color:#fff;font-size:14px}
.name-choice small{font-size:10px;line-height:1.4;font-weight:400;color:#bdc9c9}
#accountNameChoice{margin:10px 0 14px}
@media(max-width:760px){.start-account{align-items:flex-start}.name-choice{width:100%}}
.name-choice[hidden]{display:none}
.moment-stage{overflow:hidden}
.moment-stage #momentStagePoster,.moment-stage #momentStageVideo{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.moment-stage #momentStagePoster{z-index:1;filter:drop-shadow(0 8px 8px #0008)}
.moment-stage #momentStageVideo{z-index:2;display:none}
.moment-stage.playing #momentStageVideo{display:block}

@media(max-width:570px){body:not(.tool-mode) .brand{flex:none}body:not(.tool-mode) .brand h1{white-space:nowrap}body:not(.tool-mode) .top-actions{min-width:0;flex:1}}

.presence-badge{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px 12px;color:#f5dfac;text-decoration:none;font-size:12px;font-weight:800;border:1px solid #9d8061;border-radius:999px;background:#142537d9;padding:6px 10px}
.presence-badge>span{white-space:nowrap}
.presence-badge>span+span{border-left:1px solid #9d806180;padding-left:12px}
.presence-badge small{font-size:10px;font-weight:500;color:#c8d8dc}
body.tool-mode .presence-badge{display:none}
@media(max-width:760px){body:not(.tool-mode) .topbar{flex-wrap:wrap}body:not(.tool-mode) .presence-badge{order:3;width:100%;justify-content:center;border-radius:12px;padding:5px 7px;font-size:11px;gap:4px 8px}body:not(.tool-mode) .presence-badge>span+span{padding-left:8px}}
.online-link[hidden],.watch-share[hidden],#leaveWatchButton[hidden],#onlineRoomNote[hidden]{display:none}
.watch-share{margin-top:12px;padding-top:10px;border-top:1px solid #688090}
.watch-share label{display:block;margin-bottom:6px;font-weight:800;color:#f2cf8b}
#leaveWatchButton{margin-top:8px;border:1px solid #f4d797;border-radius:7px;background:#d6ab60;color:#1e2630;font-weight:900;padding:8px 12px}
body.spectating .rated-actions,body.spectating .mode-row,body.spectating .controls{display:none}
body.spectating .cell:disabled{opacity:1;cursor:default}
body.spectating .cell:hover{background-color:transparent}
.room-chat{background:linear-gradient(145deg,#1c2b3b,#172232);border:1px solid #415265;border-radius:14px;padding:14px;box-shadow:0 12px 24px #0002}
.room-chat[hidden]{display:none}
.room-chat-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.room-chat-head strong{font-size:15px;color:#f2cf8b}
.room-chat-head small,.chat-empty,.chat-notice{color:#b9c6cc;font-size:11px}
.chat-messages{max-height:180px;min-height:70px;overflow:auto;display:flex;flex-direction:column;gap:7px;overscroll-behavior:contain}
.chat-message{display:flex;gap:8px;align-items:baseline;font-size:13px;overflow-wrap:anywhere}
.chat-message strong{flex:none;color:#efc878;font-size:11px}
.chat-message span{white-space:pre-wrap}
.chat-messages:empty{min-height:0}
.chat-empty{margin:0 0 10px;text-align:center;pointer-events:none}
.chat-empty[hidden]{display:none}
.chat-form{display:flex;gap:7px;margin-top:10px}
.chat-form input{min-width:0;flex:1;background:#101c29;border:1px solid #677989;color:#f1f5f7;border-radius:8px;padding:9px}
.chat-form button{flex:none;border:1px solid #e3bf78;background:#ecc878;color:#1b2530;border-radius:8px;padding:8px 14px;font-weight:800}
.chat-notice{min-height:15px;margin:6px 0 0;color:#f2c47f}
@media(max-width:850px){.room-chat{grid-column:span 2}}
