/* ============================================================
   PLAYABLE KIT — Free tool pages (Validator, Size Checker)
   Built on top of the tokens and components in styles.css
   (site-nav, site-button, site-footer, --bg/--tx/--ac/--green/--red scales)
   and reuses .article-cta from article.css for the bottom CTA panel.
   Include styles.css + article.css BEFORE this file.
   ============================================================ */

body { padding-top: 28px; }

.tool-shell {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 96px;
}

.tool-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px 5px 10px;
  border-radius: var(--r-pill);
  background: var(--ac-dim);
  border: 1px solid var(--ac-mid);
  color: var(--ac);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 18px;
}
.tool-kicker svg { width: 13px; height: 13px; flex: 0 0 auto; }

.tool-head { text-align: center; margin-bottom: 40px; }
.tool-head h1 {
  font-size: clamp(28px, 4.2vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--tx-0);
}
.tool-head p {
  margin: 16px auto 0;
  color: var(--tx-2);
  font-size: 16px;
  line-height: 1.65;
  max-width: 58ch;
}
.tool-head p strong { color: var(--tx-0); }

/* ── Dropzone ───────────────────────────────────────────────── */
.tool-drop {
  display: block;
  border: 2px dashed var(--bd-2);
  border-radius: var(--r-xl);
  background: var(--sf-0);
  padding: clamp(32px, 6vw, 52px);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.tool-drop:hover { border-color: var(--bd-3); background: var(--sf-1); }
.tool-drop.drag { border-color: var(--ac); background: var(--ac-dim); }
.tool-drop input { display: none; }

.tool-drop-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: var(--ac-dim);
  border: 1px solid var(--ac-mid);
  color: var(--ac);
  transition: transform 0.2s var(--spring);
}
.tool-drop:hover .tool-drop-icon { transform: translateY(-2px); }
.tool-drop.drag .tool-drop-icon { transform: scale(1.06); }

.tool-drop .lead { color: var(--tx-0); font-weight: 700; font-size: 16.5px; }
.tool-drop .sub { color: var(--tx-3); font-size: 13px; margin-top: 6px; }

.tool-file-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--sf-0);
  border: 1px solid var(--bd-1);
}
.tool-file-row.show { display: flex; }
.tool-file-name { color: var(--tx-0); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tool-livetest > p { color: var(--tx-2); font-size: 13.5px; line-height: 1.6; margin-bottom: 16px; max-width: 62ch; }
.tool-live-source { color: var(--tx-3); font-size: 12.5px; margin-top: 18px; margin-bottom: -6px; }

.tool-livetest-body {
  display: none;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}
.tool-livetest-body.show { display: grid; }

/* Landscape mode switches to a stacked layout -- the portrait grid column is
   capped around 280px wide, so a landscape (wider-than-tall) frame just
   reusing that column would be squeezed down to a tiny, squat rectangle
   regardless of its aspect-ratio. Stacking gives it real width to work with. */
.tool-livetest-body.landscape { grid-template-columns: 1fr; }
.tool-livetest-body.landscape .tool-device-col { max-width: 520px; margin: 0 auto; width: 100%; }
.tool-livetest-body.landscape .tool-live-checklist { max-width: 520px; margin: 0 auto; }

.tool-device-col { display: flex; flex-direction: column; }
.tool-device-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.tool-device-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--sf-2);
  border: 1px solid var(--bd-1);
  color: var(--tx-2);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.tool-device-btn svg { width: 16px; height: 16px; }
.tool-device-btn:hover { color: var(--tx-0); border-color: var(--bd-2); }
.tool-device-btn.active { background: var(--ac-dim); border-color: var(--ac-mid); color: var(--ac); }

.tool-device-frame {
  border: 10px solid var(--sf-2);
  border-radius: 28px;
  background: #000;
  aspect-ratio: 9 / 18;
  width: 100%;
  max-width: 280px;
  overflow: hidden;
  box-shadow: var(--sh-lg);
}
.tool-livetest-body.landscape .tool-device-frame { aspect-ratio: 16 / 9; max-width: 520px; border-radius: 18px; }
.tool-device-frame iframe { width: 100%; height: 100%; border: 0; background: #000; }

.tool-live-verdict { display: none; padding: 16px 18px; border-radius: var(--r-lg); margin-bottom: 14px; }
.tool-live-verdict.show { display: block; }
.tool-live-verdict.ok { background: var(--green-bg); border: 1px solid var(--green-bd); }
.tool-live-verdict.bad { background: var(--red-bg); border: 1px solid var(--red-bd); }
.tool-live-verdict strong { display: block; color: var(--tx-0); font-size: 14.5px; font-weight: 800; margin-bottom: 4px; }
.tool-live-verdict.ok strong { color: var(--green); }
.tool-live-verdict.bad strong { color: var(--red); }
.tool-live-verdict p { color: var(--tx-2); font-size: 12.5px; line-height: 1.6; margin: 0; }

.tool-live-hint { color: var(--tx-3); font-size: 12.5px; line-height: 1.6; margin-bottom: 14px; }
.tool-live-checklist { display: grid; gap: 8px; }
.tool-live-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--sf-2);
  border: 1px solid var(--bd-1);
}
.tool-live-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--tx-3); }
.tool-live-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.tool-live-dot.bad { background: var(--red); box-shadow: 0 0 8px rgba(248,113,113,0.5); }
.tool-live-name { color: var(--tx-0); font-weight: 700; font-size: 13.5px; flex: 1; }
.tool-live-state { color: var(--tx-3); font-size: 12.5px; font-weight: 600; }
.tool-live-state.ok { color: var(--green); }
.tool-live-state.bad { color: var(--red); }

