/* KWCOMM 連線桌遊共用樣式（各頁用 --bg1 / --bg2 / --accent 換顏色） */
:root {
    --bg1: #1e3a8a; --bg2: #172554; --line: rgba(255, 255, 255, .12); --panel: rgba(0, 0, 0, .28);
    --text: #f8fafc; --muted: #cbd5e1; --accent: #facc15; --accent-ink: #422006; --danger: #f87171; --good: #4ade80;
    --font-zh: 'Noto Sans TC', sans-serif; --font-en: 'Outfit', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background: var(--bg2); }
body {
    font-family: var(--font-zh); color: var(--text); -webkit-tap-highlight-color: transparent;
    background: radial-gradient(ellipse at center, var(--bg1) 0%, var(--bg2) 75%) fixed; min-height: 100vh;
}
[hidden] { display: none !important; }
button { font-family: var(--font-zh); }
.screen { max-width: 520px; margin: 0 auto; padding: 22px 16px 30px; }
h1 { text-align: center; font-size: 1.8rem; font-weight: 900; }
h1 small { display: block; font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.box { background: var(--panel); border-radius: 22px; padding: 20px; margin-top: 18px; border: 1px solid var(--line); }
.box h2 { font-size: 1.05rem; margin-bottom: 10px; }
label.f { display: block; font-size: 0.85rem; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
input[type="text"] { width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); color: #fff; font-size: 16px; font-family: var(--font-zh); }
input[type="text"]:focus { outline: none; border-color: var(--accent); }
input.code { font-family: var(--font-en); font-size: 1.6rem; font-weight: 800; letter-spacing: 8px; text-align: center; text-transform: uppercase; }
.btn { display: block; width: 100%; padding: 14px; margin-top: 12px; border-radius: 16px; border: none; cursor: pointer; font-weight: 900; font-size: 1.05rem; background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; font-size: 0.95rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 .btn { margin-top: 8px; }
.or { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 6px 0; }
.note { font-size: 0.8rem; color: var(--muted); line-height: 1.7; margin-top: 12px; text-align: center; }
.note a { color: var(--accent); }
.rules { font-size: 0.85rem; line-height: 1.8; color: var(--muted); }
.rules p + p { margin-top: 8px; }
.rules b { color: #fff; }
.rules h2 { color: #fff; }

/* 等待室 */
.roomcode { text-align: center; }
.roomcode small { color: var(--muted); font-weight: 700; }
.roomcode b { display: block; font-family: var(--font-en); font-size: 3.2rem; letter-spacing: 10px; color: var(--accent); line-height: 1.2; }
.seatlist { list-style: none; margin-top: 12px; }
.seatlist li { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-radius: 14px; background: rgba(0,0,0,.2); margin-bottom: 8px; font-weight: 700; }
.seatlist li.empty { color: var(--muted); font-weight: 500; border: 1px dashed rgba(255,255,255,.2); background: none; }
.seatlist .tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.15); margin-left: 6px; }
.seatlist .kick { background: none; border: none; color: var(--danger); font-size: 0.8rem; cursor: pointer; font-weight: 700; }
.optrow { margin-top: 10px; }
.optrow > span { display: block; font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 90px; padding: 10px 8px; border-radius: 12px; border: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.2); color: #fff; font-weight: 700; cursor: pointer; font-size: 0.9rem; }
.seg button.on { border-color: var(--accent); background: rgba(255,255,255,.12); color: var(--accent); }
.seg button:disabled { cursor: default; }
.seg button:disabled:not(.on) { opacity: .45; }

/* 遊戲畫面共用 */
.game { position: fixed; inset: 0; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font-size: 0.8rem; color: var(--muted); flex: none; }
.topbar b { color: var(--accent); font-family: var(--font-en); letter-spacing: 2px; }
.topbar button { background: rgba(255,255,255,.12); border: none; color: #fff; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; cursor: pointer; }
.glog { font-size: 0.74rem; color: var(--muted); text-align: center; padding: 2px 12px; min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 0.72rem; font-weight: 700; }
.who { display: flex; gap: 6px; overflow-x: auto; padding: 0 10px 6px; flex: none; scrollbar-width: none; }
.who::-webkit-scrollbar { display: none; }
.who .p { flex: 1 0 auto; min-width: 72px; border-radius: 12px; background: var(--panel); padding: 6px 8px; text-align: center; border: 2px solid transparent; font-size: 0.78rem; }
.who .p.turn { border-color: var(--accent); box-shadow: 0 0 12px rgba(250, 204, 21, .45); }
.who .p.offline .nm::after { content: ' 💤'; }
.who .p .nm { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; margin: 0 auto; }
.who .p .sub { color: var(--muted); font-size: 0.7rem; }
.who .p.me { background: rgba(255,255,255,.14); }
.actions { display: flex; gap: 6px; padding: 6px 10px 10px; flex: none; flex-wrap: wrap; }
.actions button { flex: 1; min-width: 70px; padding: 13px 6px; border-radius: 14px; border: none; font-weight: 900; font-size: 0.95rem; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; }
.actions button.main { background: var(--accent); color: var(--accent-ink); }
.actions button.warn { background: #b91c1c; color: #fff; }
.actions button:disabled { opacity: .35; cursor: not-allowed; }
.board { justify-content: safe center !important; }
.status { text-align: center; font-weight: 900; font-size: 0.95rem; padding: 4px 10px; min-height: 1.6em; flex: none; }
.status.mine { color: var(--accent); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .box { margin: 0; width: 100%; max-width: 420px; background: var(--bg2); max-height: 90vh; overflow: auto; }
.modal h2 { text-align: center; font-size: 1.35rem; }
.res { list-style: none; margin: 12px 0; }
.res li { padding: 9px 10px; border-radius: 12px; background: rgba(0,0,0,.2); margin-bottom: 6px; display: flex; justify-content: space-between; font-weight: 700; }
.res .plus { color: var(--accent); } .res .minus { color: var(--danger); }
.detail { font-size: 0.85rem; color: var(--muted); line-height: 1.7; }
.toast { position: fixed; left: 50%; top: 18%; transform: translate(-50%, -10px); background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; max-width: 90vw; text-align: center; }
.toast.show { opacity: .95; transform: translate(-50%, 0); }
