@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════
   DESIGN TOKENS — LIGHT
═══════════════════════════════════════ */
:root {
  color-scheme: light;

  --bg:            #ecf0ed;
  --surface:       #ffffff;
  --surface-2:     #f4f7f5;
  --surface-3:     #e8ede9;
  --surface-code:  #0d1c14;

  --ink:           #0b1912;
  --ink-2:         #1c3326;
  --muted:         #4a6657;
  --faint:         #88a898;

  --border:        rgba(12, 30, 20, 0.1);
  --border-strong: rgba(12, 30, 20, 0.2);

  --accent:        #0a6b4a;
  --accent-hover:  #085a3d;
  --accent-bg:     #e1f3eb;
  --accent-text:   #085a3d;
  --accent-ring:   rgba(10, 107, 74, 0.22);

  --danger:        #bf3b2c;
  --danger-bg:     rgba(191, 59, 44, 0.08);
  --danger-text:   #9e3124;

  --success:       #0a6b4a;
  --success-bg:    rgba(10, 107, 74, 0.08);
  --success-text:  #085a3d;

  --code-text:     #a8d8bc;

  --shadow-xs: 0 1px 3px rgba(8, 22, 14, 0.07);
  --shadow-sm: 0 2px 8px rgba(8, 22, 14, 0.08), 0 1px 2px rgba(8, 22, 14, 0.05);
  --shadow-md: 0 4px 18px rgba(8, 22, 14, 0.1), 0 1px 4px rgba(8, 22, 14, 0.06);

  --topbar-bg: rgba(236, 240, 237, 0.88);

  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs:  7px;

  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
}

/* ═══════════════════════════════════════
   DESIGN TOKENS — DARK
═══════════════════════════════════════ */
[data-theme="dark"] {
  color-scheme: dark;

  /* Neutral charcoal backgrounds — no green tint */
  --bg:            #111111;
  --surface:       #1a1a1a;
  --surface-2:     #222222;
  --surface-3:     #2d2d2d;
  --surface-code:  #0d0d0d;

  /* Warm off-white text — easier on the eyes than cold white */
  --ink:           #f0ece7;
  --ink-2:         #c8c3bc;
  --muted:         #8a8480;
  --faint:         #4e4a47;

  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);

  /* Muted sage green — recognisable but not neon */
  --accent:        #5fa882;
  --accent-hover:  #76ba97;
  --accent-bg:     rgba(95, 168, 130, 0.13);
  --accent-text:   #76ba97;
  --accent-ring:   rgba(95, 168, 130, 0.28);

  --danger:        #e88080;
  --danger-bg:     rgba(232, 128, 128, 0.1);
  --danger-text:   #e88080;

  --success:       #5fa882;
  --success-bg:    rgba(95, 168, 130, 0.1);
  --success-text:  #76ba97;

  --code-text:     #88b89e;

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.3);

  --topbar-bg: rgba(8, 8, 8, 0.9);
}

/* ═══════════════════════════════════════
   BASE RESET
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); }

button,
input,
select,
textarea,
summary { font: inherit; }

button, .file-button { cursor: pointer; }

/* ═══════════════════════════════════════
   PAGE SHELL
═══════════════════════════════════════ */
.page-shell {
  width: min(1280px, 100vw - 2.5rem);
  margin: 0 auto;
  padding: 1.5rem 0 5rem;
}

/* ═══════════════════════════════════════
   HERO
═══════════════════════════════════════ */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem 2rem;
  margin-bottom: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* hero__copy is a plain container — no card styling */
.hero__copy { min-width: 0; }

.eyebrow,
.panel__eyebrow,
.privacy-card__label {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__copy h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.hero__lede {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 44rem;
}

.feature-list {
  display: grid;
  gap: 0.4rem;
  padding: 0;
  list-style: none;
  margin: 0.75rem 0 0;
}

.feature-list--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0 0 0.5rem;
}

.feature-list li {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-text);
  font-size: 0.775rem;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}

/* The privacy side card inside the hero */
.privacy-card {
  padding: 1.125rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 200px;
  max-width: 250px;
  flex-shrink: 0;
}

