/* tapatdot tools — shared stylesheet */
/* All tools import this file */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Softened from pure white/near-black per user feedback ("too bright") —
     a warm, slightly muted off-white closer to tapatdot.org's light mode. */
  --color-bg:           #FAF9F6;
  --color-bg-soft:      #F2F1ED;
  --color-surface:      #FEFDFB;
  --color-border:       #E4E2DC;
  --color-text:         #262521;
  --color-muted:        #6E6C64;
  --color-accent:       #5B6CF0;
  --color-accent-soft:  #EEF0FF;
  --color-accent-dark:  #4555E0;
  --color-success:      #1D9E75;
  --color-warning:      #D97706;
  --color-danger:       #DC2626;
  --radius-sm:          6px;
  --radius-md:          10px;
  --radius-lg:          14px;
  --shadow-sm:          0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:          0 4px 12px rgba(0,0,0,0.08);
  --font-body:          'Inter', system-ui, sans-serif;
  --font-mono:          'JetBrains Mono', monospace;
  --transition:         0.15s ease;
}

[data-theme="dark"] {
  --color-bg:           #0F0F1A;
  --color-bg-soft:      #16161F;
  --color-surface:      #1C1C2A;
  --color-border:       #2A2A3A;
  --color-text:         #F0F0F8;
  --color-muted:        #9090A8;
  --color-accent:       #7B8CFF;
  --color-accent-soft:  #1A1D40;
  --color-accent-dark:  #9AAAFF;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Nav ────────────────────────────────────────────────────────────────── */

.ts-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 88px;
  height: auto;
  background: var(--color-bg);
  border-bottom: 0.5px solid var(--color-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ts-back-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.ts-back-btn:hover { background: var(--color-accent-soft); color: var(--color-accent); }

.ts-nav-logo {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}

.ts-nav-logo:hover { color: var(--color-accent); }
.ts-nav-logo img { width: 150px; height: auto; display: block; border-radius: 0; }
@media (max-width: 680px) { .ts-nav-logo img { width: 100px; } }

.ts-nav-divider {
  color: var(--color-border);
  font-size: 14px;
  user-select: none;
}

.ts-nav-tool {
  font-size: 14px;
  color: var(--color-muted);
  font-weight: 400;
}

.ts-dark-toggle {
  width: 34px;
  height: 34px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition);
}

.ts-dark-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ── Searchable dropdown (progressive enhancement of long <select> lists) ── */

.ts-ssel { position: relative; }
.ts-ssel-native { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; overflow: hidden; }
.ts-ssel-btn {
  width: 100%; height: 40px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-soft);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.ts-ssel-btn:hover, .ts-ssel-btn:focus-visible { border-color: var(--color-accent); outline: none; }
.ts-ssel-btn svg { flex-shrink: 0; color: var(--color-muted); }
.ts-ssel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; flex: 1; }

.ts-ssel-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  min-width: 240px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 10px 30px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: tsPaletteIn 0.14s cubic-bezier(.16,1,.3,1);
}
.ts-ssel-search-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 0.5px solid var(--color-border); color: var(--color-muted);
}
.ts-ssel-search { flex: 1; border: none; outline: none; background: transparent; font-family: var(--font-body); font-size: 14px; color: var(--color-text); }
.ts-ssel-search::placeholder { color: var(--color-muted); }
.ts-ssel-list { max-height: 240px; overflow-y: auto; padding: 6px; }
.ts-ssel-opt { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--color-text); cursor: pointer; }
.ts-ssel-opt.active { background: var(--color-accent-soft); color: var(--color-accent); }
.ts-ssel-opt.selected { font-weight: 600; }
.ts-ssel-empty { padding: 16px 10px; text-align: center; color: var(--color-muted); font-size: 13px; }

/* ── Global search / command palette ───────────────────────────────────── */

.ts-search-trigger {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 11px;
  border: 0.5px solid color-mix(in srgb, var(--color-accent) 22%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent-soft) 55%, var(--color-bg-soft));
  color: var(--color-accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  flex: 0 1 220px;
  min-width: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.ts-search-trigger .label { color: var(--color-muted); }
.ts-search-trigger:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.ts-search-trigger:hover .label { color: var(--color-accent); }
.ts-search-trigger span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.ts-search-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  color: var(--color-muted);
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .ts-search-trigger { flex: 0 0 auto; width: 34px; padding: 0; justify-content: center; }
  .ts-search-trigger span.label, .ts-search-kbd { display: none; }
}

.ts-palette-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 10, 20, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 0;
  animation: tsPaletteFadeIn 0.15s ease;
}
@keyframes tsPaletteFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ts-palette {
  width: 100%; max-width: 600px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.15);
  overflow: hidden;
  animation: tsPaletteIn 0.18s cubic-bezier(.16,1,.3,1);
}
@keyframes tsPaletteIn { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }

.ts-palette-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--color-border);
  color: var(--color-muted);
}
.ts-palette-input-row svg { flex-shrink: 0; }
.ts-palette-input-row input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 16px; color: var(--color-text);
}
.ts-palette-input-row input::placeholder { color: var(--color-muted); }

