:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f4;
  --ink: #18221f;
  --muted: #66706d;
  --line: #d9dfdd;
  --green: #1f6f5b;
  --green-2: #e4f2ec;
  --red: #b44335;
  --amber: #b07a20;
  --blue: #376b95;
  --shadow: 0 16px 48px rgba(24, 34, 31, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

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

button.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

button.wide {
  width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 18px 12px;
}

.brand-mark,
.rail-nav a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  text-decoration: none;
}

.brand-mark {
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}

.rail-nav {
  display: grid;
  gap: 12px;
}

.rail-nav a {
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 700;
}

.rail-nav a:hover {
  color: var(--green);
}

.workspace {
  width: min(1180px, calc(100vw - 72px));
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.masthead {
  min-height: min(520px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 28px;
  align-items: center;
  padding: 0 0 28px;
}

.masthead-copy {
  display: grid;
  gap: 18px;
}

.eyebrow,
.panel-kicker,
.material-label {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 136px));
  gap: 10px;
}

.quick-stats div,
.growth-grid div {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.quick-stats span,
.growth-grid strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
  font-weight: 850;
}

.quick-stats small,
.growth-grid span {
  color: var(--muted);
}

.masthead-visual {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: var(--surface);
  aspect-ratio: 4 / 3;
}

.masthead-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-grid,
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.56fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(24, 34, 31, 0.05);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.mode-pill,
.status-dot,
.source-strip span,
.news-tag,
.topic-card span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-pill {
  background: var(--green-2);
  color: var(--green);
}

.status-dot {
  background: #f5e7dd;
  color: var(--red);
}

.status-dot.is-done {
  background: var(--green-2);
  color: var(--green);
}

.timer-display {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #eef5f1);
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-size: clamp(52px, 11vw, 96px);
  font-weight: 850;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.segmented button.is-active {
  border-color: var(--green);
  background: var(--green-2);
  color: var(--green);
  font-weight: 800;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-row button {
  padding: 0 16px;
}

.action-row.split {
  justify-content: space-between;
}

.panel-note {
  min-height: 86px;
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.source-strip span {
  background: var(--surface-2);
  color: var(--muted);
}

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

.news-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.news-card p {
  color: var(--muted);
  line-height: 1.7;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.news-tag {
  background: #e8eef4;
  color: var(--blue);
}

.favorite-button.is-active {
  border-color: var(--amber);
  background: #fff3d6;
  color: #8a5d12;
}

blockquote {
  margin: 0;
  min-height: 232px;
  display: flex;
  align-items: center;
  border-left: 4px solid var(--red);
  padding: 18px;
  background: #fff8f6;
  color: #41251f;
  line-height: 1.9;
  font-size: 20px;
  font-weight: 650;
}

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

.topic-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.topic-card p {
  color: var(--muted);
  line-height: 1.7;
}

.topic-card span {
  background: var(--green-2);
  color: var(--green);
}

.practice-card {
  display: grid;
  gap: 12px;
}

.practice-card p {
  color: var(--muted);
  line-height: 1.75;
}

.practice-card label {
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.7;
  color: var(--ink);
  background: #fbfcfd;
}

textarea:focus {
  outline: 3px solid rgba(31, 111, 91, 0.16);
  border-color: var(--green);
}

.reference-answer {
  border: 1px solid #efd4c9;
  border-radius: 8px;
  padding: 12px;
  background: #fff8f6;
}

.growth-panel {
  margin-top: 18px;
}

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

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    z-index: 5;
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-nav {
    display: flex;
    gap: 8px;
  }

  .workspace {
    width: min(100%, 760px);
    padding: 20px 16px 42px;
  }

  .masthead,
  .dashboard-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    min-height: 0;
  }

  .masthead-visual {
    aspect-ratio: 16 / 9;
  }

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

@media (max-width: 540px) {
  .quick-stats,
  .growth-grid,
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .action-row button {
    flex: 1 1 120px;
  }

  blockquote {
    min-height: 160px;
    font-size: 18px;
  }
}

/* Product upgrade: zero-cost daily study workflow */
a {
  color: var(--green);
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-switch button,
.backup-actions button,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

.mode-switch button.is-active {
  border-color: var(--green);
  background: var(--green-2);
  color: var(--green);
  font-weight: 800;
}

.morning-card {
  margin-bottom: 18px;
}

.daily-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.daily-card-grid article,
.archive-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 16px;
}

.daily-card-grid p,
.daily-card-grid li,
.archive-card p {
  color: var(--muted);
  line-height: 1.7;
}

.daily-card-grid ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.study-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.flow-step {
  height: auto;
  min-height: 92px;
  padding: 12px;
  text-align: left;
}

.flow-step strong,
.flow-step span {
  display: block;
}

.flow-step span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.flow-step.is-done {
  border-color: var(--green);
  background: var(--green-2);
}

.share-preview {
  display: grid;
  gap: 12px;
  max-width: 360px;
  margin-top: 16px;
}

.share-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.share-preview[hidden] {
  display: none;
}

.archive-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

#importData {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 920px) {
  .daily-card-grid,
  .study-flow {
    grid-template-columns: 1fr;
  }
}
