/* TicTacBase — warm sunny pad (欢快); coral/steel lineage, not cold slate. */

[data-theme="ttb"],
.ttb-root {
  --ttb-coral: #e86a56;
  --ttb-coral-hover: #d45542;
  --ttb-steel: #3f8ec4;
  --ttb-ink: #243041;
  --ttb-paper: #fff7f2;
  --ttb-surface: #ffffff;
  --ttb-empty: #fff1ea;
  --ttb-pad: #ffe8df;
  --ttb-line: #e8c4b8;
  --ttb-win: #ffe0d4;
  --ttb-sun: #ffb347;
  --ttb-font-ui: var(--font-public-sans), "Public Sans", "Segoe UI", sans-serif;
  --background: var(--ttb-paper);
  --foreground: var(--ttb-ink);
  --card: var(--ttb-surface);
  --card-foreground: var(--ttb-ink);
  --primary: var(--ttb-coral);
  --primary-foreground: #ffffff;
  --muted: #ffe9df;
  --muted-foreground: #6b5e66;
  --border: #f0d0c4;
  --secondary: var(--ttb-empty);
  --accent: #e3f2ff;
  --accent-foreground: var(--ttb-steel);
  --radius: 1.1rem;
  background:
    radial-gradient(1000px 480px at 8% -8%, color-mix(in srgb, var(--ttb-coral) 22%, transparent), transparent 58%),
    radial-gradient(900px 420px at 96% 0%, color-mix(in srgb, var(--ttb-steel) 18%, transparent), transparent 52%),
    radial-gradient(700px 360px at 50% 100%, color-mix(in srgb, var(--ttb-sun) 16%, transparent), transparent 55%),
    linear-gradient(180deg, #fffaf7 0%, var(--ttb-paper) 45%, #fff4ec 100%);
  color: var(--foreground);
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
  font-family: var(--ttb-font-ui);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* Optional dark — warm cocoa, not void slate. */
.ttb-root.ttb-dark {
  --ttb-coral: #f28a78;
  --ttb-coral-hover: #e86a56;
  --ttb-steel: #7ab8e6;
  --ttb-paper: #22181a;
  --ttb-surface: #2e2226;
  --ttb-empty: #3a2c30;
  --ttb-pad: #34262a;
  --ttb-line: #7a5558;
  --ttb-ink: #fff0ea;
  --ttb-win: #523438;
  --ttb-sun: #e8a85a;
  --background: var(--ttb-paper);
  --foreground: var(--ttb-ink);
  --card: var(--ttb-surface);
  --card-foreground: var(--ttb-ink);
  --muted: #423034;
  --muted-foreground: #d4b8b0;
  --border: #554044;
  --secondary: #3a2c30;
  --accent: #2e3a4c;
  color-scheme: dark;
  background:
    radial-gradient(900px 420px at 10% -8%, color-mix(in srgb, var(--ttb-coral) 28%, transparent), transparent 58%),
    radial-gradient(800px 380px at 94% 4%, color-mix(in srgb, var(--ttb-steel) 18%, transparent), transparent 52%),
    radial-gradient(700px 360px at 50% 110%, color-mix(in srgb, var(--ttb-sun) 14%, transparent), transparent 55%),
    var(--ttb-paper);
}

[data-theme="ttb"] *,
.ttb-root * {
  box-sizing: border-box;
}

.ttb-root .play-surface {
  background: transparent;
}

@keyframes ttb-mark-pop {
  0% {
    transform: scale(0.35);
    opacity: 0.2;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.ttb-brand-mark {
  transform: rotate(3deg);
  transition: transform 180ms ease;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ttb-coral) 28%, transparent);
}

.ttb-brand-mark:hover,
a:hover .ttb-brand-mark {
  transform: rotate(12deg);
}

.ttb-hero-kicker {
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ttb-coral) 72%, var(--muted-foreground));
}

.ttb-meta-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ttb-coral) 8%, transparent);
  transition: background 150ms ease, color 150ms ease, transform 120ms ease;
}