.ts-palette-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
/* Each group/item carries its own data-collection so results show their
   category's pastel colour (teal/clay/purple) regardless of the current page. */
.ts-palette-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent); padding: 10px 10px 4px; }
.ts-palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius-md);
  cursor: pointer; text-decoration: none; color: inherit;
}
.ts-palette-item .pi-icon {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--color-accent-soft); color: var(--color-accent);
}
.ts-palette-item .pi-icon svg { width: 17px; height: 17px; }
.ts-palette-item .pi-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ts-palette-item .pi-name { font-size: 14px; font-weight: 500; color: var(--color-text); }
.ts-palette-item .pi-desc { font-size: 12px; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-palette-item.active { background: var(--color-accent-soft); }
.ts-palette-item.active .pi-name { color: var(--color-accent); }
.ts-palette-empty { padding: 24px 12px; text-align: center; color: var(--color-muted); font-size: 13px; }

.ts-palette-footer {
  display: flex; gap: 14px; padding: 10px 16px;
  border-top: 0.5px solid var(--color-border);
  font-size: 11px; color: var(--color-muted);
}
.ts-palette-footer kbd {
  font-family: var(--font-mono); font-size: 10px; padding: 1px 5px;
  border-radius: 4px; background: var(--color-bg-soft); border: 0.5px solid var(--color-border); margin-right: 4px;
}

/* ── Main content wrapper ───────────────────────────────────────────────── */

.ts-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  transition: max-width var(--transition);
}

/* Wider shell for hub grids and workbench/table-heavy dev tools — cuts down
   on vertical scrolling by using the horizontal space large screens have. */
.ts-main-wide { max-width: 1180px; }

/* ── Tool header ────────────────────────────────────────────────────────── */

.ts-tool-header {
  margin-bottom: 32px;
}

.ts-tool-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.ts-tool-desc {
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.5;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.ts-card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.ts-card-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 10px;
}

.ts-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 14px;
}

/* ── Editable matrix table + inline remove button ───────────────────────── */

.biz-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.biz-matrix th, .biz-matrix td { border: 0.5px solid var(--color-border); padding: 8px 10px; text-align: center; }
.biz-matrix th:first-child, .biz-matrix td:first-child { text-align: left; background: var(--color-bg-soft); font-weight: 500; }
.biz-matrix th { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.biz-matrix input, .biz-matrix select { width: 100%; border: none; background: transparent; text-align: center; font-family: var(--font-body); font-size: 13px; color: var(--color-text); min-width: 0; }
.biz-matrix input:focus, .biz-matrix select:focus { outline: 1px solid var(--color-accent); border-radius: 4px; }

.biz-rm { background: none; border: none; color: var(--color-muted); cursor: pointer; font-size: 15px; flex-shrink: 0; }
.biz-rm:hover { color: var(--color-danger); }

/* Inputs nested in plain data tables (e.g. ROICalculator) get the same quiet look */
.ts-table input, .ts-table select {
  width: 100%; min-width: 64px; border: none; background: transparent;
  font-family: var(--font-body); font-size: 13px; color: var(--color-text);
}
.ts-table input:focus, .ts-table select:focus { outline: 1px solid var(--color-accent); border-radius: 4px; }

/* ── Text colour utilities ──────────────────────────────────────────────── */

.ts-text-success { color: var(--color-success); }
.ts-text-danger  { color: var(--color-danger); }

/* ── Two-panel workbench ────────────────────────────────────────────────── */

.ts-workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  align-items: start; /* don't stretch cards to the tallest sibling — avoids dead space */
}
.ts-workbench > * { min-width: 0; } /* let cards shrink below their content's intrinsic width */
@media (max-width: 700px) { .ts-workbench { grid-template-columns: 1fr; } }

/* ── Pill tabs (mode switchers) ─────────────────────────────────────────── */

.ts-pill-tabs {
  display: flex; gap: 4px; background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 3px; width: fit-content; flex-wrap: wrap;
}
.ts-pill-tab {
  padding: 5px 14px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
  border: none; background: transparent; color: var(--color-muted); cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition), color var(--transition);
}
.ts-pill-tab.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* ── Inputs ─────────────────────────────────────────────────────────────── */

.ts-textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-soft);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

.ts-textarea:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.ts-textarea::placeholder { color: var(--color-muted); }

.ts-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-soft);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.ts-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.ts-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.ts-select {
  height: 40px;
  min-width: 0;    /* let selects shrink inside flex rows instead of overflowing */
  max-width: 100%;
  padding: 0 32px 0 12px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-soft);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B80' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.ts-select:focus { border-color: var(--color-accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.ts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

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

.ts-btn-primary {
  background: var(--color-accent);
  color: #ffffff;
}

.ts-btn-primary:hover { background: var(--color-accent-dark); }

.ts-btn-secondary {
  background: var(--color-bg-soft);
  color: var(--color-text);
  border: 0.5px solid var(--color-border);
}

.ts-btn-secondary:hover { background: var(--color-accent-soft); }

.ts-btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: 0.5px solid var(--color-border);
}

.ts-btn-ghost:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ── Segmented control (tabs / format switch) ──────────────────────────── */

.ts-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
}

.ts-segment-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.ts-segment-btn:hover { color: var(--color-text); }

