:root {
  --bg: #fff8f3;
  --bg-warm: #ffeef5;
  --surface: #fffefb;
  --text: #4a3f55;
  --muted: #9a8a9e;
  --accent: #e85d6a;
  --accent-dark: #d14d5a;
  --accent-soft: #ffe4e8;
  --gold: #e8b86d;
  --gold-soft: #fff4e0;
  --jade: #6bb89a;
  --jade-dark: #4fa080;
  --jade-soft: #e3f5ec;
  --plum: #c97b9a;
  --border: #f5d5dc;
  --shadow: 0 4px 20px rgba(80, 60, 70, 0.08);
  --shadow-card: 0 6px 24px rgba(80, 60, 70, 0.1);
  --radius: 10px;
  --radius-btn: 8px;
  --radius-bar: 4px;
  --hanzi: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --sans: "Nunito", "Source Sans 3", system-ui, sans-serif;
  --cute: "ZCOOL KuaiLe", "Noto Sans SC", cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

button,
.nav-btn,
.action-card,
.tab,
.word-item-body,
.quiz-opt {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(232, 93, 106, 0.15);
  cursor: pointer;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Декор: облака и узор */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 120px 60px at 8% 12%, rgba(255, 220, 230, 0.7) 0%, transparent 70%),
    radial-gradient(ellipse 100px 50px at 92% 8%, rgba(255, 235, 210, 0.6) 0%, transparent 70%),
    radial-gradient(ellipse 140px 70px at 85% 75%, rgba(227, 245, 236, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 90px 45px at 5% 80%, rgba(255, 228, 240, 0.5) 0%, transparent 70%);
}

body::after {
  content: "福";
  position: fixed;
  right: -20px;
  bottom: 40px;
  font-family: var(--hanzi);
  font-size: 8rem;
  color: rgba(232, 93, 106, 0.04);
  pointer-events: none;
  z-index: 0;
  transform: rotate(-12deg);
}

.app {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, #fff 0%, #fff5f8 100%);
  border-right: 2px dashed var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding: 0.5rem;
}

.brand-hanzi {
  font-family: var(--cute);
  font-size: 2.2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--accent), var(--plum));
  color: #fff;
  border-radius: 50% 50% 50% 12px;
  box-shadow: 0 6px 16px rgba(232, 93, 106, 0.35);
  border: 2px solid #fff;
}

.brand strong {
  font-family: var(--cute);
  font-size: 1.15rem;
  color: var(--accent-dark);
  font-weight: 400;
}

.brand small { color: var(--muted); display: block; font-size: 0.8rem; }

.nav { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 2px solid transparent;
  background: transparent;
  border-radius: var(--radius-btn);
  font: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: 0.2s;
}

.nav-icon {
  font-family: var(--hanzi);
  font-size: 1.05rem;
  font-weight: 700;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--accent-dark);
  transition: 0.2s;
}

.nav-btn:hover .nav-icon,
.nav-btn.active .nav-icon {
  background: linear-gradient(145deg, var(--accent), var(--plum));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(232, 93, 106, 0.25);
}

.nav-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  transform: translateX(4px);
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(232, 93, 106, 0.1);
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.75rem;
  background: var(--gold-soft);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.setting-row input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.setting-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  border: 2px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--accent);
}

/* Main */
.main {
  padding: 2rem 2.5rem 3rem;
  max-width: 920px;
}

.view { display: none; animation: fadeIn 0.35s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 2rem; }
.page-header.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 {
  font-family: var(--sans);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.subtitle { color: var(--muted); margin-top: 0.4rem; font-size: 0.95rem; }

.page-header--dash {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header--dash > div {
  flex: 1;
  min-width: 0;
}

.dash-panda {
  width: clamp(72px, 18vw, 120px);
  height: auto;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
  display: block;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: none;
}

.stat-card.highlight {
  border-color: var(--accent);
  background: #fff;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--sans);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin: 0.2rem 0;
}

.stat-sub { font-size: 0.85rem; color: var(--muted); }

.progress-bar {
  height: 8px;
  background: #eee5e8;
  border-radius: var(--radius-bar);
  margin-top: 0.75rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--jade);
  border-radius: var(--radius-bar);
  width: 0%;
  transition: width 0.5s ease;
}

.action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.action-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.action-card.primary {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent-dark);
}

.action-card.primary .action-desc { color: rgba(255, 255, 255, 0.88); }

.action-icon {
  font-family: var(--hanzi);
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.5rem;
}

.action-title { font-family: var(--sans); font-size: 1.1rem; font-weight: 700; display: block; }
.action-desc { font-size: 0.88rem; color: var(--muted); margin-top: 0.3rem; display: block; }

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.panel h2 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.panel-hint {
  background: var(--gold-soft);
  border-color: var(--gold);
}

.panel-hint p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}

