/* 寵物圖鑑 */
.pets { --g40: #5ad48a; --g120: #ffb11b; --g200: #ff5f8a; }
html:is([data-theme="light"],[data-theme="paper"]) .pets { --g40: #18864a; --g120: #b06a00; --g200: #c8285a; }

.pets__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.pets__layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---------- 清單 ---------- */
.pets__aside { position: sticky; top: 124px; display: flex; flex-direction: column; max-height: calc(100vh - 140px); overflow: hidden; }
.pets__filters { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.pets__sep { width: 1px; height: 18px; margin: 6px 2px; background: var(--line-strong); }
.pets__count { margin: 0; color: var(--faint); font-size: 12.5px; }
.fam-list { margin: 0; padding: 6px; list-style: none; overflow-y: auto; scrollbar-width: thin; }
.fam { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.fam:hover { background: var(--surface-2); }
.fam[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.fam__name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.fam__sub { grid-column: 1; color: var(--faint); font-size: 12.5px; }
.fam__path { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.fam__dots { display: flex; gap: 5px; }
.fam__dots .rar-dot { width: 8px; height: 8px; }

/* ---------- 詳細 ---------- */
.pets__detail { display: grid; gap: 18px; min-width: 0; }
.pets__detail > *, .stage > *, .pets__layout > * { min-width: 0; }
.back { display: none; }
.fam-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; padding: 22px 24px; }
.fam-head h2 { margin: 0; font-size: 26px; line-height: 1.3; }
.fam-head__sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.fam-head__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.gates { display: grid; gap: 6px; width: 100%; margin: 0; padding: 14px 16px; list-style: none; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.gates li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.gates b { font-weight: 800; }
.gate-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; font-weight: 800; color: var(--bg); background: var(--gc); }
[data-g="40"] { --gc: var(--g40); } [data-g="120"] { --gc: var(--g120); } [data-g="200"] { --gc: var(--g200); }
.gates__hint { margin-top: 4px; color: var(--faint); font-size: 12.5px; }

/* 升階路線圖 */
.route { padding: 18px 20px 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; font-size: 17px; }
.section-title small { color: var(--faint); font-size: 12.5px; font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 22px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--line-strong); }
.legend i[data-g] { border-top: 2px dashed var(--gc); }
.route__scroll { overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.matrix { position: relative; display: grid; gap: 0; min-width: max-content; }
.matrix svg.edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.m-group { grid-row: 1; padding: 0 4px 2px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line); }
.m-col { grid-row: 2; padding: 4px 0 6px; text-align: center; color: var(--faint); font-size: 11.5px; font-family: var(--mono); }
.m-row { display: flex; align-items: center; gap: 7px; padding-right: 14px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--rc); }
.m-cell { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 54px; min-height: 54px; padding: 4px 0; }
.node { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid var(--rc); border-radius: 10px; background: color-mix(in srgb, var(--rc) 16%, var(--surface)); color: var(--text); font: 700 11px var(--mono); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.node:hover { transform: scale(1.12); }
.node[aria-pressed="true"] { background: var(--rc); color: var(--bg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rc) 35%, transparent); }
.node--new::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.node--alt { width: 24px; height: 18px; border-radius: 6px; font-size: 10px; }
.m-empty { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.edge { fill: none; stroke-width: 1.6; opacity: .55; transition: opacity .15s, stroke-width .15s; }
.edge--normal { stroke: var(--line-strong); opacity: .9; }
.edge--gate { stroke: var(--gc); stroke-dasharray: 4 4; opacity: .5; }
.edges.has-focus .edge { opacity: .12; }
.edges.has-focus .edge.is-on { opacity: 1; stroke-width: 2.6; }

/* 階段資料 */
.stage { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; }
.stage__main, .stage__side { display: grid; gap: 18px; align-content: start; min-width: 0; }
.card { padding: 18px 20px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.stage-head h3 { margin: 0; font-size: 21px; }
.stage-head .id { color: var(--faint); font: 12.5px var(--mono); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.fact { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.fact dt { color: var(--faint); font-size: 12px; }
.fact dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fact dd small { color: var(--muted); font-size: 12px; font-weight: 600; }

.moves { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.move { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.move:hover { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 8%, transparent); }
.move__arrow { color: var(--faint); font-size: 18px; }
.move__name { font-weight: 700; }
.move__name small { margin-left: 6px; color: var(--muted); font-weight: 500; }
.move__cond { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.label { margin: 16px 0 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.label:first-child { margin-top: 0; }

.skills { display: grid; gap: 10px; }
.skill { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.skill__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.skill__name { font-weight: 800; }
.skill__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.skill__desc { margin: 6px 0 0; color: var(--muted); font-size: 14px; white-space: pre-line; }

.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat-table th, .stat-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.stat-table thead th { color: var(--faint); font-size: 12px; font-weight: 600; }
.stat-table td.cap { color: var(--faint); }

/* 成長一覽 */
.growth { padding: 18px 20px; }
.growth__scroll { overflow-x: auto; scrollbar-width: thin; }
.growth table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.growth th, .growth td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.growth th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; color: var(--muted); }
.growth thead th { color: var(--faint); font-weight: 600; cursor: pointer; }
.growth thead th:hover { color: var(--text); }
.growth .is-cur { background: var(--accent-soft); color: var(--text); font-weight: 800; }
.growth thead .is-cur { color: var(--accent); }
.row-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 響應式 ---------- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .pets__layout { grid-template-columns: 1fr; }
  .pets__aside { position: static; max-height: none; }
  .fam-list { max-height: none; }
  .pets[data-view="list"] .pets__detail { display: none; }
  .pets[data-view="detail"] .pets__aside { display: none; }
  .pets[data-view="detail"] .pets__head { display: none; }
  .back { display: inline-flex; align-items: center; gap: 6px; justify-self: start; margin-top: 14px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-weight: 700; cursor: pointer; }
}
@media (max-width: 560px) {
  .fam-head, .route, .card, .growth { padding: 16px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-cell { width: 44px; min-height: 48px; }
  .node { width: 30px; height: 30px; }
}

/* ---------- v2：技能 → 數值 → 升階 ---------- */
.picker { position: sticky; top: 72px; z-index: 20; display: grid; gap: 10px; padding: 14px 18px; box-shadow: var(--shadow); }
.picker__now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.picker__name { font-size: 18px; font-weight: 800; }
.id { color: var(--faint); font: 12.5px var(--mono); }
.picker__rars { display: flex; flex-wrap: wrap; gap: 6px; }
.picker__stages { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.stage-btn { flex: none; display: grid; justify-items: center; min-width: 46px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font: 700 12.5px var(--mono); cursor: pointer; }
.stage-btn small { font: 500 10.5px var(--font); color: var(--faint); }
.stage-btn:hover { border-color: var(--rc); color: var(--text); }
.stage-btn[aria-pressed="true"] { background: var(--rc); border-color: var(--rc); color: var(--bg); }
.stage-btn[aria-pressed="true"] small { color: inherit; opacity: .8; }

.block { padding: 20px 22px 22px; }
.block__title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 19px; }
.block__no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 800 14px var(--mono); }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.skill__path { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; color: var(--faint); font-size: 12.5px; }
.linkish { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--line-strong); margin-left: 6px; }
.timeline li { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; padding: 6px 0 6px 16px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.is-cur::before { background: var(--accent); border-color: var(--accent); }
.timeline__stage { justify-self: start; padding: 0; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.timeline li.is-cur .timeline__stage { color: var(--accent); }
.timeline__ev { display: flex; flex-wrap: wrap; gap: 6px; }
.sk-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); }
.sk-chip--new { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); background: var(--accent-soft); }

.stats-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.facts--inline { margin: 0 0 12px; }
.delta { color: var(--faint); font-size: 12.5px; font-weight: 700; }
.delta.up { color: var(--r-精英); }
.delta.down { color: var(--r-太古); }
.growth-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 22px; }
.growth-head .label { margin: 0; }
.growth__scroll { margin-top: 8px; overflow-x: auto; scrollbar-width: thin; }
.growth__scroll table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.growth__scroll th, .growth__scroll td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.growth__scroll th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; color: var(--muted); }
.growth__scroll thead th { color: var(--faint); font-weight: 600; cursor: pointer; }
.growth__scroll .is-cur { background: var(--accent-soft); color: var(--text); font-weight: 800; }
.growth__scroll thead .is-cur { color: var(--accent); }

.block .gates { margin-bottom: 14px; }
.block .facts { margin: 0 0 14px; }
.rebirth { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; border: 1px dashed var(--line-strong); font-size: 14px; }
.rebirth ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.block .legend { margin: 6px 0 8px; }
.moves-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }

@media (max-width: 1180px) { .stats-grid { grid-template-columns: 1fr; } }
@media (max-width: 980px) { .picker { top: 64px; } }
@media (max-width: 700px) {
  .moves-grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .block { padding: 16px; }
}