.ts-segment-btn.active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

/* ── Output area ─────────────────────────────────────────────────────────── */

.ts-output {
  display: none;
  margin-top: 24px;
}

.ts-output.visible { display: block; }

/* ── Privacy notice strip ───────────────────────────────────────────────── */

.ts-privacy-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-accent-soft);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--color-accent);
  margin-bottom: 20px;
}

.ts-privacy-strip svg { flex-shrink: 0; }

/* ── Callout / disclaimer ──────────────────────────────────────────────── */

.ts-callout {
  padding: 12px 14px;
  background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ── Stats row (for WordCount, ReadScore) ───────────────────────────────── */

.ts-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.ts-stat {
  background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  min-width: 0; /* let stats shrink inside grids (see CLAUDE.md min-width gotcha) */
}
/* Base rule: stat values SHRINK to fit rather than wrapping to a new line.
   clamp() scales with viewport; overflow-wrap stays as a last-resort guard
   against pathological strings so nothing ever overflows the card. */
.ts-stat .ts-stat-num { overflow-wrap: anywhere; }

.ts-stat-num {
  display: block;
  font-size: clamp(16px, 1.4vw + 10px, 24px);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-family: var(--font-mono);
}

.ts-stat-label {
  display: block;
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 4px;
}

/* ── Table ─────────────────────────────────────────────────────────────── */

.ts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ts-table th, .ts-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--color-border);
}

.ts-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  font-weight: 500;
}

.ts-table td { color: var(--color-text); }

.ts-table tr:last-child td { border-bottom: none; }

/* Wrap any wide table in this so it scrolls internally instead of blowing
   out the page on mobile. Lives in shared.css (not dev.css) since every
   collection needs it, not just dev tools. */
.ts-table-scroll {
  width: 100%;
  min-width: 0;
  max-height: 460px;
  overflow: auto;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* ── Mono output (citations, threads) ───────────────────────────────────── */

.ts-mono-output {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.ts-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px;
  font-size: 13px;
  color: var(--color-muted);
  border-top: 0.5px solid var(--color-border);
  margin-top: auto;
}

.ts-footer a {
  color: var(--color-muted);
  text-decoration: none;
}

.ts-footer a:hover { color: var(--color-accent); }

.ts-footer-dot { color: var(--color-border); }

/* ── Homepage hero (root hub only) ──────────────────────────────────────── */

.ts-hero { text-align: center; padding: 44px 0 12px; }
.ts-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--color-accent);
  background: var(--color-accent-soft); border-radius: 999px; padding: 5px 14px;
  margin-bottom: 18px;
}
.ts-hero h1 {
  font-size: clamp(30px, 5.5vw, 46px); font-weight: 600; letter-spacing: -0.02em;
  color: var(--color-text); line-height: 1.15; margin: 0 0 14px;
}
.ts-hero h1 em { font-style: normal; color: var(--color-accent); }
.ts-hero-sub {
  font-size: 15px; line-height: 1.7; color: var(--color-muted);
  max-width: 560px; margin: 0 auto 26px;
}
.ts-hero-search {
  display: flex; align-items: center; gap: 10px; width: min(480px, 100%);
  margin: 0 auto 26px; padding: 13px 18px; cursor: pointer;
  background: var(--color-surface); border: 0.5px solid var(--color-border);
  border-radius: 999px; box-shadow: var(--shadow-md);
  color: var(--color-muted); font-family: var(--font-body); font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ts-hero-search:hover { border-color: var(--color-accent); }
.ts-hero-search .ts-search-kbd { margin-left: auto; }
.ts-hero-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ts-hero-stat {
  font-size: 12.5px; color: var(--color-muted); padding: 6px 14px;
  background: var(--color-bg-soft); border: 0.5px solid var(--color-border); border-radius: 999px;
}
.ts-hero-stat b { color: var(--color-text); font-weight: 600; }

.ts-hero-desktop-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 22px auto 0;
  padding: 12px 22px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 6px 20px -6px var(--color-accent);
  transition: transform var(--transition), box-shadow var(--transition);
}
.ts-hero-desktop-cta:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -8px var(--color-accent);
}
.ts-hero-desktop-cta-arrow { transition: transform var(--transition); }
.ts-hero-desktop-cta:hover .ts-hero-desktop-cta-arrow { transform: translateX(3px); }
@media (max-width: 480px) {
  .ts-hero-desktop-cta span:not(.ts-hero-desktop-cta-arrow) { font-size: 13px; }
}

.ts-home-section { margin-top: 44px; }
.ts-home-section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-muted); margin-bottom: 4px;
}
.ts-home-section-sub { font-size: 13px; color: var(--color-muted); margin-bottom: 4px; }

/* ── Hub / collection cards ────────────────────────────────────────────── */

.ts-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.ts-hub-card {
  display: block;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.ts-hub-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ts-hub-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.ts-hub-card-desc {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.ts-hub-card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-accent);
}

.ts-hub-card-meta {
  font-size: 12px;
  color: var(--color-muted);
}

/* ── Utilities ──────────────────────────────────────────────────────────── */

