/* 技能树页。配色、字号来自 assets/site.css。四态：已掌握点亮、不稳半亮、薄弱、未测。 */

main.tree { width: min(880px, 100%); margin: 0 auto; padding: 20px 16px 56px; }
.tree h1 { margin: 0 0 8px; font-size: 1.5rem; letter-spacing: -0.02em; }
.tree h2 { margin: 0 0 8px; font-size: 1.15rem; letter-spacing: -0.02em; }
.tree h3 { margin: 0; font-size: 1.02rem; }
.tree .muted { color: var(--muted); }
.tree p { overflow-wrap: anywhere; }

.tree-card, .tree-chap {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px 0;
}
.tree-note { padding: 10px 12px; background: var(--bg-muted); border-radius: var(--radius-sm); }
.tree-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tree-actions .btn, .tree-actions a { flex: 1 1 140px; text-align: center; }

.tree-form { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; margin: 12px 0; }
.tree-form label { font-weight: 700; }
.tree-form select { min-width: 0; width: 100%; min-height: 44px; }

.tree-bar { height: 10px; border-radius: 999px; background: var(--bg-muted); overflow: hidden; margin-top: 10px; }
.tree-bar span { display: block; height: 100%; background: #e0b03a; border-radius: 999px; }
.tree-progress-text { margin: 6px 0 0; font-weight: 800; }
.tree-counts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0 0; padding: 0; list-style: none; font-weight: 700; }
.tree-counts .is-weak { color: var(--bad); }
.tree-counts .is-shaky { color: #b45309; }

.tree-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; list-style: none; margin: 12px 0 0; padding: 0; }
.tree-legend li { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.tree-swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid transparent; display: inline-block; flex: none; }
.tree-swatch.is-mastered { background: #f6c445; border-color: #b8860b; box-shadow: 0 0 8px rgba(246, 196, 69, 0.85); }
.tree-swatch.is-shaky { background: #f6d98a; border-color: #d97706; }
.tree-swatch.is-weak { background: #f87171; border-color: #b91c1c; }
.tree-swatch.is-untested { background: #e2e8f0; border-color: #94a3b8; }

.tree-vol { margin: 18px 0 0; font-size: 1.05rem; }
.tree-chap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 12px; margin-bottom: 10px; }
.tree-chap-count { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); white-space: nowrap; }

.tree-nodes { display: flex; flex-wrap: wrap; gap: 8px; }
.tree-node {
  display: inline-flex; align-items: center; gap: 8px;
  flex: 1 1 148px; max-width: 100%; min-height: 44px;
  padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text);
  font: inherit; font-weight: 650; text-align: left; cursor: pointer;
}
.tree-node:hover { filter: brightness(0.98); }
.tree-name { overflow-wrap: anywhere; min-width: 0; }
.tree-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; }

.tree-node.is-mastered {
  background: #fff6d8; border-color: #e0b03a; color: #6b4e00;
  box-shadow: 0 0 0 3px rgba(224, 176, 58, 0.28), 0 0 16px rgba(224, 176, 58, 0.45);
}
.tree-node.is-shaky { background: #fff4cc; border-color: #e8b84a; color: #8a5a00; }
.tree-node.is-shaky .tree-dot { opacity: 0.55; }
.tree-node.is-weak { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.tree-node.is-untested { background: var(--bg-muted); border-color: #cbd5e1; color: #64748b; }

.tree-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  background: var(--bg-elev); color: var(--text);
  width: min(480px, calc(100vw - 32px)); max-height: min(80vh, 640px);
  box-shadow: var(--shadow);
}
.tree-dialog::backdrop { background: rgba(23, 25, 31, 0.45); }
.tree-dialog-body { padding: 16px 18px 18px; overflow: auto; max-height: min(80vh, 640px); }
.tree-dialog h2 { margin: 0 0 8px; }
.tree-pill {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px;
  border-radius: 999px; font-weight: 750; font-size: 0.92rem;
}
.tree-pill.is-mastered { background: #fff6d8; color: #6b4e00; }
.tree-pill.is-shaky { background: #fff4cc; color: #8a5a00; }
.tree-pill.is-weak { background: var(--bad-bg); color: var(--bad); }
.tree-pill.is-untested { background: var(--bg-muted); color: #64748b; }
.tree-criteria { margin: 8px 0 0; padding-left: 1.2em; }
.tree-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tree-links a, .tree-links button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 14px;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 650;
  color: var(--brand-strong); background: var(--bg-elev); font: inherit; cursor: pointer;
}
.tree-links a:hover, .tree-links button:hover { background: var(--bg-muted); }

@media (prefers-color-scheme: dark) {
  .tree-bar span { background: #f6c445; }
  .tree-counts .is-shaky { color: #fbbf24; }
  .tree-swatch.is-untested { background: #334155; border-color: #64748b; }
  .tree-node.is-mastered {
    background: #5c4810; border-color: #f6c445; color: #fff6d8;
    box-shadow: 0 0 0 3px rgba(246, 196, 69, 0.25), 0 0 18px rgba(246, 196, 69, 0.35);
  }
  .tree-node.is-shaky { background: #5c3b10; border-color: #fbbf24; color: #fef3c7; }
  .tree-node.is-weak { background: #7f1d1d; border-color: #fca5a5; color: #fee2e2; }
  .tree-node.is-untested { background: #232b39; border-color: #313b4d; color: #a7b2c2; }
  .tree-pill.is-mastered { background: #5c4810; color: #fff6d8; }
  .tree-pill.is-shaky { background: #5c3b10; color: #fef3c7; }
  .tree-pill.is-untested { background: #232b39; color: #a7b2c2; }
  .tree-dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
}

@media (max-width: 560px) {
  .tree-form { grid-template-columns: 1fr; }
}
