/* 猜词擂台 · 画面源样式
   基准画布 1080×1920（9:16），四周安全边距 60px。
   布局与文字全部使用 DOM + CSS；Canvas 仅作为水墨动效层。 */

:root {
  --ink: #1A2435;
  --ink-2: #2A3A52;
  --slate: #4A5B7B;
  --paper: #F5F0E8;
  --cinnabar: #C23B22;
  --gold: #C9A227;
  --canvas-w: 1080px;
  --canvas-h: 1920px;
  --safe: 60px;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", "STSong", serif;
  --font-kai: "Kaiti SC", "KaiTi", "STKaiti", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #0E1520;
  overflow: hidden;
  font-family: var(--font-serif);
  color: var(--paper);
}

/* overlay 模式：整个页面背景完全透明，便于叠加在直播画面上 */
body[data-layout="overlay"] { background: transparent; }
body[data-layout="overlay"] .stage { background: transparent; }
body[data-layout="overlay"] .panel--feed,
body[data-layout="overlay"] .panel--rank { opacity: .92; }

.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--canvas-w);
  height: var(--canvas-h);
  transform-origin: top left;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(74, 91, 123, .28) 0%, rgba(26, 36, 53, 0) 60%),
    linear-gradient(180deg, #1A2435 0%, #16202E 55%, #131C29 100%);
  padding: var(--safe);
  display: flex;
  flex-direction: column;
  gap: 40px;
  overflow: hidden;
}

/* 木纹/宣纸质感叠加层 */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .06;
  background-image:
    repeating-linear-gradient(92deg, rgba(245,240,232,.9) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(2deg, rgba(245,240,232,.7) 0 1px, transparent 1px 11px);
}

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ---------- 通用面板 ---------- */
.panel {
  position: relative;
  z-index: 2;
  border-radius: 6px;
}

.panel--round {
  flex: 0 0 auto;
  padding: 34px 40px 30px;
  background: rgba(26, 36, 53, .72);
  border: 1px solid var(--slate);
}

.round-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.round-no {
  font-size: 26px;
  letter-spacing: 4px;
  color: #9FB0C9;
}

