:root {
  --ink: #171824;
  --muted: #6e6d7b;
  --paper: #f7f8fc;
  --white: #ffffff;
  --line: #dfe1eb;
  --violet: #6457e5;
  --coral: #ff5f45;
  --shadow: 0 18px 60px rgba(39, 36, 86, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 20; background: var(--ink); color: white; padding: 10px 14px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid rgba(100, 87, 229, .38); outline-offset: 3px; }

.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 5vw, 80px); border-bottom: 1px solid var(--line); background: rgba(247, 248, 252, .9); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 8; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 30px; display: grid; grid-template-columns: repeat(3, 8px); gap: 3px; transform: rotate(-5deg); }
.brand-mark i { width: 8px; height: 8px; border-radius: 2px; background: var(--violet); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(6) { background: var(--coral); }
.brand-mark i:nth-child(4), .brand-mark i:nth-child(8) { opacity: .18; }
.top-actions, .status { display: flex; align-items: center; gap: 10px; }
.status { font-size: 12px; color: var(--muted); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #20a878; box-shadow: 0 0 0 4px rgba(32,168,120,.1); }
.icon-button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); background: var(--white); border-radius: 12px; cursor: pointer; }
.icon-button:hover { border-color: var(--violet); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

main { width: min(1440px, 100%); margin: auto; }
.intro { min-height: 445px; display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 40px; padding: 90px clamp(22px, 5vw, 80px) 62px; position: relative; overflow: hidden; }
.intro::after { content: ""; position: absolute; right: -20px; top: 26px; width: 230px; height: 230px; opacity: .38; background-image: radial-gradient(circle, var(--violet) 0 5px, transparent 6px); background-size: 24px 24px; transform: rotate(8deg); mask-image: linear-gradient(120deg, transparent, black); }
.eyebrow { margin: 0 0 14px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--violet); }
h1 { margin: 0; max-width: 760px; font-family: "Arial Black", "Microsoft YaHei UI", sans-serif; font-size: clamp(64px, 9.3vw, 132px); line-height: .9; letter-spacing: -.085em; }
.question-bead { color: var(--coral); display: inline-block; transform: rotate(7deg); }
.intro-note { max-width: 350px; align-self: end; padding-bottom: 6px; position: relative; z-index: 1; }
.intro-note p { font-size: 18px; line-height: 1.7; margin: 0 0 18px; }
.intro-note .fine { font-size: 12px; color: var(--muted); line-height: 1.65; }