.ts-hidden  { display: none !important; }
.ts-flex    { display: flex; align-items: center; gap: 10px; }
.ts-flex-wrap { flex-wrap: wrap; }
.ts-gap-sm  { gap: 8px; }
.ts-mt-sm   { margin-top: 12px; }
.ts-mt-md   { margin-top: 20px; }
.ts-row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ts-grow    { flex: 1; }
.ts-copy-btn {
  font-size: 12px;
  color: var(--color-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.ts-copy-btn:hover { color: var(--color-accent); }

.ts-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-bg-soft);
  color: var(--color-muted);
  border: 0.5px solid var(--color-border);
}
.ts-badge.ok   { color: var(--color-success); }
.ts-badge.warn { color: var(--color-warning); }
.ts-badge.over { color: var(--color-danger); }

.ts-text-success { color: var(--color-success); }
.ts-text-warning { color: var(--color-warning); }
.ts-text-danger  { color: var(--color-danger); }

/* Highlight spans (ReadScore) */
.ts-hl-long    { border-bottom: 2px solid var(--color-warning); }
.ts-hl-passive { border-bottom: 2px solid var(--color-accent); }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .ts-main { padding: 24px 16px 48px; }
  .ts-nav  { padding: 0 16px; gap: 6px; }
  .ts-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Collapse the MIDDLE breadcrumb link (the collection, e.g. "Study") on
   narrow screens so the row always fits — but always keep "Tools" (home)
   and the current page name, so there's always a way back to the hub. */
@media (max-width: 480px) {
  .ts-nav-crumb-mid { display: none; }
  .ts-nav-divider:has(+ .ts-nav-crumb-mid) { display: none; }
  /* brand text removed */
}

/* ═══════════════════════════════════════════════════════════════════════════
   v2 — per-collection themes, futuristic background, motion, how-it-works
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Per-collection accent themes (pastel, easy on the eyes) ─────────────── */
/* Tools (default / purple) glow tokens */
:root {
  --glow-1: rgba(124, 138, 255, 0.30);
  --glow-2: rgba(180, 190, 255, 0.24);
  --grad-a: #6E7CF5;
  --grad-b: #9AA6FF;
}

[data-collection="study"] {
  --color-accent:       #12A594;   /* soft teal-emerald */
  --color-accent-soft:  #E5F6F2;
  --color-accent-dark:  #0E8677;
  --glow-1: rgba(45, 190, 170, 0.26);
  --glow-2: rgba(125, 215, 200, 0.20);
  --grad-a: #12A594;
  --grad-b: #56CFBC;
}

[data-collection="write"] {
  --color-accent:       #D97757;   /* warm clay / soft coral */
  --color-accent-soft:  #FBEDE6;
  --color-accent-dark:  #BE5F41;
  --glow-1: rgba(230, 150, 110, 0.26);
  --glow-2: rgba(245, 200, 155, 0.20);
  --grad-a: #D97757;
  --grad-b: #EAA277;
}

/* Dark-mode accents per collection */
[data-theme="dark"] {
  --glow-1: rgba(124, 140, 255, 0.20);
  --glow-2: rgba(90, 110, 220, 0.15);
}
[data-theme="dark"][data-collection="study"] {
  --color-accent:       #4FD6C0;
  --color-accent-soft:  #0F2C28;
  --color-accent-dark:  #7FE7D6;
  --glow-1: rgba(45, 190, 170, 0.18);
  --glow-2: rgba(30, 140, 125, 0.14);
  --grad-a: #4FD6C0;
  --grad-b: #2FB6A0;
}
[data-theme="dark"][data-collection="write"] {
  --color-accent:       #F0A07A;
  --color-accent-soft:  #33211A;
  --color-accent-dark:  #F6BE9E;
  --glow-1: rgba(230, 150, 110, 0.18);
  --glow-2: rgba(200, 120, 80, 0.14);
  --grad-a: #F0A07A;
  --grad-b: #E9C08F;
}

/* ── Marketing (rose) ──────────────────────────────────────────────────── */
[data-collection="marketing"] {
  --color-accent:       #D6537E;
  --color-accent-soft:  #FBEAF1;
  --color-accent-dark:  #B84571;
  --glow-1: rgba(214, 83, 126, 0.24);
  --glow-2: rgba(235, 150, 180, 0.18);
  --grad-a: #D6537E;
  --grad-b: #E888AA;
}
[data-theme="dark"][data-collection="marketing"] {
  --color-accent:       #F08FB0;
  --color-accent-soft:  #3A1F2A;
  --color-accent-dark:  #F5AFC8;
  --glow-1: rgba(240, 143, 176, 0.18);
  --glow-2: rgba(200, 100, 140, 0.14);
  --grad-a: #F08FB0;
  --grad-b: #E9A8C4;
}

/* ── Finance (sage green) ─────────────────────────────────────────────── */
[data-collection="finance"] {
  --color-accent:       #4E9B6B;
  --color-accent-soft:  #E8F5EC;
  --color-accent-dark:  #3D7D56;
  --glow-1: rgba(78, 155, 107, 0.24);
  --glow-2: rgba(140, 200, 165, 0.18);
  --grad-a: #4E9B6B;
  --grad-b: #7DC298;
}
[data-theme="dark"][data-collection="finance"] {
  --color-accent:       #6FCC91;
  --color-accent-soft:  #16281D;
  --color-accent-dark:  #8FDCAE;
  --glow-1: rgba(111, 204, 145, 0.18);
  --glow-2: rgba(80, 170, 115, 0.14);
  --grad-a: #6FCC91;
  --grad-b: #9EE0B8;
}

