/* =========================================================
   Broadlingo 博语学术 · 词汇中心
   一个不订阅、不打扰、只帮学生记单词的小应用。
   ========================================================= */

:root {
  --paper: #f4efe4;
  --paper-light: #fcf8ef;
  --paper-deep: #ece4d5;
  --ink: #172329;
  --ink-soft: #415057;
  --muted: #767d79;
  --line: #dbd1bf;
  --line-soft: #e9e1d2;
  --forest: #122f43;
  --forest-2: #1d455c;
  --forest-3: #2d5c75;
  --lime: #e3c47c;
  --lime-deep: #c9a657;
  --coral: #c96a4a;
  --coral-dark: #97462e;
  --coral-soft: #f3ddd3;
  --sky: #52798e;
  --white: #fffdf8;
  --success: #2e6b4a;
  --success-soft: #dcecdf;
  --warning-soft: #f4e6c5;
  --danger-soft: #f4ddd4;
  --shadow-sm: 0 4px 14px rgba(23, 35, 41, 0.06);
  --shadow-md: 0 18px 44px rgba(23, 35, 41, 0.09);
  --shadow-lg: 0 30px 80px rgba(23, 35, 41, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC",
    "Noto Serif CJK SC", "STSong", Georgia, serif;
  --font-mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 250px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 78% -8%, rgba(227, 196, 124, 0.16), transparent 32%),
    radial-gradient(circle at 8% 100%, rgba(201, 106, 74, 0.07), transparent 28%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: 999;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

::selection {
  background: var(--lime);
  color: var(--forest);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid rgba(201, 106, 74, 0.7);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--forest);
  color: var(--white);
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript {
  max-width: 560px;
  margin: 60px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

/* ---------- Shared primitives ---------- */

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 26px;
  height: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  transform: none;
}

.btn-primary {
  background: var(--forest);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(18, 47, 67, 0.18);
}

.btn-primary:hover {
  background: var(--forest-2);
}

.btn-lime {
  background: var(--lime);
  color: var(--forest);
  box-shadow: 0 6px 20px rgba(227, 196, 124, 0.12);
}

.btn-lime:hover {
  background: #ecd28f;
}

.btn-coral {
  background: var(--coral);
  color: var(--white);
}

.btn-coral:hover {
  background: var(--coral-dark);
}

.btn-outline {
  border-color: var(--line);
  background: var(--paper-light);
}

.btn-outline:hover {
  border-color: #c8bfae;
  background: var(--white);
}

.btn-ghost {
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: rgba(23, 35, 41, 0.06);
  color: var(--ink);
}

.btn-quiet {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.btn-quiet:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.btn-danger:hover {
  background: #f3cfc3;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
}

.btn-icon.btn-sm {
  width: 34px;
  min-height: 34px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: 0.16s ease;
}

.icon-btn:hover {
  background: rgba(23, 35, 41, 0.06);
  color: var(--ink);
}

.icon-btn.is-active {
  color: var(--coral);
  background: var(--coral-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-forest {
  background: rgba(18, 47, 67, 0.09);
  color: var(--forest);
}

.badge-coral {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.badge-lime {
  background: var(--lime);
  color: var(--forest);
}

.badge-white {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.badge-dot::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 20px;
  height: 1px;
  background: currentColor;
  content: "";
}

.muted {
  color: var(--muted);
}

.serif {
  font-family: var(--font-serif);
}

.mono {
  font-family: var(--font-mono);
}

.progress {
  position: relative;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 35, 41, 0.09);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(252, 249, 242, 0.82);
}

/* ---------- Authentication ---------- */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}

.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 34px 46px 28px;
  background:
    radial-gradient(circle at 78% 4%, rgba(227, 196, 124, 0.16), transparent 34%),
    radial-gradient(circle at 8% 100%, rgba(201, 106, 74, 0.12), transparent 32%),
    var(--forest);
  color: var(--white);
}

.auth-story::before {
  position: absolute;
  top: -170px;
  right: -130px;
  width: 560px;
  height: 560px;
  border: 1px solid rgba(227, 196, 124, 0.14);
  border-radius: 50%;
  content: "";
}

.auth-story::after {
  position: absolute;
  right: 120px;
  bottom: -260px;
  width: 530px;
  height: 530px;
  border: 1px solid rgba(227, 196, 124, 0.08);
  border-radius: 50%;
  content: "";
}

.auth-brand {
  position: relative;
  z-index: 1;
  align-self: flex-start;
}

.auth-story .brand-mark {
  background: var(--lime);
  color: var(--forest);
  box-shadow: none;
}

.auth-story .brand-name strong {
  color: var(--white);
}

.auth-story .brand-name small {
  color: rgba(255, 253, 248, 0.45);
}

.auth-story-main {
  position: relative;
  z-index: 1;
  max-width: 610px;
  margin: auto 0;
  padding: 46px 0 36px;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  line-height: 1.5;
  text-transform: uppercase;
}

.auth-kicker::before {
  width: 20px;
  height: 1px;
  background: currentColor;
  content: "";
}

.auth-story h1 {
  margin: 18px 0 17px;
  font-family: var(--font-serif);
  font-size: clamp(39px, 4.2vw, 62px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.16;
}

.auth-story h1 em {
  color: var(--lime);
  font-style: italic;
}

.auth-story-main > p {
  max-width: 490px;
  color: rgba(255, 253, 248, 0.58);
  font-size: 12.5px;
  line-height: 1.75;
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 35px;
}

.auth-point {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-point-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(227, 196, 124, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--lime);
}

.auth-point-icon .icon {
  width: 16px;
  height: 16px;
}

.auth-point div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
}

.auth-point strong {
  color: rgba(255, 253, 248, 0.9);
  font-size: 11px;
  font-weight: 650;
}

.auth-point span {
  color: rgba(255, 253, 248, 0.42);
  font-size: 9.5px;
}

.auth-story-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 19px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 253, 248, 0.35);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px;
  background:
    radial-gradient(circle at 100% 0%, rgba(227, 196, 124, 0.12), transparent 38%),
    var(--paper);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 34px 33px 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper-light);
  box-shadow: var(--shadow-md);
}

.auth-card-head {
  margin-bottom: 24px;
}

.auth-card .auth-kicker {
  color: var(--muted);
}

.auth-card .auth-kicker::before {
  background: var(--coral);
}

.auth-card h2 {
  margin: 10px 0 5px;
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.auth-card-head p {
  color: var(--muted);
  font-size: 10.5px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 17px;
  padding: 10px 12px;
  border: 1px solid #c8e2ce;
  border-radius: 10px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  line-height: 1.55;
}

.auth-alert.is-error {
  border-color: #e5b6a8;
  background: var(--danger-soft);
  color: var(--coral-dark);
}

.auth-alert .icon {
  margin-top: 1px;
  flex: 0 0 auto;
}

.auth-field + .auth-field {
  margin-top: 15px;
}

.auth-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap > .icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.auth-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--paper);
  font-size: 13px;
  transition: 0.16s ease;
}

.auth-input-wrap input:focus {
  border-color: var(--forest-3);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45, 92, 117, 0.1);
}

.auth-input-wrap input:disabled {
  opacity: 0.65;
}

.auth-input-wrap input::placeholder {
  color: #a2a194;
}

.auth-submit {
  width: 100%;
  min-height: 49px;
  margin-top: 21px;
  font-size: 13px;
}

.auth-submit .icon {
  width: 16px;
  height: 16px;
}

.auth-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid rgba(23, 35, 41, 0.14);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.auth-submit .auth-spinner {
  width: 15px;
  height: 15px;
  margin-right: 2px;
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--white);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-provision {
  margin-top: 21px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
  text-align: center;
}

.auth-privacy {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 9px;
}

.auth-privacy .icon {
  color: var(--forest-3);
}

/* Boot / cloud error */

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 20%, rgba(227, 196, 124, 0.15), transparent 35%),
    var(--paper);
  text-align: center;
}

.boot-mark {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 13px;
  border-radius: 20px;
  background: var(--forest);
  color: var(--lime);
  box-shadow: 0 12px 28px rgba(18, 47, 67, 0.18);
}

.boot-mark .icon {
  width: 37px;
  height: 37px;
  stroke-width: 1.7;
}

.boot-brand {
  margin-bottom: 22px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.boot-screen > p {
  margin-top: 13px;
  color: var(--muted);
  font-size: 10.5px;
}

.cloud-error-screen {
  gap: 0;
}

.cloud-error-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 460px;
  margin-top: 24px;
}

.cloud-error-copy .eyebrow {
  color: var(--muted);
}

