/* Scoped overrides for API-injected controls only.
   The PRD HTML prototype owns the rest of the UI. */

body.mmhub-booting > aside,
body.mmhub-booting > main,
body.mmhub-booting > .md\:hidden { visibility: hidden; }

.mmhub-loading { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: #f8fafc; color: #0f172a; }
.mmhub-loading-card { display: flex; align-items: center; gap: 16px; min-width: 360px; max-width: 520px; padding: 22px 24px; background: #fff; border-radius: 20px; box-shadow: 0 24px 70px rgba(15,23,42,.12); }
.mmhub-loading-title { font-weight: 900; font-size: 16px; margin-bottom: 4px; }
.mmhub-loading-desc { color: #64748b; font-size: 13px; }
.mmhub-loading.error .mmhub-spinner { display: none; }
.mmhub-loading-error { display: grid; gap: 12px; text-align: center; }
.mmhub-loading-error button { justify-self: center; border: 0; border-radius: 12px; padding: 10px 16px; background: #f97316; color: #fff; font-weight: 850; cursor: pointer; }

.mmhub-pagination {
  margin-top: 24px;
  padding: 22px 24px;
  background: #fff;
  border: 0;
  border-radius: 20px;
  display: grid;
  grid-template-columns: minmax(190px,.72fr) minmax(420px,1.5fr) minmax(210px,.78fr);
  align-items: center;
  gap: 28px;
  color: #64748b;
  font-size: 13px;
  box-shadow: 0 18px 44px rgba(15,23,42,.07);
}
.mmhub-pagination-info { display: grid; gap: 4px; }
.mmhub-pagination-info .label { color: #64748b; font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.mmhub-pagination-info b { color: #0f172a; }
.mmhub-pagination-controls { display: inline-flex; align-items: center; gap: 6px; justify-content: center; background: #f8fafc; border: 0; border-radius: 16px; padding: 6px; }
.mmhub-pagination-controls button { min-width: 38px; height: 38px; padding: 0 13px; font-size: 13px; border-radius: 12px; border-color: transparent; background: transparent; color: #334155; font-weight: 750; }
.mmhub-pagination-controls button.nav-btn { min-width: 82px; background: transparent; color: #64748b; }
.mmhub-pagination-controls button.active-page { background: #fff; color: #0f172a; border-color: #fff; box-shadow: 0 6px 18px rgba(15,23,42,.10); font-weight: 900; }
.mmhub-pagination-controls button:hover:not(:disabled) { background: #fff7ed; color: #c2410c; }
.mmhub-pagination-controls button:disabled { opacity: .38; cursor: not-allowed; }
.mmhub-page-ellipsis { padding: 0 4px; color: #94a3b8; }
.mmhub-pagination-page { justify-self: end; color: #64748b; font-size: 13px; white-space: nowrap; }

[data-paper-controls] [data-paper-sort].active,
[data-paper-controls] [data-paper-topic].active,
[data-resource-controls] [data-resource-sort].active,
[data-resource-controls] [data-resource-filter].active {
  background: #f97316 !important;
  border-color: #c2410c !important;
  color: #fff !important;
  font-weight: 800;
}
.mmhub-state { min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 10px; color: #64748b; font-size: 14px; background: #fff; }
.mmhub-state.empty { color: #94a3b8; }
.mmhub-state.error { color: #c2410c; background: #fff7ed; }
.mmhub-spinner { width: 18px; height: 18px; border-radius: 999px; border: 2px solid #fed7aa; border-top-color: #f97316; animation: mmhub-spin .8s linear infinite; }
.mmhub-spinner.large { width: 28px; height: 28px; border-width: 3px; flex: 0 0 auto; }
@keyframes mmhub-spin { to { transform: rotate(360deg); } }

.deep-shell { max-width: 1180px; margin: 0 auto; padding: 36px 24px 72px; color: #172033; line-height: 1.72; }
.deep-hero { background: #101827; color: #fff; border-radius: 18px; padding: 28px; margin-bottom: 24px; box-shadow: 0 24px 70px rgba(15,23,42,.14); }
.deep-hero h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.25; font-weight: 950; }
.deep-hero h2 { margin: 0 0 18px; color: #cbd5e1; font-size: 18px; font-weight: 800; line-height: 1.35; }
.deep-hero p { max-width: 860px; margin: 0; color: #e2e8f0; font-size: 14px; line-height: 1.8; }
.deep-hero .tag { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 3px 10px; background: #fff7ed; color: #c2410c; font-size: 12px; font-weight: 850; }
.deep-hero-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.deep-hero-links a { min-width: 96px; background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.16) !important; color: #fff !important; }
.deep-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.deep-rail .deep-sticky { position: sticky; top: 18px; display: grid; gap: 12px; }
.kicker { color: #f97316; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.deep-rail h2 { margin: 0; color: #0f172a; font-size: 18px; font-weight: 950; }
.note { background: #fff7ed; border-left: 3px solid #f97316; border-radius: 0 12px 12px 0; padding: 12px 14px; }
.note h3 { margin: 0 0 6px; color: #0f172a; font-size: 13px; font-weight: 950; line-height: 1.35; }
.note p { margin: 0; color: #475569; font-size: 12px; line-height: 1.65; }
.note .note-why { margin-top: 8px; color: #9a3412; }
.deep-main { display: grid; gap: 26px; }
.deep-overview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, .7fr); gap: 18px; padding: 22px; border-radius: 20px; background: #101827; color: #fff; }
.deep-overview span { color: #fb923c; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.deep-overview h2 { margin: 6px 0 12px; font-size: 22px; line-height: 1.25; }
.deep-overview p { margin: 0; color: #e5e7eb; line-height: 1.8; font-size: 14px; }
.deep-overview aside { background: rgba(255,255,255,.08); border-radius: 16px; padding: 16px; }
.deep-overview aside strong { display: block; color: #fdba74; margin-bottom: 8px; }
.deep-section { margin-top: 0; }
.deep-section h2 { margin: 0 0 12px; color: #0f172a; font-size: 24px; font-weight: 950; }
.deep-section-head { margin-bottom: 14px; }
.deep-section-head p { margin: 6px 0 0; color: #64748b; font-size: 13px; line-height: 1.7; }
.deep-body, .deep-section > p, .deep-section > dl { border-radius: 14px; background: #fff; border: 1px solid #e2e8f0; padding: 18px; color: #334155; line-height: 1.85; font-size: 14px; box-shadow: 0 10px 28px rgba(15,23,42,.04); }
.deep-list, .list { display: grid; gap: 14px; }
.deep-card, .card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; box-shadow: 0 10px 28px rgba(15,23,42,.04); }
.deep-card h3 { margin: 0 0 10px; color: #0f172a; font-size: 15px; font-weight: 900; }
.deep-card p, .card p { margin: 0; color: #334155; line-height: 1.75; font-size: 14px; }
.card h3 { margin: 0 0 12px; color: #0f172a; font-size: 18px; line-height: 1.35; font-weight: 950; }
.field { display: grid; gap: 5px; margin-top: 12px; }
.field b { display: block; color: #0f172a; font-weight: 950; }
.challenge { border-color: #bfdbfe; background: #eff6ff; }
.future { background: #fff; }
.challenge-grid, .challenge-list { display: grid; grid-template-columns: 1fr; gap: 16px; }
.challenge-list .challenge,
.list .future { display: block; padding: 0; overflow: hidden; }
.challenge-list summary,
.list .future summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; cursor: pointer; list-style: none; }
.challenge-list summary::-webkit-details-marker,
.list .future summary::-webkit-details-marker { display: none; }
.challenge-list summary span,
.list .future summary span { color: #0f172a; font-size: 18px; line-height: 1.35; font-weight: 950; }
.challenge-list summary svg,
.list .future summary svg { flex: 0 0 auto; color: #64748b; transition: transform .18s ease; }
.challenge-list details[open] summary,
.list details[open].future summary { border-bottom: 1px solid #bfdbfe; }
.challenge-list details[open] summary svg,
.list details[open].future summary svg { transform: rotate(180deg); }
.expandable-body { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 18px; }
.expandable-body .field { grid-column: 1 / -1; margin-top: 0; background: rgba(255,255,255,.62); border: 1px solid #bfdbfe; border-radius: 12px; padding: 12px; }
.future .expandable-body .field { border-color: #e2e8f0; background: #f8fafc; }
.expandable-body .field:has(.flow) { grid-column: 1 / -1; }
.flow { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.flow-step { position: relative; flex: 0 0 150px; background: #dbeafe; border: 1px solid #93c5fd; border-radius: 12px; padding: 12px; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; right: -10px; top: 50%; width: 10px; height: 2px; background: #60a5fa; }
.flow-step span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: #2563eb; color: #fff; font-size: 12px; font-weight: 950; margin-bottom: 8px; }
.flow-step p { color: #1e3a8a; font-size: 12px; line-height: 1.55; }
.deep-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.deep-card-head span { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 10px; background: #fff7ed; color: #c2410c; font-size: 12px; font-weight: 900; }
.deep-card-head h3 { margin: 0; }
.deep-note, .deep-evidence { margin-top: 12px; border-radius: 12px; padding: 12px; background: #f8fafc; color: #475569; font-size: 13px; line-height: 1.7; }
.deep-note b, .deep-evidence b { display: block; color: #0f172a; margin-bottom: 4px; }
.deep-kv { display: grid; gap: 12px; margin: 0; }
.deep-kv div { display: grid; gap: 4px; }
.deep-kv dt { color: #0f172a; font-weight: 900; }
.deep-kv dd { margin: 0; color: #334155; line-height: 1.75; }
.deep-card-body { display: grid; gap: 10px; color: #334155; font-size: 14px; line-height: 1.75; }
.deep-card-body b { display: block; color: #0f172a; margin-bottom: 2px; }
.deep-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: #334155; line-height: 1.75; }
.deep-steps li { padding-left: 4px; }
.knowledge-card h3 { color: #0f172a; font-size: 16px; }
.method-step-card .deep-card-head span { background: #eff6ff; color: #1d4ed8; }
.future-card .deep-card-head span { background: #ecfdf5; color: #047857; }
.deep-ref, .ref { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; padding: 6px 10px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; color: #0f172a !important; font-weight: 800; }
.ref-link { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8 !important; text-decoration: none; }
.ref-link:hover { background: #dbeafe; }
.markdown-section { color: #334155; line-height: 1.85; font-size: 15px; }
.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4 { color: #0f172a; font-weight: 900; line-height: 1.25; margin: 1.4em 0 .55em; }
.markdown-section h1 { font-size: 28px; }
.markdown-section h2 { font-size: 22px; }
.markdown-section h3 { font-size: 18px; }
.markdown-section p { margin: 0 0 14px; }
.markdown-section ul, .markdown-section ol { margin: 0 0 16px 20px; }
.markdown-section ul { list-style: disc; }
.markdown-section ol { list-style: decimal; }
.markdown-section li { margin: 6px 0; }
.markdown-section blockquote { margin: 16px 0; border-left: 4px solid #fb923c; border-radius: 0 10px 10px 0; background: #fff7ed; color: #7c2d12; padding: 12px 16px; }
.markdown-section hr { height: 1px; margin: 28px 0; border: 0; background: linear-gradient(90deg,transparent,#cbd5e1 12%,#cbd5e1 88%,transparent); }
.markdown-section a { color: #2563eb; font-weight: 700; text-decoration: underline; text-decoration-color: #bfdbfe; text-underline-offset: 3px; }
.markdown-section a:hover { color: #ea580c; text-decoration-color: #fed7aa; }
.markdown-section em { color: #475569; }
.markdown-section del { color: #64748b; }
.markdown-section .markdown-table-wrap { overflow-x: auto; margin: 16px 0 20px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 10px 28px rgba(15,23,42,.04); }
.markdown-section table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; line-height: 1.65; }
.markdown-section th, .markdown-section td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: top; }
.markdown-section th { background: #f8fafc; color: #0f172a; font-weight: 900; white-space: nowrap; }
.markdown-section td { color: #334155; }
.markdown-section tr:last-child td { border-bottom: 0; }
.markdown-section img { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 14px 0; border: 1px solid #e2e8f0; box-shadow: 0 10px 28px rgba(15,23,42,.06); }
.markdown-section .math-block { overflow-x: auto; border-radius: 12px; background: #f8fafc; border: 1px solid #e2e8f0; padding: 14px 16px; margin: 16px 0; text-align: center; }
.markdown-section .math-content { display: block; color: #0f172a; font-size: 15px; line-height: 1.7; white-space: pre; }
.markdown-section .katex-display { margin: 0; }
.markdown-section pre { overflow-x: auto; border-radius: 14px; background: #0f172a; color: #e2e8f0; padding: 16px; margin: 16px 0; }
.markdown-section code { border-radius: 6px; background: #f1f5f9; color: #c2410c; padding: 2px 5px; font-size: .92em; }
.markdown-section pre code { background: transparent; color: inherit; padding: 0; }
.deep-index-shell { max-width: 1040px; }
.deep-index-hero { background: linear-gradient(135deg,#0f172a 0%,#1e3a5f 100%); }
.deep-read-index-list { display: grid; gap: 16px; }
.deep-read-index-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; box-shadow: 0 10px 28px rgba(15,23,42,.04); }
.deep-read-index-card-main { min-width: 0; }
.deep-read-index-card h3 { margin: 12px 0 5px; color: #0f172a; font-size: 19px; line-height: 1.35; font-weight: 950; }
.deep-read-index-card p { margin: 0; color: #475569; line-height: 1.75; font-size: 14px; }
.deep-read-index-card .deep-read-index-en { margin-bottom: 5px; color: #64748b; font-size: 13px; }
.deep-read-open-btn, .deep-read-entry-btn { flex: 0 0 auto; border: 1px solid #fed7aa; border-radius: 10px; background: #fff7ed; color: #c2410c; padding: 10px 14px; font-size: 13px; font-weight: 900; cursor: pointer; transition: all .18s ease; }
.deep-read-open-btn:hover, .deep-read-entry-btn:hover { border-color: #fb923c; background: #ffedd5; }
.deep-read-open-btn span { margin-left: 5px; }
.deep-read-entry-btn { background: #f97316; border-color: #f97316; color: #fff; }
.deep-read-entry-btn:hover { background: #ea580c; border-color: #ea580c; }
.deep-read-article-hero { background: linear-gradient(135deg,#101827 0%,#24476b 100%); }
.filter-chip-row { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 0%; min-width: 0; padding: 2px 0; }
.filter-chip-viewport { flex: 1 1 0%; min-width: 0; }
.filter-chip-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-height: 28px; overflow: hidden; }
.filter-chip-viewport.is-expanded .filter-chip-list { max-height: none; }
.filter-chip-toggle { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; min-height: 26px; padding: 2px 7px; border: 0; border-radius: 7px; background: transparent; color: #64748b; font-size: 11px; font-weight: 800; line-height: 1; cursor: pointer; transition: color .16s ease, background .16s ease; }
.filter-chip-toggle:hover { background: #f1f5f9; color: #ea580c; }
.filter-chip-toggle:focus-visible { outline: 2px solid #fb923c; outline-offset: 2px; }
[data-filter-toggle-icon] { width: 10px; color: #94a3b8; font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .mmhub-pagination { grid-template-columns: 1fr; }
  .mmhub-pagination-controls { justify-content: flex-start; }
  .mmhub-pagination-page { justify-self: start; }
  .deep-shell { padding: 24px 16px 56px; }
  .deep-layout { grid-template-columns: 1fr; }
  .deep-rail .deep-sticky { position: static; }
  .challenge-grid, .challenge-list { grid-template-columns: 1fr; }
  .deep-hero h1 { font-size: 24px; }
  .deep-read-index-card { align-items: stretch; flex-direction: column; gap: 14px; }
  .deep-read-open-btn { width: fit-content; }
}
