/* 雾中密谈 · 深色克苏鲁风（移动优先，无外部资源） */
:root{
  --ink:#d8d1b7; --muted:#8f998e; --night:#080b0a;
  --panel:#111715; --panel2:#18211d;
  --green:#466955; --green2:#84a488; --gold:#c6a85a; --red:#a34c4c;
  --line:#2b3932;
  --serif:Georgia,"Noto Serif SC","Source Han Serif SC","Songti SC",SimSun,serif;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:radial-gradient(circle at 50% 0,#16201c 0,var(--night) 52%);background-attachment:fixed;color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}
button,input,textarea,select{font:inherit}
button{min-height:44px;border:1px solid #66816d;background:#31533f;color:#f1ead2;border-radius:8px;padding:.65rem 1rem;cursor:pointer}
button:hover{filter:brightness(1.12)}
button:active{transform:translateY(1px)}
input,textarea,select{min-height:44px;width:100%;border:1px solid var(--line);border-radius:7px;background:#090d0b;color:var(--ink);padding:.65rem .7rem;outline:none}
input:focus,textarea:focus,select:focus{border-color:var(--green2);box-shadow:0 0 0 2px #84a48822}
label{display:grid;gap:.35rem;color:#bdb9a6}
.field-hint{color:var(--muted);font-size:.82rem;font-weight:400}
.hidden{display:none!important}

/* ---------- 首页 ---------- */
.home{max-width:960px;margin:auto;padding:8vh 1.2rem;padding-left:max(1.2rem,env(safe-area-inset-left));padding-right:max(1.2rem,env(safe-area-inset-right))}
.hero{text-align:center;margin-bottom:3rem}
.hero h1,.room-head h1,h2,h3{font-family:var(--serif);letter-spacing:.06em}
.hero h1{font-size:clamp(2.2rem,8vw,4rem);margin:.15rem}
.hero p{color:var(--muted)}
.sigil{display:inline-grid;place-items:center;width:3rem;height:3rem;border:1px solid var(--gold);border-radius:50%;color:var(--gold);box-shadow:0 0 30px #c6a85a44}
.home-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1.2rem}
.paper-card{display:grid;gap:1rem;padding:1.5rem;border:1px solid var(--line);border-radius:12px;background:linear-gradient(150deg,#19201b,#101512);box-shadow:0 14px 50px #0008}
.account-card{margin-bottom:1.2rem;padding:1rem 1.2rem}.account-card header{display:flex;align-items:baseline;gap:.8rem;flex-wrap:wrap}.account-card header h2,.account-card header p{margin:0}.account-card header h2 small{font:normal .75rem system-ui;color:var(--gold)}.account-card header p{color:var(--muted);font-size:.88rem}.account-forms{display:grid;grid-template-columns:1fr 1.35fr;gap:1rem;margin-top:.9rem}.account-forms form{display:grid;grid-template-columns:1fr 1fr auto;gap:.6rem;align-items:end}.account-forms #register-form{grid-template-columns:1fr 1fr 1fr auto}.account-user{display:flex;align-items:center;justify-content:space-between;gap:1rem}.account-user div{display:grid}.account-user small{color:var(--gold)}.account-card .error{margin:0;min-height:0}
.my-rooms{margin-bottom:1.2rem}.my-rooms>header{display:flex;align-items:baseline;gap:.8rem;flex-wrap:wrap}.my-rooms>header p{margin:0;color:var(--muted)}.my-room-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.65rem 0;border-bottom:1px solid var(--line)}.my-room-row div{display:grid}.my-room-row small{color:var(--muted);font-size:.82rem}
.paper-card h2{margin:0}
.room-code{text-transform:uppercase;letter-spacing:.3em}
.error{color:#e88989;text-align:center}
.owner-notice{margin:1rem 0 0;padding:.8rem 1rem;border:1px solid #806b3d;border-radius:9px;background:#211e15;color:#e3cf8d;text-align:center}
.game-type-picker{display:grid;grid-template-columns:1fr 1fr;gap:.55rem;margin:0;padding:0;border:0}.game-type-picker legend{grid-column:1/-1;margin-bottom:.25rem;color:#bdb9a6}.game-type-card{display:flex;align-items:center;gap:.55rem;padding:.65rem;border:1px solid var(--line);border-radius:9px;background:#101512;cursor:pointer}.game-type-card:has(input:checked){border-color:var(--gold);background:#211e15}.game-type-card input{width:1.15rem;height:1.15rem;min-height:0;accent-color:var(--gold)}.game-type-card span{display:grid}.game-type-card small{color:var(--muted);font-size:.75rem}

/* ---------- 房间骨架（--vvh 由 app.js 依 visualViewport 驱动，软键盘弹出时收缩） ---------- */
.room{height:100vh;height:100dvh;height:var(--vvh,100dvh);display:flex;flex-direction:column;overflow:hidden}
.room-head{min-height:64px;display:flex;align-items:center;gap:.6rem;padding:.55rem .9rem;padding-top:calc(.55rem + env(safe-area-inset-top));padding-left:max(.9rem,env(safe-area-inset-left));padding-right:max(.9rem,env(safe-area-inset-right));border-bottom:1px solid var(--line);background:#0d1210}
.room-title{min-width:0;max-width:38vw}
.room-head h1{font-size:1.2rem;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.room-head small{color:var(--gold);letter-spacing:.22em}
.room-code-button{display:block;min-height:0;border:0;background:transparent;padding:0;text-align:left}.room-code-button:hover{filter:none}.room-code-button:active{transform:none}
.setting-badge,.game-type-badge,.current-game-badge{flex:0 1 auto;max-width:22rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid #4a594c;border-radius:99px;padding:.28rem .65rem;color:#cfc49e;background:#18211d;font-size:.84rem}.game-type-badge{display:none;border-color:#806b3d;color:#e3cf8d;background:#211e15}.current-game-badge{border-color:#806b3d;color:#e3cf8d;background:#211e15}.game-count-hint{color:var(--muted);font-size:.76rem;white-space:nowrap}
.room-owner-notice{margin:0;padding:.35rem 1rem;border-bottom:1px solid #5c4e2e;background:#211e15;color:#e3cf8d;text-align:center;font-size:.88rem}
.presence{display:flex;gap:.35rem;flex:1;min-width:0;justify-content:flex-end;overflow-x:auto;scrollbar-width:none}
.presence::-webkit-scrollbar{display:none}
.player-count-button{display:none;min-height:36px;padding:.35rem .6rem;font-size:.8rem}
.avatar{flex:0 0 auto;display:grid;place-items:center;min-width:2.2rem;width:2.2rem;height:2.2rem;min-height:2.2rem;padding:0;border-radius:50%;background:#26382e;border:1px solid #476654;color:var(--ink);font-size:.8rem;position:relative}
.avatar.offline{opacity:.38}
.avatar::after{content:"";position:absolute;right:0;bottom:0;width:.55rem;height:.55rem;border-radius:50%;background:#61a879;border:2px solid #0d1210}
.avatar.offline::after{background:#667}
.ghost{background:transparent;border-color:var(--line);color:var(--ink)}
.play-area{display:grid;grid-template-columns:minmax(0,1fr) 300px;min-width:0;width:100%;min-height:0;flex:1;overflow-x:hidden}
.desktop-info{display:none}
.return-panel{display:grid;place-content:center;justify-items:center;gap:1rem;min-height:0;flex:1;padding:2rem;text-align:center;color:var(--muted)}
.return-panel p{margin:0;max-width:32rem}
.return-panel button{min-width:min(22rem,90vw)}
.chat-column{min-height:0;display:flex;flex-direction:column;flex:1}

/* ---------- 消息流 ---------- */
.messages{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:1rem max(1rem,calc((100vw - 1080px)/2));scroll-behavior:smooth;scrollbar-width:thin;scrollbar-color:#2b3932 transparent}
.message{max-width:76%;margin:.7rem 0;padding:.7rem .9rem;border:1px solid var(--line);border-radius:4px 12px 12px;background:var(--panel2);white-space:pre-wrap;overflow-wrap:anywhere}
.message.mine{margin-left:auto;background:#26372f}
.message .meta{display:block;color:#9ca59c;font-size:.75rem;margin-bottom:.25rem}
.message.ooc{border-style:dashed;background:#151b17;opacity:.92}
.message.system{max-width:100%;text-align:center;background:transparent;border:0;color:#7e8b83;font-size:.85rem}
.message.sheet .content,.message.sheet_delta .content{color:#b9c2b7;font-size:.92rem}
.message.kp{max-width:92%;border-left:4px solid var(--gold);background:linear-gradient(90deg,#241f14,#141612);padding:1rem 1.1rem;line-height:1.75}
.message.kp .meta{color:var(--gold)}
.message.kp .content{font-family:var(--serif)}
.message.kp .content strong{color:var(--gold)}
.message.whisper{border-color:#9b7830;border-left:4px solid var(--gold);background:#211e15}.message.whisper .meta{color:#d8bd6e}.message.whisper.mine{background:#2a291b}

/* ---------- 骰子卡片 ---------- */
.dice-card{max-width:400px;background:#141b18;border:1px solid #415348;border-radius:10px;padding:.8rem .9rem;margin:.7rem 0}
.dice-card.mine{margin-left:auto}
.dice-card .meta{display:block;color:#9ca59c;font-size:.75rem;margin-bottom:.2rem}
.dice-result{font:700 2.3rem/1.15 var(--serif);color:#e9e1c5}
.dice-detail{color:var(--muted);font-size:.8rem;margin-top:.25rem;overflow-wrap:anywhere}
.dice-note{color:#b9c0b6;font-size:.85rem;margin-top:.3rem}
.attr-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.3rem .45rem;margin-top:.45rem;font-size:.82rem}
.attr-grid span{background:#1c2821;border-radius:6px;padding:.32rem .3rem;text-align:center;white-space:nowrap}
.badge{display:inline-block;border-radius:99px;padding:.2rem .6rem;font-size:.78rem;margin-top:.4rem;background:#4d534e;color:#f1ead2}
.badge.普通成功{background:#565b56}
.badge.困难成功{background:#356b93}
.badge.极难成功{background:#705092}
.badge.大成功{background:linear-gradient(135deg,#c9a43a,#8f6f1d);color:#fff8e3}
.badge.大失败{background:#9e3b3b}
.badge.失败{background:transparent;border:1px solid #575d57;color:#a9b0a8}

/* ---------- 状态条 / 空态提示 ---------- */
.empty-hint{position:relative;text-align:center;margin:.5rem 1rem;padding:1rem;border:1px dashed var(--line);color:var(--muted)}
.invite-close{position:absolute;top:.35rem;right:.35rem;min-width:36px;min-height:36px;font-size:1.1rem;color:var(--muted);background:transparent;border:0}
.empty-hint .share-code{margin:.4rem 0;font-size:1.05rem}
.empty-hint .share-code strong{color:var(--gold);letter-spacing:.3em;font-size:1.25rem;margin-left:.35rem}
.empty-hint code{display:block;margin:.5rem 0;overflow-wrap:anywhere;color:#aeb6ae}
.share-actions{display:flex;gap:.6rem;justify-content:center;flex-wrap:wrap}
.kp-state{padding:.45rem 1rem;background:#211e15;color:#cdbd83;animation:pulse 1.5s infinite;text-align:center}
@keyframes pulse{50%{opacity:.6}}
.conn-state{padding:.4rem 1rem;background:#241a12;color:#d9a86a;text-align:center;font-size:.9rem}
.poll-bar{display:grid;gap:.55rem;padding:.6rem max(1rem,calc((100vw - 1080px)/2));border-bottom:1px solid #4d4329;background:#17170f}.poll-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem}.poll-options{display:flex;gap:.45rem;flex-wrap:wrap}.poll-options button{min-height:36px;padding:.35rem .7rem}.poll-options button.selected{border-color:var(--gold);background:#6e5923}.poll-results{display:flex;gap:.8rem 1.2rem;flex-wrap:wrap}.poll-results p{margin:0;color:#cfc49e;font-size:.88rem}

/* ---------- 输入区（含底部安全区） ---------- */
.composer{padding:.6rem .7rem calc(.6rem + env(safe-area-inset-bottom));padding-left:max(.7rem,env(safe-area-inset-left));padding-right:max(.7rem,env(safe-area-inset-right));border-top:1px solid var(--line);background:#0d1210}
.composer textarea{resize:none;min-height:52px;max-height:12em;overflow-y:auto}
.whisper-mode{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin-bottom:.45rem;padding:.35rem .55rem;border:1px solid #806b3d;border-radius:7px;background:#211e15;color:#e3cf8d}.whisper-mode button{min-height:34px;padding:.2rem .55rem;font-size:.78rem}
.compose-actions{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;flex-wrap:wrap}
.compose-actions button:last-child{margin-left:auto}
.module-mark{color:var(--gold);font-size:.65rem;margin-left:.25rem;vertical-align:middle}
.toggle{display:flex;align-items:center;gap:.4rem;min-height:44px;padding:0 .3rem;color:#bdb9a6}
.toggle input{width:1.25rem;height:1.25rem;min-height:0;accent-color:var(--green2)}

/* ---------- 桌面侧栏 ---------- */
.desktop-side{border-left:1px solid var(--line);background:#0e1311;padding:1rem;overflow-y:auto}
.desktop-side-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem}
.desktop-side h2,.desktop-info h2{font-size:1rem;color:var(--gold);margin:1rem 0 .5rem}
.desktop-side h2:first-child,.desktop-info h2:first-child{margin-top:0}
.desktop-side .desktop-sheet-content>button{width:100%}
#toggle-desktop-sheet{display:none;width:36px;min-width:36px;min-height:36px;padding:0;font-size:1.4rem}
.desktop-info{border-right:1px solid var(--line);background:#0e1311;padding:1rem;overflow-y:auto}
.side-room-code{display:grid;gap:.2rem;text-align:left;width:100%}.side-room-code span{color:var(--muted);font-size:.78rem}.side-room-code strong{color:var(--gold);letter-spacing:.22em;font-size:1.15rem}
.desktop-setting{margin:.8rem 0;padding:.7rem;border:1px solid #34433b;border-radius:8px;background:#141b18;color:#cfc49e;line-height:1.55;overflow-wrap:anywhere}.side-rules-button{width:100%;margin-bottom:.4rem}
.player-row,.summary-row{padding:.45rem 0;border-bottom:1px solid #202a25;color:#aeb6ae}.player-row:is(button){display:block;width:100%;min-height:0;text-align:left;border-width:0 0 1px;border-radius:0;background:transparent}.player-row:is(button):hover{color:var(--gold)}
.player-directory{display:grid;gap:.5rem}.player-directory-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.55rem;padding:.6rem;border:1px solid #29372f;border-radius:8px;background:#131a17}.player-directory-row.offline{opacity:.68}.player-directory-info{display:grid;gap:.12rem;min-width:0}.player-directory-title{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem}.player-directory-title .online{color:#76b98a;font-size:.74rem}.player-directory-title .offline{color:#8b9290;font-size:.74rem}.account-label{color:var(--gold);font-size:.76rem}.identity-summary{color:#aeb6ae;font-size:.84rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.player-directory-actions{display:flex;gap:.3rem}.player-directory-actions button{min-height:34px;padding:.25rem .5rem;font-size:.76rem}#side-players{display:grid;gap:.45rem}
.clue-list{display:grid;gap:.6rem}.clue-row{display:flex;align-items:flex-start;justify-content:space-between;gap:.65rem;padding:.65rem;border:1px solid #2b3932;border-radius:7px;background:#141b18;overflow-wrap:anywhere}.clue-row>div{display:grid;min-width:0}.clue-row span{white-space:pre-wrap;overflow-wrap:anywhere}.clue-row button{flex:0 0 auto;min-height:30px;padding:.15rem .4rem;font-size:.72rem}.clue-form{display:flex;gap:.4rem;margin:.7rem 0}.clue-form input{min-width:0}.clue-form button{padding:.45rem .6rem}.organize-clues{width:100%}.recap{margin-top:1rem;padding-top:.8rem;border-top:1px dashed var(--line);overflow-wrap:anywhere}.recap h3{margin:.2rem 0;color:var(--gold);font-size:.95rem}.recap p{margin:.3rem 0;white-space:pre-wrap}.recap-group{margin:.75rem 0}.recap-group ul{margin:.35rem 0;padding-left:1.25rem}.recap-group li{margin:.3rem 0;color:#b9c2b7;font-size:.9rem;white-space:pre-wrap;overflow-wrap:anywhere}
.games-editor{display:grid;gap:.7rem;padding-bottom:1rem;border-bottom:1px dashed var(--line)}.games-editor>header h3,.games-editor>header p{margin:0}.games-list{display:grid;gap:.45rem}.game-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.55rem;padding:.6rem;border:1px solid var(--line);border-radius:8px;background:#101512}.game-row.current{border-color:#806b3d;background:#211e15}.game-row-info{display:grid;gap:.25rem;min-width:0}.archive-meta{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap}.archive-type-badge,.archive-current{display:inline-flex;align-items:center;min-height:1.45rem;padding:.08rem .45rem;border:1px solid #4a594c;border-radius:99px;background:#18211d;color:#cfc49e;font-size:.72rem}.archive-current{border-color:#806b3d;background:#2b2415;color:#e3cf8d}.game-row-actions{display:flex;gap:.3rem}.game-row-actions button{min-height:34px;padding:.25rem .5rem;font-size:.76rem}.new-game-details{padding:.65rem;border:1px solid var(--line);border-radius:8px}.new-game-details summary{cursor:pointer;color:var(--gold)}.new-game-details[open]{display:grid;gap:.7rem}.new-game-details.disabled summary{opacity:.5;pointer-events:none}.game-type-picker.compact{margin-top:.25rem}.game-type-picker.compact .game-type-card{padding:.45rem}
.owner-players{display:grid;gap:.35rem}.owner-player{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.5rem 0;border-bottom:1px solid #202a25}.owner-player-info{display:grid;min-width:0}.owner-player-actions{display:flex;gap:.35rem}.owner-player button{min-height:36px;padding:.3rem .65rem}.template-actions{display:flex;gap:.5rem;flex-wrap:wrap}.template-actions button{flex:1 1 11rem}.poll-editor{display:grid;gap:.65rem;border-top:1px dashed var(--line);padding-top:1rem}.poll-editor-actions{display:flex;gap:.5rem}.poll-editor-actions button{flex:1}

/* ---------- 弹窗 ---------- */
dialog{border:1px solid var(--line);border-radius:12px;background:#111715;color:var(--ink);padding:0;width:min(520px,calc(100vw - 1.5rem));max-height:min(92vh,92dvh)}
dialog:not([open]){display:none}
dialog::backdrop{background:#000b;backdrop-filter:blur(3px)}
.dialog-body{display:grid;gap:1rem;padding:1rem}
.dialog-body>header,.dialog-body section>header{display:flex;align-items:center;justify-content:space-between}
.dialog-body h2,.dialog-body h3{margin:0}
.rules-content{padding:.25rem .15rem}.rules-content ul{display:grid;gap:.75rem;margin:0;padding-left:1.25rem}.rules-content li{color:#c4c6b9;line-height:1.65}.rules-dialog .dialog-body{max-height:min(86vh,720px);overflow-y:auto}
.close{min-width:44px;min-height:44px;font-size:1.4rem;padding:.1rem .6rem;background:transparent;border:0}
.quick-rolls{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem}
.identity-fields{display:grid;grid-template-columns:repeat(2,1fr);gap:.6rem}
.attributes{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem}
.attributes label{font-size:.8rem;gap:.2rem}
.roll-attrs-row button{width:100%}
.derived{display:flex;flex-wrap:wrap;gap:.5rem}
.derived span{padding:.4rem .6rem;background:#1c2821;border-radius:6px;font-size:.85rem}
.resources{display:grid;grid-template-columns:repeat(3,1fr);gap:.6rem}
.resource-control{border:1px solid var(--line);padding:.55rem;border-radius:8px;display:grid;gap:.4rem}
.resource-control strong{font-size:.85rem;color:#c8bd97}
.resource-buttons{display:flex;gap:.3rem}
.resource-buttons button{flex:1;min-height:40px;padding:.2rem 0}
.skill-row{display:grid;grid-template-columns:minmax(0,1fr) 92px 44px;gap:.4rem;margin:.4rem 0}
.skill-row button{min-height:40px;padding:.1rem 0}
.gen-sheet{display:grid;gap:.6rem;border-bottom:1px dashed var(--line);padding-bottom:.9rem}
.sheet-setting-hint{margin:0;padding:.65rem .8rem;border:1px solid #806b3d;border-radius:8px;background:#211e15;color:#e3cf8d}
.setting-editor{display:grid;gap:.75rem;border-top:1px dashed var(--line);padding-top:1rem}.setting-fields{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}.setting-editor #setting-status{min-height:1.3em;margin:0}.type-sheet-fields{display:grid;gap:.8rem}.fantasy-identity{grid-template-columns:repeat(4,minmax(0,1fr))}.fantasy-attrs{grid-template-columns:repeat(6,minmax(0,1fr))}.private-script{white-space:pre-wrap;overflow-wrap:anywhere;padding:.8rem;border:1px solid var(--line);border-radius:8px;background:#090d0b;color:#d8d1b7;font:0.92rem/1.7 var(--serif);max-height:55vh;overflow:auto}

/* ---------- 模组 ---------- */
.module-dialog{overflow:hidden}
.module-dialog .dialog-body{max-height:min(92vh,92dvh);overflow-y:auto;overscroll-behavior:contain;padding-bottom:calc(1rem + env(safe-area-inset-bottom))}
.module-help,.module-progress{margin:0;color:var(--muted)}
.module-progress{min-height:1.5em;color:#cdbd83}
.module-current{display:grid;gap:.75rem;border-top:1px dashed var(--line);padding-top:1rem}
.module-current h3{font-size:1rem;color:var(--gold)}
.module-current dl{display:grid;gap:.35rem;margin:0}
.module-meta-row{display:grid;grid-template-columns:5rem minmax(0,1fr);gap:.5rem;border-bottom:1px solid #202a25;padding:.35rem 0}
.module-meta-row dt{color:var(--muted)}
.module-meta-row dd{margin:0;overflow-wrap:anywhere}
.module-warning{margin:0;padding:.6rem;border:1px solid #806b3d;border-radius:7px;background:#211e15;color:#d7bd76}
.module-toggle{display:flex;align-items:center;gap:.55rem;min-height:44px}
.module-toggle input{width:1.25rem;height:1.25rem;min-height:0;accent-color:var(--green2)}
#module-preview{max-height:10rem;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;margin:.4rem 0 0;padding:.7rem;border:1px solid var(--line);border-radius:7px;background:#090d0b;color:#bdb9a6;font:0.86rem/1.55 var(--serif)}
.cast-owner-panel{display:grid;gap:.7rem;border-top:1px dashed var(--line);padding-top:1rem}.cast-owner-panel h3{margin:0;color:var(--gold)}.cast-draft{display:grid;gap:.6rem}.cast-role-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(9rem,.7fr) auto;align-items:center;gap:.55rem;padding:.65rem;border:1px solid var(--line);border-radius:8px;background:#101512}.cast-role-info{display:grid;min-width:0}.cast-role-info details{margin-top:.35rem}.cast-role-info summary{cursor:pointer;color:var(--gold);font-size:.82rem}.cast-role-row button{min-height:42px;padding:.45rem .7rem}
.danger{border-color:#693f3f;color:#df9999}

/* ---------- 角色卡全屏抽屉（移动端占满视口，含安全区） ---------- */
.clues-dialog,.players-dialog{width:100vw;max-width:none;max-height:none;height:100vh;height:var(--vvh,100dvh);border:0;border-radius:0}.clues-body,.players-body{height:100%;overflow-y:auto;padding-top:max(1rem,env(safe-area-inset-top));padding-bottom:calc(1rem + env(safe-area-inset-bottom))}.clues-body .clue-list{max-height:none;overflow:visible}
.sheet-dialog{width:100vw;max-width:none;max-height:none;height:100vh;height:var(--vvh,100dvh);border:0;border-radius:0}
.sheet-body{overflow-y:auto;overscroll-behavior:contain;height:100%;padding-top:max(1rem,env(safe-area-inset-top));padding-bottom:calc(1rem + env(safe-area-inset-bottom))}

/* ---------- 动效与轻提示 ---------- */
.typing{animation:reveal .25s ease}
@keyframes reveal{from{opacity:0;transform:translateY(4px)}}
.toast{position:fixed;left:50%;bottom:calc(96px + env(safe-area-inset-bottom));transform:translate(-50%,12px);background:#1d2721f2;border:1px solid var(--line);color:var(--ink);padding:.6rem 1.1rem;border-radius:9px;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:80;max-width:min(90vw,26rem);text-align:center}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.warning{border-color:#9b7830;background:#352b15f2;color:#ffe39b}

/* ---------- 桌面专用三栏（移动端规则保持在后面的独立分支） ---------- */
@media (min-width:1024px){
  html,body{font-size:16.5px;line-height:1.65}
  #owner-dialog{width:min(560px,46vw);height:100vh;max-height:none;margin:0 0 0 auto;border-radius:12px 0 0 12px}#owner-dialog .dialog-body{height:100%;overflow-y:auto;padding:1.25rem}
  .room-head{padding-left:1.1rem;padding-right:1.1rem}
  .play-area{grid-template-columns:250px minmax(0,900px) 320px;justify-content:center;background:#0a0e0c}
  .desktop-info{display:block}
  .chat-column{width:100%;max-width:900px;justify-self:center;background:#080b0a;border-left:1px solid #17201c;border-right:1px solid #17201c}
  .messages{padding:1.35rem 1.55rem}
  .message{max-width:82%;margin:1rem 0;padding:.85rem 1.05rem}
  .message.kp{max-width:96%;line-height:1.85;padding:1.15rem 1.3rem}
  .composer{position:sticky;bottom:0;padding:.8rem 1rem}
  .composer textarea{font-size:1rem;line-height:1.5}
  #toggle-desktop-sheet{display:block}
  .play-area.desktop-side-collapsed{grid-template-columns:250px minmax(0,900px) 48px}
  .play-area.desktop-side-collapsed .desktop-side{display:flex;align-items:center;justify-content:center;padding:0;overflow:hidden}
  .play-area.desktop-side-collapsed .desktop-side > *:not(.desktop-side-head){display:none}
  .play-area.desktop-side-collapsed .desktop-side-head{width:100%;justify-content:center}
  .play-area.desktop-side-collapsed .desktop-side-head > *:not(#toggle-desktop-sheet){display:none}
  .play-area.desktop-side-collapsed #toggle-desktop-sheet{transform:rotate(180deg)}
  #roll-dialog{width:min(720px,calc(100vw - 3rem))}
  .clues-dialog{width:min(560px,calc(100vw - 2rem));min-width:420px;max-width:none;height:100vh;height:100dvh;max-height:none;margin:0 0 0 auto;border:1px solid var(--line);border-radius:12px 0 0 12px}
  .clues-dialog .clues-body{height:100%;overflow-y:auto;padding:1.25rem 1.4rem}
  .sheet-dialog{width:min(1080px,calc(100vw - 3rem));height:min(92vh,900px);max-width:1080px;max-height:92vh;border:1px solid var(--line);border-radius:12px}
  .sheet-body{height:100%;padding:1.25rem 1.4rem}
  .identity-fields{grid-template-columns:repeat(5,minmax(0,1fr))}
  .attributes{grid-template-columns:repeat(8,minmax(0,1fr))}
  #skills{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 .8rem}
  .skill-row{margin:.25rem 0}
}

/* ---------- 移动端单栏 ---------- */
@media (max-width:767px){
  .home-grid{grid-template-columns:1fr}
  .account-forms,.account-forms form,.account-forms #register-form{grid-template-columns:1fr}
  .account-forms{gap:1.2rem}
  .room-head{flex-wrap:wrap}
  .room-head #rename-self,.room-head #claim-identity,.room-head #open-rules-head,.room-head #room-settings,.room-head #leave{min-height:36px;padding:.35rem .55rem;font-size:.78rem}
  .presence{display:none}.player-count-button{display:block;order:2}
  .room-title{max-width:42vw}
  .play-area{display:flex;flex-direction:column;min-height:0}
  .desktop-info,.desktop-side{display:none}
  .current-game-badge{order:3;max-width:100%;flex-basis:100%}.game-count-hint{order:4}.game-type-badge{order:4}.setting-badge{order:5;max-width:100%;flex-basis:100%}
  .game-row{grid-template-columns:1fr}.game-row-actions{display:grid;grid-template-columns:repeat(3,1fr)}
  .message{max-width:88%}
  .message.kp{max-width:94%}
  .dice-card{max-width:92%}
  .room-title{max-width:34vw}
  .resources{grid-template-columns:repeat(2,1fr)}
  .attr-grid{grid-template-columns:repeat(3,1fr)}
  .game-type-picker{grid-template-columns:1fr}
  .fantasy-identity{grid-template-columns:repeat(2,minmax(0,1fr))}.fantasy-attrs{grid-template-columns:repeat(3,minmax(0,1fr))}
  .cast-role-row{grid-template-columns:1fr}.poll-head{align-items:flex-start;flex-direction:column;gap:.15rem}.poll-options{display:grid;grid-template-columns:1fr 1fr}.poll-options button{width:100%}
  .rules-dialog,#owner-dialog{width:100vw;max-width:none;max-height:none;height:100vh;height:var(--vvh,100dvh);border:0;border-radius:0}.rules-dialog .rules-body,#owner-dialog .dialog-body{height:100%;max-height:none;overflow-y:auto;padding-top:max(1rem,env(safe-area-inset-top));padding-bottom:calc(1rem + env(safe-area-inset-bottom))}
  .my-room-row{align-items:flex-start}.my-room-row button{min-height:38px;padding:.35rem .7rem}
}
/* 独立私聊面板：私聊不进入公共消息流。 */
.private-dialog { width: min(1120px, calc(100vw - 32px)); max-width: none; height: min(820px, calc(100dvh - 32px)); max-height: none; overflow: hidden; }
.private-body { width: 100%; height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.private-layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 16px; min-height: 0; height: 100%; }
.private-sidebar { min-width: 0; min-height: 0; border-right: 1px solid var(--line); padding-right: 12px; overflow-y: auto; }
.private-conversations { display: grid; gap: 8px; }
.private-conversation { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.private-conversation.selected { border-color: var(--gold); background: #211e15; }
.private-conversation .unread { min-width: 1.4em; text-align: center; border-radius: 999px; background: var(--gold); color: #111715; }
.private-thread { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; }
.private-messages { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.private-message { align-self: flex-start; min-width: 0; max-width: min(82%, 640px); padding: 9px 11px; border-radius: 12px; background: var(--panel2); overflow-wrap: anywhere; }
.private-message.mine { align-self: flex-end; background: #26372f; }
.private-message .meta { display: block; margin-bottom: 4px; font-size: .78rem; opacity: .72; }
.private-message .content { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.private-form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.private-form textarea { min-width: 0; min-height: 64px; max-height: 12em; overflow-y: auto; resize: none; }
.private-form button { white-space: nowrap; }
.private-empty { margin: auto; opacity: .7; text-align: center; }
@media (max-width: 720px) {
  .private-dialog { width: 100vw; height: var(--vvh, 100dvh); max-width: none; max-height: none; border: 0; border-radius: 0; }
  .private-body { width: 100%; height: 100%; padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .private-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); min-height: 0; height: 100%; }
  .private-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 10px; max-height: 150px; }
  .private-conversations { display: flex; overflow-x: auto; }
  .private-conversation { min-width: 150px; }
  .private-messages { min-height: 0; }
}