.cloud-error-copy h1 {
  margin: 12px 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(31px, 4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.cloud-error-copy > p {
  max-width: 390px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.cloud-error-account {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-light);
  color: var(--ink-soft);
  font-size: 9.5px;
}

.cloud-error-account .icon {
  color: var(--forest-3);
}

.cloud-error-copy .result-actions {
  margin-top: 22px;
}

/* ---------- Sync status ---------- */

.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 13px;
  border: 1px solid #dfc88d;
  border-radius: 12px;
  background: #f8eed7;
  color: #6c571e;
  font-size: 9.8px;
  line-height: 1.55;
}

.sync-banner[hidden] {
  display: none;
}

.sync-banner[data-status="error"] {
  border-color: #e5b6a8;
  background: var(--danger-soft);
  color: var(--coral-dark);
}

.sync-banner[data-status="offline"] {
  border-color: var(--line);
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.sync-banner-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.sync-banner-icon .icon {
  width: 16px;
  height: 16px;
}

.sync-banner-text {
  flex: 1;
}

.sync-retry {
  flex: 0 0 auto;
  color: inherit;
}

.sync-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 6px 10px;
  padding: 5px 6px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sync-mini .icon {
  width: 12px;
  height: 12px;
}

.sync-mini[data-status="synced"] {
  color: var(--success);
}

.sync-mini[data-status="error"],
.sync-mini[data-status="blocked"] {
  color: var(--coral-dark);
}

.sync-mini[data-status="offline"] {
  color: var(--muted);
}

/* ---------- App shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 30px 20px 20px;
  border-right: 1px solid rgba(221, 213, 197, 0.7);
  background: rgba(248, 244, 235, 0.64);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  margin: 0 10px 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--forest);
  color: var(--lime);
  box-shadow: 0 6px 14px rgba(18, 47, 67, 0.2);
}

.brand-mark .icon {
  width: 25px;
  height: 25px;
  stroke-width: 1.7;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name strong {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.145em;
  line-height: 1;
}

.brand-name small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.side-label {
  margin: 0 12px 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav + .side-label {
  margin-top: 30px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 550;
  transition: 0.16s ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: 0.16s ease;
}

.nav-item:hover {
  background: rgba(23, 35, 41, 0.05);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--forest);
  color: var(--white);
  box-shadow: 0 5px 16px rgba(18, 47, 67, 0.15);
}

.nav-item.is-active .icon {
  color: var(--lime);
}

.nav-item .nav-count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.nav-item.is-active .nav-count {
  color: rgba(255, 253, 248, 0.58);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
}

.goal-mini {
  display: block;
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(252, 249, 242, 0.78);
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.goal-mini:hover {
  border-color: #cfc5b4;
  background: var(--paper-light);
}

.goal-mini-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
}

.goal-mini-top strong {
  color: var(--forest);
  font-family: var(--font-mono);
  font-size: 11px;
}

.goal-mini .progress {
  height: 5px;
}

.goal-mini p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 13px;
}

.profile:hover {
  background: rgba(23, 35, 41, 0.04);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.profile-meta strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.profile .icon {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: var(--muted);
}

.main {
  min-width: 0;
  padding: 38px 48px 70px;
}

.main-inner {
  width: 100%;
  max-width: 1230px;
  margin: 0 auto;
}

.mobile-topbar {
  display: none;
}

.mobile-nav {
  display: none;
}

.view-enter {
  animation: view-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Page headers ---------- */

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

.page-head-copy h1 {
  margin: 9px 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-head-copy p {
  color: var(--muted);
  font-size: 13px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 15px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.text-link:hover {
  color: var(--coral-dark);
}

.text-link .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.16s ease;
}

.text-link:hover .icon {
  transform: translateX(3px);
}

.dashboard-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 38px;
  padding: 22px 4px 0;
  border-top: 1px solid var(--line);
}

.note-quote {
  color: var(--ink-soft);
  font-size: 15px;
  font-style: italic;
  letter-spacing: 0.01em;
}

.note-caption {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-count {
  margin-left: 1px;
  opacity: 0.52;
  font-family: var(--font-mono);
  font-size: 8px;
}

.hidden {
  display: none !important;
}

.text-nowrap {
  white-space: nowrap;
}

/* ---------- Dashboard hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 28px;
  overflow: hidden;
  padding: 38px 40px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.045), transparent 48%),
    var(--forest);
  color: var(--white);
  box-shadow: 0 22px 55px rgba(18, 47, 67, 0.2);
}

.hero::before {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(227, 196, 124, 0.14);
  border-radius: 50%;
  content: "";
}

.hero::after {
  position: absolute;
  right: 105px;
  bottom: -160px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(227, 196, 124, 0.08);
  border-radius: 50%;
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 253, 248, 0.58);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(227, 196, 124, 0.1);
}

.hero h1 {
  max-width: 610px;
  margin: 20px 0 13px;
  font-family: var(--font-serif);
  font-size: clamp(33px, 3.6vw, 48px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.22;
}

.hero h1 em {
  position: relative;
  color: var(--lime);
  font-style: italic;
  white-space: nowrap;
}

.hero h1 em::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  background: rgba(227, 196, 124, 0.38);
  border-radius: 1px;
  content: "";
}

.hero-sub {
  max-width: 475px;
  color: rgba(255, 253, 248, 0.64);
  font-size: 13px;
  line-height: 1.7;
}

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

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-fact {
  display: flex;
  align-items: center;
  gap: 9px;
}

.hero-fact .icon {
  width: 17px;
  height: 17px;
  color: var(--lime);
}

.hero-fact div {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.hero-fact strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.hero-fact span {
  color: rgba(255, 253, 248, 0.48);
  font-size: 9.5px;
}

.hero-goal {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.045);
  text-align: center;
  backdrop-filter: blur(4px);
}

.goal-ring {
  --pct: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 162px;
  height: 162px;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.12) 0);
  transition: background 0.6s ease;
}

.goal-ring::before {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #17384f;
  content: "";
}

.goal-ring-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.goal-ring-inner strong {
  font-family: var(--font-serif);
  font-size: 43px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.goal-ring-inner strong small {
  color: rgba(255, 253, 248, 0.45);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
}

.goal-ring-inner span {
  margin-top: 7px;
  color: rgba(255, 253, 248, 0.56);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero-goal > p {
  margin-top: 16px;
  color: rgba(255, 253, 248, 0.6);
  font-size: 10.5px;
}

.hero-goal > p strong {
  color: var(--lime);
  font-weight: 650;
}

/* ---------- Set tones ---------- */

.tone-ink {
  --tone: #122f43;
  --tone-ink: #f8f2e6;
  --tone-accent: #c9a657;
}

.tone-ink .cover-top .badge {
  background: rgba(255, 255, 255, 0.11);
  color: var(--tone-ink);
}

.tone-ink .cover-arrow {
  border-color: rgba(255, 255, 255, 0.28);
}

.tone-ink .set-hero .btn-outline {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: var(--tone-ink);
}

.tone-ink .set-hero .btn-outline:hover {
  background: rgba(255, 255, 255, 0.16);
}

.tone-fern {
  --tone: #dce9d3;
  --tone-ink: #224c34;
  --tone-accent: #a7c995;
}

.tone-clay {
  --tone: #f0dacd;
  --tone-ink: #7a3e2c;
  --tone-accent: #d9a78e;
}

.tone-ocean {
  --tone: #d9e6ec;
  --tone-ink: #284e61;
  --tone-accent: #9fc3d2;
}

.tone-sun {
  --tone: #f1e5b9;
  --tone-ink: #6c571e;
  --tone-accent: #dcc775;
}

.tone-lilac {
  --tone: #e5def0;
  --tone-ink: #53436d;
  --tone-accent: #bfaed8;
}

/* ---------- Set cards ---------- */

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

.set-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.set-card:hover {
  border-color: #cfc5b4;
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.set-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 146px;
  padding: 18px 20px;
  overflow: hidden;
  background: var(--tone, #dce9d3);
  color: var(--tone-ink, #224c34);
}

.set-cover::before {
  position: absolute;
  top: -35px;
  right: -30px;
  width: 145px;
  height: 145px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.16;
  content: "";
}

.set-cover::after {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 62px;
  height: 62px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.12;
  content: "";
}

.cover-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cover-top .badge {
  background: rgba(255, 255, 255, 0.44);
  color: inherit;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(23, 35, 41, 0.16);
  border-radius: 50%;
  color: inherit;
  transition: 0.2s ease;
}

.cover-arrow .icon {
  width: 14px;
  height: 14px;
}

.set-card:hover .cover-arrow {
  background: var(--tone-ink);
  color: var(--tone);
  transform: rotate(-8deg);
}

.cover-label {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: clamp(27px, 2.7vw, 36px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cover-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.68;
}

.cover-bottom span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cover-bottom .icon {
  width: 12px;
  height: 12px;
}

.set-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 17px 19px 18px;
}

.set-card-body h3 {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-card-body > p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 34px;
  margin: 4px 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.set-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
}

.set-progress-row strong {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.set-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

.set-card-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.set-card-foot .icon {
  width: 12px;
  height: 12px;
}

.due-flag {
  color: var(--coral-dark);
  font-weight: 650;
}

.set-card-new {
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border-style: dashed;
  background: rgba(252, 249, 242, 0.44);
  color: var(--muted);
  text-align: center;
}

.set-card-new:hover {
  border-color: var(--forest-3);
  box-shadow: var(--shadow-sm);
  color: var(--forest);
}

.set-card-new .plus-circle {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-light);
}

.set-card-new strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.set-card-new small {
  margin-top: 4px;
  font-size: 10.5px;
}

/* ---------- Folders ---------- */

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

.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 20px 22px 18px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 24px;
  background: var(--tone, var(--paper-deep));
  color: var(--tone-ink, var(--ink));
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease;
}

.folder-card::before {
  position: absolute;
  top: -78px;
  right: -54px;
  width: 210px;
  height: 210px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.11;
  content: "";
}

.folder-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.folder-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.42);
}

.folder-symbol .icon {
  width: 22px;
  height: 22px;
}

.tone-ink .folder-symbol {
  background: rgba(255, 255, 255, 0.09);
  color: var(--lime);
}

.folder-badge {
  background: rgba(255, 255, 255, 0.38);
  color: inherit;
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.tone-ink .folder-badge {
  background: rgba(255, 255, 255, 0.11);
}

.folder-arrow {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin-left: auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.55;
  transition: 0.18s ease;
}

.folder-arrow .icon {
  width: 14px;
  height: 14px;
}

.folder-card:hover .folder-arrow {
  background: var(--tone-ink);
  color: var(--tone);
  opacity: 1;
  transform: rotate(-7deg);
}

.folder-card-main {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 25px;
}

.folder-card-main h3 {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: clamp(23px, 2.5vw, 30px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-main p {
  margin-top: 3px;
  color: inherit;
  font-size: 10.5px;
  opacity: 0.62;
}

.folder-card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid rgba(23, 35, 41, 0.14);
  font-size: 9.5px;
  font-weight: 650;
  opacity: 0.8;
}

.tone-ink .folder-card-foot {
  border-color: rgba(255, 255, 255, 0.14);
}

.tone-ink .folder-card-foot .due-flag {
  color: #f0b19d;
}

.folder-add-card {
  align-items: center;
  justify-content: center;
  min-height: 218px;
  border: 1px dashed var(--line);
  background: rgba(252, 248, 239, 0.5);
  color: var(--muted);
  box-shadow: none;
  text-align: center;
}

.folder-add-card::before {
  display: none;
}

.folder-add-card:hover {
  border-color: var(--forest-3);
  background: var(--paper-light);
  color: var(--forest);
  box-shadow: var(--shadow-sm);
}

.folder-add-card .plus-circle {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 11px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-light);
}

.folder-add-card strong {
  font-size: 12px;
  font-weight: 650;
}

.folder-add-card small {
  max-width: 240px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.folder-hero {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  padding: 31px 34px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 82% -20%, rgba(227, 196, 124, 0.16), transparent 38%),
    var(--forest);
  color: var(--white);
  box-shadow: 0 22px 55px rgba(18, 47, 67, 0.18);
}

.folder-hero::before {
  position: absolute;
  top: -100px;
  right: 120px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(227, 196, 124, 0.14);
  border-radius: 50%;
  content: "";
}

.folder-hero-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: 1px solid rgba(227, 196, 124, 0.28);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--lime);
}

.folder-hero-mark .icon {
  width: 34px;
  height: 34px;
}

.folder-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.folder-hero .eyebrow {
  color: rgba(255, 253, 248, 0.48);
}

.folder-hero h1 {
  margin: 8px 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(31px, 3.3vw, 44px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.folder-hero-copy > p {
  max-width: 600px;
  color: rgba(255, 253, 248, 0.62);
  font-size: 11.5px;
  line-height: 1.65;
}

.folder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 17px;
  margin-top: 17px;
}

.folder-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 253, 248, 0.7);
  font-size: 10px;
  font-weight: 600;
}