.ttb-meta-chip.is-on {
  background: var(--ttb-coral);
  border-color: var(--ttb-coral);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ttb-coral) 35%, transparent);
}

.ttb-meta-chip.is-steel {
  background: color-mix(in srgb, var(--ttb-steel) 14%, var(--card));
  color: var(--ttb-steel);
  border-color: color-mix(in srgb, var(--ttb-steel) 35%, transparent);
}

.ttb-diff-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: var(--card);
  padding: 0.35rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted-foreground);
  white-space: nowrap;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ttb-coral) 8%, transparent);
  transition: background 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.ttb-diff-btn:hover {
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--ttb-coral) 35%, var(--border));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ttb-coral) 18%, transparent);
}

.ttb-diff-btn.is-on:hover {
  color: #fff;
  border-color: var(--ttb-coral);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ttb-coral) 35%, transparent);
}

.ttb-diff-btn.is-on {
  background: var(--ttb-coral);
  border-color: var(--ttb-coral);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ttb-coral) 35%, transparent);
}

.ttb-board-slot {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  container-type: size;
}

.ttb-board-slot::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 6% 10%;
  z-index: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 38%, color-mix(in srgb, var(--ttb-coral) 28%, transparent), transparent 55%),
    radial-gradient(circle at 72% 52%, color-mix(in srgb, var(--ttb-steel) 22%, transparent), transparent 50%),
    radial-gradient(circle at 50% 80%, color-mix(in srgb, var(--ttb-sun) 20%, transparent), transparent 50%);
  filter: blur(32px);
  opacity: 0.95;
}

/*
 * Square from slot: set only width (+ aspect-ratio).
 * Never set height: min(100%, …) — on tall mobile slots that stretches a rectangle.
 */
.ttb-board-fit {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(100cqw, calc(100cqh - 8px), 420px);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  overflow: hidden; /* nested ultimate cells must not paint outside the square */
}

.ttb-board-fit.is-ultimate {
  width: min(100cqw, calc(100cqh - 8px), 520px);
}

/* Ultimate shell — same peach pad + coral frame as classic .ttb-grid, scaled for 9 minis. */
.ttb-ultimate {
  container-type: size;
  container-name: ttb-ultimate;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(0.32rem, 2.8cqi, 0.62rem);
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.45rem, 3.5cqi, 0.9rem);
  border: 2px solid color-mix(in srgb, var(--ttb-coral) 22%, var(--border));
  border-radius: 1.6rem;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--ttb-pad) 70%, #fff) 0%, var(--ttb-pad) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 16px 40px color-mix(in srgb, var(--ttb-coral) 18%, transparent);
  overflow: hidden;
}

.ttb-mini {
  container-type: size;
  container-name: ttb-mini;
  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(0.12rem, 2.8cqi, 0.28rem);
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: clamp(0.15rem, 2.8cqi, 0.35rem);
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: var(--card);
  opacity: 0.68;
  overflow: hidden;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ttb-coral) 8%, transparent);
  transition: opacity 200ms ease, background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.ttb-mini.is-active {
  z-index: 1;
  opacity: 1;
  border-color: color-mix(in srgb, var(--ttb-coral) 45%, var(--border));
  background: var(--card);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--ttb-coral) 28%, transparent),
    0 4px 14px color-mix(in srgb, var(--ttb-coral) 14%, transparent);
}
.ttb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  gap: clamp(0.4rem, 1.8vw, 0.8rem);
  padding: clamp(0.55rem, 2.2vw, 1.15rem);
  border: 2px solid color-mix(in srgb, var(--ttb-coral) 22%, var(--border));
  border-radius: 1.6rem;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--ttb-pad) 70%, #fff) 0%, var(--ttb-pad) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 16px 40px color-mix(in srgb, var(--ttb-coral) 18%, transparent);
  overflow: hidden;
}