.privacy-card p {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.privacy-card p:first-of-type { margin-top: 0; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.375rem 0.5rem;
  position: sticky;
  top: 0.75rem;
  z-index: 10;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.tabs {
  display: inline-flex;
  gap: 0.2rem;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 130ms ease, color 130ms ease;
}

.tab-link:hover,
.tab-link:focus-visible {
  background: var(--surface-3);
  color: var(--ink);
}

.tab-link.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 6px var(--accent-ring);
}

/* ═══════════════════════════════════════
   THEME SWITCHER
═══════════════════════════════════════ */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.theme-switcher__icon {
  display: inline-flex;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--faint);
  flex-shrink: 0;
}

[data-theme="light"] .theme-switcher__icon:first-child,
[data-theme="dark"]  .theme-switcher__icon:last-child {
  color: var(--accent);
}

.theme-switcher__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.theme-switcher__control {
  position: relative;
  display: inline-flex;
  width: 2.7rem;
  height: 1.575rem;
}

.theme-switcher__control input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.theme-switcher__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 180ms ease, border-color 180ms ease;
}

.theme-switcher__thumb {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.175rem;
  height: 1.175rem;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 180ms ease;
  z-index: 1;
}

.theme-switcher__control input:checked + .theme-switcher__track {
  background: var(--accent);
  border-color: var(--accent-hover);
}

.theme-switcher__control input:checked + .theme-switcher__track + .theme-switcher__thumb {
  transform: translateX(1.125rem);
  background: #fff;
}

.theme-switcher__control input:focus-visible + .theme-switcher__track {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ═══════════════════════════════════════
   PANEL GRID
═══════════════════════════════════════ */
.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 1.25rem;
  align-items: start;
}

.panel-grid--tester {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
}

/* ═══════════════════════════════════════
   PANEL
═══════════════════════════════════════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.panel--preview {
  position: sticky;
  top: 4.75rem;
  align-self: start;
}

.panel--preview-code,
.panel--preview-result { /* no special overrides needed */ }

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel__header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.175rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--ink);
}

.panel__subtle {
  margin: 0.3rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 34rem;
}

.panel__section + .panel__section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.section-title-row h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.section-title-row p {
  margin: 0.18rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ═══════════════════════════════════════
   STACK LIST
═══════════════════════════════════════ */
.stack-list {
  display: grid;
  gap: 0.75rem;
}

/* ═══════════════════════════════════════
   BUILDER CARD
═══════════════════════════════════════ */
.builder-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.builder-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.builder-card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.builder-card__title h4 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}

.builder-card__grid,
.advanced-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

/* ═══════════════════════════════════════
   FORM FIELDS
═══════════════════════════════════════ */
.field {
  display: grid;
  gap: 0.375rem;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}

/* ═══════════════════════════════════════
   INPUTS
═══════════════════════════════════════ */
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  padding: 0.5625rem 0.75rem;
  font-size: 0.9rem;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

textarea {
  resize: vertical;
  min-height: 7.5rem;
  line-height: 1.55;
  font-family: var(--font-body);
}

.code-input {
  font-family: var(--font-code);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   TOOLTIP
═══════════════════════════════════════ */
.tooltip {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  position: relative;
  cursor: help;
  user-select: none;
  flex-shrink: 0;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%) translateY(4px);
  width: min(240px, 70vw);
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.tooltip:hover::after,
.tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.primary-button,
.secondary-button,
.ghost-button,
.file-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease, transform 100ms ease;
}

