/**
 * TheBotStack.com - Modern Web Stylesheet
 * Architectural design tokens, responsive CSS grid, light/dark themes,
 * WCAG AAA contrast compliance, and native dialog styling.
 */

:root {
  /* Dark Theme (Default) */
  --canvas-bg: #0b0f19;
  --surface-bg: #161e2e;
  --surface-elevated: #1e293b;
  --surface-hover: #26354a;
  --border-subtle: #243045;
  --border-strong: #3b4d6b;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --primary-color: #06b6d4;
  --primary-hover: #0891b2;
  --primary-text: #021a29;

  --accent-color: #10b981;
  --accent-text: #011910;

  --warning-color: #f59e0b;
  --warning-text: #2e1102;

  --danger-color: #dc2626;
  --danger-text: #ffffff;

  --hero-gradient: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);

  /* Grade Badge Tokens (Dark Theme WCAG AAA/AA) */
  --grade-a-plus-bg: #10b981;
  --grade-a-plus-text: #011910;
  --grade-a-bg: #06b6d4;
  --grade-a-text: #021a29;
  --grade-b-bg: #2563eb;
  --grade-b-text: #ffffff;
  --grade-c-bg: #f59e0b;
  --grade-c-text: #2e1102;
  --grade-d-bg: #f97316;
  --grade-d-text: #2e1102;
  --grade-f-bg: #dc2626;
  --grade-f-text: #ffffff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  color-scheme: dark;
  scrollbar-color: var(--border-strong) var(--canvas-bg);
  scrollbar-width: thin;
}

[data-theme="light"] {
  --canvas-bg: #f8fafc;
  --surface-bg: #ffffff;
  --surface-elevated: #f1f5f9;
  --surface-hover: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  --primary-color: #0369a1;
  --primary-hover: #075985;
  --primary-text: #ffffff;

  --accent-color: #047857;
  --accent-text: #ffffff;

  --warning-color: #b45309;
  --warning-text: #ffffff;

  --danger-color: #dc2626;
  --danger-text: #ffffff;

  --hero-gradient: linear-gradient(135deg, #0369a1 0%, #047857 100%);

  /* Grade Badge Tokens (Light Theme WCAG AAA/AA) */
  --grade-a-plus-bg: #047857;
  --grade-a-plus-text: #ffffff;
  --grade-a-bg: #0369a1;
  --grade-a-text: #ffffff;
  --grade-b-bg: #1d4ed8;
  --grade-b-text: #ffffff;
  --grade-c-bg: #b45309;
  --grade-c-text: #ffffff;
  --grade-d-bg: #c2410c;
  --grade-d-text: #ffffff;
  --grade-f-bg: #dc2626;
  --grade-f-text: #ffffff;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  color-scheme: light;
  scrollbar-color: var(--border-subtle) var(--canvas-bg);
  scrollbar-width: thin;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--canvas-bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--canvas-bg);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  gap: 1.5rem;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.25rem;
}

.brand-icon {
  color: var(--primary-color);
}

.brand-tld {
  color: var(--primary-color);
  font-weight: 800;
}

.header-tagline-badge {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .header-tagline-badge {
    display: inline-block;
  }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--surface-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; color: #f59e0b; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; color: var(--text-main); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--primary-text);
}

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

.btn-secondary {
  background-color: var(--surface-bg);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: var(--surface-hover);
  border-color: var(--primary-color);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Hero Section */
.hero-section {
  padding-block: 4rem 2.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-color);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.025em;
}

.text-gradient {
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 44rem;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}

