/* ── LAYOUT: 隱藏 Quartz 側欄，給卡片牆全寬 ───────── */
body[data-slug="index"] .left.sidebar,
body[data-slug="index"] .right.sidebar { display: none !important; }
body[data-slug="index"] .center { max-width: none !important; grid-column: 1 / -1 !important; padding: 0 2rem !important; }
body[data-slug="index"] article { max-width: none !important; }
body[data-slug="index"] .page-title,
body[data-slug="index"] article > h1:first-of-type,
body[data-slug="index"] .breadcrumb-container,
body[data-slug="index"] article > .article-title,
body[data-slug="index"] .page-header,
body[data-slug="index"] .content-meta { display: none !important; }

:root {
  --mm-bg: #faf8f1;
  --mm-card-bg: #ffffff;
  --mm-card-border: #d6cdb5;
  --mm-card-border-soft: #ebe4d2;
  --mm-text: #2b2823;
  --mm-text-mute: #6a604c;
  --mm-text-dim: #aa9d7e;
  --mm-shadow: 0 1px 3px rgba(43, 40, 35, 0.05), 0 4px 12px rgba(43, 40, 35, 0.04);
  --mm-shadow-hover: 0 4px 12px rgba(43, 40, 35, 0.1), 0 12px 32px rgba(43, 40, 35, 0.08);
}

.mm-page {
  font-family: "Noto Serif TC", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color: var(--mm-text);
  margin: 0 auto;
  padding: 1rem 0 4rem;
  max-width: 1400px;
  transition: padding-bottom 0.18s ease;
}
.mm-page.has-compare { padding-bottom: 7.5rem; }