.ttb-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 1.05rem;
  background: var(--card);
  cursor: pointer;
  font-size: clamp(1.85rem, 7.5vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--ttb-coral) 10%, transparent);
  transition: background 160ms ease, transform 140ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.ttb-cell:hover:not(:disabled):not(.is-filled) {
  background: color-mix(in srgb, var(--ttb-coral) 10%, var(--card));
  border-color: color-mix(in srgb, var(--ttb-coral) 40%, var(--border));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ttb-coral) 18%, transparent);
  transform: translateY(-2px);
}

.ttb-cell:active:not(:disabled):not(.is-filled) {
  transform: scale(0.96);
}

.ttb-cell.is-hint {
  background: color-mix(in srgb, var(--ttb-coral) 14%, var(--card));
  border-color: var(--ttb-coral);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ttb-coral) 35%, transparent);
}

.ttb-cell.is-win {
  background: var(--ttb-win);
  border-color: color-mix(in srgb, var(--ttb-coral) 45%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ttb-coral) 30%, transparent);
}

.ttb-cell.is-x,
.ttb-cell.is-o {
  animation: ttb-mark-pop 240ms cubic-bezier(0.34, 1.45, 0.64, 1);
}

.ttb-cell.is-x {
  color: var(--ttb-coral);
  text-shadow: 0 2px 0 color-mix(in srgb, var(--ttb-coral) 22%, transparent);
}

.ttb-cell.is-o {
  color: var(--ttb-steel);
  text-shadow: 0 2px 0 color-mix(in srgb, var(--ttb-steel) 22%, transparent);
}

.ttb-cell:disabled {
  cursor: default;
}

/* Soft sunny pad — peach tray + white cells. */

.ttb-mini.is-claimed-x,
.ttb-mini.is-claimed-o,
.ttb-mini.is-claimed-draw {
  opacity: 1;
}

.ttb-mini.is-claimed-x {
  background: color-mix(in srgb, var(--ttb-coral) 22%, var(--ttb-empty));
}

.ttb-mini.is-claimed-o {
  background: color-mix(in srgb, var(--ttb-steel) 22%, var(--ttb-empty));
}

.ttb-mini.is-claimed-draw {
  background: color-mix(in srgb, var(--muted-foreground) 16%, var(--ttb-empty));
}

.ttb-mini-claim {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: clamp(1.25rem, 42cqi, 2.25rem);
  font-weight: 900;
  line-height: 1;
  opacity: 0.92;
}

.ttb-mini-claim.is-x {
  color: var(--ttb-coral);
}

.ttb-mini-claim.is-o {
  color: var(--ttb-steel);
}

.ttb-mini-cell {
  container-type: size;
  container-name: ttb-mini-cell;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: clamp(0.28rem, 14cqmin, 0.55rem);
  background: var(--card);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--ttb-coral) 10%, transparent);
  /* Scale to each sub-cell — classic marks fill ~65% of their square */
  font-size: clamp(0.9rem, 62cqmin, 2.75rem);
  font-weight: 900;
  line-height: 1;
  color: inherit;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 160ms ease, transform 140ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.ttb-mini-cell.is-playable {
  cursor: pointer;
}

.ttb-mini-cell.is-playable:hover {
  background: color-mix(in srgb, var(--ttb-coral) 10%, var(--card));
  border-color: color-mix(in srgb, var(--ttb-coral) 40%, var(--border));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ttb-coral) 16%, transparent);
  transform: translateY(-1px);
}

.ttb-mini-cell.is-playable:active {
  transform: scale(0.96);
}

.ttb-mini-cell.is-muted {
  pointer-events: none;
  cursor: default;
  background: color-mix(in srgb, var(--ttb-empty) 80%, var(--card));
  box-shadow: none;
}

.ttb-mini-cell.is-x,
.ttb-mini-cell.is-o {
  animation: ttb-mark-pop 240ms cubic-bezier(0.34, 1.45, 0.64, 1);
}

.ttb-mini-cell.is-x {
  color: var(--ttb-coral);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--ttb-coral) 22%, transparent);
}