.folder-meta .icon {
  width: 14px;
  height: 14px;
  color: var(--lime);
}

.folder-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.folder-hero-actions .btn-quiet {
  border-color: rgba(255, 255, 255, 0.18);
}

.folder-delete {
  color: rgba(255, 253, 248, 0.55);
}

.folder-delete:hover {
  background: rgba(201, 106, 74, 0.2);
  color: #f0b19d;
}

select.input {
  padding-right: 38px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767d79' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 15px;
  cursor: pointer;
}

/* ---------- Quick modes ---------- */

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

.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(252, 249, 242, 0.76);
  transition: 0.18s ease;
}

.mode-card:hover {
  border-color: #cfc5b4;
  background: var(--paper-light);
  transform: translateY(-2px);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.mode-icon .icon {
  width: 19px;
  height: 19px;
}

.mode-card[data-tone="lime"] .mode-icon {
  background: var(--lime);
  color: var(--forest);
}

.mode-card[data-tone="coral"] .mode-icon {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.mode-card[data-tone="sky"] .mode-icon {
  background: #dbe8ef;
  color: #335f78;
}

.mode-copy {
  min-width: 0;
  line-height: 1.35;
}

.mode-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-copy span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-card > .icon {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--muted);
}

/* ---------- Set detail ---------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 11px;
}

.breadcrumb a:hover {
  color: var(--ink);
}

.breadcrumb .icon {
  width: 12px;
  height: 12px;
}

.set-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  overflow: hidden;
  min-height: 230px;
  padding: 31px 34px;
  border-radius: var(--radius-xl);
  background: var(--tone, #dce9d3);
  color: var(--tone-ink, #224c34);
}

.set-hero::before {
  position: absolute;
  top: -110px;
  right: 130px;
  width: 330px;
  height: 330px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.12;
  content: "";
}

.set-hero::after {
  position: absolute;
  right: -50px;
  bottom: -130px;
  width: 300px;
  height: 300px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.1;
  content: "";
}

.set-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.set-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0.65;
  text-transform: uppercase;
}

.set-kicker .sep {
  width: 14px;
  height: 1px;
  background: currentColor;
}

.set-hero h1 {
  margin: 14px 0 9px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.3vw, 44px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.set-hero-copy > p {
  max-width: 550px;
  font-size: 12px;
  line-height: 1.65;
  opacity: 0.72;
}

.set-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 17px;
  margin-top: 22px;
}

.set-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.72;
}

.set-meta .icon {
  width: 14px;
  height: 14px;
}

.set-hero-side {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}

.set-monogram {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-serif);
  font-size: 55px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.92;
  opacity: 0.2;
  text-align: right;
}

.set-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.set-hero .btn-outline {
  border-color: rgba(23, 35, 41, 0.16);
  background: rgba(255, 255, 255, 0.26);
  color: inherit;
}

.set-hero .btn-outline:hover {
  background: rgba(255, 255, 255, 0.48);
}

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

.practice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 146px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(252, 249, 242, 0.78);
  transition: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.practice-card:hover {
  border-color: #c8bead;
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
}

.practice-card-number {
  position: absolute;
  top: 13px;
  right: 15px;
  color: var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.practice-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  margin-bottom: auto;
  border-radius: 11px;
  background: var(--paper-deep);
}

.practice-icon .icon {
  width: 18px;
  height: 18px;
}

.practice-card[data-mode="flashcards"] .practice-icon {
  background: var(--lime);
  color: var(--forest);
}

.practice-card[data-mode="learn"] .practice-icon {
  background: #dbe8ef;
  color: #335f78;
}

.practice-card[data-mode="quiz"] .practice-icon {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.practice-card[data-mode="match"] .practice-icon {
  background: #eee1c3;
  color: #715b26;
}

.practice-card h3 {
  margin-top: 17px;
  font-size: 13px;
  font-weight: 650;
}

.practice-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.practice-card .arrow {
  position: absolute;
  right: 15px;
  bottom: 15px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: 0.18s ease;
}

.practice-card:hover .arrow {
  color: var(--ink);
  transform: translateX(3px);
}

/* ---------- Word list ---------- */

.list-panel {
  margin-top: 28px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.list-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.list-toolbar-left h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
}

.list-toolbar-left span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 190px;
  height: 36px;
  padding: 0 12px 0 33px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  background: rgba(252, 249, 242, 0.72);
  font-size: 11.5px;
  transition: 0.16s ease;
}

.search-box input:focus {
  width: 220px;
  border-color: var(--forest-3);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45, 92, 117, 0.1);
}

.search-box input::placeholder {
  color: #9b9b8c;
}

.filter-chips {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(252, 249, 242, 0.65);
}

.chip {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  transition: 0.15s ease;
}

.chip:hover {
  color: var(--ink);
}

.chip.is-active {
  background: var(--forest);
  color: var(--white);
}

.term-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(252, 249, 242, 0.72);
}

.term-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(160px, 0.9fr) minmax(0, 1.25fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s ease;
}

.term-row:last-child {
  border-bottom: 0;
}

.term-row:hover {
  background: rgba(252, 249, 242, 0.98);
}

.term-index {
  color: #b4b3a6;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.term-word-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.term-word-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.term-word {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-phonetic {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-def {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.55;
}

