/* Toolbar & Filters */
.mw-toolbar {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 1.25rem;
}

.mw-search-box {
  position: relative;
  margin-bottom: 1rem;
}

.mw-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400, #94a3b8);
  display: flex;
}

.mw-search-input {
  width: 100%;
  height: 48px;
  border-radius: 1rem;
  border: 2px solid var(--ink-200, #cbd5e1);
  padding: 0 1rem 0 2.75rem;
  font-size: 0.9375rem;
  background: var(--surface, #ffffff);
  color: var(--ink-900, #0f172a);
  transition: border-color 0.15s ease;
}

.mw-search-input:focus {
  outline: none;
  border-color: var(--jade-500, #10b981);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.mw-filter-pills-wrap {
  margin-bottom: 0.75rem;
}

.mw-filter-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-500, #64748b);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mw-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mw-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface, #ffffff);
  border: 1.5px solid var(--ink-200, #cbd5e1);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-700, #334155);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mw-filter-pill:hover {
  border-color: var(--jade-400, #34d399);
  background: var(--jade-50, #ecfdf5);
  color: var(--jade-700, #047857);
}

.mw-filter-pill.active {
  background: var(--jade-600, #059669);
  border-color: var(--jade-600, #059669);
  color: #ffffff;
}

.mw-pill-count {
  font-size: 0.75rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

.mw-status-row {
  font-size: 0.875rem;
  color: var(--ink-500, #64748b);
  padding-top: 0.5rem;
  border-top: 1px solid var(--ink-100, #e2e8f0);
}

.mw-status-row strong {
  color: var(--jade-600, #059669);
}

/* Cards Grid */
.mw-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .mw-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .mw-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mw-card {
  background: var(--surface, #ffffff);
  border: 2px solid var(--ink-100, #e2e8f0);
  border-radius: 1.25rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.mw-card:hover {
  border-color: var(--jade-300, #6ee7b7);
  box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.1);
  transform: translateY(-2px);
}

.mw-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink-100, #e2e8f0);
  padding-bottom: 0.875rem;
  margin-bottom: 0.875rem;
}

.mw-char-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.mw-char-big {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--jade-700, #047857);
  line-height: 1;
}

.mw-char-meta {
  display: flex;
  flex-direction: column;
}

.mw-pinyin {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink-800, #1e293b);
  line-height: 1.2;
}

.mw-hanviet {
  font-size: 0.8125rem;
  color: var(--ink-400, #94a3b8);
  font-weight: 600;
}

.mw-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mw-hsk-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--gold-700, #b45309);
  background: var(--gold-50, #fffbeb);
  border: 1px solid var(--gold-200, #fde68a);
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
}

.mw-group-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ink-600, #475569);
  background: var(--ink-50, #f8fafc);
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
}

.mw-meaning-row {
  margin-bottom: 0.5rem;
}

.mw-meaning {
  font-size: 1.05rem;
  color: var(--ink-900, #0f172a);
  font-weight: 800;
}

.mw-desc {
  font-size: 0.875rem;
  color: var(--ink-600, #475569);
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.mw-nouns-row {
  font-size: 0.8125rem;
  color: var(--ink-600, #475569);
  background: var(--ink-50, #f8fafc);
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  margin-bottom: 0.875rem;
  line-height: 1.4;
}

.mw-nouns-label {
  font-weight: 700;
  color: var(--ink-700, #334155);
}

.mw-nouns-list {
  color: var(--jade-700, #047857);
  font-weight: 600;
}

.mw-examples-block {
  margin-top: auto;
  border-top: 1px dashed var(--ink-100, #e2e8f0);
  padding-top: 0.75rem;
}

.mw-examples-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-400, #94a3b8);
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}

.mw-examples-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mw-audio-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface, #ffffff);
  border: 1px solid var(--ink-100, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.mw-audio-chip:hover {
  background: var(--jade-50, #ecfdf5);
  border-color: var(--jade-200, #a7f3d0);
}

.mw-ex-han {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink-900, #0f172a);
}

.mw-ex-pinyin {
  font-size: 0.8125rem;
  color: var(--jade-600, #059669);
  font-weight: 600;
}

.mw-ex-vi {
  font-size: 0.8125rem;
  color: var(--ink-500, #64748b);
  margin-left: auto;
}

.mw-icon-sm {
  width: 14px;
  height: 14px;
  shrink: 0;
}

.mw-icon-md {
  width: 16px;
  height: 16px;
}

/* Educational Guide */
.mw-guide-article {
  margin-top: 3rem;
  padding: 2rem;
  border-radius: 1.5rem;
}

.mw-guide-heading {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink-900, #0f172a);
  margin-bottom: 1.5rem;
}

.mw-rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .mw-rules-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mw-rule-box {
  background: var(--surface, #ffffff);
  border: 1px solid var(--ink-200, #cbd5e1);
  border-radius: 1rem;
  padding: 1.25rem;
}

.mw-rule-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--jade-700, #047857);
  margin-bottom: 0.5rem;
}

.mw-rule-desc {
  font-size: 0.875rem;
  color: var(--ink-600, #475569);
  line-height: 1.6;
}

.mw-rule-desc code {
  background: var(--ink-50, #f8fafc);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--jade-700, #047857);
}

/* Dark mode adjustments */
[data-theme="dark"] .mw-hero-badge {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
  border-color: rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .mw-quiz-card {
  background: linear-gradient(135deg, #1e293b 0%, #064e3b 100%);
  border-color: rgba(5, 150, 105, 0.4);
}

[data-theme="dark"] .mw-quiz-streak-wrap {
  background: #0f172a;
  border-color: rgba(5, 150, 105, 0.4);
}

[data-theme="dark"] .mw-quiz-opt-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
  box-shadow: 0 3px 0 0 #0f172a;
}

[data-theme="dark"] .mw-quiz-opt-btn:hover {
  background: rgba(5, 150, 105, 0.2);
  border-color: #34d399;
}

[data-theme="dark"] .mw-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .mw-audio-chip {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .mw-mode-btn {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .mw-mode-btn:hover {
  background: rgba(5, 150, 105, 0.2);
  border-color: #34d399;
}

[data-theme="dark"] .mw-mode-btn.is-active {
  background: rgba(5, 150, 105, 0.25);
  border-color: #10b981;
}

[data-theme="dark"] .mw-mode-btn .mode-text strong {
  color: #f8fafc;
}

[data-theme="dark"] .mw-hud,
[data-theme="dark"] .mw-feedback-card,
[data-theme="dark"] .mw-game-result .result-stat-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .mw-hud .hud-val,
[data-theme="dark"] .mw-game-result .result-title,
[data-theme="dark"] .mw-game-result .result-stat-card .stat-num {
  color: #f8fafc;
}

[data-theme="dark"] .mw-feedback-card.is-correct {
  background: rgba(5, 150, 105, 0.15);
  border-color: rgba(5, 150, 105, 0.4);
}

[data-theme="dark"] .mw-feedback-card.is-wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .mw-view-tabs {
  background: #1e293b;
}

[data-theme="dark"] .mw-view-tab-btn {
  color: #94a3b8;
}

[data-theme="dark"] .mw-view-tab-btn.is-active {
  background: #0f172a;
  color: #34d399;
}

[data-theme="dark"] .reverse-intro-banner {
  background: linear-gradient(135deg, #1e293b 0%, #064e3b 100%);
  border-color: rgba(5, 150, 105, 0.4);
}

[data-theme="dark"] .reverse-intro-stat {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .reverse-mw-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .reverse-noun {
  color: #f8fafc;
}

[data-theme="dark"] .reverse-phrase-han {
  color: #f8fafc;
}

[data-theme="dark"] .reverse-hint-tag {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .reverse-mw-badge-box {
  background: rgba(5, 150, 105, 0.2);
  border-color: rgba(5, 150, 105, 0.4);
}
