@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --ink: #f1f6f3;
  --muted: #91a29b;
  --paper: #070b0a;
  --card: #101715;
  --line: #28342f;
  --green: #75d8b0;
  --green-dark: #9aebcc;
  --green-soft: #172a23;
  --lime: #dcef64;
  --coral: #ff8069;
  --coral-soft: #301a17;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 94% 2%, rgba(117, 216, 176, 0.13), transparent 25rem),
    radial-gradient(circle at 2% 72%, rgba(78, 143, 116, 0.12), transparent 27rem),
    var(--paper);
  font-family: "DM Sans", "Noto Sans TC", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 53, 45, 0.12);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #07110d;
  background: var(--green);
  border-radius: 12px 12px 12px 4px;
  font-size: 23px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(28, 116, 92, 0.22);
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -0.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; letter-spacing: 0.11em; }

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

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 3px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.save-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(117, 216, 176, 0.7);
}

.save-status.pulse::before { animation: savePulse 500ms ease; }
.save-status.error { color: var(--coral); }
.save-status.error::before { background: var(--coral); box-shadow: 0 0 10px rgba(255, 128, 105, 0.65); }

.icon-button, .close-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(17, 24, 22, 0.82);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-weight: 700;
}

.icon-button.muted { color: #607069; background: #111714; }

.manage-button, .submit-button {
  border: 0;
  color: #07120e;
  background: var(--green);
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.manage-button { padding: 12px 17px; }
.manage-button span { margin-right: 4px; }
.manage-button:hover, .submit-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.lookup-top-button { padding: 10px 13px; color: var(--green); background: transparent; border: 1px solid #476158; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.lookup-top-button:hover { color: #07120e; background: var(--green); border-color: var(--green); }

.intro {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  padding: 58px 0 34px;
}

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

.intro h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(38px, 6vw, 67px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.intro > div > p:last-child {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.streak-card {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border: 1px solid rgba(28, 116, 92, 0.14);
  background: rgba(16, 23, 21, 0.84);
  border-radius: 18px;
}

.streak-flame {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--green-dark);
  background: var(--lime);
  border-radius: 50%;
}

.streak-card small, .streak-card strong { display: block; }
.streak-card small { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.streak-card strong { font-size: 18px; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  margin-bottom: 22px;
}

.mode-panel, .stats-panel {
  background: rgba(15, 21, 19, 0.9);
  border: 1px solid rgba(43, 56, 51, 0.9);
  border-radius: 24px;
}

.mode-panel { padding: 25px; }
.section-heading > div, .practice-heading > div { display: flex; align-items: flex-start; gap: 12px; }

.step-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.section-heading h2, .practice-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.section-heading p, .practice-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.mode-tab {
  min-height: 105px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: #0b100f;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border 150ms ease, background 150ms ease, transform 150ms ease;
}

.mode-tab:hover { transform: translateY(-2px); border-color: #526b61; }
.mode-tab.active { background: var(--green-soft); border: 1.5px solid var(--green); }
.mode-tab > * { display: block; }
.mode-tab .mode-icon { margin-bottom: 11px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.mode-icon i { margin: 0 3px; font-style: normal; }
.mode-tab strong { font-size: 13px; }
.mode-tab small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.stats-panel { display: flex; flex-direction: column; justify-content: center; padding: 14px 23px; }
.stat { display: flex; align-items: center; gap: 13px; padding: 13px 0; }
.stat + .stat { border-top: 1px solid var(--line); }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; font-weight: 700; }
.correct-icon { color: var(--green); background: var(--green-soft); }
.accuracy-icon { color: #f0d56d; background: #2a2513; }
.review-icon { color: #ff9a87; background: var(--coral-soft); }
.stat small, .stat strong { display: block; }
.stat small { color: var(--muted); font-size: 10px; }
.stat strong { margin-top: 1px; font-size: 20px; }

.practice-section { margin-top: 18px; }
.practice-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 13px; }
.practice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 13px; }
.focus-tabs, .kind-tabs, .answer-style-tabs { display: flex; gap: 4px; padding: 4px; background: #0b100f; border: 1px solid var(--line); border-radius: 11px; }
.focus-tab, .kind-tab, .answer-style-tab { padding: 6px 10px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
.focus-tab:hover, .kind-tab:hover, .answer-style-tab:hover { color: var(--ink); }
.focus-tab.active, .kind-tab.active, .answer-style-tab.active { color: var(--green); background: var(--green-soft); }
.focus-tab span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 3px; color: #07120e; background: var(--green); border-radius: 9px; font-size: 9px; }
.reset-button { color: var(--muted); background: transparent; border: 0; font-size: 11px; cursor: pointer; }
.reset-button:hover { color: var(--green); }

.review-queue {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  margin: 0 0 13px;
  padding: 15px 18px;
  background: linear-gradient(135deg, rgba(27, 39, 34, 0.92), rgba(13, 20, 17, 0.96));
  border: 1px solid rgba(73, 99, 87, 0.75);
  border-radius: 17px;
}
.review-queue-copy { display: flex; align-items: flex-start; gap: 11px; }
.review-queue h3 { margin: 0; font-size: 14px; }
.review-queue p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.review-queue-counts { display: flex; gap: 9px; }
.review-queue-counts span { padding: 6px 8px; color: var(--muted); background: #0b100f; border-radius: 8px; font-size: 10px; white-space: nowrap; }
.review-queue-counts strong { color: var(--ink); font-size: 13px; }
.review-queue-button { padding: 9px 12px; color: #07120e; background: var(--green); border: 0; border-radius: 10px; font-size: 11px; font-weight: 800; cursor: pointer; }
.review-queue-button:hover { filter: brightness(1.08); }
.review-queue-button:disabled { color: var(--muted); background: #26332d; cursor: default; }

.mastery-notice {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 13px;
  padding: 14px 18px;
  color: #d8f8e9;
  background: linear-gradient(135deg, rgba(31, 91, 68, 0.72), rgba(16, 45, 35, 0.86));
  border: 1px solid rgba(117, 216, 176, 0.48);
  border-radius: 17px;
  box-shadow: 0 12px 30px rgba(3, 17, 12, 0.18);
}
.mastery-notice-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: #07120e;
  background: var(--green);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
}
.mastery-notice strong { display: block; font-size: 14px; }
.mastery-notice p { margin: 3px 0 0; color: #a9cfc0; font-size: 11px; }

.practice-card {
  position: relative;
  overflow: hidden;
  padding: 28px 42px 25px;
  background: var(--card);
  border: 1px solid rgba(43, 56, 51, 0.95);
  border-radius: 27px;
  box-shadow: var(--shadow);
}

.card-progress { position: absolute; inset: 0 0 auto; height: 4px; background: #1c2622; }
.card-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--green), #85b970); transition: width 300ms ease; }
.card-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.question-badge { padding: 6px 9px; color: var(--green); background: var(--green-soft); border-radius: 8px; font-weight: 700; }

.question-area { padding: 30px 0 28px; text-align: center; }
.question-label { margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: 0.05em; }
.prompt-row { display: flex; justify-content: center; align-items: center; gap: 10px; }
.prompt-row h3 { margin: 0; font-size: clamp(32px, 5vw, 49px); line-height: 1.25; letter-spacing: -0.04em; }
.speak-button { display: grid; place-items: center; width: 36px; height: 36px; color: var(--green); background: var(--green-soft); border: 0; border-radius: 50%; cursor: pointer; }
.hint-line { min-height: 21px; margin: 9px 0 0; color: var(--green); font-size: 13px; font-weight: 600; }
.word-progress { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.word-progress[data-status="weak"] { color: #ff9a87; }
.word-progress[data-status="mastered"] { color: var(--green); }

.word-analysis { max-width: 680px; margin: 15px auto 0; text-align: left; }
.word-analysis summary {
  display: flex;
  width: fit-content;
  margin: 0 auto;
  padding: 7px 11px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.word-analysis summary::-webkit-details-marker { display: none; }
.analysis-gsat {
  margin: 12px 0 7px;
  padding: 9px 11px;
  color: #dcebd8;
  background: rgba(117, 168, 98, 0.1);
  border: 1px solid rgba(117, 168, 98, 0.22);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}
.analysis-gsat-reason { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.analysis-root-heading {
  margin: 12px 0 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.word-analysis summary:hover { color: #b8f2d7; }
.analysis-toggle-icon { margin-left: 7px; transition: transform 160ms ease; }
.word-analysis[open] .analysis-toggle-icon { transform: rotate(45deg); }
.word-analysis-content {
  margin-top: 10px;
  padding: 13px 15px;
  color: #cbd8d3;
  background: #0b1210;
  border: 1px solid #2b3934;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.7;
}
.analysis-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.analysis-meta span { padding: 3px 7px; color: var(--muted); background: #15201c; border-radius: 6px; }
.word-analysis-content p { margin: 8px 0 0; text-align: center; overflow-wrap: anywhere; }

#answerForm { max-width: 820px; margin: 0 auto; }
#answerForm label { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: 11px; }
.answer-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }

input {
  width: 100%;
  min-width: 0;
  padding: 15px 17px;
  color: var(--ink);
  background: #0a100e;
  border: 1px solid #35453f;
  border-radius: 13px;
  outline: 0;
  transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus { background: #0d1512; border-color: var(--green); box-shadow: 0 0 0 4px rgba(117, 216, 176, 0.1); }
input::placeholder { color: #5f7069; }
input.correct { border-color: var(--green); background: #10251c; }
input.incorrect { border-color: var(--coral); background: #281512; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.submit-button { min-width: 175px; padding: 0 19px; box-shadow: 0 9px 18px rgba(28, 116, 92, 0.17); }
.submit-button kbd { margin-left: 10px; color: rgba(7, 18, 14, 0.82); background: rgba(7, 18, 14, 0.1); border-color: rgba(7, 18, 14, 0.2); }

kbd {
  padding: 2px 5px;
  font-family: inherit;
  font-size: 9px;
  background: #19221f;
  border: 1px solid #34433e;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(23, 53, 45, 0.1);
}

.feedback { min-height: 26px; padding: 7px 2px 0; font-size: 12px; font-weight: 600; }
.feedback.success { color: var(--green); }
.feedback.error { color: var(--coral); }
.feedback.info { color: #d9c47a; }
.feedback.loading { color: var(--muted); }

.choice-answer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 820px; margin: 0 auto; }
.choice-option { display: flex; align-items: center; min-height: 58px; padding: 12px 14px; color: var(--ink); background: #0a100e; border: 1px solid #35453f; border-radius: 13px; text-align: left; transition: border 150ms ease, background 150ms ease, transform 150ms ease; }
.choice-option:hover:not(:disabled) { border-color: var(--green); background: #102019; transform: translateY(-1px); }
.choice-option:disabled { cursor: default; opacity: 0.8; }
.choice-option.correct { color: var(--green); border-color: var(--green); background: #10251c; }
.choice-option.incorrect { color: #ffae9f; border-color: var(--coral); background: #281512; }
.choice-option-key { display: grid; place-items: center; flex: 0 0 auto; width: 23px; height: 23px; margin-right: 10px; color: var(--muted); background: #19221f; border-radius: 7px; font-size: 11px; font-weight: 700; }
.choice-option-text { overflow-wrap: anywhere; }

.card-footer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 15px; align-items: center; padding-top: 18px; border-top: 1px solid var(--line); }
.card-footer p { margin: 0; color: #83928c; font-size: 10px; }
.text-button { padding: 5px 0; color: var(--green); background: transparent; border: 0; font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--green-dark); }
.text-button:disabled { color: #66736e; cursor: not-allowed; opacity: 0.75; }
.text-button:disabled:hover { color: #66736e; }
.skip-button { justify-self: end; color: var(--muted); }
.danger-text { color: #ff9a87; }

.empty-state { padding: 55px 20px; text-align: center; background: #101715; border: 1px dashed #3a4c45; border-radius: 24px; }
.empty-state > span { display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 14px; color: var(--green); background: var(--green-soft); border-radius: 16px; font-weight: 700; }
.empty-state h3 { margin: 0; }
.empty-state p { color: var(--muted); font-size: 13px; }

.ai-check-section { margin-top: 26px; }
.ai-check-card { padding: 23px 28px 20px; background: rgba(16, 23, 21, 0.9); border: 1px solid rgba(43, 56, 51, 0.9); border-radius: 24px; }
.ai-check-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.ai-check-button { min-height: 48px; min-width: 140px; }
.ai-check-button:disabled { cursor: wait; opacity: 0.7; transform: none; }
.ai-check-result { min-height: 23px; margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ai-check-result.success { color: var(--green); }
.ai-check-result.error { color: var(--coral); }
.ai-check-result.loading { color: #f0d56d; }

footer { display: flex; justify-content: space-between; padding: 25px 4px 35px; color: #6f8179; font-size: 10px; }
footer p { margin: 0; }

dialog {
  width: min(720px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  color: var(--ink);
  background: #101715;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 35px 90px rgba(14, 45, 36, 0.28);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(5px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 27px 29px 22px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 25px; }
.dialog-header > div > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.close-button { width: 34px; height: 34px; border-radius: 10px; font-size: 22px; }

.add-word-form { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; padding: 22px 29px 38px; background: #0b110f; }
.field label { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 10px; }
.field input { padding: 12px 13px; }
.field-tip { display: block; margin: 7px 0 0 2px; color: #667970; font-size: 9px; }
.add-button { align-self: start; min-width: auto; height: 43px; margin-top: 21px; padding: 0 16px; }
.form-message { position: absolute; bottom: 10px; left: 30px; margin: 0; color: var(--coral); font-size: 10px; }
.form-message.success { color: var(--green); }
.word-lookup { padding: 20px 29px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.word-lookup-heading { display: flex; align-items: center; }
.word-lookup-heading .eyebrow { margin: 0 0 3px; }
.word-lookup-heading h3 { margin: 0; font-size: 16px; }
.word-lookup-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 12px; }
.word-lookup-form input { padding: 11px 13px; }
.lookup-button, .forget-button { min-height: 42px; padding: 0 14px; border: 0; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.lookup-button { color: #07120e; background: var(--green); }
.lookup-button:hover { background: #9be0bd; }
.word-lookup-result { min-height: 22px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.word-lookup-result.not-found { color: #ff9a87; }
.word-lookup-count { margin: 0 0 7px; color: var(--muted); }
.word-lookup-list { display: grid; gap: 6px; max-height: 245px; overflow-y: auto; padding-right: 3px; }
.word-lookup-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; background: #0b1210; border: 1px solid #2b3934; border-radius: 7px; }
.word-lookup-item.weak { border-color: rgba(255, 154, 135, 0.45); }
.word-lookup-summary { min-width: 0; }
.word-lookup-summary strong, .word-lookup-summary span { display: block; overflow-wrap: anywhere; }
.word-lookup-summary strong { color: var(--ink); font-size: 13px; }
.word-lookup-summary span { margin-top: 3px; }
.forget-button { flex: 0 0 auto; color: #fff; background: #b94e42; }
.forget-button:hover { background: var(--coral); }
.cloud-sync { padding: 18px 29px; border-bottom: 1px solid var(--line); background: rgba(117, 216, 176, 0.03); }
.cloud-sync-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cloud-sync-heading .eyebrow { margin: 0 0 3px; }
.cloud-sync-heading h3 { margin: 0; font-size: 16px; }
.cloud-sync-desc { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.cloud-sync-badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.cloud-sync-badge.error { background: var(--coral-soft); color: var(--coral); }
.cloud-sync-form { margin-top: 10px; }
.cloud-sync-input-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cloud-sync-input-row input { flex: 1; min-width: 140px; padding: 10px 12px; }
.cloud-sync-input-row .text-button { padding: 8px 10px; font-size: 11px; }
.word-list-heading { display: flex; justify-content: space-between; align-items: center; padding: 20px 29px 10px; font-size: 12px; gap: 10px; flex-wrap: wrap; }
.backup-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.backup-actions .text-button { padding: 4px 8px; font-size: 11px; }
.word-list { max-height: 335px; overflow: auto; padding: 0 21px 24px; }
.word-item { display: grid; grid-template-columns: minmax(0, 1fr) 125px auto; align-items: center; gap: 15px; padding: 12px 9px; border-bottom: 1px solid var(--line); }
.word-copy { min-width: 0; }
.word-copy strong, .word-copy span { display: block; }
.word-copy strong { overflow-wrap: anywhere; font-size: 13px; }
.word-copy span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.word-history { text-align: right; }
.word-history span, .word-history small { display: block; }
.word-history span { color: var(--ink); font-size: 11px; font-weight: 700; }
.word-history small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.word-history.weak small { color: #ff9a87; }
.word-history.mastered small { color: var(--green); }
.delete-word { width: 30px; height: 30px; color: #ff9a87; background: var(--coral-soft); border: 0; border-radius: 9px; cursor: pointer; }
.delete-word:hover { color: #fff; background: var(--coral); }

.hidden { display: none !important; }

@keyframes savePulse {
  50% { transform: scale(1.7); box-shadow: 0 0 16px rgba(117, 216, 176, 0.9); }
}

@media (max-width: 800px) {
  .dashboard { grid-template-columns: 1fr; }
  .stats-panel { flex-direction: row; padding: 8px 18px; }
  .stat { flex: 1; }
  .stat + .stat { padding-left: 18px; border-top: 0; border-left: 1px solid var(--line); }
  .card-footer { grid-template-columns: 1fr 1fr; }
  .card-footer p { display: none; }
  .practice-heading { align-items: flex-start; }
  .practice-actions { align-items: flex-end; flex-direction: column-reverse; }
  .add-word-form { grid-template-columns: 1fr 1fr; }
  .add-button { grid-column: 1 / -1; }
  .ai-check-form { grid-template-columns: 1fr 1fr; }
  .ai-check-button { grid-column: 1 / -1; }
}

@media (max-width: 570px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 72px; }
  .brand strong { font-size: 14px; }
  .manage-button { padding: 11px 12px; font-size: 12px; }
  .lookup-top-button { padding: 9px 10px; }
  .save-status { display: none; }
  .intro { align-items: flex-start; padding: 38px 2px 25px; }
  .intro h1 { font-size: 41px; }
  .intro > div > p:last-child { font-size: 13px; }
  .streak-card { display: none; }
  .mode-panel { padding: 19px; }
  .mode-tabs { grid-template-columns: 1fr; }
  .mode-tab { min-height: auto; display: grid; grid-template-columns: 68px 1fr; align-items: center; }
  .mode-tab .mode-icon { grid-row: 1 / 3; margin: 0; }
  .review-queue { grid-template-columns: 1fr; gap: 10px; }
  .review-queue-counts { flex-wrap: wrap; }
  .stats-panel { padding: 8px 10px; }
  .stat { gap: 7px; }
  .stat + .stat { padding-left: 8px; }
  .stat-icon { width: 29px; height: 29px; }
  .stat strong { font-size: 16px; }
  .practice-card { padding: 24px 18px 20px; }
  .question-area { padding: 27px 0 24px; }
  .word-analysis-content { padding: 12px; }
  .answer-row { grid-template-columns: 1fr; }
  .choice-answer { grid-template-columns: 1fr; }
  .submit-button { min-height: 49px; }
  .practice-actions > .reset-button { display: none; }
  .focus-tab, .kind-tab, .answer-style-tab { padding-inline: 8px; }
  footer { display: block; text-align: center; line-height: 2; }
  footer span { display: none; }
  .add-word-form { grid-template-columns: 1fr; padding-inline: 20px; }
  .word-lookup { padding-inline: 20px; }
  .word-lookup-item { align-items: flex-start; flex-direction: column; }
  .forget-button { width: 100%; }
  .add-button { grid-column: auto; margin-top: 0; }
  .ai-check-card { padding: 20px; }
  .ai-check-form { grid-template-columns: 1fr; }
  .ai-check-button { grid-column: auto; }
  .dialog-header { padding-inline: 20px; }
  .word-list-heading { padding-inline: 20px; }
  .word-item { grid-template-columns: minmax(0, 1fr) auto; }
  .word-history { grid-row: 2; text-align: left; }
  .word-history span, .word-history small { display: inline; }
  .word-history small { margin-left: 7px; }
  .delete-word { grid-column: 2; grid-row: 1 / 3; }
}

@media (prefers-reduced-motion: no-preference) {
  .practice-card { animation: cardIn 450ms ease both; }
  @keyframes cardIn { from { opacity: 0; transform: translateY(12px); } }
}