.signal-strip { margin: 0 clamp(22px, 5vw, 80px); min-height: 112px; padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; gap: 30px; background: var(--ink); color: white; border-radius: 18px 18px 4px 18px; box-shadow: var(--shadow); }
.signal-main { display: grid; grid-template-columns: auto auto auto; align-items: baseline; gap: 14px; }
.signal-main strong { font-size: clamp(25px, 3vw, 38px); letter-spacing: -.05em; }
.label { display: block; font-size: 10px; line-height: 1.3; letter-spacing: .12em; color: #a9a9b6; text-transform: uppercase; }
.delta { font-family: Consolas, monospace; font-size: 12px; color: #72dfba; }
.signal-meta { display: flex; gap: clamp(25px, 4vw, 60px); }
.signal-meta strong { display: block; margin-top: 7px; font-family: Consolas, monospace; font-size: 15px; font-weight: 500; }

.trend-section, .cards-section, .method-section { padding: 100px clamp(22px, 5vw, 80px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; }
h2 { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.08; letter-spacing: -.065em; }
.range-tabs { display: flex; padding: 4px; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.range-tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 13px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.range-tabs button.active { background: var(--ink); color: white; }
.legend { min-height: 53px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 18px 0 14px; }
.legend button { border: 0; background: transparent; padding: 0; display: flex; gap: 7px; align-items: center; font-size: 12px; cursor: pointer; }
.legend button.off { opacity: .3; text-decoration: line-through; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.chart-shell { position: relative; height: 430px; background: var(--white); border: 1px solid var(--line); border-radius: 4px 24px 24px 24px; overflow: hidden; box-shadow: var(--shadow); }
.chart { width: 100%; height: 100%; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart text { fill: #858592; font-family: Consolas, monospace; font-size: 10px; }
.grid-line { stroke: #eaebf2; stroke-width: 1; }
.trend-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trend-dot { stroke: white; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-area { opacity: .06; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 30px; background: white; }
.empty-state[hidden] { display: none; }
.empty-state strong { font-size: 20px; }
.empty-state p { color: var(--muted); max-width: 440px; line-height: 1.6; }
.empty-beads { color: var(--violet); letter-spacing: 7px; margin-bottom: 14px; }

.section-head.compact { align-items: end; }
.score-note { color: var(--muted); font-size: 13px; }
.keyword-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.keyword-card { min-height: 205px; padding: 22px; border: 1px solid var(--line); border-radius: 18px 18px 5px 18px; background: var(--white); position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.keyword-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.keyword-card::after { content: ""; position: absolute; right: -25px; bottom: -35px; width: 130px; height: 130px; border-radius: 42px; background: var(--card-color); opacity: .07; transform: rotate(24deg); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-name { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.card-name i { width: 10px; height: 10px; border-radius: 3px; background: var(--card-color); }
.source-chip { font-size: 9px; color: var(--muted); border: 1px solid var(--line); padding: 4px 7px; border-radius: 99px; }
.score { margin-top: 28px; font-family: "Arial Black", sans-serif; font-size: 62px; line-height: 1; letter-spacing: -.07em; }
.score small { margin-left: 5px; font-family: Consolas, monospace; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.meter { height: 7px; margin-top: 22px; border-radius: 9px; background: #edeef4; overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--score); background: var(--card-color); border-radius: inherit; }
.card-foot { display: flex; justify-content: space-between; margin-top: 9px; font-size: 10px; color: var(--muted); }

.method-section { margin-top: 110px; padding-top: 85px; padding-bottom: 95px; display: grid; grid-template-columns: 1fr 1fr; gap: 90px; border-top: 1px solid var(--line); }
.method-section h2 { font-size: clamp(32px, 3.5vw, 49px); }
.method-copy { max-width: 570px; font-size: 15px; line-height: 1.85; color: #545461; }
.method-copy p { margin: 0 0 18px; }
footer { border-top: 1px solid var(--line); padding: 30px clamp(22px, 5vw, 80px); display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100vh - 40px); border: 0; padding: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 100px rgba(16, 16, 30, .25); }
dialog::backdrop { background: rgba(23,24,36,.5); backdrop-filter: blur(5px); }
.dialog-head { padding: 26px 28px 20px; display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 30px; }
.dialog-head .icon-button { font-size: 24px; }
.dialog-body { padding: 25px 28px 32px; overflow: auto; }
.dialog-body h3 { margin: 0 0 14px; font-size: 16px; }
.dialog-body hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--muted); }
.field input:not([type="color"]) { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--ink); background: white; }
.admin-actions { min-height: 44px; display: flex; align-items: center; gap: 15px; margin-top: 12px; }
#adminMessage { font-size: 12px; color: var(--muted); }
.primary-button, .secondary-button { border: 0; border-radius: 10px; min-height: 42px; padding: 0 16px; cursor: pointer; font-weight: 700; font-size: 12px; white-space: nowrap; }
.primary-button { background: var(--violet); color: white; }
.secondary-button { background: white; border: 1px solid var(--line); }
.primary-button:disabled, .secondary-button:disabled { opacity: .5; cursor: wait; }
.form-row { display: flex; align-items: end; gap: 10px; }
.grow { flex: 1; }
.color-field input { width: 44px; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.form-help { color: var(--muted); font-size: 12px; }
code { background: #f0f1f6; padding: 2px 5px; border-radius: 4px; }
.file-drop { display: block; border: 1px dashed #b9b9ca; padding: 18px; border-radius: 12px; margin: 12px 0; text-align: center; font-size: 12px; color: var(--muted); cursor: pointer; }
.file-drop input { display: block; max-width: 100%; margin: 0 auto 8px; }

@media (max-width: 800px) {
  .topbar { height: 64px; }
  .status span { display: none; }
  .intro { min-height: 440px; grid-template-columns: 1fr; padding-top: 70px; }
  .intro-note { max-width: 520px; }
  h1 { font-size: clamp(54px, 14.5vw, 82px); line-height: .93; }
  .signal-strip { align-items: start; flex-direction: column; }
  .signal-main { grid-template-columns: auto auto; }
  .signal-main .delta { grid-column: 2; }
  .signal-meta { width: 100%; justify-content: space-between; gap: 14px; }
  .section-head { align-items: start; flex-direction: column; }
  .range-tabs { width: 100%; }
  .range-tabs button { flex: 1; }
  .chart-shell { height: 350px; }
  .keyword-grid { grid-template-columns: 1fr 1fr; }
  .method-section { grid-template-columns: 1fr; gap: 35px; }
}

@media (max-width: 520px) {
  .intro::after { display: none; }
  .signal-strip { border-radius: 14px; }
  .signal-main strong { font-size: 25px; }
  .trend-section, .cards-section { padding-top: 75px; }
  .keyword-grid { grid-template-columns: 1fr; }
  .score-note { margin: 0; }
  .form-row { align-items: stretch; flex-wrap: wrap; }
  .form-row .secondary-button { width: 100%; }
  footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
