:root {
  --bg: #F4F2EC;
  --bg-card: #ECEAE3;
  --bg-card-hover: #E5E3DC;
  --text: #1A1A1A;
  --text-dim: #6B6560;
  --text-light: #8C8680;
  --accent: #1A1A1A;
  --accent-warm: #8B7355;
  --border: #D4D0C8;
  --border-heavy: #1A1A1A;
  --focus-ring: #2E6080;
  --footer-bg: #1A1A1A;
  --footer-text: #F4F2EC;
  --scrollbar-track: #E7E3DA;
  --scrollbar-thumb: #B3A794;
  --scrollbar-thumb-hover: #8B7355;
  --radius: 6px;
  --radius-pill: 100px;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'SFMono-Regular', 'Liberation Mono', monospace;
}

[data-theme="dark"] {
  --bg: #1A1B20;
  --bg-card: #22232A;
  --bg-card-hover: #2A2B34;
  --text: #D8D4CC;
  --text-dim: #8A8580;
  --text-light: #6B6660;
  --accent: #D8D4CC;
  --accent-warm: #B09878;
  --border: #35363E;
  --border-heavy: #D8D4CC;
  --focus-ring: #7CB6D6;
  --footer-bg: #111215;
  --footer-text: #D8D4CC;
  --scrollbar-track: #24262D;
  --scrollbar-thumb: #555B66;
  --scrollbar-thumb-hover: #747B87;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--accent-warm);
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--text);
}

/* Header */
.header {
  padding: 20px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--border-heavy);
}

.header h1 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.header h1 a:hover {
  text-decoration: none;
}

.header h1 a {
  color: var(--text);
}

.header h1 span {
  font-style: italic;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-link:hover {
  color: var(--text);
}

.header h1 a,
.header-link,
.hero-inline-link,
.footer-link,
.legal-link-action {
  text-decoration: none;
}

.header-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* Hero */
.hero {
  padding: 48px 48px 40px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero-inner {
  max-width: 780px;
  margin: 0 auto;
}

.hero-headline {
  font-family: var(--serif);
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero-description {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 32px;
}

.hero-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.hero-inline-link-icon {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text-dim);
}

.hero-inline-link:hover {
  text-decoration: none;
}

.hero-example {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 36px;
  font-size: 14px;
}

.hero-example-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  font-weight: 600;
  margin-right: 4px;
}

.hero-example-chain {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
}


.hero-example-step {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.hero-example-word {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 500;
  white-space: nowrap;
}

.hero-example-word-invalid {
  color: #A24A3F;
  border-color: rgba(162, 74, 63, 0.35);
  border-style: dashed;
}

.hero-example-connector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0 2px;
}

.hero-example-line {
  width: 10px;
  height: 1px;
  background: var(--border);
}

.hero-example-line-break {
  background: rgba(162, 74, 63, 0.4);
}

.hero-example-op {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 600;
}

.hero-example-op-insert,
.hero-example-op-sub,
.hero-example-op-delete {
  color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 12%, transparent);
}

.hero-example-op-letter {
  font-weight: 700;
  font-style: italic;
  text-transform: lowercase;
}

.hero-example-op-break {
  color: #A24A3F;
  background: rgba(162, 74, 63, 0.12);
}

.hero-example-chevron {
  font-size: 10px;
  margin-left: -1px;
  color: var(--text-light);
}

.hero-example-chevron-insert,
.hero-example-chevron-sub,
.hero-example-chevron-delete {
  color: var(--accent-warm);
}

.hero-example-chevron-break {
  color: #A24A3F;
}

.hero-edit {
  font-weight: 700;
}

.hero-edit-insert,
.hero-edit-sub {
  color: var(--accent-warm);
}

.hero-edit-delete {
  color: var(--text-light);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.hero-edit-break {
  color: #A24A3F;
}

.hero-metrics {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 40px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.hero-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  flex: 1;
}

.hero-metric-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hero-metric-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.hero-metric-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-warm);
}

.hero-metric-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}



/* Hero Nav Cards */
.hero-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.hero-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: center;
  font-family: var(--sans);
  color: var(--text);
  opacity: 1;
}

.hero-nav-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
  opacity: 1;
}

.hero-nav-card.active {
  border-color: var(--border-heavy);
  box-shadow: 0 0 0 1px var(--border-heavy);
}

.hero-nav-card:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.hero-nav-icon {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.hero-nav-card:hover .hero-nav-icon,
.hero-nav-card.active .hero-nav-icon {
  color: var(--text);
}

.hero-nav-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-nav-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Leaderboard Table */
.leaderboard-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.leaderboard-wrap::-webkit-scrollbar {
  height: 10px;
}

.leaderboard-wrap::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.leaderboard-wrap::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

.leaderboard-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.leaderboard-filter-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  width: 220px;
}

.leaderboard-filter-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

.leaderboard-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 2px solid var(--border-heavy);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}

.leaderboard-table th:hover {
  color: var(--text);
}

.leaderboard-table th.sorted::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.leaderboard-table th.sorted.asc::after {
  border-bottom: 5px solid var(--text);
}

