:root {
  --ink: #07080c;
  --card: rgba(10, 13, 20, 0.42);
  --line: rgba(212, 176, 106, 0.28);
  --gold: #f5c64d;
  --gold-2: #ffe08a;
  --jade: #2ee6d6;
  --blue: #4db8ff;
  --clay: #c4a484;
  --text: #efe8d8;
  --muted: #e6dcc8;
  --num: "Bahnschrift", "Segoe UI", "DIN Alternate", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(245, 198, 77, 0.09), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(46, 230, 214, 0.05), transparent 50%),
    radial-gradient(ellipse 45% 35% at 0% 100%, rgba(77, 184, 255, 0.04), transparent 50%),
    #06070b;
  color: var(--text);
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(245, 198, 77, 0.07), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(46, 230, 214, 0.05), transparent 20%),
    radial-gradient(circle at 78% 78%, rgba(245, 198, 77, 0.05), transparent 24%);
}
.bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(245, 198, 77, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 198, 77, 0.07) 1px, transparent 1px),
    radial-gradient(rgba(245, 198, 77, 0.22) 1px, transparent 1.4px);
  background-size: 56px 56px, 56px 56px, 56px 56px;
  background-position: 0 0, 0 0, -0.5px -0.5px;
  mask-image: radial-gradient(ellipse at center, #000 42%, transparent 82%);
}
.bg-rings {
  position: absolute;
  width: 720px;
  height: 720px;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(245, 198, 77, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 36px rgba(245, 198, 77, 0.025),
    0 0 0 72px rgba(245, 198, 77, 0.018);
}
.bg-rings::before,
.bg-rings::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(245, 198, 77, 0.06);
  border-radius: 50%;
}
.bg-rings::before {
  inset: 88px;
  border-style: dashed;
}
.bg-rings::after {
  inset: 168px;
}
.bg-beam {
  position: absolute;
  top: -20%;
  left: -30%;
  width: 38%;
  height: 140%;
  background: linear-gradient(115deg, transparent 42%, rgba(245, 198, 77, 0.045) 50%, transparent 58%);
  animation: beam 22s linear infinite;
}
@keyframes beam {
  from { transform: translateX(0); }
  to { transform: translateX(320%); }
}
.bg-frame {
  position: absolute;
  inset: 10px;
}
.bg-frame .c {
  position: absolute;
  width: 64px;
  height: 64px;
}
.bg-frame .c::before,
.bg-frame .c::after {
  content: "";
  position: absolute;
  background: var(--gold);
}
.bg-frame .tl { top: 0; left: 0; border-top: 1px solid rgba(245, 198, 77, 0.7); border-left: 1px solid rgba(245, 198, 77, 0.7); }
.bg-frame .tr { top: 0; right: 0; border-top: 1px solid rgba(245, 198, 77, 0.7); border-right: 1px solid rgba(245, 198, 77, 0.7); }
.bg-frame .bl { bottom: 0; left: 0; border-bottom: 1px solid rgba(245, 198, 77, 0.7); border-left: 1px solid rgba(245, 198, 77, 0.7); }
.bg-frame .br { bottom: 0; right: 0; border-bottom: 1px solid rgba(245, 198, 77, 0.7); border-right: 1px solid rgba(245, 198, 77, 0.7); }
.bg-frame .tl::before, .bg-frame .tr::before { top: -1px; width: 12px; height: 2px; }
.bg-frame .tl::after, .bg-frame .bl::after { left: -1px; width: 2px; height: 12px; }
.bg-frame .tr::before { right: 0; }
.bg-frame .tr::after { right: -1px; top: -1px; width: 2px; height: 12px; }
.bg-frame .bl::before { bottom: -1px; width: 12px; height: 2px; }
.bg-frame .br::before { right: 0; bottom: -1px; width: 12px; height: 2px; }
.bg-frame .br::after { right: -1px; bottom: -1px; width: 2px; height: 12px; }

.watermark {
  position: fixed;
  inset: -20%;
  z-index: 8;
  pointer-events: none;
  display: none;
  background-repeat: repeat;
  opacity: 0.9;
  transform: rotate(-18deg);
}

.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-rows: 78px 1fr;
  padding: 8px 20px 16px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 176, 106, 0.55), transparent);
}

.meta-left, .meta-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-right { align-items: flex-end; text-align: right; }
.meta-left em, .meta-right em {
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-family: var(--num);
}
.meta-left span, .meta-right span {
  font-size: 15px;
  color: #cfc6b4;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.meta-right span { font-family: var(--num); font-size: 17px; color: var(--gold-2); }

.title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.wing {
  width: 72px;
  height: 10px;
  background: linear-gradient(90deg, transparent, var(--gold));
  clip-path: polygon(0 50%, 18% 0, 100% 40%, 100% 60%, 18% 100%);
  opacity: 0.85;
}
.wing.right {
  background: linear-gradient(90deg, var(--gold), transparent);
  clip-path: polygon(0 40%, 82% 0, 100% 50%, 82% 100%, 0 60%);
}
.title-block { text-align: center; }
.title-block small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--muted);
  font-family: var(--num);
  margin-bottom: 2px;
}
.title-block h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--gold-2);
}

.dash {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px 1fr 330px;
  gap: 12px;
}

