* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a1220;
  --surface: #101a2c;
  --surface-2: #142036;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f3f6fb;
  --text-2: #c5cedc;
  --muted: #7d8aa1;
  --accent: #3e7bfa;
  --live: #34c77b;
  --gold: #e3bd78;
  --c-leader: #3e7bfa;
  --c-question: #2bc4d9;
  --c-public: #9d8cff;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 85% -15%, rgba(62, 123, 250, .13), transparent 70%),
    radial-gradient(50% 50% at -10% 110%, rgba(62, 123, 250, .07), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.num {
  font-family: "Bahnschrift", "DIN Alternate", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.hidden { display: none !important; }

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform: translate(-50%, -50%);
}

/* 右上角点阵纹理 */
#stage::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 760px;
  height: 420px;
  background-image: radial-gradient(rgba(255, 255, 255, .10) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
  pointer-events: none;
}

/* ---------------- 顶栏 ---------------- */
.hd {
  position: absolute;
  left: 96px;
  right: 96px;
  top: 0;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.hd::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 120px;
  height: 2px;
  background: var(--accent);
}
.brand { display: flex; align-items: center; gap: 22px; }
.logo { width: 52px; height: 52px; color: var(--accent); }
.brand h1 { font-size: 34px; font-weight: 600; letter-spacing: 2px; }
.brand p { margin-top: 6px; font-size: 14px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; }
.hd-meta { position: relative; display: flex; align-items: center; gap: 20px; font-size: 20px; color: var(--muted); }
.hd-meta .sep { width: 1px; height: 18px; background: var(--line-strong); }
#clock-time { font-size: 24px; color: var(--text-2); }
.conn { display: flex; align-items: center; gap: 10px; }
.conn em { font-style: normal; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok i { background: var(--live); box-shadow: 0 0 0 4px rgba(52, 199, 123, .15); }
.conn.err i { background: #e5484d; }
.conn.err em { color: #f2a3a5; }

/* ---------------- 页脚 ---------------- */
.ft {
  position: absolute;
  left: 96px;
  right: 96px;
  bottom: 0;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.ft b { margin: 0 4px; color: var(--text-2); font-weight: 500; }
.ft .dot { display: inline-block; width: 8px; height: 8px; margin: 0 8px 0 24px; border-radius: 2px; vertical-align: 1px; }

/* ---------------- 视图 ---------------- */
.view {
  position: absolute;
  left: 96px;
  right: 96px;
  top: 150px;
  bottom: 80px;
  animation: view-in .4s ease;
}
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- 主界面 ---------------- */
#view-home { display: grid; grid-template-columns: 1fr 440px; gap: 56px; }
#view-home.hidden { display: none; }
.home-main { min-width: 0; }
.home-bar { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 44px; }
.tabs { display: flex; gap: 48px; }
.tabs button {
  position: relative;
  padding-bottom: 14px;
  font-family: inherit;
  font-size: 28px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color .2s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.on { color: var(--text); }
.tabs button.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.table { margin-top: 24px; max-height: 690px; overflow-y: auto; scrollbar-width: none; }
.table::-webkit-scrollbar { display: none; }

.tr {
  display: grid;
  align-items: center;
  min-height: 92px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 21px;
}
.tr.th {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 52px;
  font-size: 16px;
  color: var(--muted);
  background: var(--bg);
  border-bottom-color: var(--line-strong);
}
#pane-list .tr { grid-template-columns: 76px 1fr 140px 170px 90px 250px; }
#pane-rank .tr { grid-template-columns: 96px 1fr 140px 140px 140px 230px; }

#pane-list .tr:not(.th) { cursor: pointer; transition: background .2s; }
#pane-list .tr:not(.th):hover { background: rgba(255, 255, 255, .03); }

.td-no { color: var(--muted); font-size: 22px; }
.td-name {
  padding-right: 32px;
  line-height: 1.45;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.td-r { text-align: right; }
.td-score { font-size: 30px; font-weight: 600; }
.td-dim { color: var(--muted); }
.td-acts { display: flex; justify-content: flex-end; gap: 8px; }

.status { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.active { color: var(--live); }
.status.active i { box-shadow: 0 0 0 4px rgba(52, 199, 123, .18); }
.status.closed { color: var(--text-2); }
.status.closed i { background: var(--gold); }

.rank-badge {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.rank-badge.r1 { color: #1a1408; background: var(--gold); border-color: var(--gold); }
.rank-badge.r2 { color: #e2e7ef; border-color: #b8c2d1; border-width: 2px; }
.rank-badge.r3 { color: #e0b48c; border-color: #b8835a; border-width: 2px; }
.score-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.score-bar { width: 160px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--accent); }
#pane-rank .tr.first .td-score { color: var(--gold); }
#pane-rank .tr.first .score-bar i { background: var(--gold); }

.empty-row { padding: 120px 0; text-align: center; font-size: 22px; color: var(--muted); }

.home-side { padding-top: 44px; display: flex; flex-direction: column; gap: 24px; }
.panel {
  position: relative;
  padding: 28px 30px 30px;
  background: linear-gradient(180deg, rgba(20, 32, 54, .9), rgba(16, 26, 44, .7));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.panel-title { font-size: 20px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.panel-title::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); }
.progress-box { margin-top: 22px; display: flex; align-items: center; gap: 30px; }
.donut-lg { width: 180px; height: 180px; flex: none; }
.status-legend { list-style: none; flex: 1; }
.status-legend li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-size: 18px; color: var(--muted); border-bottom: 1px dashed var(--line); }
.status-legend li:last-child { border-bottom: none; }
.status-legend li span { display: flex; align-items: center; gap: 10px; }
.status-legend i { width: 10px; height: 10px; border-radius: 3px; }
.status-legend b { font-size: 24px; font-weight: 600; color: var(--text); }

.lead-name { margin-top: 20px; font-size: 21px; line-height: 1.5; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-score { margin-top: 10px; display: flex; align-items: baseline; gap: 14px; }
.lead-score .v { font-size: 72px; font-weight: 600; line-height: 1; color: var(--gold); }
.lead-score .l { font-size: 16px; color: var(--muted); }
.lead-bars { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.lead-bar { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 14px; font-size: 15px; color: var(--muted); }
.lead-bar .track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.lead-bar .track i { display: block; height: 100%; border-radius: 3px; }
.lead-bar b { text-align: right; font-size: 18px; font-weight: 500; color: var(--text-2); }
.lead-empty { margin-top: 24px; padding: 40px 0; text-align: center; font-size: 18px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.panel-deco {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(227, 189, 120, .18);
  box-shadow: 0 0 0 24px rgba(227, 189, 120, .04), 0 0 0 48px rgba(227, 189, 120, .025);
  pointer-events: none;
}

/* ---------------- 实时评分 ---------------- */
.live-head { margin-top: 34px; display: flex; align-items: center; gap: 36px; }
.live-no {
  flex: none;
  font-size: 128px;
  font-weight: 700;
  line-height: .9;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(125, 165, 255, .55);
  letter-spacing: -2px;
}
.live-title { min-width: 0; padding-left: 36px; border-left: 1px solid var(--line-strong); }
.live-idx { font-size: 19px; letter-spacing: 2px; color: var(--muted); }
.live-idx b { color: var(--text-2); font-weight: 500; }
#live-name {
  margin-top: 10px;
  font-size: 46px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#live-name.long { font-size: 38px; }

.live-body {
  position: absolute;
  left: 0;
  right: 0;
  top: 196px;
  bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 600px 1fr;
  border-top: 1px solid var(--line);
}

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.gauge { position: relative; flex: none; width: 540px; height: 540px; }
.gauge svg { width: 100%; height: 100%; overflow: visible; }
.gauge .g-track { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 22; stroke-linecap: round; }
.gauge .g-prog { fill: none; stroke: url(#g-blue); stroke-width: 22; stroke-linecap: round; }
.total.final .gauge .g-prog { stroke: url(#g-gold); }
.gauge .g-tick { stroke: rgba(255, 255, 255, .16); stroke-width: 2; }
.gauge .g-tick.major { stroke: rgba(255, 255, 255, .32); stroke-width: 3; }
.gauge .g-tick.on { stroke: #7fb0ff; }
.total.final .gauge .g-tick.on { stroke: var(--gold); }
.gauge .g-label { fill: var(--muted); font-size: 17px; font-family: "Bahnschrift", Arial, sans-serif; text-anchor: middle; dominant-baseline: middle; }
.gauge .g-ring { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 1.5; stroke-dasharray: 2 7; }
.gauge .g-inner { fill: url(#g-inner); }
.gauge .g-knob { fill: #fff; stroke: var(--accent); stroke-width: 5; transition: opacity .3s; }
.total.final .gauge .g-knob { stroke: #c9963f; }

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 10px;
}
.total-label { font-size: 24px; letter-spacing: 6px; color: var(--text-2); }
.total-value {
  margin: 6px 0 4px;
  font-size: 128px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--text);
  transition: color .6s;
}
.total.final .total-value { color: var(--gold); }
.total.empty .total-value { color: rgba(255, 255, 255, .2); }
.gauge-unit { font-size: 16px; color: var(--muted); letter-spacing: 2px; }

.compose {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 52px;
  border-right: 1px solid var(--line);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  font-size: 18px;
  border-radius: 999px;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.active { color: var(--live); border-color: rgba(52, 199, 123, .4); background: rgba(52, 199, 123, .06); }
.chip.active i { animation: breathe 1.6s ease-in-out infinite; }
.chip.closed { color: var(--gold); border-color: rgba(227, 189, 120, .45); background: rgba(227, 189, 120, .06); }
@keyframes breathe { 50% { opacity: .3; } }

.compose-title { font-size: 22px; font-weight: 500; color: var(--text); letter-spacing: 2px; display: flex; align-items: center; gap: 10px; }
.compose-title::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); }
.compose-scale { margin-top: 18px; display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.compose-bar {
  position: relative;
  margin-top: 8px;
  height: 40px;
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgba(255, 255, 255, .12) calc(25% - 1px) 25%),
    rgba(255, 255, 255, .04);
}
.compose-bar .seg {
  height: 100%;
  min-width: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  color: rgba(10, 18, 32, .85);
  transition: width .8s ease;
}
.legend { list-style: none; margin-top: 30px; }
.legend li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 19px;
  color: var(--text-2);
}
.legend li:last-child { border-bottom: none; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; }
.legend .eq { font-size: 16px; color: var(--muted); margin-left: 10px; }
.legend .eq b { color: var(--text-2); font-weight: 500; }
.legend .v { font-size: 26px; font-weight: 600; color: var(--text); }

.items { min-width: 0; display: flex; flex-direction: column; padding-left: 52px; border-left: 1px solid var(--line); }
.item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: none; }
.donut { position: relative; flex: none; width: 140px; height: 140px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .d-track { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 10; }
.donut .d-prog { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .8s ease; }
.donut .d-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 600;
}
.donut .d-val.none { color: rgba(255, 255, 255, .2); }
.item-info { flex: 1; min-width: 0; }
.item-head { display: flex; align-items: baseline; justify-content: space-between; }
.item-name { font-size: 23px; color: var(--text); font-weight: 500; letter-spacing: 1px; }
.item-weight { font-size: 16px; color: var(--muted); }
.item-contrib { margin-top: 12px; font-size: 16px; color: var(--muted); }
.item-contrib b { margin-left: 8px; font-size: 30px; font-weight: 600; color: var(--text-2); }
.item-prog { margin-top: 14px; display: flex; align-items: center; gap: 14px; font-size: 15px; color: var(--muted); }
.item-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.item-bar i { display: block; height: 100%; border-radius: 2px; transition: width .6s ease; }

.no-breakdown .live-body { grid-template-columns: 1fr; }
.no-breakdown .items, .no-breakdown .compose { display: none; }

/* ---------------- 控制栏 ---------------- */
.ctrl {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(17, 27, 46, .96);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  transition: opacity .35s, transform .35s;
  z-index: 5;
}
.ctrl.idle { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }

.btn {
  padding: 12px 22px;
  font-family: inherit;
  font-size: 18px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .06); color: var(--text); }
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn kbd { margin-left: 10px; font-family: "Bahnschrift", Arial, sans-serif; font-size: 13px; color: var(--muted); }
.btn.primary { color: #fff; background: var(--accent); }
.btn.primary:hover:not(:disabled) { background: #5a8ffb; }
.btn.primary kbd { color: rgba(255, 255, 255, .7); }
.btn.danger { color: #ff9b9e; }
.btn.danger:hover:not(:disabled) { background: rgba(229, 72, 77, .14); color: #ffb8ba; }
.btn.outline { border-color: var(--line-strong); }
.btn.sm { padding: 8px 14px; font-size: 16px; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, .6);
}
.modal-box {
  width: 640px;
  padding: 40px 44px 32px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: view-in .2s ease;
}
.modal-box h3 { font-size: 28px; font-weight: 600; }
.modal-box p { margin-top: 16px; font-size: 20px; line-height: 1.7; color: var(--text-2); }
.modal-btns { margin-top: 36px; display: flex; justify-content: flex-end; gap: 12px; }
.modal-btns .btn { padding: 12px 30px; border-color: var(--line-strong); }
.modal-btns .btn.primary, .modal-btns .btn.danger-solid { border-color: transparent; }
.btn.danger-solid { color: #fff; background: #d9393f; }
.btn.danger-solid:hover:not(:disabled) { background: #e5484d; }

.toast {
  position: absolute;
  left: 50%;
  top: 180px;
  transform: translate(-50%, -12px);
  padding: 14px 28px;
  font-size: 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 11;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { color: #ffb8ba; }