/* ── Legal (indigo) ───────────────────────────────────────────────────── */
[data-collection="legal"] {
  --color-accent:       #5C6FB8;
  --color-accent-soft:  #ECEEF9;
  --color-accent-dark:  #4A5A9A;
  --glow-1: rgba(92, 111, 184, 0.24);
  --glow-2: rgba(150, 165, 220, 0.18);
  --grad-a: #5C6FB8;
  --grad-b: #8B9AE0;
}
[data-theme="dark"][data-collection="legal"] {
  --color-accent:       #8B9AE0;
  --color-accent-soft:  #1E2340;
  --color-accent-dark:  #AAB6EC;
  --glow-1: rgba(139, 154, 224, 0.18);
  --glow-2: rgba(100, 115, 190, 0.14);
  --grad-a: #8B9AE0;
  --grad-b: #B0BCEC;
}

/* ── HR (plum) ────────────────────────────────────────────────────────── */
[data-collection="hr"] {
  --color-accent:       #B0609E;
  --color-accent-soft:  #F7E9F3;
  --color-accent-dark:  #8F4C80;
  --glow-1: rgba(176, 96, 158, 0.24);
  --glow-2: rgba(210, 150, 200, 0.18);
  --grad-a: #B0609E;
  --grad-b: #D08FC0;
}
[data-theme="dark"][data-collection="hr"] {
  --color-accent:       #E098D0;
  --color-accent-soft:  #2E1F2B;
  --color-accent-dark:  #EDB5E2;
  --glow-1: rgba(224, 152, 208, 0.18);
  --glow-2: rgba(180, 110, 165, 0.14);
  --grad-a: #E098D0;
  --grad-b: #EEB8E0;
}

/* ── Health (sky blue) ────────────────────────────────────────────────── */
[data-collection="health"] {
  --color-accent:       #4E8FC4;
  --color-accent-soft:  #E8F1FA;
  --color-accent-dark:  #3D71A0;
  --glow-1: rgba(78, 143, 196, 0.24);
  --glow-2: rgba(140, 185, 225, 0.18);
  --grad-a: #4E8FC4;
  --grad-b: #82B6E0;
}
[data-theme="dark"][data-collection="health"] {
  --color-accent:       #7FB8E8;
  --color-accent-soft:  #17222E;
  --color-accent-dark:  #A0CDF2;
  --glow-1: rgba(127, 184, 232, 0.18);
  --glow-2: rgba(90, 150, 200, 0.14);
  --grad-a: #7FB8E8;
  --grad-b: #A6D0F0;
}

/* ── Design (violet) ──────────────────────────────────────────────────── */
[data-collection="design"] {
  --color-accent:       #8A5CD6;
  --color-accent-soft:  #F0EBFB;
  --color-accent-dark:  #6E45B0;
  --glow-1: rgba(138, 92, 214, 0.24);
  --glow-2: rgba(180, 150, 230, 0.18);
  --grad-a: #8A5CD6;
  --grad-b: #B08AE8;
}
[data-theme="dark"][data-collection="design"] {
  --color-accent:       #B294EE;
  --color-accent-soft:  #241A38;
  --color-accent-dark:  #C7B0F5;
  --glow-1: rgba(178, 148, 238, 0.18);
  --glow-2: rgba(140, 110, 200, 0.14);
  --grad-a: #B294EE;
  --grad-b: #CCB6F5;
}

/* ── Productivity (teal-cyan) ─────────────────────────────────────────── */
[data-collection="productivity"] {
  --color-accent:       #3D9AA6;
  --color-accent-soft:  #E6F4F5;
  --color-accent-dark:  #2F7C86;
  --glow-1: rgba(61, 154, 166, 0.24);
  --glow-2: rgba(130, 200, 210, 0.18);
  --grad-a: #3D9AA6;
  --grad-b: #75C2CC;
}
[data-theme="dark"][data-collection="productivity"] {
  --color-accent:       #5FC3D0;
  --color-accent-soft:  #16282A;
  --color-accent-dark:  #82D6E0;
  --glow-1: rgba(95, 195, 208, 0.18);
  --glow-2: rgba(60, 160, 175, 0.14);
  --grad-a: #5FC3D0;
  --grad-b: #8ADAE2;
}

/* ── Futuristic background (fixed, behind everything) ────────────────────── */
.ts-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  view-transition-name: ts-bg;
}
.ts-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  will-change: transform;
  transition: background 0.5s ease;
}
.ts-bg-orb.o1 {
  width: 540px; height: 540px; top: -140px; left: -90px;
  background: radial-gradient(circle at 35% 35%, var(--glow-1), transparent 70%);
}
.ts-bg-orb.o2 {
  width: 480px; height: 480px; top: 18%; right: -140px;
  background: radial-gradient(circle at 60% 40%, var(--glow-2), transparent 70%);
}
.ts-bg-orb.o3 {
  width: 420px; height: 420px; bottom: -160px; left: 28%;
  background: radial-gradient(circle, var(--glow-1), transparent 70%);
}
.ts-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--color-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-border) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}
[data-theme="dark"] .ts-bg-grid { opacity: 0.5; }

