:root {
  color-scheme: dark;
  --bg: #141414;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: rgba(255, 255, 255, 0.85);
  --text-soft: rgba(255, 255, 255, 0.64);
  --title: linear-gradient(135deg, #00d4ff, #00ff88);
  --accent: #00d4ff;
  --success: #00ff88;
  --warning: #faad14;
  --danger: #ff4757;
  --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(0, 255, 136, 0.08), transparent),
    linear-gradient(180deg, #0d0d0f, #151518, #1a1a1f);
  color: var(--text);
}

a {
  color: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
  animation: slide-in 0.5s ease-out;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  padding: 28px;
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  background: var(--title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 20px 0 16px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  font-size: 12px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.link-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.06);
}

.panel {
  padding: 24px;
}

.section-title {
  margin-bottom: 18px;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.24);
  background: rgba(0, 212, 255, 0.08);
  color: var(--accent);
  font-size: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.section-desc {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.sub-panel {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.sub-panel + .sub-panel {
  margin-top: 16px;
}

.status {
  color: var(--text-soft);
  line-height: 1.7;
}

.status.error {
  color: #ffd8d8;
}

.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.feature-grid,
.analysis-grid,
.type-grid,
.year-keyword-grid {
  display: grid;
  gap: 16px;
}

.feature-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.analysis-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.type-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.year-keyword-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.type-card,
.year-keyword-card {
  display: block;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.feature-card:hover,
.type-card:hover,
.year-keyword-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.28);
  background: rgba(0, 212, 255, 0.06);
}

.feature-card h3,
.type-card h3,
.year-keyword-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.94);
}

.feature-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.metric-card.tone-cyan {
  border-color: rgba(0, 212, 255, 0.2);
  background: rgba(0, 212, 255, 0.08);
}

.metric-card.tone-green {
  border-color: rgba(0, 255, 136, 0.2);
  background: rgba(0, 255, 136, 0.08);
}

.metric-card.tone-amber {
  border-color: rgba(250, 173, 20, 0.2);
  background: rgba(250, 173, 20, 0.08);
}

.metric-label {
  color: var(--text-soft);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.doc-card {
  display: block;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.doc-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.doc-card h2 {
  margin: 12px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}

.doc-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-year {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.doc-arrow {
  color: var(--accent);
  font-size: 12px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.doc-meta-item {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 14px;
}

.data-table th {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

.data-table td {
  color: var(--text-soft);
}

.year-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 14px;
  align-items: end;
}

.year-bar-card {
  padding: 14px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.year-bar-value {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.year-bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 150px;
}

.year-bar-fill {
  width: 36px;
  border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, #00d4ff, #00ff88);
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.18);
}

.year-bar-label {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
}

.trend-word-list {
  display: grid;
  gap: 12px;
}

.trend-word-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.trend-word-card.rising {
  border-color: rgba(0, 255, 136, 0.22);
  background: rgba(0, 255, 136, 0.06);
}

.trend-word-card.falling {
  border-color: rgba(255, 71, 87, 0.22);
  background: rgba(255, 71, 87, 0.06);
}

.trend-word-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.95);
}

.trend-delta {
  font-size: 13px;
  font-weight: 700;
}

.trend-word-card.rising .trend-delta {
  color: var(--success);
}

.trend-word-card.falling .trend-delta {
  color: var(--danger);
}

.trend-word-meta {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
}

.audio-panel {
  border-color: rgba(0, 212, 255, 0.2);
  background: rgba(0, 212, 255, 0.05);
}

.audio-player-wrap {
  display: grid;
  gap: 14px;
}

.audio-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.audio-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.2);
  color: var(--success);
  font-size: 12px;
}

.audio-name {
  color: var(--text-soft);
  font-size: 13px;
  word-break: break-all;
}

.audio-player {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.paper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.paper-main {
  min-width: 0;
}

.paper-aside {
  position: sticky;
  top: 18px;
}

.outline-list,
.tips-list {
  display: grid;
  gap: 10px;
}

.outline-link {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.outline-link:hover {
  transform: translateX(4px);
  border-color: rgba(0, 212, 255, 0.28);
  background: rgba(0, 212, 255, 0.08);
}

.outline-h2 {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
}

.outline-h3,
.outline-h4 {
  padding-left: 18px;
}

.tip-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-soft);
  line-height: 1.6;
}

.question-support {
  margin: 0.5em 0 0.95em;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
}

.question-support-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.question-support-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 12px;
}

