:root {
  --ink: #111111;
  --body: #2f332f;
  --muted: #6f746e;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --line: #deded7;
  --line-strong: #171717;
  --red: #c9182b;
  --gold: #f1c232;
  --green: #315f52;
  --wash: #f4f1e8;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--body);
  background: var(--paper);
  font-family: "Segoe UI", "Source Sans Pro", "Noto Sans SC", sans-serif;
  font-size: 16px;
}

button,
textarea,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: white;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 650;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:disabled {
  cursor: default;
  opacity: 0.65;
}

button:hover {
  background: var(--red);
  border-color: var(--red);
  transform: translateY(-1px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 54px) 16px;
  border-top: 5px solid var(--gold);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(251, 251, 248, 0.96);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar::after {
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  background: var(--line);
  margin-top: 4px;
}

.eyebrow,
.source-line,
.meter span,
.speech-stats,
.result,
.rail-label,
.actions a,
#packDate {
  font-family: "Segoe UI", "Noto Sans SC", sans-serif;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 6vw, 74px);
  line-height: 0.96;
  font-weight: 700;
}

h2 {
  font-size: clamp(32px, 4.4vw, 58px);
  line-height: 1.02;
  max-width: 1040px;
  margin-bottom: 16px;
}

h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 14px;
  text-transform: uppercase;
  font-weight: 850;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#packDate {
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--red);
  padding: 9px 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 292px) 1fr;
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
}

.sidebar {
  min-height: calc(100vh - 116px);
  border-right: 1px solid var(--line);
  padding: 26px 18px 28px clamp(18px, 2.6vw, 34px);
  position: sticky;
  top: 116px;
  align-self: start;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbf8 100%);
}

.rail-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.meter {
  border-top: 3px solid var(--line-strong);
  background: var(--wash);
  padding: 15px 14px;
  margin-bottom: 22px;
}

.meter strong {
  display: block;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  line-height: 1;
  margin: 5px 0 12px;
}

.bar {
  height: 7px;
  background: #dfddd5;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--red);
}

#packList {
  display: grid;
  gap: 8px;
}

.pack-tab {
  width: 100%;
  min-height: 54px;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--body);
  padding: 11px 4px;
  font-weight: 700;
}

.pack-tab:hover,
.pack-tab.active {
  background: transparent;
  color: var(--red);
  transform: none;
}

.pack-tab.active {
  border-top-color: var(--red);
}

.pack-tab span,
.pack-tab strong {
  display: block;
}

.pack-tab span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pack-tab strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
}

.workspace {
  padding: clamp(18px, 4vw, 46px);
  display: grid;
  gap: 22px;
}

.lead-panel {
  position: relative;
  padding: clamp(24px, 4.5vw, 50px);
  border-top: 6px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(241, 194, 50, 0.18), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow);
}

.lead-panel::before {
  content: "Daily Lead";
  display: inline-block;
  margin-bottom: 16px;
  background: var(--red);
  color: white;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lead-panel p {
  max-width: 880px;
  font-size: 18px;
  line-height: 1.65;
}

.source-line {
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 750;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: white;
  padding: 0 13px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.actions a:hover {
  border-color: var(--red);
  color: var(--red);
}

.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.04);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.timer {
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  line-height: 1;
  margin: 4px 0 16px;
}

.listening.active {
  border-top-color: var(--red);
  background: linear-gradient(180deg, #fff9df 0%, #ffffff 54%);
}

.focus-status {
  margin-bottom: 14px;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

ol,
ul {
  padding-left: 22px;
}

li {
  margin: 9px 0;
  line-height: 1.55;
}

.hint-stack {
  display: grid;
  gap: 8px;
}

.hint-stack p,
.excerpt,
.translation-item,
.vocab-card {
  border-left: 3px solid var(--gold);
  background: #fbfbf8;
  padding: 13px 14px;
  margin: 0;
}

.excerpt-list,
.translation-list,
.vocab-grid {
  display: grid;
  gap: 11px;
}

.excerpt {
  cursor: pointer;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.5;
}

.excerpt:hover {
  border-left-color: var(--red);
  background: #fff7df;
}

.excerpt.done {
  border-left-color: var(--red);
  color: var(--red);
}

.zh-summary {
  font-size: 17px;
  line-height: 1.8;
}

.translation-item strong,
.vocab-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 7px;
}

.translation-item p,
.vocab-card p {
  margin-bottom: 8px;
  line-height: 1.55;
}

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

.vocab-card {
  border-left-color: var(--green);
}

.context-list {
  columns: 2;
  column-gap: 34px;
}

.quiz-item {
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.quiz-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.quiz-options label {
  display: flex;
  gap: 9px;
  align-items: center;
  background: #fbfbf8;
  border: 1px solid transparent;
  padding: 9px 10px;
}

.quiz-options label:hover {
  border-color: var(--gold);
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfbf8;
  color: var(--ink);
  padding: 12px;
  line-height: 1.5;
  font-size: 16px;
}

textarea:focus {
  outline: 2px solid rgba(201, 24, 43, 0.18);
  border-color: var(--red);
  background: white;
}

.result {
  margin: 12px 0 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.upgrade-box {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfbf8;
  padding: 14px 0;
}

.upgrade-box p {
  margin: 12px 0 0;
  color: var(--green);
  font-weight: 700;
}

.speaking-panel {
  border-top-color: var(--red);
}

.speaking-panel textarea {
  min-height: 120px;
}

.bilingual-panel {
  border-top-color: var(--gold);
}

.bilingual-list {
  display: grid;
  gap: 12px;
}

.bilingual-item {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.bilingual-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.bilingual-en {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.55;
}

.bilingual-zh {
  color: var(--body);
  line-height: 1.7;
}

.speech-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 900px) {
  html,
  body {
    overflow-x: hidden;
  }

  .topbar {
    align-items: start;
    grid-template-columns: 1fr;
    position: static;
    gap: 14px;
    padding: 14px 16px 12px;
  }

  h1 {
    font-size: clamp(31px, 11vw, 44px);
  }

  h2 {
    font-size: clamp(29px, 9vw, 42px);
  }

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

  .sidebar {
    order: 2;
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
    padding: 18px;
  }

  .workspace {
    order: 1;
    padding: 14px;
    gap: 16px;
  }

  .lead-panel {
    padding: 22px 18px;
    box-shadow: none;
  }

  .lead-panel p {
    font-size: 16px;
  }

  .panel {
    padding: 18px;
  }

  .panel-head {
    align-items: center;
  }

  .timer {
    font-size: 46px;
  }

  .actions a,
  button {
    min-height: 44px;
  }

  .actions a {
    flex: 1 1 130px;
    justify-content: center;
  }

  .status-strip {
    width: 100%;
    flex-wrap: wrap;
  }

  #installButton,
  #packDate {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .vocab-grid,
  .context-list,
  .bilingual-item {
    grid-template-columns: 1fr;
    columns: 1;
  }

  .quiz-options label {
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .panel-head {
    gap: 10px;
  }

  h3 {
    font-size: 16px;
  }

  .vocab-card,
  .translation-item,
  .excerpt,
  .hint-stack p {
    padding: 12px;
  }

  .bilingual-item {
    gap: 8px;
  }
}