/* ── Glass nav + gradient identity ───────────────────────────────────────── */
.ts-nav {
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
  view-transition-name: ts-nav;
}
.ts-nav-crumb {
  font-size: 14px;
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.ts-nav-crumb:hover { color: var(--color-accent); }

/* Gradient hero title */
.ts-tool-name {
  background: linear-gradient(115deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--grad-a); /* fallback */
}

/* Cards get a soft lift + accent-tinted hover ring */
.ts-card {
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.ts-hub-card { position: relative; overflow: hidden; }
.ts-hub-card::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s ease;
}
.ts-hub-card:hover::after { transform: scaleX(1); }

.ts-privacy-strip { backdrop-filter: blur(4px); }

/* ── Scroll reveal ───────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(.22,.61,.36,1),
              transform 0.6s cubic-bezier(.22,.61,.36,1);
}
.reveal.in { opacity: 1; transform: none; }

/* ── View transitions (cross-document, Chromium) ────────────────────────── */
@view-transition { navigation: auto; }
::view-transition-old(root) {
  animation: vtOut 0.28s cubic-bezier(.4,0,1,1) both;
}
::view-transition-new(root) {
  animation: vtIn 0.42s cubic-bezier(.16,1,.3,1) both;
}
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn  { from { opacity: 0; transform: translateY(14px); } }

/* ── How it works card ───────────────────────────────────────────────────── */
/* Bottom "How it works" walkthrough: Step 1 → 2 → 3, each animated w/ sample text */
.hiw2 {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 0.5px solid var(--color-border);
  clear: both;
}
.hiw2-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--color-accent);
  display: flex; align-items: center; gap: 7px; margin-bottom: 18px;
}
.hiw2-steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.hiw2-step {
  position: relative;
  min-width: 0;               /* allow grid track to shrink below content width */
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.hiw2-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  margin-bottom: 10px;
}
.hiw2-step-title {
  font-size: 13px; font-weight: 600; color: var(--color-text); margin-bottom: 12px;
}
/* Steps play one at a time (JS toggles .playing); inactive steps dim */
.hiw2-step { opacity: 0.5; transition: opacity .45s ease, border-color .45s ease, box-shadow .45s ease; }
.hiw2-step.playing {
  opacity: 1;
  border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
  box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}
.hiw2-step.playing .hiw2-num { box-shadow: 0 0 0 4px var(--color-accent-soft); }

/* Demo stage */
.ts-hiw-demo {
  position: relative;
  height: 104px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--color-accent-soft) 80%, var(--color-surface)),
    var(--color-surface));
  border: 0.5px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 10px;
}
@media (max-width: 720px) {
  .hiw2-steps { grid-template-columns: 1fr; }
  .hiw2-step { opacity: 1; }   /* stacked: show all clearly on mobile */
}

/* ── Unique per-step demos (animate only while the step is .playing) ──────── */
.d-scr { width: 100%; display: flex; flex-direction: column; align-items: center;
         justify-content: center; gap: 6px; font-family: var(--font-mono); }

/* typewriter reveal — --len set inline = character count (monospace) */
.d-type {
  display: inline-block; white-space: nowrap; overflow: hidden; max-width: 100%;
  width: 0; font-size: 11.5px; color: var(--color-text);
}
.hiw2-step.playing .d-type {
  animation: dType calc(var(--len,20) * 0.05s) linear forwards;
  border-right: 2px solid var(--color-accent);
}
@keyframes dType { to { width: calc(var(--len,20) * 1ch); } }

/* pop-in with per-item delay (--d) */
.d-in { opacity: 0; transform: translateY(7px); }
.hiw2-step.playing .d-in { animation: dIn .45s cubic-bezier(.16,1,.3,1) forwards; animation-delay: var(--d,0s); }
@keyframes dIn { to { opacity: 1; transform: none; } }

/* label: value rows (CiteMaker) */
.d-fields { align-items: stretch; gap: 5px; width: 100%; }
.d-field { display: flex; align-items: baseline; gap: 6px; font-size: 11px; }
.d-field .d-k { color: var(--color-muted); min-width: 46px; }
.d-field .d-v { color: var(--color-text); }

/* result line with check (CiteMaker) */
.d-result { flex-direction: row; gap: 8px; }
.d-check { color: var(--color-success); font-weight: 700; opacity: 0; }
.hiw2-step.playing .d-check { animation: dIn .3s ease forwards; animation-delay: 1s; }

/* course rows (GradeCalc) */
.d-rows { width: 100%; gap: 5px; }
.d-row { display: flex; justify-content: space-between; gap: 8px; font-size: 11px;
         background: var(--color-bg-soft); border: 0.5px solid var(--color-border);
         border-radius: var(--radius-sm); padding: 4px 8px; }
.d-row span:nth-child(2) { color: var(--color-accent); font-weight: 600; }