.term-example {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 11px;
  font-style: italic;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mastery {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mastery-dots {
  display: flex;
  gap: 3px;
}

.mastery-dot {
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: var(--line);
}

.mastery-dot.is-on {
  background: var(--forest-3);
}

.mastery-label {
  width: 34px;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.term-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.term-row:hover .term-actions,
.term-row:focus-within .term-actions {
  opacity: 1;
}

.term-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.term-actions .icon {
  width: 14px;
  height: 14px;
}

.audio-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
}

.audio-mini:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.audio-mini .icon {
  width: 13px;
  height: 13px;
}

.list-empty {
  padding: 44px 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.list-empty .icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  color: var(--line);
}

.list-footer {
  display: flex;
  justify-content: center;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Study / focus layout ---------- */

.focus-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -20%, rgba(227, 196, 124, 0.2), transparent 40%),
    var(--paper);
}

.study-top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(221, 213, 197, 0.65);
  background: rgba(245, 240, 230, 0.86);
  backdrop-filter: blur(14px);
}

.study-top-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 1120px;
  height: 66px;
  margin: 0 auto;
  padding: 0 26px;
}

.study-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.study-back:hover {
  color: var(--ink);
}

.study-back .icon {
  width: 16px;
  height: 16px;
}

.study-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.study-title strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-title .divider {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.study-top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.study-progress {
  width: 100%;
  height: 3px;
  background: rgba(23, 35, 41, 0.08);
}

.study-progress > span {
  display: block;
  height: 100%;
  background: var(--forest);
  transition: width 0.35s ease;
}

.focus-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 38px 26px 48px;
}

@media (min-width: 900px) and (min-height: 760px) {
  .focus-main {
    justify-content: safe center;
  }
}

.session-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
  max-width: 690px;
  margin: 0 auto 14px;
  color: var(--muted);
  font-size: 10.5px;
}

.session-meta strong {
  color: var(--ink-soft);
  font-weight: 650;
}

.session-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.session-counter strong {
  color: var(--ink);
  font-size: 13px;
}

.session-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.session-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper-light);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
}

/* ---------- Flashcards ---------- */

.flash-stage {
  width: 100%;
  max-width: 690px;
  margin: 0 auto;
  perspective: 1600px;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 410px;
  border: 0;
  border-radius: 30px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.22, 0.8, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.flashcard.is-flipped {
  transform: rotateY(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px 44px;
  border: 1px solid var(--line);
  border-radius: 30px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 24px 60px rgba(23, 35, 41, 0.09);
}

.flash-front {
  background:
    radial-gradient(circle at 80% 10%, rgba(227, 196, 124, 0.16), transparent 30%),
    var(--paper-light);
}

.flash-back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--forest);
  color: var(--white);
  transform: rotateY(180deg);
}

.flash-face::before {
  position: absolute;
  top: -85px;
  right: -65px;
  width: 230px;
  height: 230px;
  border: 1px solid var(--line);
  border-radius: 50%;
  opacity: 0.55;
  content: "";
}

.flash-back::before {
  border-color: rgba(227, 196, 124, 0.16);
}

.flash-label {
  position: absolute;
  top: 26px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.flash-label::before {
  width: 16px;
  height: 1px;
  background: currentColor;
  content: "";
}

.flash-back .flash-label {
  color: rgba(255, 253, 248, 0.42);
}

.flash-status {
  position: absolute;
  top: 21px;
  right: 24px;
}

.flash-word {
  max-width: 100%;
  font-family: var(--font-serif);
  font-size: clamp(48px, 7vw, 76px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.flash-phonetic {
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.flash-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 23px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  transition: 0.16s ease;
}

.audio-btn:hover {
  border-color: var(--forest-3);
  color: var(--forest);
}

.audio-btn .icon {
  width: 14px;
  height: 14px;
}

.flash-hint {
  position: absolute;
  right: 0;
  bottom: 25px;
  left: 0;
  color: var(--muted);
  font-size: 9.5px;
}

.flash-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 19px;
  margin: 0 3px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 8px;
}

.flash-def {
  max-width: 520px;
  font-family: var(--font-serif);
  font-size: clamp(25px, 3.6vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.flash-example {
  max-width: 520px;
  margin-top: 20px;
  color: rgba(255, 253, 248, 0.67);
  font-family: var(--font-serif);
  font-size: 14px;
  font-style: italic;
  line-height: 1.6;
}

.flash-example-zh {
  max-width: 520px;
  margin-top: 4px;
  color: rgba(255, 253, 248, 0.4);
  font-size: 10.5px;
  line-height: 1.5;
}

.flash-back .flash-hint {
  color: rgba(255, 253, 248, 0.42);
}

.flash-back .flash-hint kbd {
  border-color: rgba(255, 255, 255, 0.18);
  border-bottom-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 253, 248, 0.7);
}

.rate-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 690px;
  margin: 22px auto 0;
}

.rate-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 62px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(252, 249, 242, 0.8);
  text-align: left;
  transition: 0.18s ease;
}

.rate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.rate-btn:disabled {
  opacity: 0.42;
}

.rate-btn strong {
  font-size: 12px;
  font-weight: 650;
}

.rate-btn span {
  color: var(--muted);
  font-size: 9.5px;
}

.rate-btn .rate-key {
  float: right;
  color: #aaa99b;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.rate-btn[data-rate="again"]:hover:not(:disabled) {
  border-color: #e5b6a8;
  background: var(--coral-soft);
}

.rate-btn[data-rate="fuzzy"]:hover:not(:disabled) {
  border-color: #d9c27d;
  background: var(--warning-soft);
}

.rate-btn[data-rate="known"]:hover:not(:disabled) {
  border-color: #9bc0a8;
  background: var(--success-soft);
}

.flash-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 9.5px;
}

.flash-footnote .icon {
  width: 13px;
  height: 13px;
}

/* ---------- Learn mode ---------- */

.learn-stage {
  width: 100%;
  max-width: 730px;
  margin: 0 auto;
}

.learn-card {
  position: relative;
  padding: 32px 36px 30px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper-light);
  box-shadow: var(--shadow-md);
}

.learn-card::before {
  position: absolute;
  top: 0;
  left: 36px;
  width: 48px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--coral);
  content: "";
}

.question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 25px;
}

.question-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-label .icon {
  width: 15px;
  height: 15px;
  color: var(--coral);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.streak-pill .icon {
  width: 12px;
  height: 12px;
  color: var(--coral);
}

.learn-question {
  min-height: 72px;
  margin-bottom: 25px;
}

.learn-question h2 {
  font-family: var(--font-serif);
  font-size: clamp(29px, 4vw, 41px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.learn-question p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(245, 240, 230, 0.55);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: left;
  transition: 0.16s ease;
}

.option-btn:hover:not(:disabled):not(.is-answered) {
  border-color: var(--forest-3);
  background: var(--white);
  transform: translateY(-1px);
}

.option-letter {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-light);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
}

.option-text {
  min-width: 0;
}

.option-btn.is-selected {
  border-color: var(--forest);
  background: rgba(18, 47, 67, 0.05);
}

.option-btn.is-correct {
  border-color: #76a887;
  background: var(--success-soft);
  color: var(--success);
}

.option-btn.is-correct .option-letter {
  border-color: #76a887;
  background: #c8e2ce;
  color: var(--success);
}

.option-btn.is-wrong {
  border-color: #e0a695;
  background: var(--danger-soft);
  color: var(--coral-dark);
  animation: shake 0.36s ease;
}

.option-btn.is-wrong .option-letter {
  border-color: #e0a695;
  background: #f1c8bb;
  color: var(--coral-dark);
}

.option-btn.is-answered {
  cursor: default;
}

.option-btn.is-dim {
  opacity: 0.58;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-2px);
  }
}

.feedback {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 15px 16px;
  border-radius: 14px;
  background: var(--success-soft);
  animation: feedback-in 0.25s ease both;
}

.feedback.is-wrong {
  background: var(--danger-soft);
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(46, 107, 74, 0.14);
  color: var(--success);
}

.feedback.is-wrong .feedback-icon {
  background: rgba(184, 69, 40, 0.12);
  color: var(--coral-dark);
}

.feedback-icon .icon {
  width: 14px;
  height: 14px;
}

.feedback-copy {
  min-width: 0;
  flex: 1;
  padding-top: 2px;
}

.feedback-copy strong {
  display: block;
  color: var(--success);
  font-size: 12px;
}

.feedback.is-wrong .feedback-copy strong {
  color: var(--coral-dark);
}

.feedback-copy p {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.55;
}

.feedback-copy .feedback-term {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
}

.feedback .btn {
  align-self: center;
  min-height: 36px;
  padding: 0 15px;
  font-size: 11px;
}

.learn-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 10px;
}

.learn-footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.learn-footer kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 8px;
}

/* ---------- Result screen ---------- */

.result-stage {
  width: 100%;
  max-width: 620px;
  margin: 10px auto 0;
  text-align: center;
}