.leaderboard-table th.sorted.desc::after {
  border-top: 5px solid var(--text);
}

.leaderboard-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.leaderboard-rank {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text-dim);
  min-width: 32px;
  display: inline-block;
}

.leaderboard-rank-1,
.leaderboard-rank-2,
.leaderboard-rank-3 {
  color: var(--text);
}

.leaderboard-model {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.leaderboard-company {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-company-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.leaderboard-score {
  font-family: var(--mono);
  font-size: 14px;
}

/* Content */
.content {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 48px 80px;
  flex: 1 0 auto;
}

.panel {
  display: none;
}

.panel[hidden] {
  display: none;
}

.panel.active {
  display: block;
}

/* Section headings */
.section-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
  max-width: 600px;
  line-height: 1.5;
}

/* Sliding pill toggle */
.pill-toggle {
  display: inline-flex;
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  padding: 3px;
  gap: 0;
  cursor: pointer;
}
.pill-toggle-btn {
  position: relative;
  z-index: 1;
  padding: 5px 16px;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: color .2s;
  white-space: nowrap;
}
.pill-toggle-btn.active { color: var(--bg); }
.pill-toggle-slider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  transition: left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}

.plot-scale-toggle {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.plot-scale-toggle-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
/* Leaderboard toolbar */
.leaderboard-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.leaderboard-toolbar .leaderboard-filter-input {
  flex: 1;
  min-width: 180px;
}
.leaderboard-toolbar-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.leaderboard-toolbar .pill-toggle { margin-bottom: 0; }

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0 40px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  appearance: auto;
}

select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input[type=range] {
  accent-color: var(--accent);
}

label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.15s;
  letter-spacing: 0.01em;
}

button:hover {
  opacity: 0.85;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card);
  opacity: 1;
}

/* Searchable selector component */
.searchable-selector {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.searchable-selector .search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.searchable-selector .search-bar svg {
  flex-shrink: 0;
  color: var(--text-light);
}

.searchable-selector .search-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.searchable-selector .search-input::placeholder {
  color: var(--text-light);
}

.searchable-selector .selector-actions {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.searchable-selector .selector-actions button {
  padding: 4px 14px;
  font-size: 12px;
}

.searchable-selector .selector-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.searchable-selector .selector-list::-webkit-scrollbar { width: 10px; }
.searchable-selector .selector-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}
.searchable-selector .selector-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}
.searchable-selector .selector-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.searchable-selector .selector-list.compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 2px;
}

.searchable-selector .selector-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}

.searchable-selector .selector-item:hover {
  background: var(--bg-card-hover);
}

.searchable-selector .selector-item:focus-within {
  background: var(--bg-card-hover);
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.searchable-selector .selector-item.hidden {
  display: none;
}

.searchable-selector .selector-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.searchable-selector .selector-item input[type=checkbox] {
  flex-shrink: 0;
  accent-color: var(--accent);
}

.searchable-selector .search-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Collapsible selector */
.selector-list-collapsed {
  max-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: none;
}
.selector-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px;
  transition: transform .2s, background .15s;
  flex-shrink: 0;
}
.selector-expand-btn:hover { background: var(--bg-card-hover); }
.selector-expand-btn.expanded { transform: rotate(180deg); }

/* Chips bar */
.selector-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  min-height: 36px;
  align-items: center;
}
.selector-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  font-size: 12px;
  font-family: var(--mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  white-space: nowrap;
}
.selector-chip .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.selector-chip-x {
  border: none;
  background: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
}
.selector-chip-x:hover { color: var(--text); }
.selector-chips-clear {
  font-size: 11px;
  font-family: var(--sans);
  color: var(--text-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.selector-chips-clear:hover { color: var(--text); background: var(--bg-card-hover); }


/* Stat row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-item {
  padding: 24px 28px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
}

.stat-item:last-child {
  border-right: none;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 600;
}

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.5px;
}

.stat-row-note {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-top: -20px;
  margin-bottom: 24px;
}

/* Word Explorer grid */
.explorer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1100px) {
  .explorer-grid {
    grid-template-columns: 1fr;
  }
}

.explorer-cell {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.explorer-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.explorer-cell-word {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.explorer-cell-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.explorer-cell-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.explorer-cell-play:hover {
  opacity: 0.75;
}

.explorer-cell-play svg {
  width: 14px;
  height: 14px;
}

.explorer-cell-canvas-wrap {
  position: relative;
  width: 100%;
  height: 400px;
}

.explorer-cell-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.explorer-text-wrap {
  padding: 18px 16px 20px;
}

.explorer-text-wrap.loading {
  min-height: 120px;
}

.explorer-text-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.explorer-text-chain {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.explorer-text-sequence {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.explorer-text-arrow {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1;
}

.explorer-text-model {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.explorer-text-model-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.explorer-text-model-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-light);
}

.explorer-text-placeholder {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.explorer-text-placeholder-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-card-hover), color-mix(in srgb, var(--bg-card-hover) 55%, white), var(--bg-card-hover));
  background-size: 200% 100%;
  animation: explorerTextPulse 1.8s ease-in-out infinite;
}

.explorer-text-placeholder-line.short {
  width: 44%;
}

.explorer-text-placeholder-line.mid {
  width: 72%;
}

.explorer-text-placeholder-line.long {
  width: 88%;
}

@keyframes explorerTextPulse {
  0% { background-position: 200% 0; opacity: 0.7; }
  50% { opacity: 1; }
  100% { background-position: -200% 0; opacity: 0.7; }
}

/* Graph tooltip */
.graph-tooltip {
  position: absolute;
  background: var(--text);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: none;
  z-index: 10;
  display: none;
}

/* Step counter */
.step-counter {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  min-width: 90px;
}

/* Footer */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 48px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--footer-text);
}