/* counting number (GradeCalc / ReadScore) */
.d-count .d-num { font-size: 30px; font-weight: 700; color: var(--color-accent); letter-spacing: -0.02em; }
.d-count .d-clabel { font-size: 10px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em; }

/* flip card (FlashForge) */
.d-flip { width: 140px; height: 74px; perspective: 600px; }
.d-flip-i { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.hiw2-step.playing .d-flip-i { animation: dFlip 2.4s ease forwards .4s; }
.d-face { position: absolute; inset: 0; backface-visibility: hidden; display: flex;
          align-items: center; justify-content: center; text-align: center; padding: 8px;
          border-radius: 10px; font-size: 11.5px; border: 0.5px solid var(--color-border);
          background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.d-back { transform: rotateY(180deg); background: var(--color-accent-soft); color: var(--color-accent); }
@keyframes dFlip { 0%,35% { transform: rotateY(0); } 65%,100% { transform: rotateY(180deg); } }

/* rating pills (FlashForge) */
.d-rate { flex-direction: row; gap: 6px; }
.d-pill { font-size: 11px; padding: 3px 10px; border-radius: 999px;
          border: 0.5px solid var(--color-border); background: var(--color-surface); color: var(--color-muted); }
.d-pill.on { background: var(--color-accent); color: #fff; border-color: transparent; }

/* highlight sweep of words (BiasCheck) */
.d-hl { font-size: 12px; line-height: 1.8; color: var(--color-text); text-align: center; }
.d-mk { background: linear-gradient(var(--color-accent-soft), var(--color-accent-soft)) no-repeat;
        background-size: 0% 100%; color: var(--color-accent); border-radius: 3px; padding: 0 2px; }
.hiw2-step.playing .d-mk { animation: dMk .5s ease forwards; animation-delay: var(--d,0s); }
@keyframes dMk { to { background-size: 100% 100%; } }

/* output chips (BiasCheck) */
.d-chips { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.d-chip { font-size: 11px; padding: 3px 9px; border-radius: 999px;
          background: var(--color-accent-soft); color: var(--color-accent); border: 0.5px solid var(--color-border); }
.d-chip.on { background: var(--color-accent); color: #fff; border-color: transparent; }

/* scan sweep (ReadScore) */
.d-scan { position: relative; overflow: hidden; width: 90%; text-align: center;
          font-size: 11.5px; color: var(--color-text); padding: 6px 0; }
.d-sweep { position: absolute; top: 0; bottom: 0; width: 45%; left: -45%;
           background: linear-gradient(90deg, transparent, var(--color-accent-soft), transparent); }
.hiw2-step.playing .d-sweep { animation: dSweep 1.3s ease forwards .2s; }
@keyframes dSweep { to { left: 100%; } }

/* stat numbers (WordCount) */
.d-stats { flex-direction: row; gap: 14px; }
.d-stat { text-align: center; }
.d-stat b { display: block; font-size: 20px; color: var(--color-text); }
.d-stat small { font-size: 10px; color: var(--color-muted); }

/* mini table (WordCount) */
.d-tbl { width: 80%; gap: 3px; }
.d-trow { display: flex; justify-content: space-between; font-size: 11px; color: var(--color-text);
          border-bottom: 0.5px solid var(--color-border); padding: 2px 0; }
.d-trow span:last-child { color: var(--color-accent); }

/* tweet bubbles (ThreadCraft) */
.d-tweets { gap: 5px; width: 82%; }
.d-tweet { font-size: 11px; background: var(--color-surface); border: 0.5px solid var(--color-border);
           border-radius: 10px; padding: 4px 9px; color: var(--color-text); align-self: flex-start; }

/* ── On-device AI flags guide (BiasCheck) ────────────────────────────────── */
.bc-flags {
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-soft);
  padding: 18px;
  margin-bottom: 16px;
}
.bc-flags h3 {
  font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--color-text);
}
.bc-flags p { font-size: 13px; color: var(--color-muted); line-height: 1.6; margin-bottom: 14px; }
.bc-flag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 0.5px solid var(--color-border);
}
.bc-flag-code {
  flex: 1;
  font-family: var(--font-mono); font-size: 12px; color: var(--color-text);
  word-break: break-all;
}
.bc-flag-set { font-size: 11px; color: var(--color-muted); white-space: nowrap; }
.bc-flag-copy { flex-shrink: 0; }
.bc-flags-steps { font-size: 13px; line-height: 1.8; color: var(--color-text); padding-left: 18px; margin: 12px 0 0; }
.bc-flags-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 0;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 12px; color: var(--color-accent);
  transition: opacity var(--transition);
}
.bc-flags-link:hover { opacity: 0.75; text-decoration: underline; }

/* ── Icons (categories + tools) ──────────────────────────────────────────── */
.ts-hub-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border: 0.5px solid var(--color-border);
}
.ts-hub-icon svg { width: 22px; height: 22px; }

