:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(28, 55, 82, 0.11);
  --muted: #687b90;
  --text: #152438;
  --cyan: #0aa99b;
  --blue: #4f6fe8;
  --cloud-1: #0aa99b;
  --cloud-2: #4f6fe8;
  --cloud-3: #ef7d3c;
  --cloud-4: #d8a00d;
  --cloud-5: #2d7796;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(60, 180, 205, .13), transparent 34rem),
    radial-gradient(circle at 90% 90%, rgba(99, 116, 221, .11), transparent 32rem),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.board { width: min(1380px, calc(100% - 28px)); margin: 0 auto; padding: 20px 0 12px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .22em; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 50px); line-height: 1; letter-spacing: -.05em; }
.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.hero-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.page-switch { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #087f76; background: rgba(10, 169, 155, .09); border: 1px solid rgba(10, 169, 155, .2); border-radius: 999px; font-size: 13px; font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px rgba(37, 63, 88, .05); transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.page-switch:hover { transform: translateY(-1px); background: rgba(10, 169, 155, .14); box-shadow: 0 10px 26px rgba(10, 169, 155, .12); }
.page-switch:focus-visible { outline: 3px solid rgba(79, 111, 232, .25); outline-offset: 2px; }
.page-switch b { font-size: 17px; line-height: 1; }
.live { display: flex; align-items: center; gap: 9px; padding: 10px 14px; color: #587086; background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 8px 24px rgba(37, 63, 88, .06); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #f5b84d; box-shadow: 0 0 12px currentColor; }
.live.connected .live-dot { color: var(--cyan); background: var(--cyan); animation: pulse 2s infinite; }
.live.disconnected .live-dot { color: #ff7084; background: #ff7084; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 70px rgba(38, 66, 93, .1); backdrop-filter: blur(18px); }
.ranking { height: 100%; min-height: 0; padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 3px 0 0; font-size: 20px; }
.panel-head > p { margin: 0; color: var(--muted); font-size: 12px; }
.section-kicker { margin: 0; color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.ranking-list { display: grid; grid-template-rows: none; gap: 6px; height: auto; margin: 12px 0 0; padding: 0; list-style: none; }
.rank-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) 52px; align-items: center; min-height: 48px; padding: 6px 10px 6px 4px; background: #f8fafc; border: 1px solid rgba(31, 61, 90, .06); border-radius: 11px; transition: transform .45s ease, background .3s ease, border-color .3s ease, box-shadow .3s ease; animation: enter .45s both; }
.rank-item:hover { transform: translateX(4px); background: #fff; border-color: rgba(10, 169, 155, .22); box-shadow: 0 8px 24px rgba(34, 66, 94, .08); }
.rank-number { color: #7890a9; font-size: 18px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.rank-item:nth-child(1) .rank-number { color: #dca315; font-size: 22px; }
.rank-item:nth-child(2) .rank-number { color: #7891aa; font-size: 21px; }
.rank-item:nth-child(3) .rank-number { color: #c88152; font-size: 20px; }
.question { min-width: 0; }
.question-title { max-width: 100%; margin: 0 0 3px; overflow-wrap: anywhere; font-size: clamp(14px, 1.15vw, 16px); font-weight: 650; line-height: 1.3; white-space: normal; }
.question-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.category { padding: 3px 8px; color: #07887d; background: rgba(10, 169, 155, .1); border-radius: 6px; }
.count { min-width: 52px; text-align: right; }
.count strong { display: block; color: var(--cyan); font-size: 20px; font-variant-numeric: tabular-nums; }
.count span { color: var(--muted); font-size: 11px; }
.audience { position: relative; display: flex; overflow: hidden; height: 100%; min-height: 0; padding: 18px; flex-direction: column; }
.audience::after { position: absolute; top: -90px; right: -90px; width: 240px; height: 240px; pointer-events: none; content: ""; background: radial-gradient(circle, rgba(10, 169, 155, .12), transparent 68%); }
.audience-head { position: relative; z-index: 1; }
.audience-summary { display: flex; align-items: center; gap: 14px; min-width: 150px; justify-content: flex-end; }
.audience-summary > span { color: var(--muted); font-size: 12px; }
.audience-summary > div { display: flex; align-items: baseline; gap: 6px; }
.audience-summary strong { color: #087f76; font-size: 32px; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.audience-summary small { color: var(--muted); font-size: 12px; }
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-height: 0; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); flex: 1; align-items: stretch; }
.dimension-section, .keyword-section { display: flex; min-width: 0; min-height: 0; padding: 14px; background: #f8fafc; border: 1px solid rgba(31, 61, 90, .07); border-radius: 14px; flex-direction: column; }
.dimension-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dimension-title h3 { margin: 0; font-size: 16px; }
.dimension-title > span { color: var(--muted); font-size: 12px; }
.dimension-list { display: grid; gap: 8px; align-content: space-evenly; flex: 1; }
.dimension-row { display: grid; gap: 7px; }
.dimension-label { display: flex; justify-content: space-between; gap: 12px; color: #52677c; font-size: 13px; }
.dimension-label strong { color: var(--text); font-variant-numeric: tabular-nums; }
.dimension-track { overflow: hidden; height: 7px; background: #edf1f5; border-radius: 999px; }
.dimension-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), #4f78e8); border-radius: inherit; transition: width .55s ease; }
.dimension-empty { margin: 0; padding: 12px 0; color: var(--muted); font-size: 12px; }
.keyword-cloud { display: block; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 10px; background: radial-gradient(circle at center, rgba(10, 169, 155, .07), rgba(79, 111, 232, .025) 55%, transparent 74%); flex: 1; }
.privacy-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 10px; color: #718397; background: #f4f7fa; border: 1px solid rgba(31, 61, 90, .06); border-radius: 10px; font-size: 11px; line-height: 1.35; }
.privacy-note > span { display: grid; flex: 0 0 auto; width: 19px; height: 19px; place-items: center; color: var(--cyan); background: rgba(88, 230, 217, .1); border-radius: 50%; }
.privacy-note p { margin: 0; }
.privacy-note strong { display: block; margin-bottom: 2px; color: #3d5369; font-size: 12px; }
.empty-state { padding: 68px 20px; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 16px; place-items: center; color: var(--cyan); background: rgba(88, 230, 217, .08); border: 1px solid rgba(88, 230, 217, .22); border-radius: 18px; font-size: 28px; font-weight: 800; }
.empty-state h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; }
.empty-state p { margin: 0; font-size: 14px; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 8px 5px 0; color: #8291a1; font-size: 11px; }

@keyframes pulse { 50% { opacity: .45; transform: scale(.75); } }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 940px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .ranking, .audience { height: auto; min-height: 0; }
  .ranking-list { grid-template-rows: none; height: auto; }
  .audience { grid-row: 1; }
}

@media (max-width: 640px) {
  .board { width: min(100% - 20px, 1080px); padding-top: 32px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-controls { width: 100%; justify-content: flex-start; }
  .ranking { min-height: auto; padding: 16px 10px; border-radius: 18px; }
  .panel-head { padding-inline: 8px; }
  .audience { padding: 18px; border-radius: 18px; }
  .audience-summary { min-width: 0; gap: 8px; }
  .audience-summary > span { font-size: 11px; }
  .audience-summary strong { font-size: 28px; }
  .insight-grid { grid-template-columns: 1fr; }
  .dimension-section, .keyword-section { min-height: 320px; }
  .rank-item { grid-template-columns: 43px minmax(0, 1fr) 64px; padding-right: 10px; }
  .count { min-width: 64px; }
  .count strong { font-size: 20px; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