.footer-note {
  font-size: 12px;
  color: var(--text-light);
  font-family: var(--mono);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-link {
  font-size: 12px;
  color: var(--text-light);
  font-family: var(--mono);
}

.footer-link:hover {
  color: var(--footer-text);
  text-decoration: underline;
}

.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-shell {
  width: min(860px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.legal-kicker {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.legal-title {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.legal-intro {
  max-width: 720px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 18px;
}

.legal-card h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin-bottom: 12px;
}

.legal-card p,
.legal-card li {
  line-height: 1.75;
}

.legal-card ul {
  margin: 10px 0 0 20px;
}

.legal-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.legal-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.legal-link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
}

.legal-link-card h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin-bottom: 10px;
}

.legal-link-card p {
  color: var(--text-dim);
  margin-bottom: 18px;
}

.legal-link-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legal-link-action::after {
  content: "\2192";
  font-size: 14px;
}

/* Plotly overrides */
.js-plotly-plot .plotly .modebar {
  top: 4px !important;
  right: 4px !important;
}

/* Loading */
.loading {
  text-align: center;
  padding: 100px;
  color: var(--text-dim);
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
}

/* Explorer Modal */
.explorer-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 18, 14, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.explorer-modal-overlay.open {
  display: flex;
}

.explorer-modal {
  background: var(--bg);
  border-radius: 12px;
  width: 100%;
  max-width: 1600px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.explorer-modal-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-row-top {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.modal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-nav-btn:hover { background: var(--surface); }

.modal-row-top .modal-word {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

.modal-row-top .modal-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
}

.modal-row-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.modal-row-toggles {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-toggle-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.modal-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  border: none;
  padding: 0;
  opacity: 1;
}

.modal-toggle.active {
  background: var(--accent);
}

.modal-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.modal-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modal-toggle.active::after {
  transform: translateX(20px);
}

.modal-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.modal-body canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.modal-body canvas:active {
  cursor: grabbing;
}

.modal-body .modal-3d-container {
  width: 100%;
  height: 100%;
  display: block;
}

.modal-tooltip {
  position: absolute;
  background: var(--text);
  color: var(--bg);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: none;
  z-index: 10;
  display: none;
  white-space: nowrap;
}

.modal-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
  font: inherit;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 4px;
  padding: 2px 4px;
  text-align: left;
  opacity: 1;
}

.modal-legend-item.hidden {
  opacity: 0.3;
}

.modal-legend-item:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.modal-legend-item .legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.modal-legend-item.hidden .legend-swatch {
  opacity: 0.4;
}

.modal-legend-item .legend-label {
  text-decoration: none;
}

.modal-legend-item.hidden .legend-label {
  text-decoration: line-through;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.modal-close-btn:hover {
  background: var(--bg-card);
  opacity: 1;
}

.explorer-cell-maximize {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}

.explorer-cell-maximize:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  opacity: 1;
}

.explorer-cell-maximize svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 768px) {

  .hero {
    padding: 32px 20px 28px;
  }

  .hero-metrics {
    flex-direction: column;
    gap: 16px;
  }

  .hero-stats {
    gap: 24px;
  }


  .hero-example {
    gap: 8px;
  }

  .hero-example-chain {
    font-size: 13px;
  }

  .hero-example-word {
    padding: 3px 7px;
  }

  .hero-example-line {
    width: 6px;
  }

  .hero-example-op {
    font-size: 9px;
    padding: 1px 4px;
  }

  .hero-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .hero-nav-desc {
    display: none;
  }

  .hero-nav-card {
    padding: 12px 8px 10px;
  }

  .header,
  .content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .stat-row {
    grid-template-columns: 1fr;
  }

  .stat-item {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stat-item:last-child {
    border-bottom: none;
  }

  .explorer-grid {
    grid-template-columns: 1fr;
  }

  .explorer-cell-canvas-wrap {
    height: 320px;
  }

  .explorer-modal {
    max-width: 100%;
    height: 95vh;
  }

  .explorer-modal-overlay {
    padding: 8px;
  }

  .explorer-modal-header {
    gap: 12px;
    align-items: flex-start;
  }

  .footer-links {
    align-items: center;
    justify-content: flex-start;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .legal-link-grid {
    grid-template-columns: 1fr;
  }
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-card);
  opacity: 1;
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: block;
}

[data-theme="dark"] .js-plotly-plot .plotly .modebar-btn path {
  fill: var(--text-dim) !important;
}