.ts-tool-icon {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-accent);
  vertical-align: middle;
}
.ts-tool-icon svg { width: 26px; height: 26px; }
.ts-tool-head-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ts-tool-head-row .ts-tool-name { margin-bottom: 0; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ts-bg-orb { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hiw2-step * { animation: none !important; }
  .hiw2-step .d-type { width: auto !important; border-right: none; }
  .hiw2-step .d-in, .hiw2-step .d-check { opacity: 1 !important; transform: none !important; }
  .hiw2-step .d-mk { background-size: 100% 100% !important; }
  .hiw2-step .d-flip-i { transform: rotateY(180deg); }
  .hiw2-step .d-sweep { display: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* GitHub source link in the footer */
.ts-source-link { display: inline-flex; align-items: center; gap: 5px; color: var(--color-muted); text-decoration: none; }
.ts-source-link:hover { color: var(--color-accent); }
.ts-donate-link { display: inline-flex; align-items: center; gap: 5px; color: var(--color-muted); text-decoration: none; }
.ts-donate-link:hover { color: var(--color-accent); }
.ts-desktop-link { display: inline-flex; align-items: center; gap: 5px; color: var(--color-muted); text-decoration: none; }
.ts-desktop-link:hover { color: var(--color-accent); }

/* AI collection — soft coral, distinct from everything else */
[data-collection="ai"] {
  --color-accent:       #D96C4F;
  --color-accent-soft:  #FBEEE9;
  --color-accent-dark:  #B8532F;
  --glow-1: rgba(217, 108, 79, 0.22);
  --glow-2: rgba(240, 160, 130, 0.16);
  --grad-a: #D96C4F;
  --grad-b: #F0A082;
}
/* Data & AI — warm amber, kept clearly apart from Write's clay and Chrome AI's
   coral by being yellow-dominant rather than orange-red. */
[data-collection="data"] {
  --color-accent:       #B5822A;
  --color-accent-soft:  #FAF2E2;
  --color-accent-dark:  #8F6519;
  --glow-1: rgba(181, 130, 42, 0.20);
  --glow-2: rgba(224, 183, 106, 0.15);
  --grad-a: #B5822A;
  --grad-b: #E0B76A;
}
[data-theme="dark"][data-collection="data"] {
  --color-accent:       #E0B76A;
  --color-accent-soft:  #2A2113;
  --color-accent-dark:  #EDD09A;
  --glow-1: rgba(224, 183, 106, 0.16);
  --glow-2: rgba(181, 130, 42, 0.12);
  --grad-a: #E0B76A;
  --grad-b: #EDD09A;
}

[data-theme="dark"][data-collection="ai"] {
  --color-accent:       #F09A7E;
  --color-accent-soft:  #2C1A14;
  --color-accent-dark:  #F7B9A4;
  --glow-1: rgba(240, 154, 126, 0.18);
  --glow-2: rgba(200, 110, 80, 0.13);
  --grad-a: #F09A7E;
  --grad-b: #F7C4B0;
}

/* Chrome AI support gate */
.ai-gate { border: 0.5px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }
.ai-gate.ok { border-color: var(--color-success); background: rgba(29,158,117,0.06); }
.ai-gate.no { border-color: var(--color-warning); background: rgba(217,119,6,0.06); }
.ai-gate-icon { font-size: 20px; flex-shrink: 0; }
.ai-gate h3 { font-size: 14px; margin: 0 0 4px; color: var(--color-text); }
.ai-gate p { font-size: 13px; color: var(--color-muted); line-height: 1.6; margin: 0; }
.ai-disabled { opacity: 0.45; pointer-events: none; filter: grayscale(0.7); }

/* AITranslate column alignment */
.ai-translate-col { display: flex; flex-direction: column; min-width: 0; }
.ai-translate-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 22px; }
.ai-translate-col .ts-textarea { flex: 1; }

/* Browse-all-tools page */
.browse-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.browse-group { margin-bottom: 32px; }
.browse-group-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent); margin-bottom: 12px; }
.browse-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.browse-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  background: var(--color-accent-soft); border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg); text-decoration: none; color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}
.browse-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.browse-card-icon { color: var(--color-accent); }
.browse-card-icon svg { width: 20px; height: 20px; }
.browse-card-name { font-weight: 600; font-size: 14px; color: var(--color-text); }
.browse-card-desc { font-size: 12px; color: var(--color-muted); line-height: 1.5; }
.ts-hero-browse-link { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--color-accent); text-decoration: none; }
.ts-hero-browse-link:hover { text-decoration: underline; }
.browse-grid { display: flex; flex-direction: column; }


/* ── Shared code / badge primitives ──────────────────────────────────────
   These began life in dev.css but are now used by the dev AND data
   collections. Per the base rule, anything used by more than one
   collection lives here rather than being duplicated per stylesheet. */
/* Code / structured output */
.ts-code-output {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  background: var(--color-bg-soft);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
  min-height: 60px;
}
textarea.ts-code-input {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  min-height: 220px;
}

/* Badges / status pills */
.dev-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--color-accent-soft);
  color: var(--color-accent); border: 0.5px solid var(--color-border); }
.dev-badge.ok   { background: rgba(29,158,117,0.12); color: var(--color-success); }
.dev-badge.bad  { background: rgba(220,38,38,0.10);  color: var(--color-danger); }
.dev-badge.warn { background: rgba(217,119,6,0.12);  color: var(--color-warning); }

.dev-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.dev-muted { color: var(--color-muted); font-size: 12px; }