.result-badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--forest);
  box-shadow: 0 12px 30px rgba(201, 166, 87, 0.3);
  animation: pop-in 0.4s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

.result-badge .icon {
  width: 28px;
  height: 28px;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-stage h1 {
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.6vw, 48px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.result-stage > p {
  max-width: 460px;
  margin: 11px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 28px 0 24px;
}

.result-stat {
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(252, 249, 242, 0.7);
}

.result-stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
}

.result-stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

.result-review {
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-light);
  text-align: left;
}

.result-review-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-review-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
}

.result-review-row:last-child {
  border-bottom: 0;
}

.result-review-row strong {
  font-family: var(--font-serif);
  font-size: 14px;
}

.result-review-row span {
  color: var(--muted);
}

.result-review-row .icon {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--success);
}

.result-review-row.is-wrong .icon {
  color: var(--coral);
}

/* ---------- Quiz setup / active ---------- */

.quiz-setup {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.quiz-intro {
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
}

.quiz-intro-head {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 24px;
}

.quiz-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.quiz-icon .icon {
  width: 23px;
  height: 23px;
}

.quiz-intro h2 {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
}

.quiz-intro-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.quiz-field {
  margin-top: 18px;
}

.quiz-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.quiz-field-label span {
  color: var(--muted);
  font-weight: 400;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.segmented-count {
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.segmented label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: 0.15s ease;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented label:hover {
  color: var(--ink);
}

.segmented label:has(input:checked) {
  background: var(--white);
  color: var(--forest);
  box-shadow: 0 2px 7px rgba(23, 35, 41, 0.08);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--coral);
  outline-offset: 1px;
}

.quiz-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
}

.quiz-tip .icon {
  width: 13px;
  height: 13px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.quiz-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 22px;
}

.quiz-start span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.quiz-active {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.quiz-card {
  position: relative;
  padding: 30px 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper-light);
  box-shadow: var(--shadow-md);
}

.quiz-type {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 19px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quiz-type .icon {
  width: 14px;
  height: 14px;
  color: var(--coral);
}

.quiz-question {
  margin-bottom: 24px;
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.quiz-input-row {
  display: flex;
  gap: 9px;
}

.quiz-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--paper);
  font-family: var(--font-serif);
  font-size: 19px;
  transition: 0.16s ease;
}

.quiz-input:focus {
  border-color: var(--forest-3);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45, 92, 117, 0.1);
}

.quiz-input.is-correct {
  border-color: #76a887;
  background: var(--success-soft);
  color: var(--success);
}

.quiz-input.is-wrong {
  border-color: #e0a695;
  background: var(--danger-soft);
  color: var(--coral-dark);
}

.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.score-ring {
  --pct: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0 auto 25px;
  border-radius: 50%;
  background: conic-gradient(var(--coral) calc(var(--pct) * 1%), var(--line) 0);
}

.score-ring::before {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.score-ring div {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1;
}

.score-ring strong {
  font-family: var(--font-serif);
  font-size: 39px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.score-ring span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

/* ---------- Match game ---------- */

.match-layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
}

.match-side {
  padding-top: 12px;
}

.match-side h1 {
  margin: 10px 0 9px;
  font-family: var(--font-serif);
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.match-side > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.match-hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 24px;
}

.match-hud div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(252, 249, 242, 0.7);
}

.match-hud span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-hud strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
}

.match-side-tip {
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.65;
}

.match-side-tip strong {
  color: var(--ink-soft);
  font-weight: 650;
}

.match-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}

.match-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  padding: 12px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper-light);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
  transition: 0.18s ease;
}

.match-tile:hover:not(:disabled):not(.is-matched) {
  border-color: var(--forest-3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.match-tile.is-term {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.match-tile.is-defined {
  background: #f9f5ec;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.match-tile.is-selected {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--white);
  box-shadow: 0 8px 18px rgba(18, 47, 67, 0.18);
  transform: translateY(-2px);
}

.match-tile.is-wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral-dark);
  animation: shake 0.36s ease;
}

.match-tile.is-matched {
  border-color: transparent;
  background: rgba(227, 196, 124, 0.33);
  color: var(--forest);
  opacity: 0.35;
  transform: scale(0.97);
  pointer-events: none;
}

.match-tile.is-matched::after {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--forest-3);
  font-size: 10px;
  content: "✓";
}

.match-tile.is-matched.is-term,
.match-tile.is-matched.is-defined {
  font-size: 10.5px;
}

.match-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-light);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.match-complete .result-badge {
  margin-bottom: 15px;
}

.match-complete h2 {
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 600;
}

.match-complete p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.match-complete-stats {
  display: flex;
  gap: 26px;
  margin: 19px 0;
}

.match-complete-stats div {
  text-align: center;
}

.match-complete-stats strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 500;
}

.match-complete-stats span {
  color: var(--muted);
  font-size: 8.5px;
}

.match-complete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---------- Forms / modal ---------- */

.form-page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.form-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
}

.form-card-head {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line-soft);
}

.form-card-head h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
}

.form-card-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.form-card-body {
  padding: 24px 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field + .field {
  margin-top: 0;
}

.field label {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.field label .optional {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 400;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--paper);
  font-size: 13px;
  transition: 0.16s ease;
}

.input {
  height: 44px;
  padding: 0 13px;
}

.textarea {
  min-height: 180px;
  padding: 13px;
  line-height: 1.65;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: var(--forest-3);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45, 92, 117, 0.1);
}

.input::placeholder,
.textarea::placeholder {
  color: #a2a194;
}

.form-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.form-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.form-section-title h3 {
  font-size: 12px;
  font-weight: 700;
}

.form-section-title p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.color-swatch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.color-swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.color-swatch:has(input:checked) {
  border-color: var(--forest);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(18, 47, 67, 0.08);
}

.color-swatch:has(input:focus-visible) {
  outline: 3px solid rgba(201, 106, 74, 0.55);
  outline-offset: 2px;
}

.color-swatch i {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--swatch);
}

.color-swatch:hover {
  border-color: #c9bfae;
  color: var(--ink);
}

.color-swatch.is-active {
  border-color: var(--forest);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(18, 47, 67, 0.08);
}

.pair-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1.3fr) 32px;
  gap: 8px;
  align-items: center;
}

.pair-index {
  color: #b4b3a6;
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

.pair-row .input {
  height: 42px;
  font-size: 12px;
}

.pair-remove {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.pair-remove:hover {
  background: var(--danger-soft);
  color: var(--coral-dark);
}

.pair-remove .icon {
  width: 14px;
  height: 14px;
}

.add-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin-top: 3px;
  padding: 7px 10px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.add-pair:hover {
  border-color: var(--forest-3);
  color: var(--forest);
}

.add-pair .icon {
  width: 13px;
  height: 13px;
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 28px;
  border-top: 1px solid var(--line-soft);
  background: rgba(245, 240, 230, 0.48);
}

.form-foot-note {
  color: var(--muted);
  font-size: 9.5px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 18px;
  align-items: start;
}

.import-preview {
  position: sticky;
  top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-light);
}

.import-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
}

.import-preview-head strong {
  font-size: 11px;
}

.import-preview-head span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.import-preview-body {
  max-height: 360px;
  overflow: auto;
}

.import-preview-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 15px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px;
}

.import-preview-row:last-child {
  border-bottom: 0;
}

.import-preview-row strong {
  min-width: 82px;
  font-family: var(--font-serif);
  font-size: 13px;
}

.import-preview-row span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview-empty {
  padding: 25px 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.import-tips {
  margin-top: 16px;
  padding: 15px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.7;
}

.import-tips strong {
  color: var(--ink-soft);
}

.import-tips code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(19, 32, 25, 0.42);
  backdrop-filter: blur(5px);
  animation: fade-in 0.18s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: 100%;
  max-width: 540px;
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  background: var(--paper-light);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal.is-wide {
  max-width: 680px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 23px 25px 17px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.modal-body {
  padding: 20px 25px;
}

.modal-body .field + .field {
  margin-top: 14px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 25px;
  border-top: 1px solid var(--line-soft);
  background: rgba(245, 240, 230, 0.45);
}

.modal-foot-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.modal-close .icon {
  width: 17px;
  height: 17px;
}

.confirm-copy {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.7;
}

.confirm-copy strong {
  color: var(--ink);
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 11px;
}

.shortcut-row:last-child {
  border-bottom: 0;
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

.shortcut-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
}

/* Toast */

.toast-root {
  position: fixed;
  z-index: 1500;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: var(--forest);
  color: var(--white);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  line-height: 1.45;
  animation: toast-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
  pointer-events: auto;
}

.toast.is-out {
  animation: toast-out 0.2s ease both;
}

.toast .icon {
  width: 15px;
  height: 15px;
  color: var(--lime);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- Stats page ---------- */

.stats-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 24px;
  align-items: center;
  padding: 31px 34px;
  border-radius: var(--radius-xl);
  background: var(--forest);
  color: var(--white);
}

.stats-hero h1 {
  margin: 11px 0 7px;
  font-family: var(--font-serif);
  font-size: clamp(29px, 3.2vw, 40px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stats-hero p {
  max-width: 450px;
  color: rgba(255, 253, 248, 0.58);
  font-size: 11.5px;
  line-height: 1.7;
}

.stats-hero .eyebrow {
  color: rgba(255, 253, 248, 0.48);
}

.stats-hero-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hero-figure {
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
}

.hero-figure strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
}

.hero-figure strong small {
  margin-left: 2px;
  color: rgba(255, 253, 248, 0.42);
  font-family: var(--font-mono);
  font-size: 9px;
}

.hero-figure span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 253, 248, 0.48);
  font-size: 8.5px;
  letter-spacing: 0.05em;
}

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

.metric-card {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(252, 249, 242, 0.76);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9.5px;
}

.metric-head .icon {
  width: 15px;
  height: 15px;
  color: #a6a596;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.metric-card strong small {
  margin-left: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
}

.metric-card p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 18px;
  margin-top: 18px;
}

