/* Styles for the interactive tools on the static SEO pages.
   Loaded alongside /css/seo-page.css, whose palette it reuses exactly:
   ground #0a0f1a, panel #111827, deep panel #0d1424, border #1f2937,
   accent #6ee7b7, muted #94a3b8 / #64748b.
   Every class is prefixed ct- so it can never collide with the essay styles. */

.ct-tool {
  background: #0d1424;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 18px 18px 20px;
  margin: 0 0 28px;
}
.ct-tool-failed { color: #94a3b8; font-size: 14px; }

/* Wrapper around a mount point. Reserves vertical space before the script
   runs so the tool does not shove the article down as it appears. */
.ct-host { min-height: 120px; }
.ct-noscript {
  background: #111827; border: 1px solid #1f2937; border-radius: 10px;
  padding: 14px 18px; font-size: 14px; color: #94a3b8; margin: 0 0 28px;
}
/* One line of orientation above a tool that was added to an existing essay. */
.ct-intro { font-size: 15.5px; color: #cbd5e1; margin: 0 0 16px; }

/* The UA rule for [hidden] is display:none, but ANY author display rule beats
   it, so .ct-row on a hidden element kept it on screen (the wins/draws/losses
   row stayed visible in single-game mode). Make hiding win everywhere. */
.ct-tool [hidden] { display: none !important; }

/* ── layout ─────────────────────────────────────────────────────────── */
.ct-layout { display: flex; gap: 20px; align-items: flex-start; }
.ct-col { min-width: 0; }
.ct-col-board { flex: 0 0 300px; }
.ct-col-side { flex: 1 1 auto; }
.ct-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.ct-row > * { flex: 1 1 150px; min-width: 0; }
.ct-row-3 > * { flex: 1 1 80px; }
.ct-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 2 1 240px; }

/* ── form controls ──────────────────────────────────────────────────── */
.ct-field { margin: 0 0 14px; }
.ct-label {
  display: block; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #64748b; margin: 0 0 6px;
}
.ct-hint { font-size: 12.5px; color: #64748b; margin: 6px 0 0; }
.ct-input, .ct-select, .ct-textarea {
  width: 100%; box-sizing: border-box;
  background: #0a0f1a; color: #e8edf5;
  border: 1px solid #1f2937; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.4;
}
.ct-textarea { resize: vertical; min-height: 120px; }
.ct-input:focus, .ct-select:focus, .ct-textarea:focus {
  outline: none; border-color: #6ee7b7; box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.18);
}
.ct-mono { font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.ct-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit; padding: 11px 16px;
}
.ct-btn:disabled { opacity: 0.55; cursor: default; }
.ct-btn-primary { background: #6ee7b7; color: #0a0f1a; width: 100%; }
.ct-btn-primary:hover:not(:disabled) { background: #5ed5a5; }
.ct-btn-ghost { background: #111827; color: #cbd5e1; border-color: #1f2937; }
.ct-btn-ghost:hover { color: #e8edf5; border-color: #334155; }
.ct-actions .ct-btn-primary { width: auto; }

/* ── board ──────────────────────────────────────────────────────────── */
.ct-boardhost { width: 100%; }
.ct-board { width: 100%; }
.ct-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1 / 1; width: 100%;
  border: 1px solid #1f2937; border-radius: 8px; overflow: hidden;
}
.ct-sq {
  position: relative; padding: 0; margin: 0; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ct-light { background: #cfd8e3; }
.ct-dark { background: #6d84a1; }
.ct-selected { box-shadow: inset 0 0 0 3px #6ee7b7; }
.ct-from, .ct-to { box-shadow: inset 0 0 0 3px #f7c631; }
.ct-target::after {
  content: ''; position: absolute; width: 26%; height: 26%; border-radius: 50%;
  background: rgba(10, 15, 26, 0.35);
}
.ct-piece { width: 100%; height: 100%; display: block; pointer-events: none; }
.ct-boardbar { display: flex; gap: 8px; margin-top: 10px; }
.ct-boardbar .ct-btn { flex: 1; padding: 9px 10px; font-size: 13px; }

/* ── status + progress ──────────────────────────────────────────────── */
.ct-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; margin: 10px 0 0; min-height: 20px; color: #94a3b8;
}
.ct-status:empty { margin: 0; min-height: 0; }
.ct-status-error { color: #f0a5a5; }
.ct-status-done { color: #6ee7b7; }
.ct-spinner {
  width: 13px; height: 13px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid #1f2937; border-top-color: #6ee7b7;
  animation: ct-spin 0.8s linear infinite;
}
@keyframes ct-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ct-spinner { animation-duration: 3s; } }

.ct-bar { height: 5px; background: #111827; border-radius: 3px; overflow: hidden; margin: 12px 0 0; }
.ct-bar-fill { height: 100%; width: 0; background: #6ee7b7; transition: width 0.2s linear; }

/* ── results ────────────────────────────────────────────────────────── */
.ct-result:empty { display: none; }
.ct-result { margin-top: 16px; }
.ct-verdict, .ct-report-head {
  display: flex; gap: 10px; align-items: flex-start;
  background: #111827; border: 1px solid #1f2937; border-left: 3px solid #6ee7b7;
  border-radius: 8px; padding: 13px 15px; margin: 0 0 14px; color: #cbd5e1; font-size: 14px;
}
.ct-verdict svg, .ct-report-head svg { color: #6ee7b7; flex-shrink: 0; margin-top: 2px; }
.ct-verdict strong { display: block; color: #e8edf5; font-size: 16px; margin-bottom: 3px; }
.ct-verdict-sub { font-size: 13px; color: #94a3b8; }
.ct-note { font-size: 12.5px; color: #64748b; margin: 12px 0 0; line-height: 1.55; }
.ct-subhead { font-size: 14px; color: #94a3b8; margin: 20px 0 6px; }

.ct-cands { display: flex; flex-direction: column; gap: 6px; }
.ct-cand {
  display: grid; grid-template-columns: 46px 62px 56px 1fr; gap: 10px; align-items: baseline;
  background: #0a0f1a; border: 1px solid #1f2937; border-radius: 8px; padding: 9px 12px; font-size: 13.5px;
}
.ct-cand-best { border-color: #2f6b57; }
.ct-cand-rank { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.ct-cand-best .ct-cand-rank { color: #6ee7b7; }
.ct-cand-move { font-weight: 700; color: #e8edf5; font-size: 15px; }
.ct-cand-eval { font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace; color: #cbd5e1; }
.ct-cand-line {
  font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
  color: #64748b; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ct-sides { display: flex; gap: 12px; flex-wrap: wrap; }
.ct-side-card {
  flex: 1 1 200px; background: #0a0f1a; border: 1px solid #1f2937;
  border-radius: 10px; padding: 14px 16px;
}
.ct-side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ct-side-head strong { color: #e8edf5; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; border: 1px solid #475569; }
.ct-dot-white { background: #e8edf5; }
.ct-dot-black { background: #0a0f1a; }
.ct-accuracy { display: flex; align-items: baseline; gap: 5px; }
.ct-accuracy-value { font-size: 30px; font-weight: 700; color: #6ee7b7; letter-spacing: -0.02em; }
.ct-accuracy-unit { font-size: 12.5px; color: #64748b; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.ct-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #111827; border: 1px solid #1f2937; border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; color: #cbd5e1;
}
.ct-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ct-chip-color, #94a3b8); }

.ct-table-wrap { overflow-x: auto; }
.ct-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ct-table th, .ct-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #1f2937; }
.ct-table thead th, .ct-table tbody th {
  color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 11.5px;
}
.ct-table tbody th { text-transform: none; letter-spacing: 0; font-size: 13px; color: #94a3b8; }
.ct-table td { color: #cbd5e1; }
.ct-table .ct-sub { display: block; font-size: 11.5px; color: #64748b; margin-top: 2px; }
.ct-quality { font-weight: 600; }
.ct-cost { font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace; }
.ct-pos { color: #6ee7b7; }
.ct-neg { color: #f0a5a5; }
.ct-row-active td { background: #111827; }

/* ── tabs (Elo) ─────────────────────────────────────────────────────── */
.ct-tabs { display: flex; gap: 6px; margin: 0 0 16px; }
.ct-tab {
  background: #111827; border: 1px solid #1f2937; color: #94a3b8;
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-family: inherit; cursor: pointer;
}
.ct-tab-on { background: #6ee7b7; border-color: #6ee7b7; color: #0a0f1a; font-weight: 700; }

/* ── conversion ask, after the result and never before it ───────────── */
.ct-cta-wrap { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid #1f2937; }
.ct-cta-line { font-size: 14px; color: #cbd5e1; margin: 0 0 10px; }
.ct-cta {
  display: inline-block; background: #6ee7b7; color: #0a0f1a;
  padding: 11px 20px; border-radius: 9px; font-weight: 700; font-size: 14.5px; text-decoration: none;
}
.ct-cta:hover { background: #5ed5a5; text-decoration: none; }

/* ── cross-links between the tools ──────────────────────────────────── */
.ct-toollinks {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px;
}
.ct-toollinks span {
  font-size: 12px; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.07em; align-self: center; margin-right: 2px;
}
.ct-toollinks a {
  display: inline-flex; align-items: center; gap: 6px;
  background: #111827; border: 1px solid #1f2937; border-radius: 999px;
  padding: 6px 13px; font-size: 13px; color: #cbd5e1; text-decoration: none;
}
.ct-toollinks a:hover { border-color: #6ee7b7; color: #6ee7b7; text-decoration: none; }

/* ── narrow screens: the board stacks, tables stay at three columns ──── */
@media (max-width: 640px) {
  .ct-tool { padding: 14px 14px 16px; }
  .ct-layout { flex-direction: column; }
  .ct-col-board { flex: 1 1 auto; width: 100%; max-width: 340px; margin: 0 auto; }
  .ct-col-side { width: 100%; }
  .ct-cand { grid-template-columns: 40px 1fr 52px; grid-template-areas: 'rank move eval' '. line line'; }
  .ct-cand-rank { grid-area: rank; }
  .ct-cand-move { grid-area: move; }
  .ct-cand-eval { grid-area: eval; text-align: right; }
  .ct-cand-line { grid-area: line; white-space: normal; }
  .ct-table th, .ct-table td { padding: 7px 6px; font-size: 12.5px; }
  .ct-actions { flex: 1 1 100%; }
  .ct-actions .ct-btn { flex: 1 1 auto; }
}
