/* Tools: the "Which AI should I use?" quiz, the API cost calculator, the embed page and the /embed/leaderboard widget.
   Loaded after style.css. Everything is scoped to .tl (tool pages) or .wg (widget) so it can't leak into other pages. */

/* ---------- shared tool pieces ---------- */
.tl { margin: 22px 0 8px; min-width: 0; }
.legal .tl h2, .legal .tl h3, .legal .tl p { text-transform: none; }
.tl .tl-h2 { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); margin: 28px 0 10px; }
.tl .tl-h3 { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); margin: 26px 0 10px; }

.tl .tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--hairline-strong); border-radius: 999px;
  background: transparent; color: var(--starlight);
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.tl .tl-btn:hover { border-color: var(--starlight); }
.tl .tl-btn:active { transform: translateY(1px); }
.tl .tl-btn-primary { background: var(--accretion); border-color: var(--accretion); color: #1a0f03; }
.tl .tl-btn-primary:hover { background: var(--accretion-hot); border-color: var(--accretion-hot); box-shadow: 0 0 32px -6px rgba(255, 184, 107, 0.7); }
.tl .tl-btn-quiet { border-color: transparent; color: var(--dust); }
.tl .tl-btn-quiet:hover { color: var(--starlight); border-color: var(--hairline-strong); }
.tl .tl-btn[data-copied] { border-color: var(--accretion); color: var(--accretion); }
.tl .tl-link { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--dust); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.tl .tl-link:hover { color: var(--starlight); }
.tl .tl-link::before { content: "← "; }
.tl .tl-note { font-size: 13.5px; color: var(--accretion); margin: 0 0 14px; }
.tl-rules p { margin: 0 0 10px; }

/* ---------- quiz ---------- */
.tl-quiz { min-height: 380px; border: 1px solid var(--hairline); border-radius: var(--radius); background: rgba(12, 15, 28, 0.5); padding: clamp(18px, 4vw, 30px); }
.tl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tl .tl-steps { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); margin: 0; }
.tl-dots { display: flex; gap: 8px; }
.tl-dot { width: 28px; height: 4px; border-radius: 2px; background: var(--hairline-strong); transition: background 0.25s; }
.tl-dot.is-done { background: rgba(255, 184, 107, 0.55); }
.tl-dot.is-now { background: var(--accretion); }
.legal .tl .tl-q { font-weight: 850; font-stretch: 115%; text-transform: uppercase; font-size: clamp(22px, 5vw, 30px); line-height: 1.05; letter-spacing: -0.01em; margin: 0 0 8px; color: var(--starlight); outline: none; }
.tl .tl-hint { font-size: 14px; color: var(--dust); margin: 0 0 6px; }
.tl-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
@media (min-width: 600px) { .tl-cards { grid-template-columns: 1fr 1fr; } }
.tl .tl-card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left;
  min-height: 84px; padding: 16px 18px; width: 100%;
  border: 1px solid var(--hairline-strong); border-radius: var(--radius); background: rgba(12, 15, 28, 0.7); color: var(--starlight);
  cursor: pointer; transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.tl .tl-card:hover { border-color: var(--accretion); background: var(--accretion-wash); }
.tl .tl-card:active { transform: translateY(1px); }
.tl .tl-card.is-on { border-color: var(--accretion); background: rgba(255, 184, 107, 0.14); }
.tl .tl-card-t { font-weight: 750; font-size: 17px; line-height: 1.2; }
.tl .tl-card-d { font-size: 13.5px; color: var(--dust); line-height: 1.4; }
.tl .tl-nav { margin: 14px 0 0; }