.analytics-card {
  padding: 22px 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(252, 249, 242, 0.76);
}

.analytics-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.analytics-head h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
}

.analytics-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
}

.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

.heatmap {
  display: flex;
  gap: 8px;
  min-width: 600px;
}

.heatmap-day-labels {
  display: grid;
  grid-template-rows: repeat(7, 20px);
  gap: 5px;
  padding-top: 20px;
  color: var(--muted);
  font-size: 8px;
  line-height: 20px;
}

.heatmap-weeks {
  display: flex;
  gap: 5px;
}

.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.heatmap-month {
  height: 15px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 15px;
  white-space: nowrap;
}

.heat-grid {
  display: grid;
  grid-template-rows: repeat(7, 20px);
  gap: 5px;
}

.heat-cell {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #e9e1d2;
}

.heat-cell[data-level="1"] {
  background: #ecdfc3;
}

.heat-cell[data-level="2"] {
  background: #dfc688;
}

.heat-cell[data-level="3"] {
  background: #b8964e;
}

.heat-cell[data-level="4"] {
  background: var(--forest);
}

.heat-cell.is-today {
  box-shadow: 0 0 0 1.5px var(--coral);
}

.heat-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 8px;
}

.heat-legend .heat-cell {
  width: 10px;
  height: 10px;
}

.mastery-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mastery-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.mastery-item-head span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.mastery-list .progress {
  height: 5px;
}

.mastery-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 8.5px;
}

.mastery-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mastery-legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--dot);
}

.set-progress-list {
  margin-top: 18px;
}

.set-progress-item {
  display: grid;
  grid-template-columns: 1fr 170px 54px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.set-progress-item:last-child {
  border-bottom: 0;
}

.set-progress-item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.set-color-dot {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--tone);
}

.set-progress-item-name strong {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-progress-item-name span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
}

.set-progress-item .progress {
  height: 5px;
}

.set-progress-item > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: right;
}

/* ---------- Settings ---------- */

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.settings-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-light);
}

.settings-section {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h2 {
  font-size: 12px;
  font-weight: 700;
}

.settings-section > p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--forest);
  color: var(--lime);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
}

.account-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.account-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy span {
  color: var(--muted);
  font-size: 9px;
}

.account-row .btn {
  flex: 0 0 auto;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row-copy strong {
  display: block;
  font-size: 11px;
  font-weight: 650;
}

.settings-row-copy span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.settings-input {
  width: 96px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--paper);
  font-size: 11.5px;
  text-align: center;
}

.settings-input:focus {
  border-color: var(--forest-3);
  background: var(--white);
}

.settings-input.is-text {
  width: 164px;
  text-align: left;
}

.settings-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--forest);
  color: var(--white);
}

.about-card .brand-mark {
  background: var(--lime);
  color: var(--forest);
  box-shadow: none;
}

.about-card h3 {
  margin-top: 15px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.about-card p {
  margin-top: 6px;
  color: rgba(255, 253, 248, 0.6);
  font-size: 9.5px;
  line-height: 1.7;
}

.about-card .about-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 253, 248, 0.42);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.privacy-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(252, 249, 242, 0.6);
}

.privacy-card h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 650;
}

.privacy-card h4 .icon {
  width: 13px;
  height: 13px;
  color: var(--forest-3);
}

.privacy-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

/* ---------- Empty states ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 35px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: rgba(252, 249, 242, 0.42);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 13px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--muted);
}

.empty-icon .icon {
  width: 24px;
  height: 24px;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
}

.empty-state p {
  max-width: 370px;
  margin: 5px 0 16px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---------- Confetti ---------- */

.confetti-layer {
  position: fixed;
  z-index: 1400;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall var(--duration, 2.4s) var(--delay, 0s) cubic-bezier(0.18, 0.7, 0.3, 1) forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  8% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 40px), 105vh, 0) rotate(var(--rotate, 540deg));
  }
}

/* ---------- Mobile nav ---------- */

.mobile-nav {
  position: fixed;
  z-index: 60;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 12px;
  align-items: center;
  justify-content: space-around;
  height: 62px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(18, 47, 67, 0.95);
  box-shadow: 0 12px 34px rgba(18, 47, 67, 0.28);
  backdrop-filter: blur(12px);
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 52px;
  padding: 5px;
  border-radius: 10px;
  color: rgba(255, 253, 248, 0.52);
  font-size: 8.5px;
  font-weight: 600;
}

.mobile-nav a .icon {
  width: 19px;
  height: 19px;
}

.mobile-nav a.is-active {
  color: var(--lime);
}

.mobile-nav .mobile-add {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-top: -18px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--forest);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-nav .mobile-add .icon {
  width: 21px;
  height: 21px;
}

/* ---------- Word roots ---------- */

.root-summary {
  display: flex;
  align-items: stretch;
  gap: 1px;
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--forest);
  color: var(--white);
}

.root-summary > div {
  flex: 1;
  padding: 16px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.root-summary > div:last-child {
  border-right: 0;
}

.root-summary strong {
  display: block;
  color: var(--lime);
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}

.root-summary span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 253, 248, 0.48);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.root-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.root-search {
  width: min(100%, 380px);
  flex: 1;
}

.root-result-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

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

.root-card {
  min-width: 0;
  padding: 19px 20px 13px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background:
    radial-gradient(circle at 100% 0, rgba(227, 196, 124, 0.1), transparent 34%),
    var(--paper-light);
  box-shadow: 0 10px 28px rgba(23, 35, 41, 0.035);
}

.root-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.root-card-label {
  color: var(--forest);
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.root-card-meaning {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.root-card-count {
  flex: 0 0 auto;
  padding-top: 2px;
  text-align: right;
}

.root-card-count strong {
  display: block;
  color: var(--coral-dark);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.root-card-count span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.root-card-note {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.035em;
}

.root-word-list {
  margin-top: 11px;
  border-top: 1px solid var(--line);
}

.root-word {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(23, 35, 41, 0.08);
}

.root-word:last-child {
  border-bottom: 0;
}

.root-word strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.root-word span {
  max-width: 66%;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
  text-align: right;
}

.root-word-more {
  padding: 8px 0 3px;
  color: var(--coral-dark);
  font-size: 9px;
}

.root-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 230px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.root-empty .icon {
  width: 27px;
  height: 27px;
  margin-bottom: 11px;
  color: var(--forest-3);
}

.root-empty strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
}

.root-empty p {
  margin-top: 5px;
  font-size: 11px;
}

.root-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
}

.root-disclaimer .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.root-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  max-width: 100%;
  margin-top: 13px;
  padding: 7px 11px;
  border: 1px solid rgba(23, 35, 41, 0.1);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.55);
}

.root-hint-kicker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--coral-dark);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.root-hint-kicker .icon {
  width: 12px;
  height: 12px;
}