.stage-row span:first-child { width: 88px; color: var(--muted); }
.stage-bar-wrap {
  flex: 1;
  height: 12px;
  background: var(--bg-warm);
  border-radius: var(--radius-btn);
  overflow: hidden;
  border: 1px solid var(--border);
}

.stage-bar { height: 100%; border-radius: var(--radius-btn); }
.stage-bar.new { background: #ddd0e0; }
.stage-bar.learning { background: linear-gradient(90deg, var(--gold), #f0c878); }
.stage-bar.review { background: linear-gradient(90deg, #8ecae6, #7ab8d4); }
.stage-bar.mastered { background: linear-gradient(90deg, var(--jade), var(--jade-dark)); }
.stage-row span:last-child { width: 36px; text-align: right; font-weight: 700; color: var(--accent-dark); }

.word-summary { list-style: none; }
.word-summary li {
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.word-summary li:last-child { border-bottom: none; }
.word-summary li span:last-child { font-weight: 700; color: var(--accent-dark); }
.word-summary li:last-child span:last-child { color: var(--jade-dark); }

/* Study */
.study-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.study-header-top {
  width: 100%;
  margin-bottom: -0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.btn-finish-study {
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius-btn);
  background: var(--accent-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
  transition: 0.15s;
}

.btn-finish-study:hover {
  background: var(--accent);
  color: #fff;
}

.btn-exit-study {
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
}

.btn-exit-study:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.study-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.study-controls select {
  padding: 0.55rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.study-counter {
  font-weight: 700;
  color: var(--plum);
  background: var(--accent-soft);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
}

.flashcard-wrap {
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  min-height: 380px;
}

.flashcard {
  width: 100%;
  height: 300px;
  min-height: 300px;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 0.75rem;
  position: relative;
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: linear-gradient(160deg, #fff 0%, #fff9fb 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.card-face::before,
.card-face::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid var(--gold);
  opacity: 0.5;
}

.card-face::before { top: 12px; left: 12px; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.card-face::after { bottom: 12px; right: 12px; border-left: none; border-top: none; border-radius: 0 0 8px 0; }

.card-back { transform: rotateY(180deg); }
.flashcard.flipped .card-front { transform: rotateY(180deg); }
.flashcard.flipped .card-back { transform: rotateY(0); }

.card-prompt {
  font-family: var(--hanzi);
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.card-prompt.text-prompt {
  font-family: var(--sans);
  font-size: 1.2rem;
  max-width: 100%;
  color: var(--text);
}

.card-hanzi {
  font-family: var(--hanzi);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.card-pinyin {
  font-size: 1.4rem;
  color: var(--plum);
  margin: 0.5rem 0;
  font-weight: 600;
}

.card-translation { color: var(--muted); font-size: 1rem; max-width: 90%; }

.card-wheel {
  position: absolute;
  top: 14px;
  right: 14px;
  pointer-events: none;
}

.progress-ring {
  display: block;
  flex-shrink: 0;
}

.progress-ring .ring-bg {
  fill: none;
  stroke: #e8e8ec;
  stroke-width: 4;
}

.progress-ring .ring-fill {
  fill: none;
  stroke: var(--jade);
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.35s ease;
}

.progress-ring.done .ring-fill {
  stroke: var(--jade-dark);
}

.progress-ring .ring-text {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  fill: var(--muted);
}

.progress-ring.done .ring-text {
  fill: var(--jade-dark);
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.reveal-btn { margin-bottom: 0.75rem; }

.btn-delete-custom {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0.5rem auto 0;
  padding: 0.55rem 1rem;
  border: 2px dashed var(--plum);
  border-radius: 12px;
  background: #fff;
  color: var(--plum);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.btn-delete-custom:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.rating p {
  margin-bottom: 1rem;
  font-family: var(--cute);
  font-size: 1.15rem;
  color: var(--accent-dark);
}

.rating-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.rate {
  padding: 1.1rem 1rem;
  border: none;
  border-radius: var(--radius-btn);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.08);
}

.rate span {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.95;
}

.rate:active { transform: translateY(4px); box-shadow: none; }

.rate.know {
  background: var(--jade-dark);
}

.rate.unknown {
  background: var(--accent-dark);
}

.study-setup {
  text-align: center;
  padding: 2.5rem 1.5rem;
  max-width: 440px;
  margin: 0 auto 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-card);
}

.study-setup-icon,
.study-empty-icon {
  margin-bottom: 0.25rem;
}

.study-mark {
  font-family: var(--hanzi);
  font-size: 2.25rem;
  font-weight: 700;
  display: inline-flex;
  width: 4.25rem;
  height: 4.25rem;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--accent), var(--plum));
  color: #fff;
  border-radius: 50% 50% 50% 12px;
  box-shadow: 0 6px 16px rgba(232, 93, 106, 0.3);
  border: 2px solid #fff;
}

.study-setup-title {
  font-family: var(--cute);
  font-size: 1.6rem;
  color: var(--accent-dark);
  margin: 0.25rem 0 0.5rem;
  font-weight: 400;
}

.study-setup-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 auto 1.5rem;
  max-width: 340px;
  line-height: 1.55;
}

.batch-picker {
  margin: 0 0 1.5rem;
  padding: 1.35rem 1.25rem;
  background: var(--accent-soft);
  border-radius: 18px;
  border: 2px solid var(--border);
}

.batch-picker label {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.batch-picker-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.batch-picker input {
  width: 5.5rem;
  padding: 0.7rem 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  border: 3px solid var(--accent);
  border-radius: 14px;
  font: inherit;
  color: var(--accent-dark);
  background: #fff;
}

.btn-start-batch {
  width: 100%;
  max-width: 300px;
  font-size: 1.05rem;
  padding: 1rem 1.5rem;
}

.study-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.study-empty-sub {
  font-size: 0.9rem;
  margin: 0.75rem auto 1rem;
  max-width: 360px;
  white-space: pre-line;
  line-height: 1.6;
}

.list-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 0.2rem;
}

.btn-add-hsk {
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--jade), var(--jade-dark));
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-add-hsk:disabled {
  opacity: 0.5;
  cursor: default;
}

.study-empty-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 300px;
  margin: 1.25rem auto 0;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.35rem;
  border: none;
  border-radius: var(--radius-btn);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover { transform: translateY(-2px); }

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 2px solid var(--border);
}

.hidden { display: none !important; }

/* Quiz */
.quiz-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--border);
}

.quiz-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.quiz-question {
  font-family: var(--hanzi);
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--accent-dark);
  min-height: 4rem;
}

.quiz-empty-msg {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
}

.quiz-options { display: flex; flex-direction: column; gap: 0.65rem; }

.quiz-opt {
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: 0.15s;
}

.quiz-opt:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(6px);
}

.quiz-opt.correct {
  border-color: var(--jade-dark);
  background: var(--jade-soft);
}

.quiz-opt.wrong {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-feedback { text-align: center; margin: 1rem 0; font-weight: 600; color: var(--accent-dark); }
.quiz-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; }
.quiz-done { text-align: center; padding: 2rem; }
.quiz-result { font-family: var(--cute); font-size: 1.75rem; color: var(--accent-dark); margin: 1rem 0; }

.quiz-done-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 240px;
  margin: 0 auto;
}

/* List */
.search {
  padding: 0.65rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  min-width: 220px;
  background: #fff;
}

.search:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }

.tab {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: var(--radius-btn);
  font: inherit;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--muted);
  transition: 0.15s;
}

