:root {
  --paper: #f5f3ee;
  --card: #fffdf9;
  --ink: #1e2926;
  --muted: #6f7773;
  --line: #d9d8d1;
  --green: #1f5747;
  --green-dark: #153e34;
  --mint: #dce9df;
  --peach: #e7b9a6;
  --peach-light: #f4e2da;
  --shadow: 0 24px 70px rgba(28, 47, 41, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(231, 185, 166, 0.22), transparent 24rem),
    var(--paper);
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 110px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 64px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 25px;
  font-style: italic;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.status-pill {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.75);
  font-size: 12px;
}

.status-pill.ai {
  color: var(--green);
  border-color: #b4cbbd;
  background: #eef6f0;
}

.browser-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -28px 0 32px;
  padding: 15px 18px;
  border: 1px solid #dfad98;
  border-radius: 3px;
  color: #7f3e2c;
  background: var(--peach-light);
  font-size: 13px;
}

.browser-warning strong {
  flex: 0 0 auto;
}

.browser-warning span {
  color: #704c40;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: reveal 0.35s ease-out;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
}

.hero,
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

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

h1 {
  margin-bottom: 14px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(42px, 6vw, 70px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

h1 em {
  color: var(--green);
  font-weight: 500;
}

.hero-copy,
.page-heading > div > p:last-child {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.today-card {
  width: 250px;
  padding: 24px;
  border-radius: 4px 34px 4px 4px;
  color: white;
  background: var(--green);
  box-shadow: var(--shadow);
}

.today-card > span,
.today-card small {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.today-card strong {
  display: block;
  margin: 8px 0 16px;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 400;
}

.progress-track {
  height: 4px;
  margin-bottom: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--peach);
  transition: width 0.3s ease;
}

.practice-layout,
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
}

.import-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.import-tabs button {
  padding: 10px 16px;
  border: 0;
  border-radius: 99px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.import-tabs button.active {
  color: white;
  background: var(--green);
}

.import-panel {
  display: none;
}

.import-panel.active {
  display: block;
  animation: reveal 0.25s ease-out;
}

.batch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.import-help.light {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--card);
}

.import-help.light .eyebrow {
  color: var(--green);
}

.import-help.light p {
  color: var(--muted);
}

.preview-summary,
.import-result,
.file-preview {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 3px;
  background: var(--mint);
  color: var(--green-dark);
  line-height: 1.65;
}

.file-drop {
  position: relative;
  padding: 70px 30px;
  border: 2px dashed #b8c8c1;
  border-radius: 4px 40px 4px 4px;
  background: rgba(255, 253, 249, 0.65);
  text-align: center;
}

.file-drop.dragging {
  border-color: var(--green);
  background: #edf5f0;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-drop h2 {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 500;
}

.file-drop p {
  max-width: 620px;
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.7;
}

.file-drop small {
  display: block;
  margin-top: 14px;
  color: var(--muted);
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.import-result {
  border-left: 4px solid var(--green);
  background: #eaf4ed;
}

.practice-card,
.form-card {
  min-height: 430px;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgba(30, 41, 38, 0.08);
  border-radius: 4px 48px 4px 4px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  padding: 6px 10px;
  border-radius: 99px;
  color: var(--green);
  background: var(--mint);
  font-weight: 700;
}

.prompt-label {
  margin: 40px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

#question-chinese {
  max-width: 740px;
  margin-bottom: 12px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(27px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.35;
}

.context {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
}

.form-card label {
  display: block;
}

.form-card label > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.voice-answer {
  margin-top: 30px;
}

.voice-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mic-button {
  display: flex;
  width: 100%;
  min-height: 126px;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border: 1px solid #b9cbc4;
  border-radius: 4px 28px 4px 4px;
  color: var(--green);
  background: #eef5f0;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}

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

.mic-button.listening {
  color: #8c3e2b;
  border-color: var(--peach);
  background: var(--peach-light);
  box-shadow: 0 0 0 7px rgba(231, 185, 166, 0.18);
}

.mic-button.unsupported {
  cursor: not-allowed;
  opacity: 0.7;
}

.mic-icon {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--green);
}

.mic-button.listening .mic-icon {
  background: #a64d36;
  animation: pulse 1.25s infinite;
}

.mic-icon::before {
  position: absolute;
  top: 11px;
  left: 20px;
  width: 10px;
  height: 18px;
  border: 2px solid white;
  border-radius: 7px;
  content: "";
}

.mic-icon::after {
  position: absolute;
  top: 28px;
  left: 16px;
  width: 18px;
  height: 10px;
  border-bottom: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid white;
  border-radius: 0 0 12px 12px;
  content: "";
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 10px rgba(166, 77, 54, 0.14); }
}

.mic-button strong,
.mic-button small {
  display: block;
}

.mic-button strong {
  margin-bottom: 6px;
  font-size: 17px;
}

.mic-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.transcript-box {
  min-height: 82px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.5);
}

.transcript-box > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.transcript-box p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.transcript-box.has-text p {
  color: var(--ink);
}

.form-card label > span b {
  color: #b0563f;
}

.form-card label > span small {
  font-weight: 400;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  resize: vertical;
  padding: 18px;
  font-size: 17px;
  line-height: 1.6;
}

input,
select {
  height: 52px;
  padding: 0 15px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 87, 71, 0.1);
}

.practice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.button {
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-weight: 750;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  background: var(--green);
}

.button.primary:hover {
  background: var(--green-dark);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.button kbd {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  font: inherit;
  font-size: 10px;
}

.button.wide {
  width: 100%;
}

.side-note,
.import-help {
  align-self: start;
  padding: 28px 8px 28px 28px;
  border-left: 1px solid var(--line);
}

.note-number {
  color: var(--peach);
  font-family: Georgia, serif;
  font-size: 46px;
}

.side-note h3 {
  margin: 24px 0 10px;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}

.side-note p,
.import-help p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.page-heading h1 {
  font-size: clamp(38px, 5vw, 58px);
}

.count-badge {
  min-width: 120px;
  padding: 19px;
  border-radius: 50%;
  text-align: center;
  background: var(--mint);
}

.count-badge.warm {
  background: var(--peach-light);
}

.count-badge strong,
.count-badge span {
  display: block;
}

.count-badge strong {
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 500;
}

.count-badge span {
  color: var(--muted);
  font-size: 11px;
}

.form-card {
  min-height: 0;
  padding: 36px;
}

.form-card label {
  margin-bottom: 20px;
}

.import-help {
  border-left: 0;
  padding: 38px 30px;
  border-radius: 4px 34px 4px 4px;
  color: #fff;
  background: var(--green);
}

.import-help .eyebrow,
.import-help p {
  color: rgba(255, 255, 255, 0.7);
}

.import-help h2 {
  font-family: Georgia, serif;
  font-size: 31px;
  font-weight: 500;
}

.text-button {
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1px solid var(--peach);
  color: white;
  background: none;
  cursor: pointer;
}

.mistake-list {
  display: grid;
  gap: 15px;
}

.mistake-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
}

.mistake-score {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  color: #87442f;
  background: var(--peach-light);
  font-family: Georgia, serif;
  font-size: 22px;
}

.mistake-item h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.mistake-answer {
  margin-bottom: 8px;
  color: #9c4934;
  text-decoration: line-through;
}

.mistake-recommended {
  color: var(--green);
  font-weight: 700;
}

.mistake-reason {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.mistake-pattern {
  display: inline-block;
  margin: 8px 0 5px;
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--green-dark);
  background: var(--mint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.mistake-why {
  margin-bottom: 0;
  color: #705d35;
  font-size: 12px;
  line-height: 1.6;
}

.delete-mistake {
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.empty-list,
.empty-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2,
.empty-list h2 {
  color: var(--ink);
  font-family: Georgia, serif;
  font-weight: 500;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--green);
  font-size: 26px;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 20px;
  display: flex;
  width: min(640px, calc(100% - 28px));
  padding: 8px;
  border: 1px solid rgba(30, 41, 38, 0.09);
  border-radius: 5px;
  background: rgba(255, 253, 249, 0.93);
  box-shadow: 0 15px 50px rgba(28, 47, 41, 0.15);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.bottom-nav button {
  flex: 1;
  padding: 12px 10px;
  border: 0;
  border-radius: 3px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav button span {
  margin-right: 6px;
  font-family: Georgia, serif;
}

.bottom-nav button.active {
  color: #fff;
  background: var(--green);
}

.bottom-nav i {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  place-items: center;
  border-radius: 10px;
  background: var(--peach-light);
  color: #87442f;
  font-size: 10px;
  font-style: normal;
}

.feedback-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 33, 29, 0.58);
  backdrop-filter: blur(5px);
}

.feedback-card {
  width: min(610px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: clamp(26px, 5vw, 44px);
  border-radius: 4px 46px 4px 4px;
  background: var(--card);
  box-shadow: 0 35px 100px rgba(12, 29, 23, 0.3);
}

.feedback-top {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-bottom: 32px;
}

.score-ring {
  display: grid;
  flex: 0 0 auto;
  width: 90px;
  height: 90px;
  place-content: center;
  border: 8px solid var(--mint);
  border-radius: 50%;
  text-align: center;
}

.score-ring strong {
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-size: 10px;
}

.feedback-top h2 {
  margin-bottom: 5px;
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 500;
}

.feedback-top p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.feedback-section {
  padding: 17px 0;
  border-top: 1px solid var(--line);
}

.feedback-section > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.feedback-section p {
  margin-bottom: 0;
  line-height: 1.65;
}

.feedback-section.recommended p {
  color: var(--green);
  font-size: 18px;
  font-weight: 750;
}

.feedback-section.pattern p {
  padding: 11px 13px;
  border-radius: 3px;
  color: var(--green-dark);
  background: var(--mint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
}

.feedback-section.why p {
  color: #604d27;
}

.mistake-alert {
  margin: 5px 0 18px;
  padding: 12px 15px;
  border-radius: 3px;
  color: #7a402f;
  background: var(--peach-light);
  font-size: 12px;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 100;
  top: 24px;
  left: 50%;
  padding: 12px 18px;
  border-radius: 3px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.permission-guide {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 33, 29, 0.58);
  backdrop-filter: blur(5px);
}

.permission-guide article {
  position: relative;
  width: min(440px, 100%);
  padding: 34px;
  border-radius: 4px 38px 4px 4px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.permission-guide h2 {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 500;
}

.permission-guide article > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.guide-close {
  position: absolute;
  top: 13px;
  right: 15px;
  border: 0;
  color: var(--muted);
  background: none;
  font-size: 23px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    margin-bottom: 42px;
  }

  .status-pill {
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .browser-warning {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .today-card {
    width: 100%;
    border-radius: 3px 28px 3px 3px;
  }

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

  .import-tabs {
    overflow-x: auto;
  }

  .import-tabs button {
    flex: 0 0 auto;
  }

  .file-preview {
    align-items: stretch;
    flex-direction: column;
  }

  .side-note {
    display: none;
  }

  .practice-card,
  .form-card {
    padding: 26px 20px;
    border-radius: 3px 30px 3px 3px;
  }

  .practice-actions {
    justify-content: stretch;
  }

  .practice-actions .button {
    flex: 1;
  }

  .button kbd {
    display: none;
  }

  .count-badge {
    align-self: flex-start;
  }

  .mistake-item {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .delete-mistake {
    grid-column: 2;
    justify-self: start;
  }

  .bottom-nav button span {
    display: none;
  }
}