.ttb-mini-cell.is-o {
  color: var(--ttb-steel);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--ttb-steel) 22%, transparent);
}

.ttb-mini-cell.is-hint {
  border-color: var(--ttb-coral);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ttb-coral) 35%, transparent);
  background: color-mix(in srgb, var(--ttb-coral) 14%, var(--card));
}

/* Mobile: single-row scroll (§0.16). PC: wrap, no horizontal scroll. */
.ttb-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ttb-toolbar::-webkit-scrollbar {
  display: none;
}

.ttb-toolbar > * {
  flex-shrink: 0;
}

.ttb-scorebar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted-foreground);
  white-space: nowrap;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--ttb-coral) 10%, transparent);
}

.ttb-scorebar strong {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.ttb-hint-chip {
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ttb-coral) 28%, var(--border));
  background: color-mix(in srgb, var(--card) 90%, var(--ttb-coral) 6%);
  padding: 0.45rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--foreground);
  text-align: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ttb-coral) 12%, transparent);
}

.ttb-status-line {
  margin-top: 0.25rem;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--ttb-ink) 78%, var(--ttb-coral));
}

.ttb-status-line.is-end {
  display: none;
}

.ttb-end-banner {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  border-radius: 12px;
  border: 2px solid var(--ttb-coral);
  background: color-mix(in srgb, var(--ttb-coral) 14%, var(--card));
  padding: 0.65rem 0.85rem;
  text-align: center;
}

.ttb-end-banner.is-draw {
  border-color: var(--ttb-steel);
  background: color-mix(in srgb, var(--ttb-steel) 12%, var(--card));
}

.ttb-end-banner-copy {
  min-width: 0;
  text-align: center;
}

.ttb-end-banner-kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.ttb-end-banner-title {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--foreground);
  line-height: 1.2;
}

.ttb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ttb-end-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--ttb-sun) 28%, transparent), transparent 55%),
    color-mix(in srgb, var(--ttb-paper) 62%, transparent);
  backdrop-filter: blur(3px);
  padding: 1rem;
  text-align: center;
}

.ttb-end-overlay .ttb-end-banner-title {
  margin: 0;
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
}

.ttb-end-overlay .ttb-btn {
  margin-top: 0.35rem;
  pointer-events: auto;
}

.ttb-end-overlay.is-draw {
  background: color-mix(in srgb, var(--ttb-steel) 12%, color-mix(in srgb, var(--ttb-paper) 55%, transparent));
}

.ttb-meta-chip.is-end {
  background: var(--ttb-coral);
  color: #fff;
}

.ttb-meta-chip.is-end-draw {
  background: var(--ttb-steel);
  color: #fff;
}

.ttb-action-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ttb-action-strip::-webkit-scrollbar {
  display: none;
}

.ttb-action-strip > * {
  flex-shrink: 0;
}

/* PC：可换行、无横滑（对齐 p8b）；移动端保持单行横滑 */
@media (min-width: 1024px) {
  .ttb-toolbar,
  .ttb-action-strip {
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
    padding-bottom: 0;
  }
}

.ttb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  flex-shrink: 0;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--ttb-coral) 18%, var(--border));
  background: var(--card);
  padding: 0.55rem 1.05rem;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--foreground);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--ttb-coral) 12%, transparent);
  transition: background 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.ttb-btn:hover {
  background: var(--secondary);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ttb-coral) 18%, transparent);
}

.ttb-btn:active {
  transform: scale(0.98);
}

.ttb-btn-primary {
  background: var(--ttb-coral);
  border-color: var(--ttb-coral);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--ttb-coral) 38%, transparent);
}

.ttb-btn-primary:hover {
  background: var(--ttb-coral-hover);
}

.ttb-btn-icon {
  width: 48px;
  padding-left: 0;
  padding-right: 0;
}

