:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #172126;
  --muted: #607076;
  --line: #d9ded7;
  --high: #b42318;
  --watch: #b86b00;
  --note: #25636f;
  --green: #2f6f4e;
  --blue: #2d5f9a;
  --shadow: 0 8px 24px rgba(23, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.brand p,
.generated {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.refresh-button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.refresh-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1380px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics div {
  min-height: 88px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.metrics small {
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 12px;
  margin-bottom: 18px;
}

.controls input,
.controls select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.voice-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 230px) auto minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.voice-mode {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.voice-mode strong {
  color: var(--ink);
  font-size: 13px;
}

.voice-mode span {
  font-weight: 500;
}

.voice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-button,
.voice-card-button,
.practice-card-button,
.practice-close {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.voice-button {
  padding: 0 12px;
}

.voice-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.voice-button:disabled,
.voice-card-button:disabled,
.practice-card-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.voice-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.feed {
  display: grid;
  gap: 12px;
}

.brief-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--note);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brief-card.is-speaking {
  border-color: #a9c2de;
  box-shadow: 0 10px 28px rgba(45, 95, 154, 0.16);
}

.brief-card.urgency-high {
  border-left-color: var(--high);
}

.brief-card.urgency-watch {
  border-left-color: var(--watch);
}

.card-topline,
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.card-voice-actions {
  display: flex;
  justify-content: flex-end;
}

.card-practice-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.voice-card-button,
.practice-card-button {
  min-height: 28px;
  padding: 0 10px;
  color: var(--blue);
  background: #f7faff;
}

.practice-card-button {
  color: var(--green);
  background: #f4faf7;
}

.brief-card.is-speaking .voice-card-button {
  border-color: #a9c2de;
  background: #eaf3ff;
}

.meta {
  color: #51636b;
  font-variant-numeric: tabular-nums;
}

.pill,
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 700;
  background: #edf1ec;
  color: var(--ink);
}

.score {
  min-width: 40px;
  color: #fff;
  background: var(--blue);
}

.urgency-high .pill {
  background: #fde8e6;
  color: var(--high);
}

.urgency-watch .pill {
  background: #fff2d9;
  color: var(--watch);
}

.bilingual {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 18px;
  align-items: start;
}

.cn-copy,
.en-copy {
  min-width: 0;
}

.en-copy {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow span {
  margin-left: 8px;
  color: var(--green);
  text-transform: none;
}

.brief-card h2,
.brief-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.brief-card h3 {
  font-size: 17px;
  font-weight: 700;
}

.cn-copy p {
  margin: 8px 0 0;
  color: #2f4148;
  font-size: 15px;
}

.translated-summary {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.note-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4faf7;
  border: 1px solid #d8e4df;
}

.note-box strong {
  display: block;
  color: #244c3c;
  font-size: 13px;
}

.note-box p {
  margin: 6px 0 0;
  font-size: 14px;
}

.summary {
  margin: 0;
  color: #405057;
  font-size: 15px;
}

.translation-provider {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.lens {
  padding: 10px 12px;
  border: 1px solid #d8e4df;
  border-radius: 8px;
  background: #f4faf7;
  color: #244c3c;
  font-size: 14px;
}

.lens-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lens-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lens-grid p {
  margin: 0;
  color: #244c3c;
  font-size: 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef1f3;
  color: #374950;
  font-size: 12px;
}

.tag.asset {
  background: #e9f0fa;
  color: var(--blue);
}

.source-row {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.source-row small {
  margin-left: 6px;
  color: var(--muted);
}

.english-signals {
  color: var(--muted);
  font-size: 13px;
}

.english-signals summary {
  cursor: pointer;
  width: fit-content;
  color: var(--blue);
  font-weight: 700;
}

.english-signals .tags {
  margin-top: 8px;
}

.english-signals .note-box {
  margin-top: 10px;
}

.english-signals p {
  margin: 6px 0 0;
}

.english-signals .rank-list {
  margin-top: 10px;
}

.english-signals .rank-list li {
  align-items: start;
}

.english-signals .rank-list p {
  margin: 0;
  color: #2f4148;
  font-size: 13px;
}

.study-zone {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.study-zone summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.study-zone summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 10px;
  margin-top: 10px;
}

.study-block {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.study-block > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
}

.study-block p {
  margin: 0;
  color: #2f4148;
  font-size: 13px;
}

.key-sentence {
  grid-column: 1 / -1;
  border-color: #d8e4df;
  background: #f4faf7;
}

.breakdown-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.breakdown-list li {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid #e4e8e2;
  border-radius: 8px;
  background: var(--surface);
}

.breakdown-list strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.breakdown-list small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.vocab-chip {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: #eef1f3;
}

.vocab-chip strong,
.vocab-chip small {
  display: block;
  overflow-wrap: anywhere;
}

.vocab-chip strong {
  color: var(--ink);
  font-size: 12px;
}

.vocab-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.reading-check {
  border-color: #dfe7f2;
  background: #f7faff;
}

.empty-copy {
  color: var(--muted);
}

.practice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: none;
  background: rgba(23, 33, 38, 0.22);
}

.practice-backdrop.open {
  display: block;
}

.practice-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(520px, 100%);
  height: 100vh;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 32px rgba(23, 33, 38, 0.14);
  transform: translateX(100%);
  transition: transform 0.18s ease;
}

.practice-panel.open {
  transform: translateX(0);
}

.practice-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.practice-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.practice-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.practice-close {
  padding: 0 10px;
}

.practice-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.practice-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.practice-message {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.practice-message.user {
  border-color: #dfe7f2;
  background: #f7faff;
}

.practice-message strong {
  color: var(--ink);
  font-size: 13px;
}

.practice-message p {
  margin: 0;
  color: #2f4148;
  font-size: 14px;
}

.practice-message small {
  color: var(--muted);
  font-size: 12px;
}

.practice-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.practice-form textarea {
  min-height: 94px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  font: inherit;
}

.side {
  display: grid;
  gap: 12px;
}

.side section {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.rank-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.rank-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.rank-list strong {
  color: var(--ink);
}

.rank-list small {
  color: var(--high);
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    position: static;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .workspace {
    display: grid;
  }

  .lens-grid {
    grid-template-columns: 1fr;
  }

  .en-copy {
    border-left: 1px solid var(--line);
    border-top: 0;
    padding-left: 18px;
    padding-top: 0;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voice-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .study-grid,
  .vocab-grid {
    grid-template-columns: 1fr;
  }

  .practice-panel {
    width: min(480px, 100%);
  }
}

@media (max-width: 640px) {
  main {
    width: min(100% - 20px, 1380px);
    margin-top: 14px;
  }

  .topbar {
    padding: 18px 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .voice-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .voice-button {
    min-width: 0;
    padding: 0 8px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .practice-panel {
    padding: 14px;
  }

  .practice-form {
    grid-template-columns: 1fr;
  }

  .brief-card {
    padding: 14px;
  }

  .bilingual {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .en-copy {
    padding-left: 10px;
  }

  .brief-card h2 {
    font-size: 15px;
  }

  .brief-card h3 {
    font-size: 14px;
  }

  .cn-copy p,
  .summary {
    font-size: 13px;
  }

  .note-box {
    padding: 8px;
  }

  .study-zone summary {
    display: grid;
    gap: 2px;
  }

  .study-block {
    padding: 10px;
  }
}