.tl .tl-sum { font-family: var(--font-mono); font-size: 12px; color: var(--dust); margin: 0 0 16px; overflow-wrap: anywhere; }
.tl .tl-win { border: 1px solid rgba(255, 184, 107, 0.45); border-radius: var(--radius); background: var(--accretion-wash); padding: clamp(18px, 4vw, 26px); }
.tl .tl-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accretion); margin: 0 0 8px; }
.legal .tl .tl-name { font-weight: 850; font-stretch: 120%; text-transform: uppercase; font-size: clamp(28px, 7vw, 46px); line-height: 0.95; letter-spacing: -0.02em; margin: 0 0 8px; overflow-wrap: anywhere; outline: none; }
.legal .tl .tl-name a { color: var(--starlight); text-decoration: none; }
.legal .tl .tl-name a:hover { color: var(--accretion); }
.tl .tl-by { font-family: var(--font-mono); font-size: 12px; color: var(--dust); margin: 0 0 14px; }
.tl .tl-why { font-size: 17px; line-height: 1.5; color: var(--starlight); margin: 0 0 18px; text-wrap: pretty; }
.tl .tl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 16px; margin: 0; padding-top: 16px; border-top: 1px solid var(--hairline); }
.tl .tl-stats dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dust); }
.tl .tl-stats dd { font-family: var(--font-mono); font-size: 17px; font-weight: 600; color: var(--starlight); font-variant-numeric: tabular-nums; margin: 2px 0 0; }
.tl-alts { display: grid; gap: 10px; }
.legal .tl .tl-alt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: rgba(12, 15, 28, 0.6); color: var(--starlight); text-decoration: none; transition: border-color 0.18s; }
.legal .tl .tl-alt:hover { border-color: var(--accretion); }
.tl .tl-alt-n { font-family: var(--font-mono); font-size: 13px; color: var(--dust); flex: none; width: 18px; }
.tl .tl-alt-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl .tl-alt-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.tl .tl-alt-s { font-family: var(--font-mono); font-size: 11.5px; color: var(--dust); overflow-wrap: anywhere; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 6px; }
.tl .tl-more { font-size: 14px; margin: 12px 0 0; }
.seo-table-wrap .seo-table.tl-picks { min-width: 0; }
.tl-picks td a { color: var(--starlight); text-decoration: none; font-weight: 600; }
.tl-picks td a:hover { color: var(--accretion); text-decoration: underline; }
.tl-picks td:first-child a { font-family: var(--font-display); font-weight: 400; color: var(--starlight-2); }
.tl-picks td:first-child a:hover { color: var(--accretion); }

