/* Styles for the connections views: teammates (network graph, tree, list,
   league-wide) and connect (path finder and the linking game). */

/* ---- teammates: hero -------------------------------------------------------------- */
.tm-hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.tm-hero-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.tm-hero-name { font-size: 18px; font-weight: 600; }
.tm-hero-name .muted { font-weight: 400; font-size: 14px; }
.tm-hero-teams { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-hero-sub { color: var(--dim); }
.tm-hero-sub strong { color: var(--text); }
.tm-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-hero-actions a.btn:hover { text-decoration: none; }
.tm-note { display: flex; gap: 8px; align-items: baseline; }
.tm-note .badge { flex: 0 0 auto; }

/* ---- teammates: graph -------------------------------------------------------------- */
.tm-controls { align-items: center; }
.tm-yearbox { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 0; }
.tm-slider { flex: 1; min-width: 80px; }
.tm-year { min-width: 74px; font-variant-numeric: tabular-nums; }
.tm-canvas-wrap { position: relative; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; touch-action: none; }
.tm-canvas { display: block; cursor: grab; }
.tm-canvas:active { cursor: grabbing; }
.tm-sel { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); font-size: 13px; }
.tm-sel[hidden] { display: none; }
.tm-sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-sel-actions a.btn:hover { text-decoration: none; }
.tm-under { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 8px 0 6px; }
.tm-legend { margin: 4px 0 12px; align-items: center; }
.tm-hof-ring { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--gold); vertical-align: -1px; }
.tm-top-title { margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tm-top-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 13px; }
.tm-pill .legend-swatch { width: 9px; height: 9px; border-radius: 50%; }
.tm-recenter { display: inline-block; padding: 0 4px; color: var(--dim); font-size: 14px; line-height: 1; }
.tm-recenter:hover { color: var(--accent); text-decoration: none; }
.tm-tip { display: flex; flex-direction: column; gap: 3px; }
.tm-tip-stints { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tm-stint { white-space: nowrap; }
.tm-stints { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; white-space: normal; }

/* ---- teammates: tree --------------------------------------------------------------- */
.tm-tree-wrap { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; touch-action: none; }
.tm-tree-svg { display: block; width: 100%; height: auto; max-height: 82vh; cursor: grab; }
.tm-tree-svg:active { cursor: grabbing; }
.tm-tree-label { fill: var(--text); font-size: 10px; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.tm-tree-label.d1 { font-size: 11.5px; font-weight: 600; }
.tm-tree-label.hof { fill: var(--gold); }
.tm-tree-node { cursor: pointer; }
.tm-tree-node:hover .tm-tree-label { fill: var(--accent); }
.tm-tree-node:hover circle { stroke: var(--accent); stroke-width: 2px; }
.tm-tree-cname { fill: var(--text); font-size: 13px; font-weight: 700; }
.tm-tree-csub { fill: var(--dim); font-size: 11px; }

/* ---- teammates: list / league ---------------------------------------------------------- */
.tm-stats { margin-bottom: 14px; }
.tm-filter { min-width: 200px; }
.tm-strip { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tm-champs { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.tm-champ { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tm-champ:last-child { border-bottom: none; }
.tm-champ-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-weight: 600; }
.tm-trophy { font-size: 14px; }
.tm-champ-mates { color: var(--dim); margin-top: 3px; }
.tm-ring { white-space: nowrap; }
.tm-barcell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tm-barcell .bar { width: 70px; }

/* ---- connect: path finder ------------------------------------------------------------- */
.cx-pickers { margin-bottom: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: stretch; }
.cx-slot { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); min-width: 0; }
.cx-slot-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); font-weight: 600; }
.cx-slot .picker { min-width: 0; width: 100%; }
.cx-slot-player { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cx-slot-player .cx-pname { font-weight: 600; font-size: 15px; }
.cx-mid { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.cx-result-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cx-degree { font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

/* chain of faces */
.cx-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.cx-node { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; width: 112px; padding: 6px 4px; border-radius: 8px; color: var(--text); }
.cx-node:hover { background: var(--hover); text-decoration: none; }
.cx-node .cx-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.cx-node .cx-sub { font-size: 11px; color: var(--dim); }
.cx-node.endpoint .face { box-shadow: 0 0 0 2px var(--accent); }
.cx-link { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; max-width: 120px; color: var(--dim); font-size: 11px; text-align: center; }
.cx-link .cx-arrow { font-size: 18px; line-height: 1; color: var(--dim); }
.cx-link .cx-stint { white-space: nowrap; }
.cx-link.unsure .cx-arrow { opacity: 0.55; }
.cx-stint.unsure { opacity: 0.75; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.cx-timing { font-size: 10px; font-style: italic; opacity: 0.8; }
.cx-alts { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line, rgba(127,127,127,0.25)); display: flex; flex-direction: column; gap: 6px; }
.cx-alts-head { font-weight: 600; font-size: 13px; }
.cx-alt { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.cx-alt-end { font-weight: 600; }
.cx-alt-arrow { color: var(--dim); }
.cx-alt-team { font-size: 11px; }
.cx-alt-arrow.unsure .cx-alt-team { text-decoration: underline dotted; }
.cx-none { padding: 18px; border: 1px dashed var(--bad); border-radius: var(--radius); color: var(--bad); background: rgba(192, 50, 58, .06); }
.cx-none strong { display: block; font-size: 16px; margin-bottom: 4px; }

/* distribution chart */
.cx-dist svg { display: block; width: 100%; max-width: 760px; height: auto; }
.cx-dist .cx-bar { fill: var(--accent); opacity: .75; }
.cx-dist .cx-bar.target { fill: var(--gold); opacity: 1; }
.cx-dist .cx-bar.none { fill: var(--dim); opacity: .45; }
.cx-dist text { fill: var(--dim); font-size: 11px; }
.cx-dist text.cx-val { fill: var(--text); font-weight: 600; }
.cx-far { margin-top: 8px; }

/* ---- connect: game ------------------------------------------------------------------- */
.cx-game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 12px; }
.cx-game-title { font-size: 13px; color: var(--dim); }
.cx-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 14px; }
.cx-vs .cx-end { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--panel-2); min-width: 0; }
.cx-vs .cx-end.target { justify-content: flex-end; text-align: right; }
.cx-vs .cx-end-name { font-weight: 700; font-size: 15px; }
.cx-vs .cx-end-sub { font-size: 12px; color: var(--dim); }
.cx-vs .cx-par { text-align: center; color: var(--dim); font-size: 12px; }
.cx-vs .cx-par strong { display: block; font-size: 20px; color: var(--text); }
.cx-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 0; }
.cx-step { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-left: 3px solid var(--line); margin-left: 18px; position: relative; }
.cx-step .cx-step-n { position: absolute; left: -14px; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--dim); }
.cx-step .cx-step-body { display: flex; flex-direction: column; gap: 2px; margin-left: 16px; min-width: 0; }
.cx-step .cx-step-name { font-weight: 600; }
.cx-step .cx-step-via { font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cx-step.goal { border-left-color: var(--good); }
.cx-step.goal .cx-step-n { background: var(--good); color: #fff; border-color: var(--good); }
.cx-step.start .cx-step-n { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cx-input { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius); margin-left: 18px; }
.cx-input .picker { flex: 1; min-width: 200px; }
.cx-msg { margin: 8px 0 0 18px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.cx-msg.bad { background: rgba(192, 50, 58, .1); color: var(--bad); }
.cx-msg.good { background: rgba(26, 127, 75, .12); color: var(--good); }
.cx-msg.hint { background: var(--accent-soft); color: var(--text); }
.cx-shake { animation: cx-shake .35s; }
@keyframes cx-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.cx-win { padding: 14px; border-radius: var(--radius); background: var(--panel-2); margin: 12px 0; }
.cx-win-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.cx-win-title.perfect { color: var(--good); }
.cx-share { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.cx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

@media (max-width: 820px) {
	.cx-pickers { grid-template-columns: minmax(0, 1fr); }
	.cx-mid { flex-direction: row; justify-content: center; }
	.cx-chain { flex-direction: column; align-items: stretch; }
	.cx-node { flex-direction: row; width: auto; text-align: left; gap: 10px; }
	.cx-node .cx-node-text { display: flex; flex-direction: column; }
	.cx-link { flex-direction: row; max-width: none; min-width: 0; padding-left: 26px; gap: 6px; flex-wrap: wrap; text-align: left; }
	.cx-link .cx-arrow { transform: rotate(90deg); }
	.cx-vs { grid-template-columns: minmax(0, 1fr); }
	.cx-vs .cx-end.target { justify-content: flex-start; text-align: left; }
	.tm-yearbox { flex-basis: 100%; }
	.tm-help { flex-basis: 100%; }
	.page-teammates .picker, .page-connect .picker { min-width: 0; width: 100%; }
	.cx-input .picker { flex: 1 1 100%; }
}
@media (max-width: 600px) {
	.page-teammates table.data .tm-hide-sm { display: none; }
}