.question-support-button {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.question-support-button:hover,
.question-support-button.is-active {
  transform: translateY(-1px);
}

.question-support-button.tone-answer.is-active {
  border-color: rgba(0, 255, 136, 0.32);
  background: rgba(0, 255, 136, 0.12);
}

.question-support-button.tone-analysis.is-active {
  border-color: rgba(0, 212, 255, 0.32);
  background: rgba(0, 212, 255, 0.12);
}

.question-support-button.tone-transcript.is-active {
  border-color: rgba(250, 173, 20, 0.32);
  background: rgba(250, 173, 20, 0.12);
}

.question-support-content {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.question-support-block {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.question-support-label {
  font-size: 12px;
  color: var(--accent);
}

.question-support-answer {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.96);
}

.question-support-text {
  margin-top: 8px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.86);
}

.question-support-text.transcript {
  white-space: pre-wrap;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  align-items: end;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.filter-label {
  font-size: 12px;
  color: var(--text-soft);
}

.filter-select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 10px;
}

.analysis-page-wrap {
  display: grid;
  gap: 14px;
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.distribution-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.distribution-option {
  font-size: 18px;
  font-weight: 700;
}

.distribution-count {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
}

.distribution-prob {
  margin-top: 4px;
  color: var(--text-soft);
}

.distribution-card.option-a {
  border-color: rgba(0, 212, 255, 0.25);
}
.distribution-card.option-b {
  border-color: rgba(0, 255, 136, 0.25);
}
.distribution-card.option-c {
  border-color: rgba(250, 173, 20, 0.25);
}
.distribution-card.option-d {
  border-color: rgba(255, 71, 87, 0.25);
}

.year-bars-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 12px;
}

.year-bar-item {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.year-bar-year,
.year-bar-total {
  font-size: 12px;
  color: var(--text-soft);
}

.year-bar-stack {
  width: 42px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column-reverse;
  background: rgba(255, 255, 255, 0.03);
}

.year-bar-stack .seg {
  width: 100%;
}

.year-bar-stack .seg-a {
  background: rgba(0, 212, 255, 0.75);
}
.year-bar-stack .seg-b {
  background: rgba(0, 255, 136, 0.75);
}
.year-bar-stack .seg-c {
  background: rgba(250, 173, 20, 0.75);
}
.year-bar-stack .seg-d {
  background: rgba(255, 71, 87, 0.75);
}

.heatmap-table td.heat.option-a {
  background: rgba(0, 212, 255, 0.35);
}
.heatmap-table td.heat.option-b {
  background: rgba(0, 255, 136, 0.35);
}
.heatmap-table td.heat.option-c {
  background: rgba(250, 173, 20, 0.35);
}
.heatmap-table td.heat.option-d {
  background: rgba(255, 71, 87, 0.35);
}

.vocab-heatmap-table {
  min-width: 860px;
}

.vocab-heatmap-table td:first-child,
.vocab-heatmap-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: rgba(20, 20, 20, 0.96);
}

.vocab-heatmap-table td.vocab-heat {
  text-align: center;
  border-radius: 4px;
}

.paper-content {
  line-height: 1.75;
}

.paper-content h1,
.paper-content h2,
.paper-content h3,
.paper-content h4 {
  color: rgba(255, 255, 255, 0.92);
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  line-height: 1.35;
}

.paper-content h1 {
  margin-top: 0;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 2rem;
}

.paper-content h2 {
  font-size: 1.5rem;
}

.paper-content h3 {
  font-size: 1.18rem;
}

.paper-content h4 {
  font-size: 1rem;
}

.paper-content p {
  margin: 0.35em 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.paper-content .subhead {
  margin-top: 1em;
  font-weight: 600;
  color: #8bdfff;
}

.paper-content .directions {
  margin: 0.8em 0;
  padding: 12px 14px;
  background: rgba(0, 212, 255, 0.08);
  border-left: 4px solid #00d4ff;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
}

.paper-content .question {
  margin-top: 0.9em;
  font-weight: 600;
}

.paper-content .option {
  padding-left: 1.25em;
}

.paper-content u {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.96);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

.paper-content .cloze-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8em;
  margin: 0 0.08em;
  padding: 0 0.28em 0.06em;
  border-bottom: 1.6px solid currentColor;
  font-weight: 700;
  line-height: 1;
  vertical-align: -0.08em;
  white-space: nowrap;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .paper-layout {
    grid-template-columns: 1fr;
  }

  .analysis-grid,
  .type-grid,
  .year-keyword-grid {
    grid-template-columns: 1fr;
  }

  .paper-aside {
    position: static;
  }

  .hero,
  .panel {
    border-radius: 16px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

  .hero h1 {
    font-size: 24px;
  }
}