.root-parts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.root-part {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.root-part b {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
}

.root-part i {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.root-part.is-prefix b,
.root-part.is-suffix b {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: -0.02em;
}

.root-plus {
  color: var(--muted);
  font-size: 10px;
}

.root-hint.is-dark {
  margin-top: 15px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
}

.root-hint.is-dark .root-hint-kicker {
  color: var(--lime);
}

.root-hint.is-dark .root-part b {
  color: var(--paper-light);
}

.root-hint.is-dark .root-part i,
.root-hint.is-dark .root-plus {
  color: rgba(255, 253, 248, 0.55);
}

.root-hint.is-inline {
  justify-content: flex-start;
  margin-top: 8px;
  padding: 6px 9px;
  border-color: rgba(23, 35, 41, 0.08);
  background: rgba(255, 255, 255, 0.44);
}

.root-hint.is-inline .root-hint-kicker {
  font-size: 7.5px;
}

.root-hint.is-inline .root-part b {
  font-size: 11.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .main {
    padding: 32px 32px 60px;
  }

  .hero {
    padding: 33px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .set-grid {
    gap: 14px;
  }

  .set-cover {
    min-height: 132px;
  }

  .cover-label {
    font-size: 32px;
  }

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

  .practice-grid {
    gap: 9px;
  }

  .term-row {
    grid-template-columns: 26px minmax(140px, 0.8fr) minmax(0, 1.1fr) auto;
    gap: 10px;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr) 230px;
  }
}

@media (max-width: 1000px) {
  :root {
    --sidebar-w: 220px;
  }

  .sidebar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand {
    margin-left: 7px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .hero-goal {
    flex-direction: row;
    justify-content: flex-start;
    gap: 24px;
    min-height: 0;
    padding: 18px 22px;
    text-align: left;
  }

  .goal-ring {
    width: 118px;
    height: 118px;
    flex: 0 0 auto;
  }

  .goal-ring::before {
    inset: 7px;
  }

  .goal-ring-inner strong {
    font-size: 31px;
  }

  .goal-ring-inner strong small {
    font-size: 9px;
  }

  .hero-goal > p {
    max-width: 180px;
    margin-top: 0;
    font-size: 9.5px;
  }

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

  .set-grid .set-card-new {
    display: none;
  }

  .set-hero {
    grid-template-columns: minmax(0, 1fr) 190px;
  }

  .set-monogram {
    font-size: 44px;
  }

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

  .term-row {
    grid-template-columns: 24px minmax(0, 0.9fr) minmax(0, 1.1fr) auto;
  }

  .term-actions {
    opacity: 1;
  }

  .match-layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
  }

  .match-tile {
    min-height: 96px;
  }
}

@media (max-width: 860px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: calc(20px + env(safe-area-inset-top)) 22px 105px;
  }

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

  .mobile-topbar .brand {
    margin: 0;
  }

  .mobile-topbar .brand-mark {
    width: 35px;
    height: 35px;
    border-radius: 11px;
  }

  .mobile-topbar .brand-mark .icon {
    width: 21px;
    height: 21px;
  }

  .mobile-topbar .brand-name strong {
    font-size: 14px;
  }

  .mobile-topbar .brand-name small {
    margin-top: 4px;
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  .mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .mobile-streak {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(252, 249, 242, 0.65);
    color: var(--ink-soft);
    font-size: 9.5px;
    font-weight: 650;
  }

  .mobile-streak .icon {
    width: 13px;
    height: 13px;
    color: var(--coral);
  }

  .mobile-nav {
    display: flex;
  }

  .toast-root {
    right: 16px;
    bottom: 88px;
    left: 16px;
    align-items: center;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-head-actions .btn span {
    display: none;
  }

  .page-head-actions .btn {
    width: 42px;
    padding: 0;
  }

  .folder-hero {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    padding: 26px;
  }

  .folder-hero-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .set-hero {
    grid-template-columns: 1fr;
  }

  .set-hero-side {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-start;
  }

  .set-monogram {
    display: none;
  }

  .set-hero-actions {
    justify-content: flex-start;
  }

  .study-top-inner {
    padding: 0 16px;
  }

  .focus-main {
    padding: 28px 18px 40px;
  }

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

  .match-side {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 0;
  }

  .match-side h1 {
    margin-top: 4px;
    font-size: 27px;
  }

  .match-side > p {
    display: none;
  }

  .match-hud {
    margin-top: 0;
    min-width: 210px;
  }

  .match-side-tip {
    display: none;
  }

  .match-board {
    margin-top: 4px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .import-preview {
    position: static;
  }

  .stats-hero {
    grid-template-columns: 1fr;
  }

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

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

  .settings-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .root-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .main {
    padding: calc(16px + env(safe-area-inset-top)) 15px 100px;
  }

  .input,
  .textarea,
  .search-box input,
  .settings-input {
    font-size: 16px;
  }

  .mobile-topbar {
    margin-bottom: 17px;
  }

  .root-summary {
    margin-bottom: 14px;
    border-radius: 15px;
  }

  .root-summary > div {
    padding: 12px 11px;
  }

  .root-summary strong {
    font-size: 22px;
  }

  .root-summary span {
    font-size: 8px;
  }

  .root-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    margin-bottom: 12px;
  }

  .root-search {
    width: 100%;
    max-width: none;
  }

  .root-result-count {
    align-self: flex-end;
  }

  .root-card {
    padding: 16px 16px 10px;
  }

  .root-card-label {
    font-size: 27px;
  }

  .root-word strong {
    font-size: 13px;
  }

  .root-word span {
    max-width: 62%;
    font-size: 9px;
  }

  .root-hint {
    gap: 4px 8px;
    padding: 6px 8px;
  }

  .root-hint-kicker {
    font-size: 7.5px;
  }

  .root-part b {
    font-size: 12px;
  }

  .root-part i {
    font-size: 8px;
  }

  .root-part.is-prefix b,
  .root-part.is-suffix b {
    font-size: 9.5px;
  }

  .dashboard-head {
    flex-wrap: wrap;
    row-gap: 10px;
    margin-bottom: 14px;
  }

  .dashboard-head .eyebrow {
    white-space: nowrap;
  }

  .dashboard-actions {
    margin-left: auto;
  }

  .dashboard-actions .btn:first-child {
    display: none;
  }

  .page-head {
    display: block;
    margin-bottom: 18px;
  }

  .page-head-copy h1 {
    margin-top: 7px;
    font-size: 29px;
  }

  .page-head-actions {
    margin-top: 13px;
    padding-bottom: 0;
  }

  .page-head-actions .btn {
    width: auto;
    padding: 0 15px;
  }

  .page-head-actions .btn span {
    display: inline;
  }

  .hero {
    padding: 25px 23px;
    border-radius: 24px;
  }

  .hero h1 {
    margin-top: 17px;
    font-size: 31px;
    line-height: 1.27;
  }

  .hero-sub {
    font-size: 11.5px;
  }

  .hero-actions {
    width: 100%;
    margin-top: 21px;
  }

  .hero-actions .btn {
    flex: 1;
    padding: 0 13px;
    font-size: 12px;
  }

  .hero-facts {
    gap: 16px;
    margin-top: 22px;
    padding-top: 16px;
  }

  .hero-goal {
    gap: 16px;
    padding: 14px;
  }

  .goal-ring {
    width: 96px;
    height: 96px;
  }

  .goal-ring::before {
    inset: 6px;
  }

  .goal-ring-inner strong {
    font-size: 27px;
  }

  .goal-ring-inner span {
    margin-top: 6px;
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  .hero-goal > p {
    max-width: 150px;
    font-size: 9px;
    line-height: 1.5;
  }

  .section-head {
    margin-top: 26px;
  }

  .section-head h2 {
    font-size: 20px;
  }

  .set-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .set-cover {
    min-height: 128px;
  }

  .set-card {
    border-radius: 20px;
  }

  .mode-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mode-card {
    padding: 12px;
    border-radius: 14px;
  }

  .mode-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .mode-copy strong {
    font-size: 11.5px;
  }

  .mode-copy span,
  .mode-card > .icon {
    display: none;
  }

  .folder-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .folder-card {
    min-height: 190px;
    padding: 17px 18px 15px;
    border-radius: 20px;
  }

  .folder-card-main {
    padding-top: 19px;
  }

  .folder-card-main h3 {
    font-size: 25px;
  }

  .folder-symbol {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .folder-symbol .icon {
    width: 19px;
    height: 19px;
  }

  .folder-hero {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 23px 21px;
    border-radius: 24px;
  }

  .folder-hero-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .folder-hero-mark .icon {
    width: 26px;
    height: 26px;
  }

  .folder-hero h1 {
    margin-top: 7px;
    font-size: 29px;
  }

  .folder-hero-copy > p {
    font-size: 10.5px;
  }

  .folder-meta {
    gap: 11px;
    margin-top: 13px;
  }

  .folder-meta span {
    font-size: 9px;
  }

  .folder-hero-actions {
    width: 100%;
  }

  .folder-hero-actions .btn-lime {
    flex: 1;
  }

  .folder-add-card {
    min-height: 165px;
  }

  .set-hero {
    min-height: 0;
    padding: 24px 22px;
    border-radius: 24px;
  }

  .set-hero h1 {
    margin: 10px 0 7px;
    font-size: 30px;
  }

  .set-hero-copy > p {
    font-size: 10.5px;
  }

  .set-meta {
    gap: 12px;
    margin-top: 16px;
  }

  .practice-grid {
    gap: 8px;
    margin-top: 12px;
  }

  .practice-card {
    min-height: 125px;
    padding: 13px;
    border-radius: 15px;
  }

  .practice-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .practice-card h3 {
    margin-top: 14px;
    font-size: 12px;
  }

  .practice-card p {
    font-size: 9px;
  }

  .practice-card .arrow {
    display: none;
  }

  .list-toolbar {
    display: block;
  }

  .list-tools {
    flex-wrap: wrap;
    margin-top: 12px;
  }

  .search-box {
    flex: 1;
  }

  .search-box input,
  .search-box input:focus {
    width: 100%;
  }

  .filter-chips {
    order: 2;
    width: 100%;
    justify-content: space-between;
  }

  .filter-chips .chip {
    flex: 1;
    padding: 0 6px;
  }

  .term-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    grid-template-areas:
      "idx word actions"
      ". def def"
      ". mastery mastery";
    gap: 4px 8px;
    align-items: start;
    padding: 13px 12px;
  }

  .term-index {
    grid-area: idx;
    padding-top: 5px;
  }

  .term-word-wrap {
    grid-area: word;
  }

  .term-def {
    grid-area: def;
    margin-top: 1px;
    font-size: 11.5px;
  }

  .term-row .term-side {
    display: contents;
  }

  .term-actions {
    grid-area: actions;
    align-self: start;
  }

  .term-actions .audio-mini {
    display: none;
  }

  .mastery {
    grid-area: mastery;
    justify-content: flex-start;
    margin-top: 4px;
  }

  .mastery-label {
    width: auto;
  }

  .term-example {
    display: none;
  }

  .study-top-inner {
    grid-template-columns: auto 1fr auto;
    height: 59px;
    padding: 0 12px;
    gap: 8px;
  }

  .study-back span {
    display: none;
  }

  .study-title {
    justify-content: center;
  }

  .study-title .divider,
  .study-title > span {
    display: none;
  }

  .study-title strong {
    max-width: 150px;
  }

  .study-top-right .btn-ghost span {
    display: none;
  }

  .study-top-right .btn-ghost {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .focus-main {
    padding: 23px 14px 34px;
  }

  .session-meta {
    margin-bottom: 10px;
    padding: 0 4px;
  }

  .session-hint {
    display: none;
  }

  .flashcard {
    min-height: 390px;
  }

  .flash-face {
    padding: 35px 22px;
    border-radius: 24px;
  }

  .flash-word {
    font-size: 46px;
  }

  .flash-def {
    font-size: 27px;
  }

  .flash-example {
    margin-top: 15px;
    font-size: 12px;
  }

  .flash-example-zh {
    font-size: 9.5px;
  }

  .flash-hint {
    bottom: 19px;
    font-size: 8.5px;
  }

  .flash-label {
    top: 21px;
    left: 22px;
  }

  .flash-status {
    top: 15px;
    right: 16px;
  }

  .rate-row {
    gap: 6px;
    margin-top: 13px;
  }

  .rate-btn {
    min-height: 57px;
    padding: 9px 11px;
    border-radius: 12px;
  }

  .rate-btn strong {
    font-size: 11px;
  }

  .rate-btn span {
    font-size: 8.5px;
  }

  .rate-btn .rate-key {
    display: none;
  }

  .flash-footnote {
    display: none;
  }

  .learn-card,
  .quiz-card {
    padding: 24px 19px;
    border-radius: 21px;
  }

  .learn-card::before {
    left: 19px;
  }

  .question-top {
    margin-bottom: 20px;
  }

  .learn-question {
    min-height: 55px;
    margin-bottom: 19px;
  }

  .option-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .option-btn {
    min-height: 54px;
    font-size: 11.5px;
  }

  .feedback {
    flex-wrap: wrap;
    padding: 12px;
  }

  .feedback .btn {
    width: 100%;
    margin-top: 3px;
  }

  .learn-footer {
    font-size: 9px;
  }

  .learn-footer > span:last-child {
    display: none;
  }

  .result-stats {
    gap: 6px;
  }

  .result-stat strong {
    font-size: 21px;
  }

  .result-stat span {
    font-size: 8.5px;
  }

  .result-actions .btn {
    flex: 1;
    padding: 0 12px;
    font-size: 12px;
  }

  .quiz-intro {
    padding: 23px 20px;
    border-radius: 20px;
  }

  .quiz-intro h2 {
    font-size: 22px;
  }

  .segmented {
    border-radius: 10px;
  }

  .segmented label {
    font-size: 9.5px;
  }

  .quiz-question {
    font-size: 27px;
  }

  .quiz-start {
    display: block;
  }

  .quiz-start .btn {
    width: 100%;
    margin-top: 12px;
  }

  .match-layout {
    gap: 12px;
  }

  .match-side {
    display: block;
  }

  .match-side h1 {
    font-size: 26px;
  }

  .match-hud {
    margin-top: 12px;
  }

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

  .match-tile {
    min-height: 91px;
    padding: 8px 6px;
    border-radius: 11px;
    font-size: 9.5px;
  }

  .match-tile.is-term {
    font-size: 14px;
  }

  .match-tile.is-defined {
    font-size: 8.5px;
  }

  .match-complete {
    min-height: 330px;
  }

  .form-card-head,
  .form-card-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .form-foot {
    display: block;
    padding: 15px 18px;
  }

  .form-foot .form-actions {
    margin-top: 10px;
  }

  .form-foot .form-actions .btn {
    flex: 1;
  }

  .pair-row {
    grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1.1fr) 28px;
    gap: 5px;
  }

  .pair-row .input {
    padding: 0 9px;
    font-size: 11px;
  }

  .import-preview-body {
    max-height: 240px;
  }

  .stats-hero {
    padding: 24px 21px;
    border-radius: 24px;
  }

  .stats-hero-figures {
    gap: 7px;
  }

  .hero-figure {
    padding: 12px;
  }

  .hero-figure strong {
    font-size: 25px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .heatmap {
    min-width: 0;
    gap: 6px;
  }

  .heatmap-day-labels {
    grid-template-rows: repeat(7, 18px);
    gap: 4px;
    padding-top: 18px;
    font-size: 7px;
    line-height: 18px;
  }

  .heatmap-weeks {
    gap: 4px;
  }

  .heatmap-week {
    flex: 0 0 18px;
    gap: 4px;
  }

  .heatmap-month {
    height: 14px;
    font-size: 7px;
    line-height: 14px;
  }

  .heat-grid {
    grid-template-rows: repeat(7, 18px);
    gap: 4px;
  }

  .heat-cell {
    width: 18px;
    height: 18px;
    border-radius: 3px;
  }

  .heat-legend .heat-cell {
    width: 9px;
    height: 9px;
  }

  .analytics-card {
    padding: 17px 16px;
    border-radius: 19px;
  }

  .set-progress-item {
    grid-template-columns: 1fr 65px;
    gap: 8px;
  }

  .set-progress-item .progress {
    display: none;
  }

  .settings-side {
    grid-template-columns: 1fr;
  }

  .settings-row {
    align-items: flex-start;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-height: 90vh;
    border-radius: 22px 22px 0 0;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-foot {
    flex-wrap: wrap;
  }

  .modal-foot-right {
    width: 100%;
  }

  .modal-foot-right .btn {
    flex: 1;
  }

  .toast {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .hero-actions {
    display: block;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-actions .btn + .btn {
    margin-top: 7px;
  }

  .hero-goal {
    display: block;
    text-align: center;
  }

  .goal-ring {
    margin: 0 auto;
  }

  .hero-goal > p {
    max-width: none;
    margin-top: 11px;
  }

  .set-hero-actions {
    width: 100%;
  }

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

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

  .auth-story {
    padding: 24px 28px 0;
  }

  .auth-story-main {
    max-width: none;
    margin: 0;
    padding: 36px 0 34px;
  }

  .auth-story h1 {
    font-size: clamp(34px, 6vw, 46px);
  }

  .auth-points {
    display: none;
  }

  .auth-story-foot {
    display: none;
  }

  .auth-panel {
    padding: 30px 22px 48px;
  }

  .auth-card {
    max-width: 480px;
  }
}

@media (max-width: 640px) {
  .auth-story {
    padding: 18px 18px 0;
  }

  .auth-story-main {
    padding: 22px 0 24px;
  }

  .auth-story-main > p {
    display: none;
  }

  .auth-story h1 {
    margin: 13px 0 0;
    font-size: 31px;
  }

  .auth-kicker {
    font-size: 8px;
  }

  .auth-panel {
    padding: 20px 14px 38px;
  }

  .auth-card {
    padding: 24px 21px 22px;
    border-radius: 22px;
  }

  .auth-card h2 {
    font-size: 28px;
  }

  .auth-input-wrap input {
    font-size: 16px;
  }

  .auth-privacy {
    justify-content: center;
    max-width: 300px;
    text-align: center;
  }

  .account-row {
    flex-wrap: wrap;
  }

  .account-row .btn {
    width: 100%;
    margin-top: 7px;
  }

  .sync-banner {
    align-items: flex-start;
    flex-wrap: wrap;
    font-size: 9px;
  }

  .sync-banner-text {
    min-width: calc(100% - 36px);
  }

  .sync-retry {
    margin-left: auto;
  }
}

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

/* ---------- Print ---------- */

@media print {
  .sidebar,
  .mobile-nav,
  .mobile-topbar,
  .study-top,
  .hero-actions,
  .practice-grid,
  .list-tools,
  .term-actions {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .term-list,
  .set-hero {
    break-inside: avoid;
  }
}
