/* 網頁即時場次（live.js）：手機優先、深色；class 一律 lv- 開頭，避免與控制台樣式衝突 */

.lv-page { padding-bottom: 80px; }
.lv-page .card.empty h2 { margin: 12px 0 6px; color: var(--text); }
.lv-list-head h1 { display: flex; align-items: center; gap: 10px; }

.lv-guild { margin-bottom: 28px; }
.lv-guild-name { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 12px; }
.lv-guild-name .guild-icon.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.lv-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lv-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.lv-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.lv-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lv-card-top strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-card-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- 場次頁 ---------- */

.lv-session {
  --lv-glow: rgba(240, 178, 50, .18);
  max-width: 1180px; margin: 0 auto; padding: 16px 12px 80px;
  transition: background-color .6s;
}
.lv-session.lv-night { --lv-glow: rgba(88, 101, 242, .22); }
.lv-conn {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 12px; margin-bottom: 8px; border-radius: 10px; background: rgba(218, 55, 60, .18); color: #ff9a9d; font-size: 13px;
}

.lv-head { margin-bottom: 12px; }
.lv-head-row { display: flex; align-items: flex-start; gap: 10px; }
.lv-back { display: inline-flex; padding: 6px; margin-top: 2px; border-radius: 8px; color: var(--muted); }
.lv-back:hover { color: var(--text); background: var(--panel-2); }
.lv-title { flex: 1; min-width: 0; }
.lv-title h1 { font-size: 20px; overflow-wrap: anywhere; }
.lv-sub { font-size: 13px; margin-top: 2px; }
.lv-head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lv-head-actions .btn { white-space: nowrap; }
.lv-phase-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.lv-phase, .lv-countdown, .lv-viewer {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px; font-weight: 600;
}
.lv-night .lv-phase { border-color: rgba(88, 101, 242, .55); color: #c3c8ff; }
.lv-countdown b { font-variant-numeric: tabular-nums; font-size: 14px; }
.lv-countdown.urgent, .lv-center-timer.urgent { color: #ff8a8d; border-color: rgba(218, 55, 60, .6); }
.lv-viewer { font-weight: 500; color: var(--muted); }
.lv-viewer-player { color: #57d98c; border-color: rgba(35, 165, 90, .5); }
.lv-viewer-host, .lv-viewer-storyteller { color: var(--yellow); border-color: rgba(240, 178, 50, .5); }
.lv-viewer-test { color: #ffcf7a; border-style: dashed; }

.lv-layout { display: grid; gap: 14px; }
.lv-col-main, .lv-col-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 960px) {
  .lv-session { padding: 24px 24px 80px; }
  .lv-layout { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); align-items: start; }
  .lv-col-side { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 2px; }
  .lv-title h1 { font-size: 24px; }
}

.lv-card-block { padding: 16px; }
.lv-card-block h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 12px; }
.lv-note { margin: 0; }
.lv-small { font-size: 13px; }
.lv-pre { white-space: pre-line; overflow-wrap: anywhere; }
.lv-hint { display: flex; gap: 6px; align-items: flex-start; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.lv-hint .ico { flex-shrink: 0; margin-top: 2px; }

/* ---------- 圓桌 ---------- */

.lv-table-wrap {
  padding: 8px; border-radius: var(--radius); border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 50%, var(--lv-glow), transparent 62%), var(--bg-2);
}
.lv-table { width: 100%; max-width: 560px; margin: 0 auto; }
.lv-table-empty { padding: 40px 0; text-align: center; }
.lv-ring { position: relative; width: 100%; aspect-ratio: 1 / 1; }
.lv-ring::before {
  content: ""; position: absolute; inset: 21%; border-radius: 50%;
  background: radial-gradient(circle, #2f2416 0%, #22190f 70%); border: 2px solid #4a3920;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 0 6px rgba(74, 57, 32, .25);
}
.lv-night .lv-ring::before { background: radial-gradient(circle, #1c2142 0%, #12152b 70%); border-color: #2f3770; box-shadow: inset 0 0 40px rgba(0, 0, 0, .6), 0 0 0 6px rgba(47, 55, 112, .3); }
.lv-center {
  position: absolute; inset: 27%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; z-index: 1; padding: 4px;
}
.lv-center-phase { font-size: clamp(13px, 3.6vw, 17px); font-weight: 700; overflow-wrap: anywhere; }
.lv-center-timer b { font-size: clamp(22px, 7vw, 34px); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.lv-center-meta { font-size: 12px; }

.lv-seat {
  --lv-av: 48px;
  position: absolute; z-index: 2; width: calc(var(--lv-av) + 28px); transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
}
.lv-ring-sm .lv-seat { --lv-av: 40px; }
.lv-ring-xs .lv-seat { --lv-av: 32px; }
@media (max-width: 420px) {
  .lv-seat { --lv-av: 40px; }
  .lv-ring-sm .lv-seat { --lv-av: 32px; }
  .lv-ring-xs .lv-seat { --lv-av: 26px; }
}
.lv-avatar {
  position: relative; width: var(--lv-av); height: var(--lv-av); border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--border); display: grid; place-items: center;
  font-weight: 700; color: var(--muted); transition: border-color .2s, box-shadow .2s, filter .3s;
}
.lv-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.lv-seat-no {
  position: absolute; left: -6px; top: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); font-size: 11px; line-height: 18px; color: var(--text);
}
.lv-seat-dead { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #ff9a9d; }
.lv-seat-voted { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; }
.lv-seat-name { max-width: 100%; font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-ring-xs .lv-seat-name { font-size: 10px; }
.lv-seat-marks { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
.lv-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); color: var(--yellow); }
.lv-mark-team { color: #7ab8ff; }
.lv-mark-assassin, .lv-mark-hunter, .lv-mark-block { color: #ff8a8d; }
.lv-mark-ghost_vote { color: #c3c8ff; }
.lv-mark-no_vote { color: var(--muted); opacity: .6; }
.lv-mark-candidate { color: #7ab8ff; }
.lv-mark-exploded { color: #ff8a8d; }
.lv-mark-idiot { color: var(--muted); }
.lv-seat-tag { font-size: 10px; padding: 0 6px; border-radius: 999px; background: rgba(240, 178, 50, .15); color: var(--yellow); line-height: 18px; }

.lv-seat.dead .lv-avatar { filter: grayscale(1) brightness(.7); }
.lv-seat.dead .lv-seat-name { color: var(--muted); text-decoration: line-through; }
.lv-seat.me .lv-avatar { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 165, 90, .35); }
.lv-seat.on-team .lv-avatar { border-color: #7ab8ff; }
.lv-seat.speaking .lv-avatar { border-color: rgba(240, 178, 50, .8); }
.lv-seat.waiting .lv-avatar { animation: lv-pulse 1.6s ease-in-out infinite; }
@keyframes lv-pulse { 50% { box-shadow: 0 0 0 4px rgba(88, 101, 242, .35); } }
@media (prefers-reduced-motion: reduce) { .lv-seat.waiting .lv-avatar { animation: none; } }

/* ---------- 投票 ---------- */

.lv-vote { border-color: rgba(88, 101, 242, .5); }
.lv-vote p { margin: 0 0 10px; }
.lv-progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 6px 0 4px; }
.lv-progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.lv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; }
.lv-chip.done { border-color: rgba(35, 165, 90, .6); color: #8be3b0; }
.lv-vote-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.lv-vote-options .btn { flex: 1 1 120px; justify-content: center; }

/* ---------- 我的身分 ---------- */

.lv-me-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.lv-me-head h2 { margin: 0; }
.lv-hold {
  position: relative; min-height: 120px; border-radius: 10px; overflow: hidden; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  background: var(--bg-2); border: 1px dashed var(--border); outline: none;
}
.lv-hold:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.lv-hold-cover {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; padding: 12px; background: repeating-linear-gradient(45deg, #1d1e22 0 12px, #202126 12px 24px);
  transition: opacity .12s;
}
.lv-hold-body { padding: 14px; visibility: hidden; }
.lv-hold.revealed { border-style: solid; }
.lv-hold.revealed .lv-hold-cover { opacity: 0; pointer-events: none; }
.lv-hold.revealed .lv-hold-body { visibility: visible; }
.lv-role { font-size: 24px; font-weight: 800; }
.lv-role-side { margin-top: 2px; font-size: 14px; font-weight: 600; }
.lv-side-good .lv-role-side { color: #7ab8ff; }
.lv-side-evil .lv-role-side { color: #ff8a8d; }
.lv-side-good.lv-me { border-color: rgba(122, 184, 255, .35); }
.lv-side-evil.lv-me { border-color: rgba(255, 138, 141, .35); }
.lv-role-desc { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.lv-me-group { margin-top: 12px; }
.lv-me-label { margin: 12px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.lv-me-group .lv-me-label { margin-top: 0; }
.lv-me-hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 12px; padding: 10px; border-radius: 8px; background: rgba(88, 101, 242, .1); font-size: 13px; }
.lv-me-hint .ico { flex-shrink: 0; margin-top: 2px; }

/* ---------- 遊戲面板 ---------- */

.lv-facts { display: grid; gap: 6px; font-size: 14px; }
.lv-facts > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lv-facts .muted { min-width: 64px; font-size: 13px; }

.lv-quests { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.lv-quest {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px;
  background: var(--bg-2); border: 2px solid var(--border); text-align: center; min-width: 0;
}
.lv-quest-size { font-size: 22px; font-weight: 800; line-height: 1; }
.lv-quest-label { font-size: 11px; color: var(--muted); }
.lv-quest-fails, .lv-quest-two { font-size: 10px; color: var(--muted); }
.lv-quest-two { color: var(--yellow); }
.lv-quest-success { border-color: rgba(122, 184, 255, .8); background: rgba(122, 184, 255, .12); }
.lv-quest-success .lv-quest-label { color: #a9d0ff; }
.lv-quest-fail { border-color: rgba(255, 138, 141, .8); background: rgba(218, 55, 60, .14); }
.lv-quest-fail .lv-quest-label { color: #ffb0b2; }
.lv-quest-current { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(240, 178, 50, .2); }
.lv-rejects { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.lv-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); }
.lv-dot.on { background: var(--red); border-color: var(--red); }

.lv-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.lv-details summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.lv-details summary::-webkit-details-marker { display: none; }
.lv-details summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.lv-details[open] summary::after { transform: rotate(-135deg); }
.lv-card-block > .lv-details:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

.lv-proposals, .lv-timeline, .lv-secrets, .lv-chat-list, .lv-roles { list-style: none; margin: 10px 0 0; padding: 0; }
.lv-proposal { padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border-left: 3px solid var(--border); margin-bottom: 8px; }
.lv-proposal.ok { border-left-color: var(--green); }
.lv-proposal.no { border-left-color: var(--red); }
.lv-proposal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.lv-yes { color: #8be3b0; }
.lv-no { color: #ffb0b2; }

.lv-order { margin: 4px 0 0; padding-left: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 2px 12px; font-size: 14px; }
.lv-tally { display: grid; gap: 6px; margin-top: 10px; }
.lv-tally-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.lv-tally-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-tally-bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.lv-tally-bar span { display: block; height: 100%; background: #9aa3ff; }
.lv-tally-row.out .lv-tally-bar span { background: var(--red); }
.lv-tally-row.out .lv-tally-name { color: #ffb0b2; font-weight: 700; }
.lv-tally-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.lv-ballots { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--muted); }

/* ---------- 全知／揭曉 ---------- */

.lv-omni { border-color: rgba(240, 178, 50, .45); }
.lv-omni summary { color: var(--yellow); }
.lv-reveal { border-color: rgba(35, 165, 90, .5); }
.lv-roles { display: grid; gap: 4px; }
.lv-role-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); font-size: 14px; }
.lv-role-row b { text-align: right; }
.lv-role-row.lv-side-good b { color: #a9d0ff; }
.lv-role-row.lv-side-evil b { color: #ffb0b2; }
.lv-secrets li { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ---------- 時間軸 ---------- */

.lv-timeline { position: relative; }
.lv-tl { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(53, 55, 60, .6); font-size: 14px; }
.lv-tl:last-child { border-bottom: 0; }
.lv-tl-icon { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); }
.lv-tl-body { min-width: 0; flex: 1; }
.lv-tl-time { font-size: 12px; color: var(--muted); }
.lv-tl-night .lv-tl-icon { color: #a5acff; }
.lv-tl-day .lv-tl-icon, .lv-tl-leader .lv-tl-icon, .lv-tl-end .lv-tl-icon { color: var(--yellow); }
.lv-tl-death .lv-tl-icon, .lv-tl-exile .lv-tl-icon, .lv-tl-fail .lv-tl-icon, .lv-tl-assassin .lv-tl-icon, .lv-tl-shot .lv-tl-icon { color: #ff8a8d; }
.lv-tl-success .lv-tl-icon, .lv-tl-peace .lv-tl-icon { color: #57d98c; }
.lv-tl-vote .lv-tl-icon, .lv-tl-team .lv-tl-icon, .lv-tl-quest .lv-tl-icon { color: #7ab8ff; }
.lv-more { margin-top: 8px; width: 100%; justify-content: center; }

/* ---------- 聊天 ---------- */

.lv-chat .lv-me-head { margin-bottom: 8px; }
.lv-chat-list { max-height: 360px; overflow-y: auto; }
.lv-msg { display: flex; gap: 10px; padding: 6px 0; }
.lv-msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.lv-msg-body { min-width: 0; font-size: 14px; }
.lv-msg-head { display: flex; gap: 8px; align-items: baseline; }
.lv-msg-head .muted { font-size: 11px; }

/* ---------- 分享 ---------- */

.lv-share summary .badge { margin-left: 4px; }
.lv-share p { margin: 10px 0; }
.lv-share-row { display: flex; gap: 8px; margin-bottom: 10px; }
.lv-share-row input { flex: 1; min-width: 0; font-size: 13px; }
