﻿/* 惊爆伦敦 · 联机版 */
:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --blue: #2563eb;
    --blue-d: #1d4ed8;
    --blue-soft: #eff6ff;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --green: #059669;
    --green-soft: #ecfdf5;
    --shadow: 0 12px 32px rgba(15, 23, 42, .08);
    --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(900px 480px at 8% -10%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%),
        radial-gradient(700px 420px at 100% 0%, #fee2e2 0%, rgba(254, 226, 226, 0) 55%),
        var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.app { max-width: 1120px; margin: 0 auto; padding: 18px 16px 56px; }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.brand { font-weight: 850; letter-spacing: 1px; color: var(--ink); }
.brand-name { font-size: 18px; }
.net { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.net i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; display: inline-block; }
.net.on i { background: var(--green); box-shadow: 0 0 0 3px rgba(5, 150, 105, .14); }
.net.warn i { background: var(--amber); }
.top-right { display: flex; align-items: center; gap: 10px; }
.rules-layer { z-index: 95; }
.rules-card ul { margin: 6px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.9; color: #334155; }


/* 结算对局信息 */
.review-layer { z-index: 96; }
.review-card { width: min(760px, 100%); max-height: 88vh; overflow: auto; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.review-head h2 { margin: 0; font-size: 20px; }
.review-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12.5px; color: var(--muted); }
.review-result { font-size: 14px; font-weight: 850; }
.review-result.good { color: var(--blue); }
.review-result.bad { color: var(--red); }
.review-why { margin: 8px 0 0; font-size: 13px; color: #475569; line-height: 1.6; }
.review-sub { margin: 16px 0 8px; font-size: 12px; font-weight: 800; color: #475569; letter-spacing: .3px; }
.review-players { display: flex; flex-direction: column; gap: 6px; }
.review-player {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
    background: #f8fafc; font-family: inherit; font-size: 13px; color: var(--ink);
    cursor: pointer; text-align: left;
}
.review-player:hover { border-color: #cbd5e1; background: #fff; }
.review-player.open { border-color: #93c5fd; background: var(--blue-soft); border-radius: 10px 10px 0 0; }
.review-player .camp { font-size: 10.5px; padding: 2px 7px; }
.rp-seat { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: var(--blue); }
.rp-name { flex: 1 1 auto; min-width: 0; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-meta { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); }
.rp-arrow { flex: 0 0 auto; color: #94a3b8; font-size: 12px; }
.review-hand {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 11px;
    border: 1px solid #bfdbfe; border-top: 0; border-radius: 0 0 10px 10px; background: #fff;
}
.review-chip {
    display: inline-block; border: 1px solid var(--line); border-radius: 7px;
    padding: 4px 8px; font-size: 12px; font-weight: 800;
}
.review-chip.real { background: var(--blue-soft); border-color: #bfdbfe; color: #1e40af; }
.review-chip.fake { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.review-chip.ben { background: var(--red-soft); border-color: #fca5a5; color: #991b1b; }
.review-empty-hand { font-size: 12px; color: var(--muted); }
.review-log { max-height: 300px; overflow: auto; padding-right: 4px; }
.review-round { margin: 10px 0 3px; font-size: 11.5px; font-weight: 800; color: var(--blue); }
.review-entry { padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; color: #334155; }
.review-entry:last-child { border-bottom: 0; }
.review-empty { padding: 18px 0; text-align: center; color: var(--muted); font-size: 12.5px; }

/* 浮层层级必须高于揭示条 */
#rules-modal.overlay { z-index: 95; }
#review-modal.overlay { z-index: 96; }
#pin-modal.overlay { z-index: 97; }

/* 通用面板 */
.panel {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-title h2, .panel h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin: 12px 0 0; }
.danger-text { color: var(--red); }
.danger { color: var(--red); }

/* 按钮 */
.btn {
    appearance: none; border: 1px solid transparent; border-radius: 11px;
    padding: 11px 18px; font-size: 14px; font-weight: 650; cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    font-family: inherit; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .22); }
.btn.primary:hover:not(:disabled) { background: var(--blue-d); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: 0 4px 12px rgba(15, 23, 42, .05); }
.btn.secondary:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: #f1f5f9; color: var(--ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { width: 100%; display: block; }
.btn.small { padding: 8px 12px; font-size: 12.5px; border-radius: 9px; }

/* 表单 */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 650; color: var(--muted); margin-bottom: 7px; }
input {
    width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 11px;
    padding: 0 13px; font-size: 15px; color: var(--ink); background: #fff;
    outline: none; font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(147, 197, 253, .25); }

/* 首页 */
.hero { text-align: center; padding: 10px 0 24px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.5px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, .85fr); gap: 16px; align-items: start; }
.home-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.home-grid .panel { margin-bottom: 0; }

/* 大厅 */
.lobby-panel { margin-bottom: 0; display: flex; flex-direction: column; }
.lobby-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.lobby-tools input { height: 38px; max-width: 220px; font-size: 13px; }
.lobby-tools input::placeholder { font-size: 12.5px; }
.lobby-tools .btn { height: 38px; padding: 0 14px; white-space: nowrap; flex: 0 0 auto; }
.room-list { display: flex; flex-direction: column; gap: 8px; flex: 0 1 auto; max-height: 620px; overflow: auto; }
.room-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 10px; background: #f8fafc;
}
.room-row:hover { border-color: #cbd5e1; background: #fff; }
.room-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: #94a3b8; }
.room-dot.wait { background: var(--green); }
.room-dot.play { background: var(--blue); }
.room-dot.over { background: #94a3b8; }
.room-main { flex: 1 1 auto; min-width: 0; }
.room-title { display: flex; align-items: center; gap: 6px; line-height: 1.15; }
.room-code { font-size: 13.5px; font-weight: 750; color: var(--ink); letter-spacing: 1.1px; flex: 0 0 auto; }
.room-lock {
    flex: 0 0 auto; padding: 1px 5px; border-radius: 999px;
    background: #fef3c7; color: #92400e; font-size: 10px; font-weight: 700; letter-spacing: 0;
}
.room-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.room-state { font-weight: 600; }
.room-state.wait { color: var(--green); }
.room-state.play { color: var(--blue); }
.room-state.over { color: #64748b; }
.room-sep { color: #cbd5e1; }
.room-host, .room-count { color: #64748b; }
.room-join { flex: 0 0 auto; height: 30px; padding: 0 11px; font-size: 12px; }
.room-empty { margin: auto; padding: 34px 0; text-align: center; color: var(--muted); }
.room-empty-title { font-size: 13.5px; font-weight: 700; color: #64748b; }
.room-empty-hint { margin-top: 6px; font-size: 12px; color: #94a3b8; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-size: 12.5px; color: #475569; cursor: pointer; }

.pin-create-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.pin-create-row > label { flex: 0 0 auto; font-size: 12.5px; color: #475569; }
.pin-create { height: 38px; max-width: 170px; padding: 0 10px; font-size: 14px; letter-spacing: 2px; text-align: center; }
.pin-create::placeholder { font-size: 12.5px; letter-spacing: 0; }
.check-row input { width: 16px; height: 16px; accent-color: var(--blue); }
.pin-input { letter-spacing: 3px; text-align: center; font-weight: 700; font-size: 16px; }
.pin-input::placeholder { font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.pin-layer { z-index: 97; }
.pin-error { min-height: 18px; margin: 6px 0 0; color: var(--red); font-size: 12.5px; }

.rules ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.85; color: #334155; }
.home-rules { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; color: #475569; }
.home-rules li { margin-bottom: 6px; }
.home-rules li:last-child { margin-bottom: 0; }

/* 大厅 */
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#room-code { font-size: 30px; font-weight: 850; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.lobby-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.seat {
    position: relative; border: 1px solid var(--line); border-radius: 13px;
    padding: 12px; min-height: 96px; background: #f8fafc;
    display: flex; flex-direction: column; gap: 5px; justify-content: center;
}
.seat.empty { border-style: dashed; background: #fbfdff; color: #94a3b8; align-items: center; text-align: center; }
.seat.can-switch { cursor: pointer; }
.seat.can-switch:hover { border-color: #93c5fd; background: #f0f9ff; }
.seat-move { font-size: 10.5px; font-weight: 700; color: var(--blue); }
.seat.is-me { border-color: #93c5fd; background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(147, 197, 253, .22); }
.seat.is-host { border-color: #fcd34d; }
.seat.is-off { opacity: .55; }
.seat-top { display: flex; align-items: center; gap: 6px; }
.seat-no { font-size: 12px; font-weight: 800; color: var(--blue); }
.seat-name { font-size: 15px; font-weight: 750; word-break: break-all; }
.seat-state { font-size: 11.5px; color: var(--muted); }
.seat-state.ready { color: var(--green); font-weight: 700; }
.seat-state.wait { color: var(--amber); }
.seat-tag {
    font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px;
    background: #fef3c7; color: #92400e;
}
.seat-tag.you { background: #dbeafe; color: #1e40af; }
.seat-tag.bot { background: #e2e8f0; color: #475569; }
.seat-kick {
    position: absolute; top: 7px; right: 7px; border: 0; background: transparent;
    color: #94a3b8; font-size: 16px; line-height: 1; cursor: pointer; padding: 4px;
}
.seat-kick:hover { color: var(--red); }
.seat-add {
    margin-top: 7px; border: 1px dashed #93c5fd; background: #fff; color: var(--blue);
    border-radius: 9px; padding: 6px 9px; font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.seat-add:hover { background: var(--blue-soft); }
.lobby-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.lobby-actions .btn { flex: 1 1 140px; }
#fill-btn { flex: 0 1 auto; }
#start-btn { flex: 0 1 auto; margin-left: auto; }

/* 游戏状态 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px 20px; }
.stat { text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.stat b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat b.info { color: var(--blue); }

.game-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .9fr); gap: 16px; align-items: start; }
.main-col { min-width: 0; }
.side-col { min-width: 0; }

.turn-banner {
    border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px;
    background: #0f172a; color: #e2e8f0; font-size: 14px; font-weight: 650;
    display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow);
}
.turn-banner.mine { background: linear-gradient(120deg, #1d4ed8, #2563eb 60%, #3b82f6); color: #fff; }
.turn-banner .pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #93c5fd; box-shadow: 0 0 0 0 rgba(147, 197, 253, .7); animation: pulse 1.8s infinite; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(147, 197, 253, .55); }
    70% { box-shadow: 0 0 0 10px rgba(147, 197, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(147, 197, 253, 0); }
}

/* 玩家 */
.players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.pcard {
    position: relative; background: #fff; border: 1px solid var(--line); border-radius: 13px;
    padding: 11px 11px 10px; min-height: 104px; box-shadow: 0 5px 14px rgba(15, 23, 42, .05);
    display: flex; flex-direction: column; gap: 4px; transition: border-color .15s ease, transform .15s ease;
}
.pcard.me { border-color: #93c5fd; }
.pcard.cur { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16), 0 8px 18px rgba(37, 99, 235, .13); }
.pcard.off { opacity: .55; }
.pcard.targetable { cursor: pointer; }
.pcard.targetable:hover { border-color: var(--green); transform: translateY(-2px); }
.pcard.selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(5, 150, 105, .18); }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pseat { font-size: 11px; font-weight: 800; color: var(--blue); }
.pname { font-size: 13.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcards { display: flex; align-items: center; gap: 3px; margin-top: 2px; min-height: 20px; }
.pcount { font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.mini-back {
    width: 13px; height: 19px; border-radius: 2.5px; display: inline-block;
    background: repeating-linear-gradient(45deg, #1e293b 0 3px, #334155 3px 6px);
    border: 1px solid #0f172a;
}
.pbadges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.pbadge {
    font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 999px;
    background: #f1f5f9; color: #475569;
}
.pbadge.cur { background: #dbeafe; color: #1e40af; }
.pbadge.bot { background: #e2e8f0; color: #475569; }
.pbadge.off { background: #fee2e2; color: #991b1b; }

/* 操作区 */
.action { min-height: 132px; }
.action h3 { margin: 0 0 6px; font-size: 17px; }
.action p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.target-btn {
    border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 10px;
    text-align: left; cursor: pointer; font-family: inherit; color: var(--ink);
    transition: border-color .12s, background .12s;
}
.target-btn:hover { border-color: var(--green); background: var(--green-soft); }
.target-btn b { display: block; font-size: 13px; margin-bottom: 2px; }
.target-btn span { font-size: 11.5px; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-bottom: 14px; }
.idx-btn {
    border: 1px solid var(--line); background: linear-gradient(160deg, #1e293b, #334155);
    color: #cbd5e1; border-radius: 8px; height: 84px; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 750; position: relative;
}
.idx-btn:hover { border-color: var(--blue); }
.idx-btn.sel { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); color: #fff; }
.idx-btn::after {
    content: ""; position: absolute; inset: 7px; border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 5px; pointer-events: none;
}
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.warn-line { color: var(--amber); font-size: 12.5px; margin-bottom: 10px; }
.waiting { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }

/* 身份与引线牌 */
.identity { position: sticky; top: 14px; }
.camp-wrap { margin-bottom: 12px; }
.camp {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 800;
}
.camp.good { background: var(--blue-soft); color: #1e40af; border: 1px solid #bfdbfe; }
.camp.bad { background: var(--red-soft); color: #991b1b; border: 1px solid #fecaca; }
.camp.none { background: #f1f5f9; color: var(--muted); border: 1px solid var(--line); }
.hand { display: flex; flex-wrap: wrap; gap: 7px; }
.hc {
    width: 58px; height: 80px; border-radius: 8px; border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: 11.5px; font-weight: 850; padding: 4px; line-height: 1.25;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .07); background: #fff;
}
.hc.real { background: var(--blue-soft); border-color: #bfdbfe; color: #1e40af; }
.hc.fake { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.hc.ben { background: var(--red-soft); border-color: #fca5a5; color: #991b1b; }
.hand-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* 战报 */
.log-panel { max-height: 300px; overflow: auto; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { font-size: 12.5px; color: #334155; padding: 7px 0; border-bottom: 1px dashed var(--line); line-height: 1.5; }
.log li:last-child { border-bottom: 0; }
.log li.real { color: #1e40af; }
.log li.ben { color: #991b1b; }
.log li.fake { color: #475569; }
.log .log-empty { color: var(--muted); }

/* 浮层 */
.overlay {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, .48); backdrop-filter: blur(4px); padding: 18px;
}
.overlay-card {
    width: min(660px, 100%); max-height: 88vh; overflow: auto; background: #fff;
    border-radius: 18px; padding: 26px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.overlay-card h2 { margin: 0 0 8px; font-size: 24px; }
.overlay-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.overlay-card .big { font-size: 30px; font-weight: 850; margin-bottom: 6px; }
.overlay-card .big.good { color: var(--blue); }
.overlay-card .big.bad { color: var(--red); }
.ov-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.camps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.camp-item {
    display: flex; flex-direction: column; gap: 2px; border-radius: 9px; padding: 8px 9px;
    font-size: 12.5px; text-align: center; background: #f1f5f9;
}
.camp-item-name { font-size: 12px; line-height: 1.35; }
.camp-item-camp { font-size: 11px; font-weight: 800; line-height: 1.3; }
.prep-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1e40af; font-size: 12.5px; }
.prep-notice .btn { flex: 0 0 auto; }
.camp-item.good { background: var(--blue-soft); color: #1e40af; }
.camp-item.bad { background: var(--red-soft); color: #991b1b; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 750; color: var(--blue); }

/* 弹层提示 */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
    background: #0f172a; color: #f8fafc; border-radius: 11px; padding: 11px 15px;
    font-size: 13px; box-shadow: 0 12px 30px rgba(15, 23, 42, .3);
    animation: toastIn .18s ease-out; line-height: 1.5;
}
.toast.error { background: #991b1b; }
.toast.good { background: #065f46; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 剪线揭示：贴顶紧凑条，不遮挡统计 */
.flash-wrap { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 70; width: min(92vw, 420px); pointer-events: none; }
.flash {
    background: #fff; border-radius: 11px; padding: 8px 12px; box-shadow: 0 12px 28px rgba(15, 23, 42, .2);
    border: 1px solid var(--line); animation: flashIn .16s ease-out; text-align: center;
}
.flash.real { border-color: #60a5fa; background: #f8fbff; }
.flash.fake { border-color: #cbd5e1; background: #f8fafc; }
.flash.ben { border-color: #ef4444; background: #fff7f7; }
.flash-main { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.flash-card { font-size: 16px; font-weight: 850; letter-spacing: .5px; }
.flash.real .flash-card { color: #1d4ed8; }
.flash.fake .flash-card { color: #475569; }
.flash.ben .flash-card { color: #b91c1c; }
.flash-detail { font-size: 12px; color: var(--muted); }
.flash-stat { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.connecting {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px; width: min(92vw, 560px);
    background: #0f172a; color: #fff; padding: 8px 10px 8px 14px; border-radius: 12px;
    font-size: 12.5px; z-index: 90; box-shadow: var(--shadow);
}
#connecting-text { flex: 1 1 auto; min-width: 0; line-height: 1.4; }
.connecting-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.connecting-btn {
    border: 0; border-radius: 7px; height: 30px; padding: 0 10px;
    background: #fff; color: #0f172a; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit; white-space: nowrap;
}
.connecting-btn:hover { background: #e2e8f0; }
.connecting-btn.ghost { background: rgba(255, 255, 255, .12); color: #e2e8f0; }
.connecting-btn.ghost:hover { background: rgba(255, 255, 255, .2); }
.game-footer { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.game-footer .btn { flex: 0 0 auto; }

/* 房间文字聊天 */
.chat-toggle {
    position: fixed; right: 18px; bottom: 18px; z-index: 89;
    display: inline-flex; align-items: center; gap: 7px;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 10px 15px; font-size: 13px; font-weight: 650; color: var(--ink);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14); cursor: pointer; font-family: inherit;
}
.chat-toggle:hover { border-color: #cbd5e1; }
.chat-toggle.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.chat-toggle svg { flex: 0 0 auto; }
.chat-unread {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}
.chat-panel {
    position: fixed; right: 18px; bottom: 70px; z-index: 88;
    width: min(350px, calc(100vw - 36px)); height: min(460px, 68vh);
    background: #fff; border: 1px solid var(--line); border-radius: 15px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.chat-head strong { font-size: 13.5px; }
.chat-close {
    border: 0; background: transparent; font-size: 20px; line-height: 1;
    color: var(--muted); cursor: pointer; padding: 2px 6px; font-family: inherit;
}
.chat-list { flex: 1; overflow-y: auto; padding: 12px 14px; background: #fbfdff; }
.chat-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 24px 0; }
.chat-msg { margin-bottom: 10px; }
.chat-msg.mine { text-align: right; }
.chat-meta { display: flex; gap: 6px; align-items: baseline; font-size: 10.5px; color: #94a3b8; margin-bottom: 3px; }
.chat-msg.mine .chat-meta { justify-content: flex-end; }
.chat-name { color: #475569; font-weight: 700; }
.chat-text {
    display: inline-block; background: #fff; border: 1px solid var(--line);
    border-radius: 9px; padding: 6px 9px; font-size: 13px; line-height: 1.5;
    color: #1e293b; word-break: break-word; text-align: left; max-width: 100%;
}
.chat-msg.mine .chat-text { background: var(--blue-soft); border-color: #bfdbfe; color: #1e3a8a; }
.chat-form { display: flex; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.chat-form input { flex: 1 1 auto; width: auto; min-width: 0; height: 38px; font-size: 13px; border-radius: 9px; padding: 0 10px; }
.chat-form .btn { flex: 0 0 auto; padding: 8px 13px; }
.chat-hint { font-size: 10.5px; color: #94a3b8; padding: 0 14px 10px; }
.chat-open .chat-toggle { display: none !important; }

@media (max-width: 900px) {
    .home-grid { grid-template-columns: 1fr; }
    .game-grid { grid-template-columns: 1fr; }
    .identity { position: static; }
    .players { grid-template-columns: repeat(4, 1fr); }
    .side-col { display: grid; grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .app { padding: 12px 12px 40px; }
    .panel { padding: 16px; border-radius: 14px; }
    .hero { padding: 4px 0 18px; }
    .seats { grid-template-columns: repeat(2, 1fr); }
    .players { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 12px 4px; padding: 14px; }
    .stat:nth-child(2) { border-right: 0; }
    .stat b { font-size: 18px; }
    #room-code { font-size: 24px; letter-spacing: 4px; }
    .lobby-head { flex-direction: column; align-items: flex-start; }
    .lobby-actions .btn { flex: 1 1 100%; }
    #start-btn { margin-left: 0; }
    .hc { width: 54px; height: 74px; }
    .overlay-card { padding: 20px; }
    .camps { grid-template-columns: repeat(2, 1fr); }
    .flash-wrap { top: 8px; }
    .chat-toggle { right: 12px; bottom: 12px; padding: 9px 13px; }
    .chat-panel {
        right: 0; left: 0; bottom: 0; width: 100%;
        height: min(70vh, 520px); border-radius: 16px 16px 0 0; border-bottom: 0;
    }
    .chat-form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .connecting { bottom: calc(78px + env(safe-area-inset-bottom)); padding: 7px 8px 7px 12px; gap: 8px; }
    .connecting-btn { height: 28px; padding: 0 8px; font-size: 11.5px; }
    .lobby-tools input { max-width: none; flex: 1 1 auto; }

    .review-player { flex-wrap: wrap; }
    .rp-meta { flex: 1 1 100%; width: auto; margin-left: 0; padding-left: 24px; }
}