/* Scanner Input Card */
.scanner-card {
  max-width: 46rem;
  margin-inline: auto;
  background-color: var(--surface-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.scanner-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .scanner-input-group {
    flex-direction: row;
    align-items: center;
  }
}

.input-icon-wrap {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding-left: 0.5rem;
}

@media (min-width: 640px) {
  .input-icon-wrap {
    display: flex;
  }
}

.scanner-input-group input {
  flex: 1;
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-size: 1rem;
  font-family: var(--font-mono);
}

@media (min-width: 640px) {
  .scanner-input-group input {
    border: none;
    padding-left: 0.5rem;
  }
}

.scanner-input-group input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Presets */
.preset-group {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.preset-chip {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover, .preset-chip.active {
  background-color: var(--surface-hover);
  border-color: var(--primary-color);
  color: var(--text-main);
}

/* Results Section */
.results-section {
  padding-bottom: 4rem;
}

.score-overview-card {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .score-overview-card {
    flex-direction: row;
    align-items: center;
  }
}

/* Radial Gauge */
.score-gauge-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.radial-gauge-container {
  position: relative;
  width: 140px;
  height: 140px;
}

.radial-gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: var(--surface-elevated);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-value-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-number {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.gauge-max {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.score-details-wrap {
  flex: 1;
}

.score-header-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .score-header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.grade-badge-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  font-weight: 800;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.grade-a-plus { background-color: var(--grade-a-plus-bg); color: var(--grade-a-plus-text); }
.grade-a { background-color: var(--grade-a-bg); color: var(--grade-a-text); }
.grade-b { background-color: var(--grade-b-bg); color: var(--grade-b-text); }
.grade-c { background-color: var(--grade-c-bg); color: var(--grade-c-text); }
.grade-d { background-color: var(--grade-d-bg); color: var(--grade-d-text); }
.grade-f { background-color: var(--grade-f-bg); color: var(--grade-f-text); }

.score-target-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-all;
}

.score-tier-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* View Mode Toggle */
.view-mode-toggle {
  display: inline-flex;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-mode-btn.active {
  background-color: var(--surface-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.tier-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.quick-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-pill {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  display: inline-flex;
  gap: 0.375rem;
}

.stat-label {
  color: var(--text-muted);
}

.stat-val {
  color: var(--text-main);
  font-weight: 600;
}

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

/* Agent Context Lens */
.agent-context-lens {
  background-color: #050811;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.agent-context-lens.visually-hidden {
  display: none;
}

.lens-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: #0b0f19;
  border-bottom: 1px solid #1e293b;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lens-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background-color: #ef4444; }
.terminal-dot.yellow { background-color: #f59e0b; }
.terminal-dot.green { background-color: #10b981; }

.lens-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  font-family: var(--font-mono);
}

.lens-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lens-tag {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  background-color: #1e293b;
  color: #38bdf8;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.lens-copy-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  background-color: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lens-copy-btn:hover {
  background-color: #334155;
  color: #ffffff;
  border-color: var(--primary-color);
}

.lens-pre {
  padding: 1.25rem;
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Category Grid */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.category-breakdown-section {
  margin-bottom: 2.5rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.category-card {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.cat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.cat-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
}

.cat-score-badge {
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface-elevated);
  color: var(--text-main);
}

.cat-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: var(--surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--primary-color);
  transition: width 0.6s ease;
}

/* Remediation Center */
.remediation-section {
  margin-bottom: 2.5rem;
}

.section-header-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .section-header-wrap {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
}

.remediation-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.remediation-item {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--warning-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .remediation-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.remediation-left {
  flex: 1;
}

.rem-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.rem-points-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--warning-color);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

.rem-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
}

.rem-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* 24-Point Audit Checklist */
.full-audit-section {
  margin-bottom: 3rem;
}

.form-select {
  background-color: var(--surface-bg);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.audit-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audit-check-row {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.15s ease;
}

.audit-check-row:hover {
  border-color: var(--border-strong);
}

.check-left-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.check-status-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
}

.check-pass {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-color);
}

.check-fail {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger-color);
}

.check-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.check-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.check-points-val {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Calculator Section */
.calculator-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-subtle);
}

.section-heading-centered {
  text-align: center;
  max-width: 44rem;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}

.section-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-elevated);
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.section-headline {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.section-subheadline {
  font-size: 1rem;
  color: var(--text-secondary);
}

.calculator-card {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.live-calc-score-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-score-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.calc-score-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.calculator-toggles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.calc-toggle-item {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.calc-toggle-item:hover {
  background-color: var(--surface-hover);
}

.calc-toggle-item input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.1875rem;
  accent-color: var(--primary-color);
  cursor: pointer;
}

.calc-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  cursor: pointer;
}

.calc-toggle-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.calc-toggle-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Leaderboard Section */
.leaderboard-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-subtle);
}

.table-container {
  overflow-x: auto;
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.leaderboard-table th {
  padding: 1rem;
  background-color: var(--surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.leaderboard-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.leaderboard-table tbody tr:hover {
  background-color: var(--surface-hover);
}

.table-domain {
  font-weight: 600;
  color: var(--text-main);
}

.table-category {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.table-score {
  font-family: var(--font-mono);
  font-weight: 700;
}

.feature-pill {
  display: inline-block;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  margin-right: 0.25rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* API Docs Section */
.api-docs-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-subtle);
}

.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.api-card {
  background-color: var(--surface-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.api-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.api-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.code-block {
  background-color: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: #38bdf8;
  overflow-x: auto;
  line-height: 1.5;
}

.api-tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tool-chip {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--primary-color);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Modal Dialog */
.modal-dialog {
  margin: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background-color: var(--surface-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  max-width: 38rem;
  width: 90%;
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  .modal-dialog {
    transform: scale(0.95);
  }
}

.modal-dialog[open] {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .modal-dialog[open] {
    transform: scale(1);

    @starting-style {
      transform: scale(0.95);
    }
  }
}

.modal-dialog[open] {
  @starting-style {
    opacity: 0;
  }
}

.modal-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(4px);
  transition-property: background-color, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-behavior: allow-discrete;
}

.modal-dialog[open]::backdrop {
  background-color: rgba(0, 0, 0, 0.75);

  @starting-style {
    background-color: rgba(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-dialog,
  .modal-dialog::backdrop {
    transition-duration: 0.05s;
  }
}

.dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.btn-icon-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}

.btn-icon-close:hover {
  color: var(--text-main);
}

.dialog-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dialog-code-wrap pre {
  background-color: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: #34d399;
  overflow-x: auto;
  max-height: 260px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--surface-bg);
  border-top: 1px solid var(--border-subtle);
  padding-top: 3.5rem;
  padding-bottom: 2rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-copy {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  max-width: 20rem;
}

.links-col h4 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.links-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.links-col a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

.links-col a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

/* Utilities */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