.seal {
  display: inline-block;
  padding: 6px 16px;
  font-size: 24px;
  letter-spacing: 3px;
  color: var(--paper);
  background: var(--cinnabar);
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(194, 59, 34, .35);
}
.seal[data-difficulty="medium"] { background: #A9702B; }
.seal[data-difficulty="hard"] { background: #7A2E4A; }

.hint {
  font-size: 48px;
  line-height: 1.42;
  letter-spacing: 2px;
  min-height: 68px;
  color: var(--paper);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}

.timer {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
}

.timer-bar {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: rgba(74, 91, 123, .45);
  overflow: hidden;
}
.timer-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--slate), var(--cinnabar));
  transition: width .95s linear;
  transform-origin: left;
}
.timer-bar i[data-urgent="1"] { background: linear-gradient(90deg, #A9702B, var(--cinnabar)); }

.timer-num {
  width: 76px;
  text-align: right;
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  color: var(--cinnabar);
}

/* ---------- 弹幕流 ---------- */
.panel--feed {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 26px;
  background: rgba(245, 240, 232, .07);
  border: 1px solid rgba(74, 91, 123, .7);
  overflow: hidden;
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: 30px;
  line-height: 1.35;
  padding: 10px 16px;
  border-radius: 4px;
  background: rgba(26, 36, 53, .5);
  animation: feedIn .32s ease-out;
}

.feed .nick { flex: 0 0 auto; max-width: 240px; color: #9FB0C9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .text { flex: 1 1 auto; color: var(--paper); word-break: break-all; }

.feed li[data-hit="1"] {
  background: rgba(201, 162, 39, .16);
  border-left: 6px solid var(--gold);
  animation: hitPop .5s ease-out;
}
.feed li[data-hit="1"] .text { color: var(--gold); font-weight: 700; }
.feed li[data-hit="1"] .nick { color: #E3C97A; }

@keyframes feedIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes hitPop { 0% { transform: scale(1); } 45% { transform: scale(1.035); } 100% { transform: scale(1); } }

/* ---------- 排行榜 ---------- */
.panel--rank {
  flex: 0 0 auto;
  padding: 24px 30px 20px;
  background: linear-gradient(180deg, rgba(74, 91, 123, .3), rgba(26, 36, 53, .8));
  border: 1px solid var(--slate);
}

.rank-title {
  font-size: 26px;
  letter-spacing: 8px;
  color: #9FB0C9;
  text-align: center;
  margin-bottom: 16px;
}

.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.rank li {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 30px;
  padding: 8px 14px;
  border-radius: 4px;
}
.rank li:nth-child(1) { background: rgba(201, 162, 39, .16); }
.rank li:nth-child(2) { background: rgba(200, 205, 215, .1); }
.rank li:nth-child(3) { background: rgba(169, 112, 43, .12); }

.rank .no {
  flex: 0 0 46px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  font-size: 24px;
  border-radius: 3px;
  background: rgba(74, 91, 123, .5);
}
.rank li:nth-child(1) .no { background: var(--gold); color: #22303F; }
.rank li:nth-child(2) .no { background: #C8CDD7; color: #22303F; }
.rank li:nth-child(3) .no { background: #A9702B; }

.rank .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .score { flex: 0 0 auto; color: var(--gold); font-variant-numeric: tabular-nums; }

.rank-foot { margin-top: 14px; font-size: 22px; color: #7E90AC; text-align: right; }

/* ---------- 预热 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: linear-gradient(180deg, #16202E 0%, #1A2435 60%, #131C29 100%);
  padding: var(--safe);
}
.overlay[hidden] { display: none; }

.mountains { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42%; }

.preheat-title {
  position: relative;
  display: flex;
  gap: 26px;
  font-size: 104px;
  letter-spacing: 6px;
  color: var(--paper);
  text-shadow: 0 4px 24px rgba(0, 0, 0, .5);
}
.preheat-sub { position: relative; font-size: 40px; letter-spacing: 14px; color: #9FB0C9; margin-bottom: 10px; }

.preheat-ring { position: relative; width: 240px; height: 240px; }
.preheat-ring svg { width: 100%; height: 100%; }
.preheat-ring .ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 76px;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
}

.rules {
  position: relative;
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  font-size: 26px;
  color: #9FB0C9;
  text-align: center;
  line-height: 1.9;
}
.rules li::before { content: "· "; color: var(--cinnabar); }

/* ---------- 结算 ---------- */
.overlay--result { background: rgba(14, 21, 32, .88); }

.result-card {
  width: 100%;
  max-width: 860px;
  padding: 54px 56px;
  background: rgba(26, 36, 53, .94);
  border: 1px solid var(--slate);
  border-radius: 8px;
  text-align: center;
}

.result-label { font-size: 26px; letter-spacing: 10px; color: #9FB0C9; }
.result-answer {
  font-size: 96px;
  margin: 26px 0 34px;
  color: var(--gold);
  letter-spacing: 6px;
  font-family: var(--font-kai);
  text-shadow: 0 4px 26px rgba(201, 162, 39, .28);
}

.result-winners { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.result-winners li {
  display: flex;
  justify-content: space-between;
  font-size: 30px;
  padding: 8px 18px;
  border-radius: 4px;
  background: rgba(74, 91, 123, .22);
}
.result-winners .w-name { color: var(--paper); }
.result-winners .w-score { color: var(--gold); font-variant-numeric: tabular-nums; }
.result-winners .empty { justify-content: center; color: #7E90AC; font-size: 26px; }

.result-next { font-size: 26px; color: #7E90AC; }

/* ---------- 提示条 / 离线条 ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 16px 34px;
  font-size: 34px;
  border-radius: 6px;
  background: rgba(194, 59, 34, .9);
  color: var(--paper);
  animation: toastIn .3s ease-out;
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.offline {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 26px;
  font-size: 24px;
  border-radius: 4px;
  background: rgba(169, 112, 43, .92);
  color: #1A2435;
}
.offline[hidden] { display: none; }