.tab:hover { border-color: var(--accent); color: var(--accent-dark); }

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--plum));
  color: #fff;
  border-color: transparent;
}

.word-list { display: flex; flex-direction: column; gap: 0.55rem; }

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.list-count {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.list-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.5rem 0 1rem;
}

.list-hint strong {
  color: var(--plum);
  font-weight: 700;
}

.btn-delete-word {
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
}

.btn-delete-word:hover {
  background: var(--accent);
  color: #fff;
}

.word-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: 0.15s;
}

.word-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.word-item-body { cursor: pointer; min-width: 0; }
.word-item-body:hover .hanzi { color: var(--plum); }

.word-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}

.badge.custom {
  background: var(--gold-soft);
  color: #a67c00;
}

.word-item .num { color: var(--plum); font-size: 0.85rem; font-weight: 600; }
.word-item .hanzi { font-family: var(--hanzi); font-size: 1.5rem; font-weight: 700; color: var(--accent-dark); }
.word-item .meta { font-size: 0.85rem; color: var(--muted); }
.word-item .meta .py { color: var(--plum); font-weight: 600; }

.badge {
  font-size: 0.68rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-btn);
  font-weight: 700;
}

.badge.new { background: #f0e8f4; color: #8a7a94; }
.badge.learning { background: var(--gold-soft); color: #b8860b; }
.badge.review { background: #e3f0fa; color: #5a8ab0; }
.badge.mastered { background: var(--jade-soft); color: var(--jade-dark); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 63, 85, 0.35);
}

.modal-box {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 1.75rem;
  max-width: 400px;
  width: 100%;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-card);
}

.modal-box h2 {
  font-family: var(--cute);
  color: var(--accent-dark);
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.add-word-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.add-word-form input {
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font: inherit;
  color: var(--text);
}

.add-word-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -290px;
    transition: left 0.25s;
    width: 268px;
    box-shadow: var(--shadow-card);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .main { padding: 4.5rem 1.25rem 2rem; }
  .action-cards { grid-template-columns: 1fr; }
  .rating-btns { grid-template-columns: 1fr; }
  .word-item {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }
  .word-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .page-header--dash {
    align-items: center;
    gap: 0.65rem;
  }
  .page-header--dash h1 {
    font-size: 1.4rem;
  }
  .page-header--dash .subtitle {
    font-size: 0.88rem;
  }
}