/* visually hidden but readable by screen readers */
.mm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── HEADER ───────────────────────────────── */
.mm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--mm-card-border-soft);
}
.mm-title-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: var(--mm-text-dim);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.mm-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  color: var(--mm-text);
  line-height: 1.1;
  margin: 0;
}
.mm-subtitle {
  font-size: 0.9rem;
  color: var(--mm-text-mute);
  margin-top: 0.5rem;
}
.mm-stats {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.mm-stat {
  text-align: center;
  user-select: none;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s, background 0.15s, border-color 0.15s;
}
.mm-stat:hover { background: var(--mm-card-bg); border-color: var(--mm-card-border-soft); }
.mm-stat.active {
  background: var(--mm-card-bg);
  border-color: currentColor;
}
.mm-stat.active .mm-stat-label { color: var(--mm-text); font-weight: 500; }
.mm-stat.dim { opacity: 0.3; transition: opacity 0.2s; }
.mm-stat.dim:hover { opacity: 0.55; }
.mm-stat-num {
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
}
.mm-stat-label {
  font-size: 0.62rem;
  color: var(--mm-text-mute);
  margin-top: 0.3rem;
  letter-spacing: 0.06em;
}

/* ── CONTROLS ─────────────────────────────── */
.mm-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.mm-search-wrap {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}
.mm-search {
  width: 100%;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border);
  color: var(--mm-text);
  padding: 0.6rem 2rem 0.6rem 0.9rem;
  font-size: 0.88rem;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.mm-search:focus { border-color: #b89154; box-shadow: 0 0 0 3px rgba(184, 145, 84, 0.15); }
.mm-search-clear {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--mm-text-dim);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.2rem 0.4rem;
  display: none;
}
.mm-search-wrap.has-value .mm-search-clear { display: block; }
.mm-search-clear:hover { color: var(--mm-text); }

.mm-filters { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.mm-filter {
  padding: 0.45rem 0.95rem;
  font-size: 0.78rem;
  border: 1px solid var(--mm-card-border-soft);
  background: transparent;
  color: var(--mm-text-mute);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.mm-filter:hover { background: var(--mm-card-bg); color: var(--mm-text); }
.mm-filter.active {
  background: #b89154;
  color: #fff;
  border-color: #b89154;
}

.mm-tier-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
}
.mm-tier-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  font-size: 0.74rem;
  border: 1px solid var(--mm-card-border-soft);
  background: transparent;
  color: var(--mm-text-mute);
  cursor: pointer;
  border-radius: 14px;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.mm-tier-filter:hover { color: var(--mm-text); border-color: var(--mm-card-border); }
.mm-tier-filter.active {
  background: var(--mm-text);
  color: #faf8f1;
  border-color: var(--mm-text);
}
.mm-tier-filter-count {
  font-size: 0.65rem;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}
.mm-tier-filter.active .mm-tier-filter-count { opacity: 0.85; }

.mm-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.mm-sort-label {
  font-size: 0.72rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.06em;
}
.mm-sort {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border);
  color: var(--mm-text);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
}
.mm-sort:focus { outline: none; border-color: #b89154; box-shadow: 0 0 0 3px rgba(184, 145, 84, 0.15); }

.mm-category-filters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
  padding: 0.4rem 0.7rem;
  background: var(--mm-card-bg);
  border: 1px dashed var(--mm-card-border-soft);
  border-radius: 6px;
}
.mm-cat-filter {
  padding: 0.25rem 0.7rem;
  font-size: 0.7rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mm-text-mute);
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  transition: all 0.12s;
}
.mm-cat-filter:hover { color: var(--mm-text); background: var(--mm-card-border-soft); }
.mm-cat-filter.active { background: var(--mm-text); color: #faf8f1; }

.mm-scenario-filters {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.mm-scenario-label {
  font-size: 0.68rem;
  color: var(--mm-text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-right: 0.15rem;
}
.mm-scenario-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.7rem;
  border: 1px solid var(--mm-card-border-soft);
  background: transparent;
  color: var(--mm-text-mute);
  cursor: pointer;
  border-radius: 10px;
  font-family: inherit;
  transition: all 0.12s;
}
.mm-scenario-filter:hover { color: var(--mm-text); border-color: var(--mm-card-border); }
.mm-scenario-filter.active {
  background: #b89154;
  color: #fff;
  border-color: #b89154;
}
.mm-scenario-count {
  font-size: 0.62rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.mm-scenario-more {
  background: transparent;
  border: 1px dashed var(--mm-card-border);
  color: var(--mm-text-mute);
  padding: 0.25rem 0.65rem;
  border-radius: 10px;
  font-size: 0.7rem;
  cursor: pointer;
  font-family: inherit;
}
.mm-scenario-more:hover { color: var(--mm-text); border-style: solid; }
.mm-scenario-filters.expanded .mm-scenario-more.collapse,
.mm-scenario-filters:not(.expanded) .mm-scenario-more.expand { display: inline-flex; }
.mm-scenario-filters.expanded .mm-scenario-more.expand,
.mm-scenario-filters:not(.expanded) .mm-scenario-more.collapse { display: none; }
.mm-scenario-filters:not(.expanded) .mm-scenario-filter.hidden { display: none; }

.mm-share {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.6rem;
  padding: 0.55rem 1rem;
  background: transparent;
  border: 1px solid var(--accent, #b89154);
  color: var(--accent, #b89154);
  font-size: 0.82rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: all 0.15s;
  vertical-align: top;
}
.mm-share:hover { background: var(--accent, #b89154); color: #fff; }
.mm-share.copied { background: #6f8f4f; border-color: #6f8f4f; color: #fff; }
.mm-share.failed { background: #c44; border-color: #c44; color: #fff; }

/* ── RECENT（細條，輔助型，不搶 filter 注意力） ─── */
.mm-recent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
  padding: 0 0.1rem;
  font-size: 0.76rem;
}
.mm-recent[hidden] { display: none; }
.mm-recent-label {
  font-size: 0.68rem;
  color: var(--mm-text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mm-recent-chip {
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--accent, #b89154);
  padding: 0.05rem 0.15rem;
  color: var(--accent, #b89154);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.mm-recent-chip:hover { color: var(--mm-text); border-bottom-style: solid; }
.mm-recent-clear {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 0.68rem;
  color: var(--mm-text-dim);
  cursor: pointer;
  padding: 0.05rem 0.3rem;
  font-family: inherit;
}
.mm-recent-clear:hover { color: var(--mm-text); text-decoration: underline; }

/* ── VIEW SWITCHER ─────────────────────── */
.mm-views {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--mm-card-border-soft);
}
.mm-views-divider {
  width: 1px;
  height: 18px;
  background: var(--mm-card-border-soft);
  margin: 0 0.55rem;
  display: inline-block;
}
.mm-view {
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mm-text-mute);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: all 0.12s;
  border-bottom: 2px solid transparent;
}
.mm-view:hover { color: var(--mm-text); }
.mm-view.active {
  color: var(--mm-text);
  border-bottom-color: #b89154;
  font-weight: 500;
}
.mm-controls-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
}
.mm-sort-wrap { margin-left: 0; }
.mm-result-count {
  font-size: 0.74rem;
  color: var(--mm-text-mute);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.mm-result-count:empty { display: none; }

/* 非 grid/table 視圖時隱藏 filter 列（這些 view 的內容不受 filter 影響） */
.mm-page.is-explore .mm-controls,
.mm-page.is-explore .mm-tier-filters,
.mm-page.is-explore .mm-category-filters,
.mm-page.is-explore .mm-scenario-filters {
  display: none !important;
}
.mm-page.is-explore .mm-views { margin-bottom: 1.5rem; }

/* ── TABLE VIEW ─────────────────────────── */
.mm-table-wrap { overflow-x: auto; grid-column: 1/-1; }
.mm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 6px;
}
.mm-table thead th {
  background: #f5efe0;
  color: var(--mm-text-mute);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--mm-card-border);
  font-weight: 500;
  text-transform: uppercase;
}
.mm-table tbody tr {
  border-bottom: 1px solid var(--mm-card-border-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.mm-table tbody tr:hover { background: #fcfaf3; }
.mm-table tbody tr:focus { outline: 2px solid #b89154; outline-offset: -2px; }
.mm-table tbody td { padding: 0.65rem 0.9rem; vertical-align: top; }
.mm-tbl-eng { font-size: 0.7rem; color: var(--mm-text-mute); font-style: italic; margin-top: 0.15rem; }
.mm-tbl-summary { color: var(--mm-text-mute); max-width: 360px; }
.mm-tbl-case { color: var(--mm-text-mute); }
.mm-tbl-cases { font-size: 0.7rem; color: var(--mm-text-dim); margin-top: 0.15rem; }
.mm-tbl-disc { font-size: 0.85em; }
.mm-tbl-tier {
  font-size: 0.62rem;
  padding: 0.1rem 0.45rem;
  border-radius: 8px;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.mm-tbl-tier.core { color: #b89154; }
.mm-tbl-tier.dict { color: var(--mm-text-dim); }

/* ── HBS CASES VIEW ─────────────────────── */
.mm-cases-wrap {
  display: block;
  grid-column: 1/-1;
}
.mm-cases-section-label {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--mm-text);
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 0.35rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--mm-card-border);
}
.mm-cases-section-second { margin-top: 2.5rem; }
.mm-cases-hint {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  margin-bottom: 1rem;
  line-height: 1.7;
}
.mm-cases-unified {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
}
.mm-case-unified {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-left: 3px solid var(--accent, #b89154);
  border-radius: 6px;
  padding: 0.95rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.12s, transform 0.12s, border-color 0.12s;
  cursor: pointer;
  outline: none;
}
.mm-case-unified:hover {
  box-shadow: var(--mm-shadow-hover);
  border-color: var(--accent, #b89154);
  transform: translateY(-1px);
}
.mm-case-unified:focus-visible {
  box-shadow: 0 0 0 3px var(--accent, #b89154);
}
.mm-case-cta {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--mm-card-border-soft);
  font-size: 0.72rem;
  color: var(--accent, #b89154);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.mm-case-cta small {
  font-size: 0.82em;
  opacity: 0.65;
  font-weight: 400;
  margin-left: 0.3rem;
}
.mm-case-unified:hover .mm-case-cta { color: var(--mm-text); }
.mm-case-unified.multi {
  grid-column: span 2;
  border-left-width: 4px;
  background: linear-gradient(180deg, var(--mm-card-bg) 0%, #fcfaf3 100%);
}
.mm-case-unified-title {
  margin: 0.1rem 0 0.15rem;
  font-size: 1.05rem;
  color: var(--mm-text);
  font-weight: 500;
}
.mm-case-unified.multi .mm-case-unified-title { font-size: 1.3rem; }
.mm-case-text-preview {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  line-height: 1.65;
  margin: 0.45rem 0 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mm-case-trigger-label {
  font-size: 0.65rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0.7rem 0 0.4rem;
}
.mm-case-trigger-label.single { color: var(--mm-text-dim); }
.mm-case-unified .mm-lolla { gap: 0.35rem; }

@media (max-width: 880px) {
  .mm-case-unified.multi { grid-column: span 1; }
}
.mm-case-card {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border);
  border-left: 4px solid #b89154;
  border-radius: 6px;
  padding: 1.5rem 1.6rem;
}
.mm-case-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--mm-text-dim);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.mm-case-title {
  font-size: 1.4rem;
  margin: 0 0 0.2rem;
  color: var(--mm-text);
  font-weight: 500;
}
.mm-case-eng { font-size: 0.85rem; color: var(--mm-text-mute); font-style: italic; margin-bottom: 0.7rem; }
.mm-case-outcome {
  font-size: 0.85rem;
  background: #fdf8ef;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  margin: 0.6rem 0 0.9rem;
  line-height: 1.7;
}
.mm-case-trigger-label {
  font-size: 0.7rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0.9rem 0 0.5rem;
}

/* ── PAIRS VIEW ─────────────────────────── */
.mm-pairs-wrap { display: grid; grid-template-columns: 1fr; gap: 0.9rem; grid-column: 1/-1; }
.mm-pairs-hint {
  font-size: 0.82rem;
  color: var(--mm-text-mute);
  padding: 0.85rem 1rem;
  background: #fdf8ef;
  border-radius: 6px;
  border-left: 3px solid #b89154;
  line-height: 1.7;
}
.mm-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0.85rem;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 6px;
  padding: 1rem 1.2rem;
}
.mm-pair-side {
  border-top: 3px solid #b89154;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}
.mm-pair-side:hover { background: #fcfaf3; }
.mm-pair-disc {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.mm-pair-title {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.mm-pair-oneliner {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  line-height: 1.6;
}
.mm-pair-link {
  display: flex;
  align-items: center;
  font-size: 1.4rem;
  color: var(--mm-text-dim);
  user-select: none;
}

/* ── AI VIEW ────────────────────────────── */
.mm-view-ai { color: #8a5a3a; font-weight: 500; }
.mm-view-ai.active { color: var(--mm-text); border-bottom-color: #8a5a3a; }

.mm-ai-wrap {
  grid-column: 1/-1;
  max-width: 780px;
  margin: 0 auto;
  display: block;
}
.mm-ai-intro {
  margin-bottom: 1.1rem;
  padding: 1rem 1.25rem;
  background: #fdf8ef;
  border-radius: 6px;
  border-left: 3px solid #b89154;
}
.mm-ai-title {
  font-size: 1.05rem;
  color: var(--mm-text);
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.mm-ai-sub {
  font-size: 0.82rem;
  color: var(--mm-text-mute);
  line-height: 1.7;
}
.mm-ai-input {
  width: 100%;
  min-height: 140px;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid var(--mm-card-border);
  border-radius: 6px;
  background: var(--mm-card-bg);
  color: var(--mm-text);
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.7;
}
.mm-ai-input:focus {
  outline: none;
  border-color: #b89154;
  box-shadow: 0 0 0 3px rgba(184, 145, 84, 0.15);
}
.mm-ai-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.55rem;
}
.mm-ai-count {
  font-size: 0.7rem;
  color: var(--mm-text-dim);
  font-variant-numeric: tabular-nums;
}
.mm-ai-count.over { color: #c44; font-weight: 500; }
.mm-ai-submit {
  background: #b89154;
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  font-size: 0.88rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.mm-ai-submit:hover:not(:disabled) { background: #cca268; }
.mm-ai-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.mm-ai-hint {
  font-size: 0.7rem;
  color: var(--mm-text-dim);
  margin-top: 0.85rem;
  line-height: 1.65;
}
.mm-ai-banner {
  margin: 0 0 1.1rem;
  padding: 0.95rem 1.15rem;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.7;
}
.mm-ai-banner.exhausted {
  background: #fbeae6;
  border-left: 3px solid #c44;
  color: var(--mm-text);
}
.mm-ai-banner.exhausted strong { color: #c44; }
.mm-ai-banner.exhausted small { font-size: 0.78rem; color: var(--mm-text-mute); }
.mm-ai-quota {
  font-size: 0.7rem;
  color: var(--mm-text-dim);
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
  text-align: right;
}
.mm-ai-input:disabled {
  background: #f5f0e3;
  color: var(--mm-text-dim);
  cursor: not-allowed;
}

.mm-ai-loading {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--mm-card-bg);
  border: 1px dashed var(--mm-card-border-soft);
  border-radius: 6px;
  text-align: center;
  color: var(--mm-text-mute);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.mm-ai-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--mm-card-border);
  border-top-color: #b89154;
  border-radius: 50%;
  animation: mm-ai-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes mm-ai-spin {
  to { transform: rotate(360deg); }
}
.mm-ai-error {
  margin-top: 1.2rem;
  padding: 0.85rem 1rem;
  background: #fdf0ec;
  border-left: 3px solid #c44;
  border-radius: 4px;
  color: var(--mm-text);
  font-size: 0.84rem;
  line-height: 1.65;
}

.mm-ai-recs {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.mm-ai-recs-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--mm-text-dim);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.mm-ai-rec {
  display: flex;
  gap: 0.95rem;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-left: 4px solid var(--accent, #b89154);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
}
.mm-ai-rec:hover {
  box-shadow: var(--mm-shadow-hover);
  border-color: var(--accent, #b89154);
  transform: translateY(-1px);
}
.mm-ai-rec:focus-visible { box-shadow: 0 0 0 3px var(--accent, #b89154); }
.mm-ai-rec-num {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--accent, #b89154);
  font-variant-numeric: tabular-nums;
  min-width: 2.2rem;
}
.mm-ai-rec-body { flex: 1; min-width: 0; }
.mm-ai-rec-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 0.45rem;
}
.mm-ai-rec-title {
  font-size: 1.1rem;
  color: var(--mm-text);
  font-weight: 500;
}
.mm-ai-rec-meta {
  font-size: 0.7rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.04em;
}
.mm-ai-rec-reason {
  font-size: 0.88rem;
  color: var(--mm-text);
  line-height: 1.7;
  margin-bottom: 0.45rem;
}
.mm-ai-rec-oneliner {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  line-height: 1.65;
  padding: 0.4rem 0;
  border-top: 1px dashed var(--mm-card-border-soft);
}
.mm-ai-rec-cta {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--accent, #b89154);
  font-weight: 500;
}
.mm-ai-rec:hover .mm-ai-rec-cta { color: var(--mm-text); }

/* ── CARD COMPARE STATE ─────────────────── */
.mm-card.compare {
  outline: 2px dashed var(--accent, #b89154);
  outline-offset: -2px;
}

/* ── COMPARE BAR（浮動在頁面底部） ───────── */
.mm-compare-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1.25rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #2b2823;
  color: #faf8f1;
  padding: 0.65rem 1rem 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.82rem;
  box-shadow: 0 6px 24px rgba(43, 40, 35, 0.32), 0 2px 6px rgba(0,0,0,0.18);
  max-width: min(960px, calc(100% - 2rem));
  animation: mm-bar-rise 0.22s ease;
}
@keyframes mm-bar-rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.mm-compare-bar[hidden] { display: none; }
.mm-cmp-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
  text-transform: uppercase;
}
.mm-cmp-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; flex: 1; }
.mm-cmp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #44403a;
  padding: 0.25rem 0.55rem 0.25rem 0.7rem;
  border-radius: 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
.mm-cmp-chip:hover { background: #5a564e; }
.mm-cmp-remove {
  background: none;
  border: none;
  color: #aa9d7e;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}
.mm-cmp-remove:hover { color: #fff; }
.mm-cmp-go {
  background: #b89154;
  color: #fff;
  border: none;
  padding: 0.4rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
}
.mm-cmp-go:disabled { opacity: 0.4; cursor: not-allowed; }
.mm-cmp-go:hover:not(:disabled) { background: #cca268; }
.mm-cmp-clear {
  background: transparent;
  color: #aa9d7e;
  border: 1px solid #44403a;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  font-family: inherit;
}
.mm-cmp-clear:hover { color: #fff; border-color: #5a564e; }

/* ── COMPARE OVERLAY ────────────────────── */
.mm-cmp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 40, 35, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: mm-fade-in 0.18s ease;
}
.mm-cmp-modal {
  background: var(--mm-bg, #faf8f1);
  border-radius: 8px;
  max-width: 1200px;
  max-height: 92vh;
  width: 100%;
  padding: 2rem 2rem 1.5rem;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
}
.mm-cmp-title {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1.2rem;
  color: var(--mm-text);
}
.mm-cmp-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--mm-text-mute);
  cursor: pointer;
  line-height: 1;
}
.mm-cmp-close:hover { color: var(--mm-text); }
.mm-cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}
.mm-cmp-panel {
  background: var(--mm-card-bg);
  border: 1px solid var(--accent, #b89154);
  border-top: 3px solid var(--accent, #b89154);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
}
.mm-cmp-head { margin-bottom: 0.9rem; }
.mm-cmp-disc {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: var(--accent, #b89154);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.mm-cmp-panel h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
}
.mm-cmp-eng {
  font-size: 0.75rem;
  color: var(--mm-text-mute);
  font-style: italic;
  margin-top: 0.15rem;
}
.mm-cmp-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--mm-card-border-soft);
  font-size: 0.82rem;
  line-height: 1.65;
}
.mm-cmp-row-label {
  color: var(--mm-text-mute);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.mm-result-count {
  font-size: 0.82rem;
  color: var(--mm-text);
  margin-bottom: 1rem;
  font-weight: 500;
  min-height: 1.2em;
}

.mm-hl {
  background: #fde8a8;
  color: inherit;
  padding: 0 0.08em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.mm-detail .mm-hl { background: #f4d97a; }

/* ── LAYOUT BODY ──────────────────────────── */
.mm-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}
.mm-body.has-selected { grid-template-columns: 1fr minmax(360px, 440px); }

/* ── GRID ─────────────────────────────────── */
.mm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.mm-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--mm-text-mute);
  padding: 3rem 1rem;
  font-size: 0.9rem;
  line-height: 1.8;
}
.mm-empty-title {
  font-size: 1.05rem;
  color: var(--mm-text);
  font-weight: 500;
  margin-bottom: 0.85rem;
}
.mm-empty-filters {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  margin-bottom: 1.1rem;
}
.mm-empty-chip {
  display: inline-block;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  padding: 0.18rem 0.6rem;
  border-radius: 10px;
  font-size: 0.74rem;
  margin: 0 0.2rem;
  color: var(--mm-text);
}
.mm-empty-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.mm-empty-action {
  display: inline-block;
  background: #b89154;
  color: #fff !important;
  border: none;
  padding: 0.5rem 1.1rem;
  font-size: 0.84rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.mm-empty-action:hover { background: #cca268; }
.mm-empty-action.subtle {
  background: transparent;
  color: #b89154 !important;
  border: 1px solid var(--mm-card-border);
}
.mm-empty-action.subtle:hover { background: var(--mm-card-bg); }

/* ── CARD ─────────────────────────────────── */
.mm-card {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-top: 3px solid var(--accent, #b89154);
  padding: 1.1rem 1.1rem 1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.18s;
  box-shadow: var(--mm-shadow);
  outline: none;
  display: flex;
  flex-direction: column;
  min-height: 170px;
}
.mm-card:hover {
  box-shadow: var(--mm-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--accent, #b89154);
}
.mm-card:focus-visible {
  box-shadow: 0 0 0 3px var(--accent, #b89154);
}
.mm-card.active {
  background: var(--accent-bg, #fdf8ef);
  border-color: var(--accent, #b89154);
  box-shadow: var(--mm-shadow-hover);
}
.mm-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}
.mm-card-discipline {
  color: var(--accent, #b89154);
  font-weight: 600;
}
.mm-card-tier {
  font-size: 0.58rem;
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
  letter-spacing: 0.08em;
  background: var(--accent-bg, #fdf8ef);
  color: var(--accent, #b89154);
  border: 1px solid var(--accent, #b89154);
  font-weight: 500;
}
.mm-card-tier.tier-dict {
  background: transparent;
  color: var(--mm-text-dim);
  border-color: var(--mm-card-border-soft);
}
.mm-card-title {
  font-size: 1.12rem;
  color: var(--mm-text);
  font-weight: 500;
  margin-bottom: 0.15rem;
  letter-spacing: 0.01em;
}
.mm-card-english {
  font-size: 0.72rem;
  color: var(--mm-text-mute);
  font-style: italic;
  margin-bottom: 0.55rem;
}
.mm-card-summary {
  font-size: 0.78rem;
  color: var(--mm-text-mute);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mm-card-case {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid var(--mm-card-border-soft);
  font-size: 0.74rem;
  color: var(--mm-text-mute);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  letter-spacing: 0.01em;
}
.mm-card-case-arrow {
  color: var(--accent, #b89154);
  font-size: 0.68rem;
  line-height: 1;
  flex-shrink: 0;
}
.mm-card-case-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── DETAIL PANEL ─────────────────────────── */
.mm-detail {
  background: var(--accent-bg, #fdf8ef);
  border: 1px solid var(--accent, #b89154);
  border-radius: 8px;
  padding: 1.75rem;
  position: sticky;
  top: 1.5rem;
  box-shadow: var(--mm-shadow-hover);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
.mm-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.mm-detail-eyebrow {
  font-size: 0.62rem;
  color: var(--accent, #b89154);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.mm-detail-title {
  font-size: 1.5rem;
  margin: 0;
  color: var(--mm-text);
  font-weight: 500;
  line-height: 1.2;
}
.mm-detail-english {
  font-size: 0.8rem;
  color: var(--mm-text-mute);
  font-style: italic;
  margin-top: 0.2rem;
}
.mm-detail-tagline {
  font-size: 1rem;
  color: var(--mm-text);
  margin: 0.95rem 0 0;
  line-height: 1.65;
  font-weight: 500;
}
.mm-detail-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--mm-text-mute);
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.mm-detail-close:hover { color: var(--mm-text); }
.mm-detail-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent, #b89154), transparent);
  margin: 1.5rem 0 1.25rem;
}
.mm-section { margin-bottom: 1.35rem; }
.mm-section-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--accent, #b89154);
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  font-weight: 600;
}
.mm-section-body {
  font-size: 0.88rem;
  color: var(--mm-text);
  line-height: 1.85;
}
.mm-rich p,
.mm-rich .mm-md-p {
  margin: 0 0 0.7rem;
}
.mm-rich p:last-child,
.mm-rich .mm-md-p:last-child { margin-bottom: 0; }
.mm-rich .mm-md-list {
  margin: 0 0 0.7rem;
  padding-left: 1.2rem;
}
.mm-rich .mm-md-list li {
  margin-bottom: 0.25rem;
  line-height: 1.75;
}
.mm-rich .mm-md-ol { padding-left: 1.5rem; }
.mm-rich .mm-md-ol li { margin-bottom: 0.4rem; }
.mm-rich strong { color: var(--accent, #b89154); font-weight: 600; }
.mm-rich br { line-height: 1.65; }
.mm-rich .mm-md-table-wrap {
  overflow-x: auto;
  margin: 0.45rem 0 0.85rem;
  -webkit-overflow-scrolling: touch;
}
.mm-rich .mm-md-table {
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 100%;
  background: var(--mm-card-bg);
}
.mm-rich .mm-md-table th,
.mm-rich .mm-md-table td {
  border: 1px solid var(--mm-card-border-soft);
  padding: 0.45rem 0.7rem;
  text-align: left;
  line-height: 1.55;
  vertical-align: top;
  white-space: nowrap;
}
.mm-rich .mm-md-table th {
  background: #fdf8ef;
  color: var(--mm-text);
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}
@media (max-width: 540px) {
  .mm-rich .mm-md-table th,
  .mm-rich .mm-md-table td { white-space: normal; }
}
.mm-section-hint {
  font-size: 0.72rem;
  color: var(--mm-text-mute);
  margin: -0.2rem 0 0.55rem;
  line-height: 1.5;
}
.mm-related-divider {
  font-size: 0.6rem;
  color: var(--mm-text-dim);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 1.1rem 0 0.4rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--mm-card-border-soft);
}
.mm-case-box {
  background: var(--mm-card-bg);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}
.mm-case-company {
  font-size: 1rem;
  color: var(--accent, #b89154);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.mm-case-text {
  font-size: 0.84rem;
  color: var(--mm-text);
  line-height: 1.85;
}
.mm-lolla {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.mm-lolla-chip {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  padding: 0.35rem 0.8rem;
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--mm-text);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.mm-lolla-chip:hover {
  border-color: var(--accent, #b89154);
  color: var(--accent, #b89154);
  transform: translateY(-1px);
}
.mm-lolla-chip.disabled {
  opacity: 0.55;
  cursor: default;
  color: var(--mm-text-mute);
}
.mm-lolla-chip.disabled small {
  opacity: 0.6;
  font-size: 0.85em;
  margin-left: 0.25rem;
}
.mm-lolla-chip.disabled:hover {
  border-color: var(--mm-card-border-soft);
  color: var(--mm-text-mute);
  transform: none;
}
.mm-cta-wrap {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px dashed var(--accent, #b89154);
}
.mm-cta {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--accent, #b89154);
  color: white !important;
  text-decoration: none !important;
  border-radius: 6px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.mm-cta:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.mm-cta-hint {
  font-size: 0.72rem;
  color: var(--mm-text-mute);
  margin-top: 0.5rem;
}
.mm-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.4rem;
  gap: 0.5rem;
}
.mm-nav-btn {
  background: transparent;
  border: 1px solid var(--mm-card-border-soft);
  color: var(--mm-text-mute);
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.15s;
}
.mm-nav-btn:hover:not(:disabled) {
  border-color: var(--accent, #b89154);
  color: var(--mm-text);
}
.mm-nav-btn:disabled { opacity: 0.3; cursor: default; }

/* ── LOADING SKELETON ─────────────────────── */
.mm-skel {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-top: 3px solid var(--mm-card-border-soft);
  padding: 1.1rem;
  border-radius: 6px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mm-skel-line {
  background: linear-gradient(90deg, var(--mm-card-border-soft) 0%, #f3ecda 50%, var(--mm-card-border-soft) 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: mm-shimmer 1.4s ease-in-out infinite;
}
.mm-skel-line.w-30 { width: 30%; height: 0.6rem; }
.mm-skel-line.w-70 { width: 70%; height: 1rem; }
.mm-skel-line.w-50 { width: 50%; height: 0.65rem; }
.mm-skel-line.w-100 { width: 100%; height: 0.65rem; }
.mm-skel-line.w-85 { width: 85%; height: 0.65rem; }
.mm-skel-line.w-40 { width: 40%; height: 0.65rem; margin-top: auto; }
@keyframes mm-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── BACKDROP (mobile detail) ─────────────── */
.mm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 40, 35, 0.45);
  backdrop-filter: blur(2px);
  z-index: 999;
  animation: mm-fade-in 0.18s ease;
}
@keyframes mm-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── AI MODE TOGGLE（即時 / ✦ AI）─────────────── */
.mm-ai-modes {
  display: flex;
  gap: 0.5rem;
  margin: 0.4rem 0 1rem;
  flex-wrap: wrap;
}
.mm-ai-mode {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  padding: 0.7rem 1rem;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--mm-text-mute);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.mm-ai-mode:hover { border-color: var(--mm-text-mute); color: var(--mm-text); }
.mm-ai-mode.is-active {
  background: var(--mm-text);
  color: var(--mm-bg);
  border-color: var(--mm-text);
}
.mm-ai-mode-name {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.mm-ai-mode-sub {
  font-size: 0.7rem;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ── REASON CHIPS（即時推薦結果旁的命中說明）── */
.mm-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin: 0.4rem 0 0.55rem;
}
.mm-reason-chip {
  font-size: 0.7rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.mm-reason-chip.reason-scenario {
  background: rgba(184, 145, 84, 0.08);
  border-color: rgba(184, 145, 84, 0.32);
  color: #8a6630;
}
.mm-reason-chip.reason-kw {
  background: var(--mm-bg);
  border-color: var(--mm-card-border-soft);
  color: var(--mm-text-mute);
}
.mm-reason-chip.reason-disc {
  background: rgba(127, 163, 201, 0.1);
  border-color: rgba(127, 163, 201, 0.32);
  color: #4f78a0;
}
.mm-reason-chip.reason-net {
  background: rgba(150, 134, 193, 0.1);
  border-color: rgba(150, 134, 193, 0.32);
  color: #6e5fa0;
}
.mm-reason-chip.reason-tier {
  background: rgba(138, 175, 134, 0.1);
  border-color: rgba(138, 175, 134, 0.32);
  color: #5a8055;
}

.mm-ai-rec-score {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.72rem;
  color: var(--mm-text-dim);
  font-weight: 500;
  align-self: flex-start;
  padding: 0.15rem 0.4rem;
  background: var(--mm-bg);
  border-radius: 4px;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.mm-ai-instant-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--mm-text-mute);
  font-size: 0.88rem;
  line-height: 1.7;
  background: var(--mm-card-bg);
  border: 1px dashed var(--mm-card-border-soft);
  border-radius: 8px;
}

.mm-ai-meta.instant {
  justify-content: flex-end;
  font-size: 0.78rem;
  color: var(--mm-text-mute);
}

/* ── GRAPH VIEW（D3 關係圖譜）─────────────────── */
.mm-graph-wrap { grid-column: 1/-1; }
.mm-graph-shell {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 8px;
  overflow: hidden;
}
.mm-graph-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--mm-card-border-soft);
  background: var(--mm-bg);
}
.mm-g-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.mm-g-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.75rem;
  color: var(--mm-text-mute);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.mm-g-legend-item:hover {
  background: var(--mm-card-bg);
  border-color: var(--mm-card-border-soft);
}
.mm-g-legend-item.is-active {
  background: var(--mm-card-bg);
  border-color: var(--lg-color, var(--mm-text-mute));
  color: var(--mm-text);
  font-weight: 500;
}
.mm-g-legend-item.is-dimmed { opacity: 0.35; }
.mm-g-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lg-color);
  flex-shrink: 0;
}
.mm-graph-actions { display: flex; gap: 0.6rem; align-items: center; }
.mm-graph-meta { font-size: 0.72rem; color: var(--mm-text-mute); }
.mm-graph-btn {
  padding: 0.32rem 0.7rem;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 6px;
  font-size: 0.74rem;
  color: var(--mm-text-mute);
  cursor: pointer;
  font-family: inherit;
}
.mm-graph-btn:hover { background: var(--mm-bg); color: var(--mm-text); border-color: var(--mm-text-mute); }

.mm-graph-svg-wrap {
  position: relative;
  width: 100%;
  height: 640px;
  background:
    radial-gradient(circle, var(--mm-card-border-soft) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--mm-card-bg);
}
.mm-graph-svg { width: 100%; height: 100%; cursor: grab; display: block; }
.mm-graph-svg:active { cursor: grabbing; }

.mm-g-link {
  stroke: var(--mm-card-border-soft);
  stroke-opacity: 0.55;
  stroke-width: 1;
  transition: stroke 0.15s, stroke-opacity 0.15s, stroke-width 0.15s;
}
.mm-g-link.is-highlight {
  stroke: var(--mm-text-mute);
  stroke-opacity: 0.85;
  stroke-width: 1.6;
}
.mm-g-link.is-dimmed { stroke-opacity: 0.1; }

.mm-g-node { transition: opacity 0.15s; }
.mm-g-node circle {
  stroke: var(--mm-card-bg);
  stroke-width: 1.5;
  transition: stroke-width 0.15s;
}
.mm-g-node.is-core circle { stroke: #d4a05a; stroke-width: 2.6; }
.mm-g-node.is-highlight circle { stroke: var(--mm-text); stroke-width: 3; }
.mm-g-node:focus { outline: none; }
.mm-g-node:focus circle { stroke: var(--mm-text); stroke-width: 3; }
.mm-g-node:focus text { fill: var(--mm-text); font-weight: 600; }
.mm-g-node.is-dimmed { opacity: 0.2; }
.mm-g-node text {
  font-family: "Noto Sans TC", "Inter", -apple-system, sans-serif;
  font-size: 11px;
  fill: var(--mm-text-mute);
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--mm-card-bg);
  stroke-width: 3;
  stroke-linejoin: round;
}
.mm-g-node.is-core text { font-weight: 600; fill: var(--mm-text); font-size: 11.5px; }
.mm-g-node.is-highlight text { fill: var(--mm-text); font-weight: 600; }

.mm-graph-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  box-shadow: var(--mm-shadow-hover);
  max-width: 280px;
  z-index: 5;
  line-height: 1.55;
}
.mm-graph-tooltip[hidden] { display: none; }
.mm-g-tt-title { font-family: "Noto Serif TC", Georgia, serif; font-weight: 600; font-size: 0.95rem; color: var(--mm-text); }
.mm-g-tt-en { font-style: italic; font-size: 0.72rem; color: var(--mm-text-mute); margin-bottom: 0.25rem; }
.mm-g-tt-meta { font-size: 0.7rem; color: var(--mm-text-mute); }
.mm-g-tt-case {
  font-size: 0.75rem;
  color: var(--mm-text);
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--mm-card-border-soft);
}
.mm-g-tt-one {
  font-size: 0.72rem;
  color: var(--mm-text-mute);
  margin-top: 0.25rem;
  font-style: italic;
}

.mm-graph-hint {
  padding: 0.6rem 1.1rem;
  font-size: 0.74rem;
  color: var(--mm-text-mute);
  border-top: 1px solid var(--mm-card-border-soft);
  background: var(--mm-bg);
}

/* ── SYNERGY VIEW（招牌組合）───────────────────── */
.mm-synergy-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  grid-column: 1/-1;
}
.mm-synergy-hint {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 8px;
  padding: 0.9rem 1.2rem;
  font-size: 0.86rem;
  color: var(--mm-text-mute);
  line-height: 1.7;
}
.mm-synergy-hint strong { color: var(--mm-text); font-weight: 600; }

.mm-syn-card {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-left: 4px solid var(--mm-card-border);
  border-radius: 8px;
  padding: 1.4rem 1.6rem 1.5rem;
  box-shadow: var(--mm-shadow);
  transition: box-shadow 0.18s, border-left-color 0.18s;
}
.mm-syn-card:hover {
  box-shadow: var(--mm-shadow-hover);
  border-left-color: var(--mm-text-mute);
}

.mm-syn-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.mm-syn-head-left { flex: 1; min-width: 0; }
.mm-syn-theme {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mm-text-mute);
  background: var(--mm-bg);
  border: 1px solid var(--mm-card-border-soft);
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}
.mm-syn-name {
  font-family: "Noto Serif TC", "Palatino Linotype", Georgia, serif;
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--mm-text);
  margin: 0 0 0.25rem;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.mm-syn-subtitle {
  font-family: "Source Serif 4", "Palatino Linotype", Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--mm-text-mute);
  margin: 0;
}
.mm-syn-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding: 0.45rem 0.7rem 0.4rem;
  background: var(--mm-bg);
  border-radius: 6px;
  border: 1px solid var(--mm-card-border-soft);
}
.mm-syn-count-num {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--mm-text-mute);
  line-height: 1;
}
.mm-syn-count-label {
  font-size: 0.62rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

.mm-syn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin: 0.9rem 0 1rem;
}
.mm-syn-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  background: var(--mm-bg);
  border: 1px solid var(--mm-card-border-soft);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--mm-text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.mm-syn-chip:hover {
  border-color: var(--chip-accent, var(--mm-text-mute));
  background: var(--mm-card-bg);
  transform: translateY(-1px);
}
.mm-syn-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mm-syn-chip-title { font-weight: 500; }
.mm-syn-chip-disc {
  font-size: 0.66rem;
  color: var(--mm-text-mute);
  letter-spacing: 0.04em;
}
.mm-syn-chip.is-missing {
  background: transparent;
  color: var(--mm-text-dim);
  border-style: dashed;
  cursor: not-allowed;
}

.mm-syn-why {
  font-size: 0.93rem;
  line-height: 1.8;
  color: var(--mm-text);
  margin: 0 0 0.9rem;
}
.mm-syn-case {
  display: block;
  background: var(--mm-bg);
  border-left: 3px solid var(--mm-text-mute);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--mm-text-mute);
}
.mm-syn-case-label {
  display: inline-block;
  font-family: "Noto Serif TC", Georgia, serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--mm-text);
  margin-right: 0.55rem;
  padding-right: 0.55rem;
  border-right: 1px solid var(--mm-card-border-soft);
}
.mm-syn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin-top: 0.85rem;
}
.mm-syn-tag {
  font-size: 0.7rem;
  padding: 0.18rem 0.55rem;
  background: var(--mm-bg);
  border: 1px solid var(--mm-card-border-soft);
  color: var(--mm-text-mute);
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* ── MOBILE ───────────────────────────────── */
@media (max-width: 880px) {
  body[data-slug="index"] .center { padding: 0 1rem !important; }
  .mm-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .mm-body.has-selected { grid-template-columns: 1fr; }
  .mm-detail {
    position: fixed;
    inset: 0.75rem;
    z-index: 1000;
    max-height: calc(100vh - 1.5rem);
  }
  .mm-body.has-selected .mm-backdrop { display: block; }
  .mm-compare-bar {
    bottom: 0.75rem;
    padding: 0.5rem 0.8rem 0.5rem 1rem;
    max-width: calc(100% - 1.5rem);
  }
  .mm-compare-bar .mm-cmp-chips { display: none; }
  .mm-cmp-go, .mm-cmp-clear { padding: 0.4rem 0.7rem; font-size: 0.74rem; }
  /* mobile 開 detail 時，compare bar 被 detail 蓋住 — 主動隱藏避免視覺衝突 */
  .mm-page.has-detail .mm-compare-bar { display: none; }
}
@media (max-width: 880px) {
  .mm-graph-svg-wrap { height: 480px; }
  .mm-graph-header { gap: 0.5rem; padding: 0.6rem 0.8rem; }
  .mm-syn-card { padding: 1.1rem 1.1rem 1.2rem; }
  .mm-syn-name { font-size: 1.18rem; }
  .mm-ai-mode { min-width: 0; padding: 0.55rem 0.8rem; }
  .mm-ai-mode-sub { font-size: 0.66rem; }
}
@media (max-width: 540px) {
  .mm-grid { grid-template-columns: 1fr; }
  .mm-card { min-height: auto; }
  .mm-graph-svg-wrap { height: 420px; }
  .mm-g-node text { font-size: 9px; }
  .mm-syn-head { flex-direction: column; gap: 0.5rem; }
  .mm-syn-count { flex-direction: row; gap: 0.4rem; padding: 0.32rem 0.6rem; }
  .mm-header { gap: 1rem; }
  .mm-stats { gap: 0.5rem; }
  .mm-title { font-size: 1.6rem; }
  .mm-views {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: thin;
  }
  .mm-view { white-space: nowrap; padding: 0.4rem 0.7rem; font-size: 0.78rem; flex-shrink: 0; }
  .mm-views-divider { flex-shrink: 0; }
  .mm-controls { gap: 0.4rem; }
  .mm-search-wrap { flex: 1 1 100%; max-width: none; }
  .mm-filters { gap: 0.3rem; }
  .mm-filter { padding: 0.35rem 0.65rem; font-size: 0.72rem; }
  .mm-controls-meta { width: 100%; justify-content: space-between; }
  .mm-stat-label { font-size: 0.58rem; }
}