.tool-diag {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--sf-1);
  border: 1px solid var(--bd-1);
}
.tool-diag summary { cursor: pointer; color: var(--tx-2); font-size: 12.5px; font-weight: 600; }
.tool-diag summary:hover { color: var(--tx-0); }
.tool-diag p { color: var(--tx-1); font-size: 12.5px; line-height: 1.6; margin: 10px 0; }
.tool-diag pre {
  background: var(--sf-0);
  border: 1px solid var(--bd-1);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--tx-2);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .tool-livetest-body { grid-template-columns: 1fr; }
  .tool-device-frame { max-width: 240px; margin: 0 auto; }
}

.tool-error {
  display: none;
  margin-top: 16px;
  padding: 13px 18px;
  border-radius: var(--r-lg);
  background: var(--red-bg);
  border: 1px solid var(--red-bd);
  color: var(--red);
  font-size: 14px;
}
.tool-error.show { display: block; }

.tool-spin {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--tx-2);
  font-size: 14px;
  margin-top: 18px;
}
.tool-spin.show { display: flex; }
.tool-spin svg { animation: toolSpin 0.8s linear infinite; color: var(--ac); }
@keyframes toolSpin { to { transform: rotate(360deg); } }

.tool-results { display: none; margin-top: 36px; }
.tool-results.show { display: block; }

/* ── Results: per-network size list (size checker) ─────────── */
.tool-results h2 { color: var(--tx-0); font-size: 19px; font-weight: 800; margin-bottom: 16px; }
.tool-network-list { display: grid; gap: 10px; margin-bottom: 26px; }
.tool-network-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--sf-0); border: 1px solid var(--bd-1); }
.tool-network-row.fail { border-color: var(--red-bd); }
.tool-network-icon { flex: 0 0 auto; width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; }
.tool-network-row.pass .tool-network-icon { background: rgba(74,222,128,0.18); color: var(--green); }
.tool-network-row.fail .tool-network-icon { background: rgba(248,113,113,0.18); color: var(--red); }
.tool-network-main { flex: 1; min-width: 0; }
.tool-network-main .name { color: var(--tx-0); font-weight: 700; font-size: 14.5px; }
.tool-network-main .bar-wrap { margin-top: 9px; height: 6px; border-radius: 4px; background: var(--sf-2); overflow: hidden; }
.tool-network-main .bar { height: 100%; border-radius: 4px; background: var(--green); transition: width 0.4s var(--ease); }
.tool-network-row.fail .bar { background: var(--red); }
.tool-network-findings { margin-top: 9px; font-size: 12.5px; color: var(--red); line-height: 1.5; }
.tool-network-size { flex: 0 0 auto; text-align: right; font-size: 13px; color: var(--tx-2); white-space: nowrap; }
.tool-network-size strong { color: var(--tx-0); }

/* ── About section ──────────────────────────────────────────── */
.tool-about { margin-top: 60px; padding-top: 32px; border-top: 1px solid var(--bd-1); }
.tool-about h2 { color: var(--tx-0); font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.tool-about p { color: var(--tx-2); font-size: 14.5px; line-height: 1.75; margin-bottom: 14px; }
.tool-about ul { padding-left: 20px; color: var(--tx-2); font-size: 14.5px; line-height: 1.7; display: grid; gap: 8px; }
.tool-about li::marker { color: var(--ac); }
.tool-about a { color: var(--purple, #a78bfa); }
.tool-about code { font-family: "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: 0.87em; background: var(--sf-2); border: 1px solid var(--bd-1); padding: 2px 7px; border-radius: 6px; color: #d4ff1e; }

@media (max-width: 640px) {
  .tool-network-row { flex-wrap: wrap; }
  .tool-network-size { text-align: left; }
}

/* ── Network requirements panel (dedicated per-network pages) ─ */
.tool-req-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 28px 0;
}
.tool-req-card { padding: 16px 18px; border-radius: var(--r-lg); background: var(--sf-0); border: 1px solid var(--bd-1); }
.tool-req-card .req-label { color: var(--tx-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 7px; }
.tool-req-card .req-value { color: var(--tx-0); font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.tool-req-card .req-value code { font-size: 0.82em; background: var(--sf-2); border: 1px solid var(--bd-1); padding: 1px 6px; border-radius: 5px; color: #d4ff1e; }

.tool-req-notes { margin: 0 0 32px; padding-left: 20px; color: var(--tx-1); font-size: 14.5px; line-height: 1.75; display: grid; gap: 8px; }
.tool-req-notes li::marker { color: var(--ac); }

/* ── Network hub (validator.html) ─────────────────────────── */
.tool-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 32px; }
.tool-hub-card {
  display: block;
  padding: 22px 20px;
  border-radius: var(--r-xl);
  background: var(--sf-0);
  border: 1px solid var(--bd-1);
  transition: all 0.18s var(--ease);
}
.tool-hub-card:hover { border-color: var(--ac-mid); background: var(--sf-1); transform: translateY(-2px); }
.tool-hub-card:focus-visible { outline: none; border-color: var(--ac); box-shadow: 0 0 0 3px var(--ac-dim); }
.tool-hub-card h3 { color: var(--tx-0); font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.tool-hub-card p { color: var(--tx-2); font-size: 13px; line-height: 1.55; }
/* .network-badge itself now lives in styles.css (site-wide nav dropdown uses
   it too), .lg is still only needed here for the larger hub-card badges. */
.network-badge.lg { width: 48px; height: 48px; font-size: 16px; margin-bottom: 14px; }
.network-icon.lg { width: 48px; height: 48px; margin-bottom: 14px; }
