:root {
  --paper: #f6f7f2;
  --surface: #ffffff;
  --surface-soft: #eef3ec;
  --ink: #17211b;
  --muted: #667068;
  --line: #dce2dc;
  --green: #2f6b4f;
  --green-dark: #214d39;
  --green-soft: #dcebe1;
  --amber: #b97822;
  --amber-soft: #fff1d8;
  --red: #b94b46;
  --red-soft: #fbe6e3;
  --blue: #366895;
  --blue-soft: #e4eff9;
  --shadow: 0 20px 60px rgba(34, 55, 42, 0.1);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 5% 0%, rgba(188, 219, 199, 0.42), transparent 34rem),
    radial-gradient(circle at 100% 30%, rgba(242, 218, 167, 0.2), transparent 32rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(47, 107, 79, 0.24);
  outline-offset: 3px;
}

#app:focus {
  outline: none;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(223, 228, 243, 0.82);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 38px rgba(34, 55, 42, 0.07);
  backdrop-filter: blur(18px);
  gap: 28px;
}

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

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

.level-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.level-switch button {
  min-width: 50px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.level-switch button[aria-pressed="true"] {
  color: white;
  background: var(--green);
  background: var(--green);
  box-shadow: 0 5px 12px rgba(47, 107, 79, 0.2);
}

.app-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-tools[hidden] {
  display: none;
}

.app-tool-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.app-tool-button:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.app-tool-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.cloud-status {
  max-width: 112px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-dialog {
  width: min(720px, calc(100% - 24px));
  max-height: min(88dvh, 900px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(23, 33, 27, 0.3);
}

.manual-dialog::backdrop {
  background: rgba(16, 26, 20, 0.54);
  backdrop-filter: blur(5px);
}

.manual-dialog-head,
.manual-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  background: white;
}

.manual-dialog-head {
  border-bottom: 1px solid var(--line);
}

.manual-dialog-head small {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.manual-dialog-head h2 {
  margin: 3px 0 0;
  font-size: 25px;
}

.manual-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.manual-dialog-body {
  max-height: calc(min(88dvh, 900px) - 166px);
  padding: 6px 24px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.manual-dialog-body section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.manual-dialog-body section:last-child {
  border-bottom: 0;
}

.manual-dialog-body h3 {
  margin: 0 0 9px;
  font-size: 17px;
}

.manual-dialog-body p,
.manual-dialog-body li {
  color: #566159;
  font-size: 14px;
  line-height: 1.75;
}

.manual-dialog-body p {
  margin: 7px 0 0;
}

.manual-dialog-body ol,
.manual-dialog-body ul {
  margin: 7px 0 0;
  padding-left: 22px;
}

.manual-key-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.manual-key-grid span {
  padding: 10px;
  border-radius: 10px;
  color: var(--green-dark);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 750;
}

.manual-key-grid kbd {
  display: inline-grid;
  min-width: 28px;
  min-height: 25px;
  margin-right: 4px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid #a9c2b0;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: white;
  font: 800 11px/1 "Segoe UI", sans-serif;
}

.manual-dialog-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.manual-dialog-foot .button {
  width: auto;
  min-width: 120px;
}

.account-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 28px 90px rgba(23, 33, 27, 0.28);
}

.account-dialog::backdrop {
  background: rgba(16, 26, 20, 0.52);
  backdrop-filter: blur(5px);
}

.account-card {
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: var(--surface);
}

.account-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.account-brand > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: white;
  background: var(--green);
  font: 700 23px/1 Georgia, serif;
  box-shadow: 0 9px 22px rgba(47, 107, 79, 0.22);
}

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

.account-brand strong {
  letter-spacing: 0.06em;
}

.account-brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.account-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.account-tabs button.active {
  color: var(--green-dark);
  background: white;
  box-shadow: 0 5px 15px rgba(34, 55, 42, 0.08);
}

.account-message,
.account-note,
.account-help {
  color: var(--muted);
  line-height: 1.65;
}

.account-message {
  min-height: 26px;
  margin: 14px 0 10px;
  font-size: 13px;
}

.account-message.error {
  color: var(--red);
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
}

.account-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: white;
}

.account-form input:focus {
  border-color: var(--green);
}

.account-form .button-primary {
  margin-top: 4px;
}

.account-signed > p:first-child {
  margin: 12px 0 5px;
  font-size: 18px;
}

.account-note {
  margin: 0 0 20px;
  font-size: 13px;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.account-actions .button:last-child {
  grid-column: 1 / -1;
}

.account-actions .button {
  min-height: 42px;
  padding: 0 12px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.account-actions .account-danger {
  color: #8c342f;
  background: var(--red-soft);
}

.account-help {
  margin: 18px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--green);
  box-shadow: 0 8px 22px rgba(47, 107, 79, 0.22);
  font: 700 22px/1 Georgia, serif;
}

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

.brand strong {
  font-size: 16px;
  letter-spacing: 0.035em;
}

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

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(223, 228, 243, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
}

.main-nav button,
.main-nav a {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.main-nav button:hover,
.main-nav button[aria-current="page"],
.main-nav a:hover {
  color: var(--green-dark);
  background: var(--surface-soft);
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: white;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}

.storage-warning {
  margin: 2px 0 18px;
  padding: 12px 16px;
  border: 1px solid #edc58a;
  border-radius: 12px;
  background: #fff6e7;
  color: #754a13;
  font-size: 14px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 46px;
  align-items: center;
  min-height: 570px;
  padding: clamp(42px, 7vw, 82px);
  border: 1px solid rgba(220, 226, 220, 0.92);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 246, 0.94));
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(220, 235, 225, 0.58);
  pointer-events: none;
}

.hero::before {
  content: "";
  position: absolute;
  top: -95px;
  left: 38%;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: rgba(188, 219, 199, 0.18);
  filter: blur(2px);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 18px;
  padding: 7px 11px;
  border: 1px solid #c9dccf;
  border-radius: 999px;
  color: var(--green);
  background: rgba(238, 247, 241, 0.82);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h1,
.study-heading h1 {
  margin: 0;
  letter-spacing: -0.045em;
}

.hero h1 {
  max-width: 610px;
  color: var(--ink);
  font: 850 clamp(42px, 5.8vw, 70px)/1.08 "Segoe UI Variable", "Segoe UI", "PingFang SC", sans-serif;
  letter-spacing: -0.065em;
}

.hero-copy {
  max-width: 570px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.high-pass-progress {
  margin: 16px 0 0;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
}

.high-pass-notice {
  display: grid;
  gap: 9px;
  max-width: 570px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #b8d6c3;
  border-radius: 16px;
  background: var(--green-soft);
}

.high-pass-notice strong {
  color: var(--green-dark);
  font-size: 18px;
}

.high-pass-notice span {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.high-pass-notice .button {
  width: fit-content;
  margin-top: 4px;
}

.resume-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid #c9dccf;
  border-radius: 16px;
  background: var(--green-soft);
}

.resume-panel strong,
.resume-panel span {
  display: block;
}

.resume-panel span {
  margin-top: 4px;
  color: var(--green-dark);
  font-size: 13px;
}

.setup-card {
  position: relative;
  z-index: 1;
  padding: 30px;
  border: 1px solid rgba(220, 226, 220, 0.95);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 55px rgba(34, 55, 42, 0.1);
  backdrop-filter: blur(12px);
}

.setup-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.setup-card > p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
}

.choice-group {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.choice-group legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

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

.segmented.counts {
  grid-template-columns: repeat(5, 1fr);
}

.choice-pill {
  position: relative;
}

.choice-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.choice-pill span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fbfcfa;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: 0.16s ease;
}

.choice-pill input:checked + span {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px var(--green), 0 6px 14px rgba(47, 107, 79, 0.1);
}

.choice-pill input:focus-visible + span {
  outline: 3px solid rgba(47, 107, 79, 0.2);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  width: 100%;
  color: white;
  background: var(--green);
  box-shadow: 0 10px 22px rgba(47, 107, 79, 0.2);
}

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

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.home-frequent-button {
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  border-color: #c6d9cc;
  color: var(--green-dark);
  background: var(--green-soft);
}

.home-frequent-button small {
  color: var(--muted);
  font-size: 11px;
}

.button-compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.record-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.record-tools button {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.record-tools button:hover {
  color: var(--green-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.record-tools .clear-records-button {
  color: #9b4944;
}

.record-tools .clear-records-button:hover {
  color: #752e2a;
}

.hero-stats {
  display: flex;
  gap: 26px;
  margin-top: 36px;
}

.hero-stat {
  min-width: 92px;
  padding: 12px 14px;
  border: 1px solid rgba(222, 226, 243, 0.9);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.66);
}

.hero-stat strong,
.hero-stat span {
  display: block;
}

.hero-stat strong {
  color: var(--green-dark);
  font: 800 25px/1 "Segoe UI Variable", "Segoe UI", sans-serif;
}

.hero-stat span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.study-layout {
  max-width: 880px;
  margin: 30px auto 0;
}

.study-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.study-heading h1 {
  font-size: 20px;
}

.progress-copy {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde4de;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.24s ease;
}

.study-practice-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.word-card {
  position: relative;
  min-height: 430px;
  padding: clamp(34px, 7vw, 70px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.word-card-label {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.study-add-frequent {
  position: absolute;
  top: 24px;
  right: 24px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c6d9cc;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.study-add-frequent:hover:not(:disabled) {
  border-color: var(--green);
  background: #cfe4d6;
}

.study-add-frequent:disabled {
  cursor: default;
  opacity: 0.56;
}

.study-remove-frequent {
  color: #93463f;
  border-color: #e5c7c3;
  background: #fbefed;
}

.study-remove-frequent:hover:not(:disabled) {
  border-color: #bb736b;
  background: #f5dedb;
}

.frequent-undo-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--green-soft);
  font-size: 14px;
}

.frequent-undo-notice span { min-width: 0; overflow-wrap: anywhere; }
.frequent-undo-notice button { flex-shrink: 0; }

.word-text {
  display: block;
  width: 100%;
  min-height: 105px;
  margin: 0;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
  text-align: center;
  transform-origin: center;
  font: 600 clamp(42px, 8vw, 80px)/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -0.035em;
}

.word-phonetic {
  margin: 4px auto 0;
  color: var(--green-dark);
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.meaning-wrap {
  max-width: 660px;
  margin: 30px auto 0;
}

.meaning-panel {
  padding: 20px 24px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--surface-soft);
  animation: reveal 0.22s ease-out;
}

.meaning-panel.know {
  border-color: #b9d7c3;
  background: var(--green-soft);
  color: var(--green-dark);
}

.meaning-panel.unknown {
  border-color: #edc1bd;
  background: var(--red-soft);
  color: #7f302c;
}

.meaning-panel.unlearned {
  border-color: #efd39f;
  background: var(--amber-soft);
  color: #70480f;
}

.meaning-panel.know small,
.meaning-panel.unknown small,
.meaning-panel.unlearned small {
  color: currentColor;
  opacity: 0.72;
}

.correct-to-wrong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #9a514c;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.correct-to-wrong:hover {
  background: var(--red-soft);
  color: #7f302c;
}

.correction-row {
  display: flex;
  justify-content: flex-end;
  min-height: 38px;
  padding-top: 6px;
}

.meaning-panel small,
.meaning-panel strong {
  display: block;
}

.meaning-panel small {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.meaning-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.sense-list {
  display: grid;
}

.meaning-sense {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  text-align: left;
}

.meaning-sense + .meaning-sense {
  border-top: 1px solid rgba(44, 54, 47, 0.13);
}

.sense-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  font: 800 11px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}

.meaning-panel strong {
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.55;
}

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

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 720px;
  margin: 22px auto 0;
}

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

.answer-button {
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  cursor: pointer;
  font-weight: 750;
}

.answer-button:hover:not(:disabled) {
  border-color: currentColor;
}

.answer-button:disabled {
  cursor: default;
  opacity: 0.38;
}

.answer-button.know {
  color: var(--green-dark);
  background: var(--green-soft);
}

.answer-button.unknown {
  color: #8c342f;
  background: var(--red-soft);
}

.answer-button.unlearned {
  color: #805414;
  background: var(--amber-soft);
}

.keycap {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 7px;
  opacity: 0.62;
  font-size: 11px;
  font-weight: 800;
}

.navigation-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  max-width: 720px;
  min-height: 58px;
  margin: 12px auto 0;
}

.previous-button,
.next-button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.previous-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.keycap-leading {
  margin-right: 8px;
  margin-left: 0;
}

.section-wrap {
  max-width: 960px;
  margin: 38px auto 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h1 {
  font-size: clamp(28px, 5vw, 44px);
}

.section-heading p {
  margin: 9px 0 0;
  color: var(--muted);
}

.shortcut-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.shortcut-list {
  padding: 8px 22px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 82px;
  padding: 13px 4px;
}

.shortcut-row + .shortcut-row {
  border-top: 1px solid var(--line);
}

.shortcut-row strong,
.shortcut-row span {
  display: block;
}

.shortcut-row strong {
  font-size: 16px;
}

.shortcut-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.shortcut-key-button {
  display: grid;
  grid-template-columns: minmax(58px, auto) auto;
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid #c8d7cc;
  border-radius: 12px;
  color: var(--green-dark);
  background: var(--green-soft);
  cursor: pointer;
}

.shortcut-key-button:hover,
.shortcut-key-button.is-listening {
  border-color: var(--green);
  background: #edf6f0;
}

.shortcut-key-button kbd {
  min-width: 44px;
  padding: 7px 10px;
  border: 1px solid #a9c2b0;
  border-bottom-width: 3px;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font: 800 13px/1 "Segoe UI", sans-serif;
  text-align: center;
  white-space: nowrap;
}

.shortcut-key-button small {
  color: var(--muted);
  font-size: 11px;
}

.shortcut-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.shortcut-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.frequent-heading {
  align-items: center;
}

.frequent-test-button {
  width: auto;
  min-width: 132px;
}

.frequent-add {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
}

.frequent-add > label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.frequent-add-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.frequent-add input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
}

.custom-word-card {
  margin: 16px 0 20px;
  padding: 16px;
  border: 1px solid #cbdccd;
  border-radius: 14px;
  background: var(--green-soft);
}

.custom-word-card > p {
  margin: 0 0 14px;
}

.custom-word-card > p strong,
.custom-word-card > p span {
  display: block;
}

.custom-word-card > p span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.custom-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(220px, 1.4fr);
  gap: 10px;
}

.custom-fields label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.custom-fields input,
.custom-fields select {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 0 11px;
  border: 1px solid #bdcfbf;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

.custom-fields input[readonly] {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

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

.custom-actions .button {
  width: auto;
}

.cancel-custom {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.frequent-add input::placeholder {
  color: #909991;
}

.frequent-suggestions {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #c9dbce;
  border-radius: 14px;
  background: var(--green-soft);
}

.frequent-suggestions[hidden] {
  display: none;
}

.frequent-suggestion {
  display: grid;
  grid-template-columns: auto minmax(110px, 0.55fr) minmax(0, 1.45fr);
  gap: 11px;
  align-items: center;
  min-height: 46px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  text-align: left;
}

.frequent-suggestion:hover {
  border-color: var(--green);
  background: white;
}

.frequent-suggestion strong {
  overflow-wrap: anywhere;
  font: 700 16px/1.25 Georgia, "Times New Roman", serif;
}

.frequent-suggestion small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-key {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid #9ebba7;
  border-radius: 8px;
  color: var(--green-dark);
  background: white;
  font-size: 12px;
  font-weight: 900;
}

.frequent-add .button {
  width: auto;
}

.frequent-empty {
  padding: 48px 28px;
  box-shadow: none;
}

.remove-frequent {
  justify-self: start;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #efc6c2;
  border-radius: 10px;
  color: #8c342f;
  background: var(--red-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.remove-frequent:hover {
  border-color: #d78d87;
  background: #f8d8d4;
}

.empty-state,
.complete-card {
  padding: 70px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-icon,
.complete-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 28px;
  font-weight: 800;
}

.empty-state h2,
.complete-card h1 {
  margin: 0;
}

.empty-state p,
.complete-card p {
  margin: 10px 0 24px;
  color: var(--muted);
}

.complete-card .complete-repeat {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 12px;
}

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

.word-list-item {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.5fr) auto;
  gap: 24px;
  align-items: center;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.84);
}

.word-list-item .english {
  overflow-wrap: anywhere;
  font: 600 21px/1.25 Georgia, serif;
}

.word-list-item .meaning {
  color: #4f5952;
  font-size: 14px;
  line-height: 1.55;
}

.list-pos {
  display: inline-block;
  min-width: 38px;
  color: var(--green-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 800;
}

.list-sense {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.list-sense + .list-sense {
  margin-top: 4px;
}

.status-chip {
  justify-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status-chip.wrong {
  color: #8c342f;
  background: var(--red-soft);
}

.status-chip.unlearned {
  color: #805414;
  background: var(--amber-soft);
}

.status-chip.mastered {
  color: var(--green-dark);
  background: var(--green-soft);
}

.list-meta {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 10;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 12px;
  color: white;
  background: rgba(23, 33, 27, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 13px;
}

noscript {
  display: block;
  margin: 40px;
  text-align: center;
}

@media (max-width: 850px) {
  .page-shell {
    width: min(100% - 24px, 720px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .brand-area {
    width: 100%;
    justify-content: space-between;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
    backdrop-filter: none;
  }

  .main-nav button,
  .main-nav a {
    justify-content: center;
    width: 100%;
    min-width: 0;
  }

  .main-nav .manual-link {
    min-height: 38px;
    border-radius: 9px;
    color: white;
    background: var(--green);
    box-shadow: 0 5px 14px rgba(33, 77, 57, 0.2);
    font-weight: 800;
  }

  .main-nav .manual-link:hover {
    color: white;
    background: var(--green-dark);
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 40px 28px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: clamp(42px, 13vw, 64px);
  }

  .setup-card {
    padding: 24px;
  }
}

@media (max-width: 620px) {
  .site-header {
    gap: 16px;
  }

  .brand-area {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .manual-dialog-head,
  .manual-dialog-foot {
    padding: 16px 18px;
  }

  .manual-dialog-body {
    max-height: calc(88dvh - 148px);
    padding: 3px 18px 18px;
  }

  .manual-key-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-nav {
    border-radius: 13px;
  }

  .nav-count {
    display: none;
  }

  .hero {
    padding: 34px 20px;
  }

  .hero h1 {
    font-size: clamp(38px, 10.5vw, 46px);
  }

  .hero-stats {
    gap: 18px;
  }

  .resume-panel,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented.counts {
    grid-template-columns: repeat(3, 1fr);
  }

  .word-card {
    min-height: 350px;
    padding: 38px 20px;
    border-radius: 22px;
  }

  .study-add-frequent {
    top: 15px;
    right: 15px;
    min-height: 32px;
    padding: 0 10px;
  }

  .word-text {
    min-height: 88px;
    font-size: clamp(36px, 14vw, 58px);
    line-height: 1.5;
  }

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

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

  .answer-button {
    min-height: 52px;
    padding: 0 7px;
  }

  .answer-grid.is-answered {
    display: none;
  }

  .answer-button .keycap {
    margin-left: 4px;
  }

  .navigation-row {
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid rgba(220, 226, 220, 0.95);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 34px rgba(34, 55, 42, 0.18);
    backdrop-filter: blur(14px);
  }

  .navigation-row.is-ready {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 30;
  }

  .previous-button,
  .next-button {
    min-height: 48px;
    padding: 0 9px;
  }

  .word-list-item {
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
  }

  .word-list-item .meaning {
    grid-column: 1 / -1;
  }

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

  .custom-fields {
    grid-template-columns: 1fr;
  }

  .frequent-add .button {
    width: 100%;
  }

  .shortcut-list {
    padding: 5px 15px;
  }

  .shortcut-row {
    gap: 12px;
  }

  .shortcut-key-button {
    grid-template-columns: 1fr;
  }

  .shortcut-key-button small {
    display: none;
  }

  .shortcut-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .frequent-suggestion {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .frequent-suggestion small {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
