/* =========================================================
   LLM 101｜PART 02 · UNIT 05 專屬樣式
   只放 p2-* 元件與本單元圖解補充；顏色與間距全部沿用 main.css 的 tokens。
   沒有新增全域變數，也沒有引入外部資源。
   1. 共用工具
   2. 05-1 四層圖
   3. 05-2 模型頁五區
   4. 05-3 Model Card 熱點
   5. 05-4 家族樹與版本拆解卡
   6. 05-5 模型角色卡
   7. 05-6 流程與模型選擇器
   8. 響應式
   9. 動態與列印
   ========================================================= */

/* ---------- 1. 共用工具 ---------- */
.p2-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.p2-mono,
.p2-svg-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.p2-hint {
  margin: 0 0 14px;
  font-size: .8rem;
  line-height: 1.7;
  color: var(--muted);
}

.p2-state {
  margin: 0;
  font-size: .88rem;
  line-height: 1.75;
  color: var(--muted);
}

.p2-card-head { margin-bottom: 12px; }

.p2-card-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--primary);
}

.p2-card-title {
  margin: 3px 0 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.p2-card-sub {
  margin: 5px 0 0;
  font-size: .84rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 2. 05-1 四層圖 ---------- */
/* 直向 HTML 卡片：字級不隨容器縮放，390 不需要水平捲動。
   左欄是「使用」鏈（1→2→3）；授權是右欄的條件卡，不是第四個執行階段。 */

.p2-band {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.4;
}

.p2-band-mark {
  fill: var(--primary);
  opacity: .55;
}

.p2-layer-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 240px);
  gap: 18px;
  align-items: center;
}

.p2-layer-chain {
  display: grid;
  gap: 0;
  min-width: 0;
}

.p2-layer {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas:
    "num main"
    "num note";
  column-gap: 12px;
  row-gap: 3px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
}

.p2-layer-num {
  grid-area: num;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-weak);
  border: 1px solid var(--primary);
  border-radius: 999px;
}

.p2-layer-main {
  grid-area: main;
  min-width: 0;
}

.p2-layer-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
}

.p2-layer-eg {
  margin: 3px 0 0;
  font-size: .84rem;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.p2-layer-note {
  grid-area: note;
  margin: 0;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* 卡與卡之間只放「使用」向下箭頭：1→2→3，沒有第四段 */
.p2-layer-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  padding: 3px 15px;
}

.p2-layer-link-line {
  position: relative;
  justify-self: center;
  width: 0;
  height: 24px;
  border-left: 2px dashed var(--border);
}

.p2-layer-link-line::after {
  content: "";
  position: absolute;
  left: -5px;
  bottom: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.p2-layer-link-label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
}

/* 授權：掛在模型／權重旁的條件標籤，用虛線與階段卡區隔 */
.p2-layer-aside {
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1.5px dashed var(--primary);
  border-radius: 14px;
}

.p2-layer-aside .p2-layer-name {
  font-size: .98rem;
}

.p2-layer-aside-tag {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 8px;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--primary);
  background: var(--primary-weak);
  border-radius: 6px;
}

.p2-layer-aside .p2-layer-eg { margin-top: 8px; }

.p2-layer-aside .p2-layer-note { margin-top: 6px; }

.p2-band-num {
  fill: var(--primary-weak);
  stroke: var(--primary);
  stroke-opacity: .5;
  stroke-width: 1.2;
}

.p2-dash-line {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  opacity: .6;
}

.p2-arrow-head {
  stroke: var(--muted);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}

/* 圖內小字說明：用 p2- 前綴，避免動到共用圖解樣式 */
.diagram .p2-diagram-note {
  fill: var(--muted);
}

/* ---------- 3. 05-2 模型頁五區 ---------- */
.p2-hub-mock {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.p2-zone {
  min-width: 0;
  padding: 12px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.p2-zone-search,
.p2-zone-filter { grid-column: 1 / -1; }

.p2-zone-publisher,
.p2-zone-modelcard,
.p2-zone-files { grid-column: span 2; }

.p2-zone-tag {
  margin: 0 0 7px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--primary);
}

.p2-zone-note {
  margin: 8px 0 0;
  font-size: .78rem;
  line-height: 1.65;
  color: var(--muted);
}

.p2-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.p2-search-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
}

.p2-search-btn {
  flex: none;
  padding: 4px 10px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 7px;
  font-size: .76rem;
  font-weight: 700;
}

.p2-hub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.p2-hub-chip {
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  color: var(--muted);
}

.p2-publisher-name {
  margin: 0;
  font-size: .95rem;
  font-weight: 800;
}