.primary-button { background: var(--accent); color: #fff; box-shadow: 0 1px 5px var(--accent-ring); }
.primary-button:hover { background: var(--accent-hover); transform: translateY(-1px); }

.secondary-button { background: var(--accent-bg); color: var(--accent-text); }
.secondary-button:hover { filter: brightness(0.93); transform: translateY(-1px); }

.ghost-button,
.file-button { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

.ghost-button:hover,
.file-button:hover { background: var(--surface-3); color: var(--ink); border-color: var(--border-strong); transform: translateY(-1px); }

.danger-button { background: var(--danger-bg); color: var(--danger); }
.danger-button:hover { filter: brightness(1.1); transform: translateY(-1px); }

.file-button {
  position: relative;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ═══════════════════════════════════════
   INFO BANNER
═══════════════════════════════════════ */
.info-banner {
  padding: 0.7rem 0.9rem;
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius-xs);
  color: var(--accent-text);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════
   SUPPORT CARD
═══════════════════════════════════════ */
.support-card {
  padding: 1rem 1.125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.support-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.support-card p {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.support-card a {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}

.support-card a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   CODE CARD
═══════════════════════════════════════ */
.code-card {
  overflow: auto;
  background: var(--surface-code);
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
}

.code-card pre {
  margin: 0;
  padding: 1.125rem;
  min-height: 21rem;
  font-family: var(--font-code);
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--code-text);
}

/* ═══════════════════════════════════════
   RESULT CARD
═══════════════════════════════════════ */
.result-card {
  min-height: 22rem;
  padding: 1.125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.result-card--empty {
  display: grid;
  place-items: center;
  color: var(--faint);
  text-align: center;
  font-size: 0.875rem;
}

.result-card--success {
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
  background: linear-gradient(160deg, var(--success-bg) 0%, var(--surface-2) 50%);
}

.result-card--error {
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: linear-gradient(160deg, var(--danger-bg) 0%, var(--surface-2) 50%);
}

.result-card__status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 6px;
  padding: 0.28rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.result-card__status--success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid color-mix(in srgb, var(--success) 22%, transparent);
}

.result-card__status--error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
}

.result-card h3 {
  margin: 1rem 0 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.result-card h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}

.result-card p,
.result-card li {
  line-height: 1.55;
  font-size: 0.875rem;
}

.result-card ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

/* ═══════════════════════════════════════
   TRACE / ACTION ITEMS
═══════════════════════════════════════ */
.trace-list,
.action-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.trace-item,
.action-item {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.5;
}

.trace-item--failed {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 22%, transparent);
}

.trace-item--passed {
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 22%, transparent);
}

/* ═══════════════════════════════════════
   ADVANCED PANEL
═══════════════════════════════════════ */
.advanced-panel {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.advanced-panel summary {
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 130ms ease, background 130ms ease;
}

.advanced-panel summary::-webkit-details-marker { display: none; }

.advanced-panel summary::before {
  content: "›";
  font-size: 1rem;
  line-height: 1;
  transition: transform 150ms ease;
  display: inline-block;
}

.advanced-panel[open] summary::before { transform: rotate(90deg); }

.advanced-panel summary:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.advanced-panel[open] summary {
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.advanced-panel__grid {
  padding: 1rem;
}

/* ═══════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════ */
.muted-text {
  color: var(--muted);
  margin: 0.6rem 0 0;
  font-size: 0.875rem;
}

.inline-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.4rem;
}

.pill {
  padding: 0.22rem 0.5rem;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-code);
}

.empty-message {
  color: var(--faint);
  font-style: italic;
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.site-footer p { margin: 0 0 0.5rem; }
.site-footer p:last-child { margin-bottom: 0; }

.site-footer strong { color: var(--ink); }

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

.site-footer__links { font-size: 0.8125rem; }

/* Email address assembled only by CSS — never plain text in the DOM */
.obfuscated-email::after {
  content: attr(data-u) "\40" attr(data-d);
}

/* ═══════════════════════════════════════
   RESPONSIVE — 980px
═══════════════════════════════════════ */
@media (max-width: 980px) {
  .hero,
  .panel-grid,
  .panel-grid--tester,
  .builder-card__grid,
  .advanced-panel__grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .privacy-card { max-width: 100%; }

  .panel--preview { position: static; }

  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
  }

  .tabs { flex: 1; }
}

/* ═══════════════════════════════════════
   RESPONSIVE — 640px
═══════════════════════════════════════ */
@media (max-width: 640px) {
  .page-shell {
    width: calc(100vw - 1.5rem);
    padding-top: 0.75rem;
  }

  .hero { padding: 1.25rem; }

  .panel { padding: 1.125rem; }

  .panel__header,
  .section-title-row,
  .builder-card__header {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-link {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .topbar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tabs { width: 100%; }

  .theme-switcher {
    width: 100%;
    justify-content: space-between;
  }
}