/* Install: icon only (match moon / sound / panel). */
.ttb-pwa-install > span > button {
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 0.75rem !important;
  border-color: var(--border) !important;
  background: var(--card) !important;
  color: var(--muted-foreground) !important;
  opacity: 1 !important;
}

.ttb-pwa-install > span > button > span {
  display: none !important;
}

.ttb-action-strip .ttb-pwa-install > span > button {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  border-radius: 0.9rem !important;
}

/* Desktop utils in hero; mobile utils in action strip — own display so .ttb-btn cannot override. */
.ttb-desktop-utils {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.ttb-mobile-only {
  display: inline-flex;
}

@media (min-width: 1024px) {
  .ttb-desktop-utils {
    display: flex;
  }

  .ttb-mobile-only {
    display: none !important;
  }
}

.ttb-btn.is-active {
  border-color: var(--ttb-steel);
  color: var(--ttb-steel);
  background: color-mix(in srgb, var(--ttb-steel) 10%, var(--card));
}

.ttb-seo {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ttb-empty) 55%, var(--card)) 0%, var(--card) 100%);
  border-top: 1px solid var(--border);
}

.ttb-seo-inner {
  margin: 0 auto;
  max-width: 720px;
  padding: 2.5rem 1.25rem 3.5rem;
}

.ttb-article .article-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.ttb-article .article-lead-title,
.ttb-article h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.ttb-article .article-section {
  margin-top: 2rem;
}

.ttb-article p,
.ttb-article li {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted-foreground);
}

.ttb-article ol,
.ttb-article ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.ttb-article .article-section strong,
.ttb-article .article-lead strong {
  color: var(--ttb-ink);
  font-weight: 700;
}

/* Text + figure stagger — stack on narrow; alternate sides from md up */
.ttb-split {
  display: grid;
  gap: 1.25rem;
  margin: 0.35rem 0 1.1rem;
  align-items: start;
}

.ttb-split-copy > p:first-child,
.ttb-split-copy > ol:first-child,
.ttb-split-copy > ul:first-child {
  margin-top: 0;
}

.ttb-split-copy > p + p,
.ttb-split-copy > ul + p,
.ttb-split-copy > p + ul {
  margin-top: 1rem;
}

@media (min-width: 800px) {
  .ttb-split {
    grid-template-columns: minmax(0, 1fr) minmax(12.5rem, 17.5rem);
    gap: 1.75rem 2rem;
    align-items: center;
  }

  .ttb-split--figure-end .ttb-article-figure {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-top: 0.35rem;
  }

  .ttb-split--figure-end .ttb-split-copy {
    grid-column: 1;
    grid-row: 1;
  }

  .ttb-split--figure-start {
    grid-template-columns: minmax(12.5rem, 17.5rem) minmax(0, 1fr);
  }

  .ttb-split--figure-start .ttb-article-figure {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin-top: -0.15rem;
  }

  .ttb-split--figure-start .ttb-split-copy {
    grid-column: 2;
    grid-row: 1;
  }
}

/* Below-fold diagrams — tiny SVG, lazy img; reserved aspect avoids CLS */
.ttb-article-figure {
  margin: 0;
  width: 100%;
  max-width: 22.5rem;
  justify-self: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ttb-paper) 70%, var(--ttb-surface));
}

.ttb-article-figure-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 320px;
  aspect-ratio: 320 / 168;
  background: var(--ttb-paper);
}

.ttb-article-figure-cap {
  margin: 0;
  padding: 0.55rem 0.75rem 0.65rem;
  border-top: 1px dashed var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted-foreground);
}

.ttb-faq-list {
  margin: 0;
}

.ttb-faq-item {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}

.ttb-faq-item dt {
  font-weight: 800;
  color: var(--foreground);
}

.ttb-faq-item dd {
  margin: 0.35rem 0 0;
  color: var(--muted-foreground);
}

.ttb-link-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1.25rem;
  font-weight: 700;
}

.ttb-link-rail a {
  color: var(--ttb-steel);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ttb-compare-line a {
  color: var(--ttb-coral);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