.p2-publisher-badge {
  display: inline-block;
  margin: 2px 0 0;
  padding: 2px 8px;
  background: var(--primary-weak);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
}

.p2-mock-modelid {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.p2-hub-files {
  margin: 0;
  padding: 0 0 0 1em;
  list-style: disc;
  font-size: .78rem;
  line-height: 1.7;
  color: var(--text);
}

.p2-hub-files li { overflow-wrap: anywhere; }

/* ---------- 4. 05-3 Model Card 熱點 ---------- */
.p2-hotspots {
  display: grid;
  grid-template-columns: minmax(0, 296px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.p2-hotspots-stage {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-stage-caption {
  margin: 0 0 8px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
}

.p2-page-mock {
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.p2-mock-id {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.p2-mock-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.p2-mock-tabs span {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
}

.p2-mock-tabs .p2-tab-on {
  background: var(--primary-weak);
  color: var(--primary);
}

.p2-mock-rows {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.p2-mock-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.p2-mock-label {
  flex: none;
  width: 4.8em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
}

.p2-mock-line {
  flex: 1 1 auto;
  height: 6px;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.p2-hotspot-dot {
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
}

.p2-hotspot-dot:hover,
.p2-hotspot-dot[aria-expanded="true"] {
  border-color: var(--primary);
  border-width: 2.5px;
  background: var(--primary-weak);
  color: var(--primary);
}

.p2-mock-foot {
  margin: 9px 0 0;
  font-size: .68rem;
  color: var(--muted);
}

.p2-hotspots-list { min-width: 0; }

.p2-hotspot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.p2-hotspot + .p2-hotspot { margin-top: 8px; }

.p2-hotspot-heading {
  margin: 0;
  font-size: 1rem;
}

.p2-hotspot-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.p2-hotspot-btn:hover { background: var(--surface-2); }

.p2-hotspot[data-open="true"] .p2-hotspot-btn {
  background: var(--primary-weak);
  color: var(--primary);
}

.p2-hotspot-num {
  flex: none;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 800;
  color: var(--muted);
}

.p2-hotspot[data-open="true"] .p2-hotspot-num {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.p2-hotspot-label { min-width: 0; }

.p2-hotspot-state {
  margin-left: auto;
  flex: none;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.p2-hotspot[data-open="true"] .p2-hotspot-state { color: var(--primary); }

.p2-hotspot-panel { padding: 0 12px 12px; }

.p2-hotspot-dl {
  margin: 0;
  display: grid;
  gap: 5px;
  padding-top: 2px;
  border-top: 1px dashed var(--border);
}

.p2-hotspot-dl > div {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  gap: 8px;
  padding-top: 5px;
  font-size: .84rem;
  line-height: 1.65;
}

.p2-hotspot-dl dt {
  color: var(--muted);
  font-weight: 700;
}

.p2-hotspot-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- 5. 05-4 家族樹與版本拆解卡 ---------- */
/* 寬圖用自身水平捲動，不把 min-content 推給頁面造成 390px 溢出。
   contain: inline-size 讓捲動容器的內在寬度與內容脫鉤（Chromium／Firefox／Safari 皆支援）。 */
.p2-scroll { contain: inline-size; }

.p2-tree-inner { min-width: 720px; }

.p2-node {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1.3;
}

.p2-node-family {
  fill: var(--primary-weak);
  stroke: var(--primary);
  stroke-opacity: .35;
}

.p2-node-center {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 1.8;
}

/* 官方 repo 用實線 primary，社群轉換 repo 用虛線 muted：
   兩者並排，但不做「哪個比較好」的暗示。 */
.p2-node-official {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 1.6;
}

.p2-node-community {
  fill: var(--surface-2);
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
}

.p2-arrow-line {
  stroke: var(--muted);
  stroke-width: 1.6;
  opacity: .65;
}

.p2-bus {
  stroke: var(--muted);
  stroke-width: 1.4;
  opacity: .35;
}

.p2-version-card {
  margin-top: 16px;
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-select-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.p2-select-label {
  flex: none;
  font-size: .84rem;
  font-weight: 800;
}

#unit-05 .p2-select {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: .88rem;
}

.p2-dl {
  margin: 0;
  display: grid;
}

.p2-dl-row {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}

.p2-dl-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.p2-dl dt {
  font-size: .78rem;
  font-weight: 800;
  color: var(--muted);
}

.p2-dl dd {
  margin: 0;
  min-width: 0;
  font-size: .86rem;
  line-height: 1.7;
}

.p2-dl-value {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.p2-dl-note {
  display: block;
  margin-top: 2px;
  font-size: .76rem;
  line-height: 1.6;
  color: var(--muted);
}

.p2-version-title {
  margin: 0 0 8px;
  font-size: .88rem;
  font-weight: 800;
}

/* 05-4｜官方 vs 社群：SVG 先給 repo 位置，這裡用六列給可查的實例。
   三欄在 390 疊成「維度＋兩個帶標籤的值」，關係仍在。 */
.p2-compare {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-compare-title {
  margin: 0 0 8px;
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.5;
}

.p2-compare-row {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}

.p2-compare-row.is-head {
  padding-top: 0;
  border-top: 0;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
}

.p2-compare-key {
  margin: 0;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.6;
  color: var(--muted);
}

.p2-compare-val {
  margin: 0;
  min-width: 0;
  font-size: .82rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.p2-compare-tag {
  display: inline-block;
  margin-right: 4px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: var(--primary);
}

.p2-compare-note {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: .76rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 6. 05-5 模型角色卡 ---------- */
/* 先用同一條規模帶分三組（≤10B／10–40B／>40B），卡片保留查值與官方連結。
   分組不是分數或排名；MoE 卡仍同時列總參數與啟用參數。 */
.p2-model-scale {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-scale-axis {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--muted);
}

.p2-scale-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.p2-scale-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border-left: 1px dashed var(--border);
}

.p2-scale-col:first-child { border-left: 0; }

.p2-scale-range {
  font-family: var(--font-mono);
  font-size: .86rem;
  font-weight: 800;
  color: var(--primary);
}

.p2-scale-name {
  font-size: .74rem;
  line-height: 1.5;
  color: var(--muted);
}

.p2-scale-note {
  margin: 8px 0 0;
  font-size: .76rem;
  line-height: 1.7;
  color: var(--muted);
}

.p2-model-groups {
  display: grid;
  gap: 18px;
}

.p2-model-group { min-width: 0; }

/* 兩張卡的小組用兩欄，避免第三欄留下像「缺一張」的空位；
   手機（<=859）仍由 .p2-model-cards 的單欄規則接管。 */
@media (min-width: 860px) {
  .p2-model-group-pair .p2-model-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.p2-model-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.p2-model-group-title {
  margin: 0;
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.5;
}

.p2-model-group-note {
  margin: 0;
  font-size: .76rem;
  line-height: 1.6;
  color: var(--muted);
}

.p2-model-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.p2-model-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-model-role {
  margin: 0;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--primary);
}

.p2-model-name {
  margin: 3px 0 0;
  font-size: .98rem;
  line-height: 1.4;
}

.p2-model-id {
  margin: 3px 0 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.p2-model-why {
  margin: 8px 0 0;
  font-size: .82rem;
  line-height: 1.65;
}

.p2-model-spec {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 3px;
}

.p2-model-spec > div {
  display: grid;
  grid-template-columns: 5.2em minmax(0, 1fr);
  gap: 6px;
  font-size: .76rem;
  line-height: 1.55;
}

.p2-model-spec dt {
  color: var(--muted);
  font-weight: 700;
}

.p2-model-spec dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.p2-model-link {
  display: block;
  margin-top: auto;
  padding-top: 10px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.5;
}

.p2-model-link + .p2-model-link { padding-top: 4px; }

/* ---------- 7. 05-6 流程與模型選擇器 ---------- */
.p2-flow-inner { min-width: 740px; }

.p2-step-arrow {
  stroke: var(--muted);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .7;
}

/* 05-6：每一步的淘汰出口，以及兩張裝置卡接到第 5 步的虛線。
   淘汰不是主要路徑，所以用虛線與 muted；不搶走 1→6 的前進方向。 */
.p2-exit-link {
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-dasharray: 3 3;
  opacity: .6;
}

.p2-exit {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}

.diagram .p2-step-title {
  font-size: 13px;
  font-weight: 800;
  fill: var(--text);
}

.diagram .p2-exit-label {
  font-size: 11.5px;
  font-weight: 800;
  fill: var(--primary);
}

.p2-exit-bar {
  fill: var(--primary-weak);
  stroke: var(--border);
  stroke-width: 1.2;
}

.diagram .p2-exit-bar-text {
  font-size: 11.5px;
  font-weight: 700;
  fill: var(--text);
}

.p2-device-link {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
  opacity: .55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p2-picker {
  margin-top: 16px;
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.p2-picker-form {
  display: grid;
  gap: 13px;
  margin-bottom: 12px;
}

.p2-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.p2-legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: .84rem;
  font-weight: 800;
}

.p2-seg-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.p2-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.p2-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.p2-seg:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.p2-radio:checked + .p2-seg {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.p2-radio:focus-visible + .p2-seg {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.p2-picker-result {
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.p2-result-head {
  margin: 0 0 10px;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.6;
}

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

.p2-result-card {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.p2-result-flag {
  margin: 0;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--ok);
}

.p2-result-name {
  margin: 2px 0 0;
  font-size: .96rem;
  line-height: 1.4;
}

.p2-result-id {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.p2-result-spec {
  margin: 8px 0 0;
  display: grid;
  gap: 2px;
}

.p2-result-spec > div {
  display: grid;
  grid-template-columns: 5em minmax(0, 1fr);
  gap: 6px;
  font-size: .76rem;
  line-height: 1.55;
}

.p2-result-spec dt {
  color: var(--muted);
  font-weight: 700;
}

.p2-result-spec dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.p2-result-note {
  margin: 8px 0 0;
  font-size: .78rem;
  line-height: 1.65;
  color: var(--muted);
}

.p2-result-link {
  display: inline-block;
  margin-top: 8px;
  font-size: .78rem;
  font-weight: 700;
}

.p2-result-foot {
  margin: 10px 0 0;
  font-size: .78rem;
  line-height: 1.7;
  color: var(--muted);
}

.p2-miss { margin-top: 16px; }

.p2-miss-title {
  margin: 0 0 7px;
  font-size: .86rem;
  line-height: 1.5;
}

.p2-miss-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.p2-miss-list li {
  display: grid;
  grid-template-columns: 10em minmax(0, 1fr);
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: .78rem;
  line-height: 1.65;
}

.p2-miss-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.p2-miss-why {
  min-width: 0;
  color: var(--muted);
}

/* ---------- 8. 響應式 ---------- */
@media (max-width: 1080px) {
  .p2-model-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p2-hotspots { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
}

@media (max-width: 859px) {
  /* 05-1：三張階段卡單欄堆疊，授權條件卡接在權重之後；字級不縮放 */
  .p2-layer-map { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  .p2-layer-aside { align-self: stretch; }

  .p2-hub-mock { grid-template-columns: 1fr; }
  .p2-zone-search,
  .p2-zone-filter,
  .p2-zone-publisher,
  .p2-zone-modelcard,
  .p2-zone-files { grid-column: 1 / -1; }

  .p2-hotspots { grid-template-columns: 1fr; gap: 12px; }

  /* 手機：不用圖上熱點，改成六列按鈕清單 */
  .p2-hotspots-stage { display: none; }

  .p2-hotspot-dl > div { grid-template-columns: 1fr; gap: 1px; }

  .p2-model-cards { grid-template-columns: 1fr; }

  .p2-version-card,
  .p2-picker { padding: 13px; }

  .p2-dl-row { grid-template-columns: 1fr; gap: 2px; }

  /* 05-4：六個維度改成「維度 → 官方值 → 社群值」直向疊，
     值前面已有「官方／社群」標籤，不需要表頭。 */
  .p2-compare-row { grid-template-columns: 1fr; gap: 3px; padding: 9px 0; }
  .p2-compare-row.is-head { display: none; }
  .p2-compare-key { font-size: .8rem; }

  /* 05-4：右側補充說明在 390 會只剩被裁掉的字，直接隱藏；
     官方／社群兩個 repo 節點與下方六維度表仍在。 */
  .p2-svg-wide-note { display: none; }

  /* 05-5：三組卡片單欄；規模帶保留三欄，讓「小→大」關係還在。 */
  .p2-scale-col { padding: 7px 8px; }
  .p2-scale-name { font-size: .7rem; }

  .p2-seg-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .p2-seg { width: 100%; }

  .p2-result-grid { grid-template-columns: 1fr; }

  .p2-miss-list li { grid-template-columns: 1fr; gap: 1px; }

  .p2-zone-note,
  .p2-hub-files { font-size: .8rem; }
}

@media (max-width: 460px) {
  .p2-hotspot-state { font-size: .66rem; }
  .p2-card-title { font-size: 1rem; }
  #unit-05 .p2-select { flex-basis: 100%; }

  .p2-scale-col { padding: 7px 5px; }
  .p2-scale-range { font-size: .76rem; }
  .p2-scale-name { font-size: .66rem; }

  .p2-compare { padding: 12px; }
  .p2-compare-val { font-size: .8rem; }
}

/* ---------- 9. 動態與列印 ---------- */
@media (prefers-reduced-motion: reduce) {
  .p2-hotspot-btn,
  .p2-seg { transition: none; }
}

@media print {
  .p2-hotspots-stage,
  .p2-select-row,
  .p2-picker-form,
  .p2-hint { display: none !important; }

  .p2-hotspot-panel[hidden] { display: block !important; }

  .p2-version-card,
  .p2-picker,
  .p2-hotspots-stage,
  .p2-zone { break-inside: avoid; }
}