.col, .mid, .right {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(212, 176, 106, 0.55);
  pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card.grow { flex: 1; }

.card-hd {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #e6dcc8;
}
.card-hd::before {
  content: "";
  width: 3px;
  height: 12px;
  margin-right: 8px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
}
.card-hd .more {
  margin-left: auto;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.16em;
  cursor: pointer;
  opacity: 0.8;
}

#sourceChart { height: 196px; }
#trendChart { height: 230px; }

.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-item { animation: rise 0.5s ease both; }
.funnel-meta {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #c9c0ae;
  margin-bottom: 6px;
}
.funnel-meta b {
  color: var(--gold-2);
  font-family: var(--num);
  font-weight: 500;
}
.funnel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.funnel-rate {
  color: var(--gold);
  font-size: 14px;
  font-family: var(--num);
  min-width: 52px;
  text-align: right;
}
.bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4db8ff, #2ee6d6 45%, #f5c64d);
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 14px 14px;
  overflow: hidden;
}
.kpi .label {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.kpi .value {
  font-family: var(--num);
  font-size: 32px;
  font-weight: 600;
  color: var(--gold-2);
  line-height: 1.2;
  margin-top: 6px;
  letter-spacing: 0.02em;
}
.kpi.sm .value { font-size: 24px; }
.kpi .sub {
  font-size: 13px;
  color: #7f786c;
  margin-top: 4px;
}
.kpi .sub b { color: #d8d0c0; font-weight: 500; }

.trend-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.trend-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 8px;
}
.trend-tabs > span {
  cursor: pointer;
  padding: 4px 12px 8px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid transparent;
}
.trend-tabs > span.active {
  color: var(--gold-2);
  border-bottom-color: var(--gold);
}
.trend-tabs .tools { margin-left: auto; }

.seg {
  display: flex;
  border: 1px solid var(--line);
}
.seg button {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.seg button.active {
  background: rgba(212, 176, 106, 0.12);
  color: var(--gold-2);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 14px;
  color: #c9c0ae;
  margin: 2px 0 8px;
}
.legend label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.legend input { accent-color: var(--gold); }
.dot { width: 7px; height: 7px; border-radius: 50%; }

.chart-fill {
  flex: 1;
  min-height: 0;
  position: relative;
}
#compChart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.lottery {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 6px;
}
.lottery-line {
  flex: 1;
  height: 18px;
  position: relative;
  background: linear-gradient(90deg, transparent, rgba(212, 176, 106, 0.35), transparent) 0 9px / 100% 1px no-repeat;
}
.lottery-line i {
  position: absolute;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.portrait-tabs {
  display: flex;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
  margin-left: auto;
  letter-spacing: 0.08em;
}
.portrait-tabs span { cursor: pointer; padding: 2px 8px; }
.portrait-tabs span.active { color: var(--gold-2); }

#portraitChart { height: 200px; }

.player-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.player-hd {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--muted);
  min-width: 0;
}
.player-hd span {
  cursor: pointer;
  padding: 2px 8px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}
.player-hd span.active { color: var(--gold-2); }
.player-hd .dl {
  margin-left: auto;
  min-width: 0;
  flex: 1;
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.stage {
  flex: 1;
  min-height: 168px;
  background: rgba(5, 5, 8, 0.45);
  position: relative;
  overflow: hidden;
}
.stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stage .caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 14px 12px;
  background: linear-gradient(transparent, rgba(5, 5, 8, 0.88));
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--gold-2);
}
.stage .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 8, 0.22);
}
.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(240, 217, 160, 0.7);
  background: rgba(7, 8, 12, 0.45);
  cursor: pointer;
  position: relative;
}
.play-btn::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 18px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--gold-2);
}

.comment-list, .highlights {
  display: none;
  padding: 14px 16px;
  overflow: auto;
  flex: 1;
}
.comment-list.show { display: flex; flex-direction: column; gap: 14px; }
.highlights.show {
  display: block;
  color: #b7ad9a;
  font-size: 15px;
  line-height: 2;
  letter-spacing: 0.04em;
}
.comment { font-size: 15px; line-height: 1.55; color: #d8d0c0; }
.comment b { color: var(--gold); font-weight: 500; letter-spacing: 0.04em; }
.comment .time {
  color: #6f6a60;
  margin-left: 8px;
  font-size: 13px;
  font-family: var(--num);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #07080c;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
.boot.off {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-inner { text-align: center; }
.boot-ring {
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border: 2px solid rgba(245, 198, 77, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.boot-inner p {
  font-size: 15px;
  letter-spacing: 0.28em;
  color: var(--gold-2);
}
.boot-inner span {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--muted);
  font-family: var(--num);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.screen {
  opacity: 0;
}
body.ready .screen {
  opacity: 1;
  transition: opacity 0.4s ease;
}
body.ready .topbar {
  animation: rise 0.55s ease both;
}
body.ready .card,
body.ready .kpi {
  animation: rise 0.55s ease both;
}
body.ready .col .card:nth-child(1) { animation-delay: 0.05s; }
body.ready .col .card:nth-child(2) { animation-delay: 0.12s; }
body.ready .col .card:nth-child(3) { animation-delay: 0.18s; }
body.ready .kpi:nth-child(1) { animation-delay: 0.08s; }
body.ready .kpi:nth-child(2) { animation-delay: 0.12s; }
body.ready .kpi:nth-child(3) { animation-delay: 0.16s; }
body.ready .kpi:nth-child(4) { animation-delay: 0.2s; }
body.ready .mid .trend-card { animation-delay: 0.22s; }
body.ready .right .card:nth-child(1) { animation-delay: 0.1s; }
body.ready .right .card:nth-child(2) { animation-delay: 0.18s; }

@media (max-width: 1280px) {
  body { overflow: auto; }
  .screen { height: auto; }
  .dash { grid-template-columns: 1fr; }
  .title-block h1 { font-size: 22px; letter-spacing: 0.16em; }
  .wing { display: none; }
}