/* ---------- calculator ---------- */
.tl-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 560px) { .tl-form { grid-template-columns: 1fr 1fr; } .tl-form .tl-field:first-child { grid-column: 1 / -1; } }
.tl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-field label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dust); }
.tl-field input {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm); background: rgba(12, 15, 28, 0.8);
  color: var(--starlight); font-family: var(--font-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tl-field input:hover { border-color: var(--dust); }
.tl-field input:focus-visible { outline: 2px solid var(--blueshift); outline-offset: 2px; border-color: var(--blueshift); }
.tl .tl-vol { font-family: var(--font-mono); font-size: 12px; color: var(--dust); margin: 12px 0 14px; }
.tl .tl-sum2 { font-size: 15.5px; line-height: 1.6; color: var(--starlight-2); margin: 0 0 6px; padding: 14px 16px; border: 1px solid rgba(255, 184, 107, 0.35); border-radius: var(--radius-sm); background: var(--accretion-wash); }
.tl-calc .tl-num, .tl-calc th.tl-num { text-align: right; white-space: nowrap; }
.tl-calc td:first-child { min-width: 0; }
.tl-calc td a { font-weight: 650; color: var(--starlight); text-decoration: none; font-family: var(--font-display); font-size: 14.5px; }
.tl-calc td a:hover { color: var(--accretion); text-decoration: underline; }
.tl-calc tr.is-cheapest td, .tl-calc tr.is-value td { background: rgba(255, 184, 107, 0.07); }
.tl-calc .tl-num[data-cost] { color: var(--starlight); font-weight: 600; }
.tl-badge { display: inline-block; margin: 4px 6px 0 0; padding: 2px 8px; border-radius: 999px; background: var(--accretion); color: #1a0f03; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tl-badge-v { background: var(--blueshift); }
.seo-table-wrap.tl-calc-wrap .seo-table { min-width: 0; }
@media (max-width: 480px) {
  .tl-calc th, .tl-calc td { padding-left: 4px; padding-right: 4px; }
  .tl-calc td a { font-size: 13.5px; }
}

/* ---------- embed page ---------- */
.tl-sizes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.tl .tl-chip { min-height: 40px; padding: 0 16px; border: 1px solid var(--hairline-strong); border-radius: 999px; background: transparent; color: var(--dust); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.tl .tl-chip:hover { color: var(--starlight); border-color: var(--starlight); }
.tl .tl-chip[aria-pressed="true"] { color: #1a0f03; background: var(--accretion); border-color: var(--accretion); }
.tl-preview { border: 1px dashed var(--hairline-strong); border-radius: var(--radius); padding: 14px; background: rgba(12, 15, 28, 0.35); overflow: hidden; }
.tl-preview iframe { display: block; margin: 0 auto; width: 100%; max-width: 100%; height: 420px; border: 0; transition: max-width 0.25s var(--ease-out); }
.tl-code { margin: 0 0 14px; padding: 16px; overflow-x: auto; border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm); background: rgba(5, 6, 11, 0.9); }
.tl-code code { font-family: var(--font-mono); font-size: 12px; line-height: 1.7; color: var(--accretion-hot); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- /embed/leaderboard widget (standalone page, not the shell) ---------- */
body.wg-body { margin: 0; min-height: 100vh; background: var(--void); overflow-x: hidden; }
.wg { display: flex; flex-direction: column; min-height: 100vh; max-width: 700px; margin: 0 auto; padding: 12px clamp(12px, 3vw, 20px) 0; }
.wg a { color: inherit; text-decoration: none; }
.wg-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; }
.wg-title { font-weight: 850; font-stretch: 115%; text-transform: uppercase; font-size: clamp(16px, 4.6vw, 20px); letter-spacing: -0.01em; color: var(--starlight); }
.wg-title:hover { color: var(--accretion); }
.wg-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dust); }
.wg-list { flex: 1; margin: 0; padding: 0; list-style: none; }
.wg-row {
  position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; column-gap: clamp(8px, 2.4vw, 14px);
  padding: 9px 0 12px; border-top: 1px solid var(--hairline); min-height: 52px;
}
.wg-row:hover .wg-name b { color: var(--accretion); }
.wg-row:focus-visible { outline-offset: -2px; }
.wg-rank { font-family: var(--font-mono); font-size: 12px; color: var(--dust); }
.wg-name { display: flex; flex-direction: column; min-width: 0; }
.wg-name b { font-weight: 700; font-size: clamp(14px, 3.8vw, 16px); line-height: 1.2; color: var(--starlight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-name small { font-family: var(--font-mono); font-size: 10.5px; color: var(--dust); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-score { font-family: var(--font-mono); font-weight: 600; font-size: clamp(18px, 5vw, 22px); color: var(--accretion); font-variant-numeric: tabular-nums; text-align: right; }
.wg-price { display: flex; flex-direction: column; align-items: flex-end; min-width: 50px; font-family: var(--font-mono); font-size: 12px; color: var(--starlight-2); font-variant-numeric: tabular-nums; }
.wg-price small { font-size: 9.5px; color: var(--dust); }
.wg-bar { position: absolute; left: 0; right: 0; bottom: 5px; height: 2px; background: transparent; }
.wg-bar::after { content: ""; display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, rgba(255, 184, 107, 0.7), rgba(255, 184, 107, 0.15)); border-radius: 2px; }
.wg-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; padding: 8px 0 10px; border-top: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 10px; color: var(--dust); }
.wg-foot a:hover { color: var(--starlight); }
