/* QueryCamp workbook theme.
   One accent (green) reserved for actions and success. Structure comes from
   rules and whitespace, not cards or shadows. */

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

:root {
  color-scheme: light;

  --paper: #ffffff;
  --paper-2: #f5f6f7;
  --paper-3: #eceef0;
  --ink: #16181b;
  --ink-2: #454a52;
  --ink-3: #676d76;
  --rule: #e3e5e8;
  --rule-2: #c9cdd2;

  --green: #0a6b4c;
  --green-hover: #07573d;
  --green-wash: #e8f3ee;
  --green-rgb: 10, 107, 76;
  --green-disabled: #7fae9b;
  --green-ink: #0b4a35;
  --on-green: #ffffff;
  --red: #b3261e;
  --red-wash: #fcefee;
  --red-ink: #7d1b15;
  --red-rgb: 179, 38, 30;
  --danger: #b3261e;
  --danger-hover: #8f1e17;
  --on-danger: #ffffff;
  --amber: #c79a3a;
  --amber-ink: #774c00;
  --amber-wash: #fdf4e1;
  --selection: #cfe6db;
  --heat-1: #c3e1d2;
  --heat-2: #86c2a6;
  --heat-3: #3b9570;

  --code-bg: #1e2024;
  --code-bar: #26292e;
  --code-ink: #e6e7e9;
  --code-dim: #969ca6;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 3px;
  --r: 5px;
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--green);
}

/* Dark palette: applied when the OS prefers dark and the visitor hasn't
   chosen a theme yet, or forced either way via the header toggle
   (data-theme, set by the inline boot script and toggleTheme() in app.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15171a;
    --paper-2: #1d2024;
    --paper-3: #272b30;
    --ink: #eceeef;
    --ink-2: #aeb3ba;
    --ink-3: #7d828a;
    --rule: #2a2e33;
    --rule-2: #3b4149;

    --green: #3fae82;
    --green-hover: #4dc293;
    --green-wash: rgba(63, 174, 130, .16);
    --green-rgb: 63, 174, 130;
    --green-disabled: #2c5b48;
    --green-ink: #8fe0bc;
  --on-green: #0c1f17;
    --red: #e2726b;
    --red-wash: rgba(226, 114, 107, .16);
    --red-ink: #f0a9a3;
    --red-rgb: 226, 114, 107;
    --danger: #a13830;
    --danger-hover: #bb443b;
    --on-danger: #ffffff;
    --amber: #d9ab4c;
    --amber-ink: #e8c17a;
    --amber-wash: rgba(217, 169, 76, .14);
    --selection: rgba(63, 174, 130, .35);
    --heat-1: #1d3a2d;
    --heat-2: #2c6b4d;
    --heat-3: #3f9d72;
  }
  :root:not([data-theme="light"]) .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23aeb3ba' stroke-width='1.5'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15171a;
  --paper-2: #1d2024;
  --paper-3: #272b30;
  --ink: #eceeef;
  --ink-2: #aeb3ba;
  --ink-3: #7d828a;
  --rule: #2a2e33;
  --rule-2: #3b4149;

  --green: #3fae82;
  --green-hover: #4dc293;
  --green-wash: rgba(63, 174, 130, .16);
  --green-rgb: 63, 174, 130;
  --green-disabled: #2c5b48;
  --green-ink: #8fe0bc;
  --on-green: #0c1f17;
  --red: #e2726b;
  --red-wash: rgba(226, 114, 107, .16);
  --red-ink: #f0a9a3;
  --red-rgb: 226, 114, 107;
  --danger: #a13830;
  --danger-hover: #bb443b;
  --on-danger: #ffffff;
  --amber: #d9ab4c;
  --amber-ink: #e8c17a;
  --amber-wash: rgba(217, 169, 76, .14);
  --selection: rgba(63, 174, 130, .35);
  --heat-1: #1d3a2d;
  --heat-2: #2c6b4d;
  --heat-3: #3f9d72;
}
:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23aeb3ba' stroke-width='1.5'/%3E%3C/svg%3E");
}

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .15s ease-out, color .15s ease-out;
}

::selection { background: var(--selection); }

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

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

code, pre, kbd { font-family: var(--mono); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tabular { font-variant-numeric: tabular-nums; }
.fine { font-size: 13px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.lede { font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; }

/* ---------- Buttons & form controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .12s ease-out, border-color .12s ease-out;
}
.btn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--rule-2); }
.btn:disabled { color: var(--ink-3); background: var(--paper-2); border-color: var(--rule); }

.btn-primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn-primary:hover:not(:disabled) { background: var(--green-hover); border-color: var(--green-hover); }
.btn-primary:disabled { color: var(--on-green); background: var(--green-disabled); border-color: var(--green-disabled); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-danger:disabled { opacity: .55; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }

.link-btn {
  color: var(--green);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(var(--green-rgb), .35);
  text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: currentColor; }
.link-danger { color: var(--red); text-decoration-color: rgba(var(--red-rgb), .35); }

.input, .select, .field input, .sandbox-import-field input[type="text"] {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .field input:focus, .sandbox-import-field input[type="text"]:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(var(--green-rgb), .15);
}
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23676d76' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 500; }
.optional { font-weight: 400; color: var(--ink-3); }
.field-note { font-size: 13px; color: var(--ink-3); }
.form-error {
  margin: -4px 0 14px;
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--red-wash);
  color: var(--red);
  font-size: 14px;
}

/* ---------- Status, difficulty ---------- */

.status { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.status-done { color: var(--green); font-weight: 500; }
.status-tried { color: var(--amber-ink); }
.status-fail { color: var(--red); font-weight: 500; }

.mark {
  flex: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--rule-2);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  line-height: 1;
  color: #fff;
}
.mark-done { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 600; }
.mark-tried { border-color: var(--amber); background: linear-gradient(90deg, var(--amber) 50%, transparent 50%); }

.diff {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}
.diff-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.diff-bars i { display: block; width: 3px; background: var(--rule-2); border-radius: 1px; }
.diff-bars i:nth-child(1) { height: 4px; }
.diff-bars i:nth-child(2) { height: 7px; }
.diff-bars i:nth-child(3) { height: 10px; }
.diff-bars i:nth-child(4) { height: 12px; }
.diff-bars i.on { background: var(--ink-2); }

/* ---------- Header ---------- */

.app-header { border-bottom: 1px solid var(--rule); background: var(--paper); }

.promo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 2px;
  width: 100%;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--green-wash);
  color: var(--green-ink);
  font-size: 14px;
  text-align: center;
}
.promo-banner strong { font-weight: 700; }
.promo-banner-cta { flex: none; font-weight: 600; white-space: nowrap; }
.promo-banner:hover .promo-banner-cta { text-decoration: underline; }
.app-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; }
.brand-pro { font-size: 10px; margin-left: 0; }
.wordmark {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.app-nav { display: flex; align-self: stretch; gap: 22px; }
.app-header-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: var(--ink-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); }
.app-nav .nav-link.is-active { color: var(--ink); font-weight: 500; }
.app-nav .nav-link.is-active:not(.nav-upgrade)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--green);
}
.app-header-right .nav-link.is-active { color: var(--ink); font-weight: 500; }
.nav-quiet { color: var(--ink-3); }

.nav-upgrade {
  align-self: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--green);
  color: var(--on-green);
  font-weight: 700;
  white-space: nowrap;
}
.nav-upgrade:hover, .nav-upgrade.is-active { background: var(--green-hover); color: var(--on-green); }
.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r);
  font-size: 15px;
  line-height: 1;
  color: var(--ink-2);
}
.theme-toggle:hover { background: var(--paper-2); color: var(--ink); }

/* ---------- Page scaffolding ---------- */

.page { max-width: 1120px; margin: 0 auto; padding: 40px 24px 96px; }
.page-narrow { max-width: 880px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.page-sub { margin-top: 8px; color: var(--ink-2); max-width: 64ch; }

.plan-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}
.plan-chip-premium { background: var(--green); border-color: var(--green); color: var(--on-green); }
.plan-days { color: var(--ink-3); }

.section { margin-top: 44px; }
.section-title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }

.empty-note { color: var(--ink-2); padding: 20px 0; }
.empty-note .link-btn { margin-top: 6px; }

.ruled-list { list-style: none; border-top: 1px solid var(--rule); }
.ruled-list > li { border-bottom: 1px solid var(--rule); }
.plain-list { padding-left: 18px; display: grid; gap: 6px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; }
.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.data-table thead th {
  background: var(--paper-2);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-2);
  border-bottom-color: var(--rule-2);
  font-family: var(--mono);
}
.data-table td { font-family: var(--mono); color: var(--ink); }
.data-table .num { text-align: right; }
.data-table td.null { color: var(--ink-3); font-style: italic; }
.data-table tbody tr:hover td { background: var(--paper-2); }

/* ---------- Landing ---------- */

.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.landing-main h1,
.hero-title {
  font-size: 40px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 20ch;
}
.landing-main .lede { margin-top: 18px; }
.pro-badge {
  display: inline-block;
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 0 5px;
  margin-left: 2px;
  vertical-align: middle;
  line-height: 1.5;
}

.demo { margin-top: 40px; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.demo-editor { background: var(--code-bg); color: var(--code-ink); }
.demo-file {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--code-dim);
  padding: 8px 16px;
  border-bottom: 1px solid #33363c;
}
.demo pre { padding: 14px 16px 16px; font-size: 13.5px; line-height: 1.6; overflow-x: auto; }
.kw { color: #8db6de; }
.fn { color: #dcc38a; }
.str { color: #a7cc92; }
.demo-result thead th { border-top: 0; }
.demo-scroll { overflow-x: auto; }
.demo-result tbody tr:last-child td { border-bottom: 0; }
.demo figcaption {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}

.landing-eyebrow { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-bottom: 14px; }
.landing-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 24px; font-size: 14px; color: var(--ink-3); }
.landing-stats strong { font-size: 22px; font-weight: 600; color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums; }
.hero-slides { display: grid; }
.hero-slide { grid-area: 1 / 1; min-width: 0; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
.hero-slide.is-active { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.hero-slide { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: start; }
.hero-slide .demo { margin-top: 0; }
.hero-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.hero-tab { position: relative; padding: 0 0 12px; margin-bottom: -1px; border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.hero-tab:hover, .hero-tab.is-active { color: var(--ink); }
.hero-tab-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; overflow: hidden; }
.hero-tab.is-active .hero-tab-bar { background: var(--rule-2); }
.hero-tab-bar::after { content: ""; position: absolute; inset: 0; background: var(--green); transform: scaleX(0); transform-origin: left; }
.hero-tab.is-active .hero-tab-bar::after { transform: scaleX(1); }
.hero-tab.is-active .hero-tab-bar.is-running::after { transform: scaleX(0); animation: hero-fill 8s linear forwards; }
.hero:hover .hero-tab-bar.is-running::after, .hero:focus-within .hero-tab-bar.is-running::after { animation-play-state: paused; }
@keyframes hero-fill { to { transform: scaleX(1); } }
.landing-cta { display: flex; align-items: center; gap: 20px; margin-top: 24px; }
@media (prefers-reduced-motion: reduce) { .hero-slide, .hero-slide.is-active { transition: none; } html { scroll-behavior: auto; } }
html { scroll-behavior: smooth; }

.landing-domains { margin-top: 56px; scroll-margin-top: 24px; }
.landing-domains-lede { color: var(--ink-2); max-width: 62ch; margin: -6px 0 18px; }
.landing-domains .domain-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.landing-domain { cursor: default; }
.landing-domain.is-soon { justify-content: center; }
.landing-domain-hook { font-size: 14px; color: var(--ink-2); line-height: 1.45; }

.demo-brief { padding: 12px 16px; background: var(--paper-2); border-bottom: 1px solid var(--rule); }
.demo-brief-tag { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); }
.demo-brief p { margin-top: 4px; font-weight: 500; }
.demo-brief code { font-family: var(--mono); font-size: .92em; }
.sandbox-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.sandbox-chip { font-family: var(--mono); font-size: 12.5px; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-2); }
.sandbox-chip strong { color: var(--ink); font-weight: 600; }
.sandbox-chip em { font-style: normal; color: var(--ink-3); margin-left: 3px; }

.landing-points { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 32px; margin-top: 56px; border-top: 1px solid var(--ink); padding-top: 22px; }
.landing-points li { display: flex; flex-direction: column; gap: 3px; }
.landing-points span { font-size: 14.5px; color: var(--ink-2); max-width: 62ch; }

.landing-outline { margin-top: 56px; }
.outline { list-style: none; border-top: 1px solid var(--ink); }
.outline-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}
.outline-num { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.outline-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.outline-name { font-weight: 500; }
.outline-topics { font-size: 14px; color: var(--ink-3); }
.outline-count { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.landing-outline .fine { margin-top: 14px; }

.auth-page { max-width: 420px; margin: 0 auto; padding: 40px 24px 96px; }
.auth-back { display: inline-block; margin-bottom: 20px; }
.auth {
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
}
.auth-title { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 18px; }
.auth-switch { display: flex; gap: 20px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.auth-switch-btn {
  position: relative;
  padding: 0 0 10px;
  font-size: 15px;
  color: var(--ink-3);
}
.auth-switch-btn.is-active { color: var(--ink); font-weight: 600; }
.auth-switch-btn.is-active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
}
.auth-form .btn-primary { height: 40px; font-size: 15px; margin-top: 4px; }
.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: 13px;
  color: var(--ink-3);
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.auth #google-btn { height: 40px; }
.auth-note { margin-top: 18px; line-height: 1.5; }

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- Home: track list ---------- */

.continue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px 14px 18px;
  margin-bottom: 36px;
  background: var(--paper-2);
  border-radius: var(--r);
}
.continue-text { color: var(--ink-2); min-width: 0; }
.continue-text strong { color: var(--ink); font-weight: 600; }
.continue-meta { color: var(--ink-3); }

.track-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 56px;
  align-items: start;
}

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.filters-search { flex: 1 1 240px; min-width: 0; }
.filters .select { flex: 0 0 auto; }
.filters .link-btn { margin-left: 6px; }
.track-summary { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }

.module { margin-top: 36px; }
.module-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  font-size: 17px;
  font-weight: 600;
}
.module-num { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink-3); }
.module-count { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--ink-3); }

.item-list { list-style: none; }
.track-main > .item-list { margin-top: 24px; border-top: 1px solid var(--ink); }
.item-list > li { border-bottom: 1px solid var(--rule); }
.item-row {
  width: 100%;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 8px 12px 2px;
  text-align: left;
  transition: background-color .12s ease-out;
}
.item-row:hover { background: var(--paper-2); }
.item-row:focus-visible { border-radius: 0; }
.item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.item-title { font-size: 15px; font-weight: 500; color: var(--ink); }
.item-desc {
  font-size: 14px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-meta { display: flex; align-items: center; gap: 10px; justify-self: end; }
.premium-badge {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-3);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---------- Domains ---------- */

.domain-index-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.domain-index-head .link-btn { flex: none; margin-bottom: 3px; }
.domain-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.domain-grid > li { display: flex; }
.domain-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px 18px 16px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  transition: border-color .12s ease-out, background-color .12s ease-out;
}
button.domain-card:hover { background: var(--paper-2); border-color: var(--rule-2); }
button.domain-card:hover .domain-chip { background: var(--paper-3); }
button.domain-card:hover .domain-icon { background: var(--green-wash); color: var(--green-ink); }
.domain-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: var(--r);
  background: var(--paper-2);
  color: var(--ink-2);
  transition: background-color .12s ease-out, color .12s ease-out;
}
.domain-name { font-size: 16px; font-weight: 600; color: var(--ink); }
.domain-tagline { font-size: 14px; color: var(--ink-3); }
.domain-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.domain-chip {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--paper-2);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  white-space: nowrap;
}
.domain-chip.is-mono { font-family: var(--mono); }
.domain-chip-count { margin-left: 3px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.domain-foot {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.domain-card .meter { width: 100%; margin-top: 6px; }
.domain-card.is-soon { background: transparent; border-style: dashed; }
.domain-card.is-soon .domain-name { color: var(--ink-2); }
.domain-card.is-soon .domain-icon { background: transparent; border: 1px dashed var(--rule-2); color: var(--ink-3); }
.domain-card.is-soon .domain-chip { color: var(--ink-3); background: transparent; border: 1px solid var(--rule); }
.domain-soon { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); }
.domain-soon-section { margin-top: 48px; }

.domain-back { display: inline-block; margin-bottom: 18px; }
.domain-title { display: flex; align-items: center; gap: 12px; }
.domain-title .domain-icon { margin-bottom: 0; background: var(--green-wash); color: var(--green-ink); }
.domain-brief { display: grid; gap: 12px; margin-top: 20px; }
.domain-brief > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.domain-brief dt { font-size: 13px; color: var(--ink-3); }
.domain-brief .domain-chips { margin-top: 0; }
.domain-tag { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.side { position: sticky; top: 24px; padding-top: 4px; }
.side-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.side-total { font-size: 14px; color: var(--ink-2); margin-bottom: 16px; }
.side-total strong { font-weight: 600; color: var(--ink); }
.meter-list { list-style: none; display: grid; gap: 12px; }
.meter-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.meter { height: 4px; background: var(--paper-3); border-radius: 2px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green); }
.side-block { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); }

.stars { display: inline-flex; gap: 1px; font-size: 14px; line-height: 1; color: var(--rule-2); }
.star.is-on { color: var(--amber); }
.stars-lg { font-size: 24px; gap: 2px; margin-bottom: 8px; }
.stars-block { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.stars-block .side-total { margin-bottom: 10px; }
.stars-lock { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.domain-foot { align-items: center; }
.section-meta { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--ink-3); }

/* Star tiles on the Progress page: one hue per star level (--t), mixed into the theme's paper so
   both themes work; ★5 is a shining gold tile. */
.star-tiles { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.star-tiles > li { display: flex; }
.star-tile {
  --t: var(--rule-2);
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  text-align: left;
  border: 1px solid var(--t);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--t) 14%, var(--paper));
  color: color-mix(in srgb, var(--t) 55%, var(--ink));
  transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.star-tile > * { position: relative; z-index: 1; }
button.star-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--t) 25%, transparent); }
.star-tile .domain-icon { margin-bottom: 4px; background: color-mix(in srgb, var(--t) 22%, var(--paper)); color: inherit; }
.star-tile-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.star-tile .stars { color: color-mix(in srgb, var(--t) 30%, var(--paper)); }
.star-tile .star.is-on { color: var(--t); }
.star-tile .stars-lg { font-size: 20px; margin: 2px 0 4px; }
.star-tile-foot { width: 100%; display: flex; justify-content: space-between; gap: 8px; margin-top: auto; font-size: 13px; }
.star-tile.tier-0 { border-style: dashed; background: var(--paper); color: var(--ink-3); }
.star-tile.tier-0 .stars { color: var(--rule-2); }
.star-tile.tier-1 { --t: #b87333; }
.star-tile.tier-2 { --t: #8e9aa6; }
.star-tile.tier-3 { --t: #2f9a6a; }
.star-tile.tier-4 { --t: #4a72c9; }
.star-tile.tier-5 {
  --t: #b8891f;
  border-color: #c9981f;
  background: linear-gradient(135deg, #fdf0b8 0%, #f0cd5e 38%, #d9a92e 62%, #f7e08e 100%);
  color: #4a3300;
  box-shadow: 0 4px 18px rgba(217, 169, 46, .35);
}
.star-tile.tier-5 .star-tile-name { color: #2e2000; }
.star-tile.tier-5 .domain-icon { background: rgba(255, 255, 255, .45); color: #5c4000; }
.star-tile.tier-5 .star.is-on { color: #8a5a00; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.star-tile.tier-5::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .7) 48%, transparent 66%);
  background-size: 250% 100%;
  animation: star-shine 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes star-shine {
  0% { background-position: 130% 0; }
  60%, 100% { background-position: -130% 0; }
}
.star-tiles-sample { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 16px; }
.star-tiles-sample .star-tile { padding: 12px; }
.star-tiles-sample .stars-lg { font-size: 17px; }
@media (max-width: 640px) { .star-tiles-sample { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  .star-tile { transition: none; }
  button.star-tile:hover { transform: none; }
  .star-tile.tier-5::after { animation: none; background-position: 50% 0; opacity: .5; }
}
.side-block p { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }

/* ---------- Profile ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.stat-row > div { padding: 14px 16px 16px 0; }
.stat-row > div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.stat-row dt { font-size: 13px; color: var(--ink-3); }
.stat-row dd { font-size: 26px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-row dd span { font-size: 14px; font-weight: 400; color: var(--ink-3); }

.heatmap-wrap { max-width: 100%; overflow-x: auto; padding-bottom: 4px; }
.heatmap-body { display: flex; gap: 6px; }
.heat-dow { flex: none; display: grid; grid-template-rows: 14px repeat(7, 1fr); gap: 3px; font-size: 10px; color: var(--ink-3); }
.heat-dow span { display: flex; align-items: center; }
/* Weeks stretch to the full content width; below ~10px per cell the wrapper scrolls instead. */
.heatmap {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: 14px repeat(7, auto);
  grid-template-columns: repeat(var(--weeks), minmax(10px, 1fr));
  gap: 3px;
  min-width: calc(var(--weeks) * 13px);
}
.heat-month { font-size: 10px; line-height: 14px; color: var(--ink-3); white-space: nowrap; overflow: visible; }
.heat-cell { border-radius: 2px; background: var(--paper-3); }
.heatmap .heat-cell { width: 100%; aspect-ratio: 1; }
.heat-cell.heat-future { background: transparent; }
.heat-legend .heat-cell { width: 11px; height: 11px; }
.heat-cell.level-1 { background: var(--heat-1); }
.heat-cell.level-2 { background: var(--heat-2); }
.heat-cell.level-3 { background: var(--heat-3); }
.heat-cell.level-4 { background: var(--green); }
.heat-legend { display: flex; align-items: center; gap: 3px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.heat-legend span:first-child { margin-right: 4px; }
.heat-legend span:last-child { margin-left: 4px; }
.section .fine { margin-top: 10px; }

.history-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 90px;
  gap: 12px;
  align-items: baseline;
  padding: 11px 8px;
  text-align: left;
  transition: background-color .12s ease-out;
}
.history-row:hover { background: var(--paper-2); }
.history-row:focus-visible { border-radius: 0; }
.history-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-kind { font-size: 13px; color: var(--ink-3); }
.history-row .status { text-align: right; }

/* ---------- Pricing ---------- */

.plan-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.plan-table th, .plan-table td { padding: 12px 16px; border-bottom: 1px solid var(--rule); text-align: center; }
.plan-table tbody th { text-align: left; font-weight: 400; color: var(--ink-2); padding-left: 0; }
.plan-table thead th {
  vertical-align: top;
  border-bottom: 1px solid var(--ink);
  padding-top: 18px;
  padding-bottom: 16px;
  width: 22%;
}
.plan-spacer { visibility: hidden; }
.plan-table thead td { border-bottom: 1px solid var(--ink); }
.plan-name { display: block; font-size: 14px; font-weight: 600; }
.plan-price { display: block; font-size: 24px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.plan-period { display: block; font-size: 13px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.plan-pick {
  background: var(--green-wash);
  position: relative;
  box-shadow: inset 2px 0 0 var(--green), inset -2px 0 0 var(--green);
}
.plan-table thead th.plan-pick { box-shadow: inset 2px 0 0 var(--green), inset -2px 0 0 var(--green), inset 0 2px 0 var(--green); }
.plan-table tfoot td.plan-pick { box-shadow: inset 2px 0 0 var(--green), inset -2px 0 0 var(--green), inset 0 -2px 0 var(--green); }
.plan-badge {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  display: inline-block;
  white-space: nowrap;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--green);
  color: var(--on-green);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.plan-was { display: block; font-size: 13px; color: var(--ink-3); text-decoration: line-through; margin-top: 10px; }
.plan-save {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 9px;
  border-radius: var(--r-sm);
  background: var(--green);
  color: var(--on-green);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.plan-bonus { color: var(--green-ink); }
.plan-table tfoot td { border-bottom: 0; padding-top: 18px; padding-bottom: 18px; }
.yes { color: var(--green); font-weight: 600; }
.no { color: var(--ink-3); }
.plan-table-wrap { padding-top: 18px; }
.pricing-note {
  margin-top: 20px;
  max-width: 70ch;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--green-wash);
  color: var(--green-ink);
  font-weight: 500;
}
.pricing-note strong { font-weight: 700; }

/* ---------- Work screens (practice, sandbox) ---------- */

body:has(.work) { overflow: hidden; }
.work { height: 100vh; display: flex; flex-direction: column; }

.work-header {
  flex: none;
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
}
.work-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.work-header .wordmark { font-size: 15px; }
.work-header-right { flex: none; display: flex; align-items: center; gap: 8px; }
.crumb { color: var(--ink-3); white-space: nowrap; }
.crumb-sep { color: var(--rule-2); }
.crumb-current { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ide {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(0, 1fr);
}
.ide-sandbox { grid-template-columns: 248px minmax(0, 1fr); }

.ide-pane, .ide-side { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--rule); }
.ide-side { background: var(--paper-2); }

.pane-tabs { flex: none; display: flex; gap: 22px; padding: 0 28px; border-bottom: 1px solid var(--rule); }
.pane-tab { position: relative; padding: 12px 0 11px; font-size: 14px; color: var(--ink-3); }
.pane-tab:hover { color: var(--ink); }
.pane-tab.is-active { color: var(--ink); font-weight: 500; }
.pane-tab.is-active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
}
.pane-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 28px 64px; }
.pane-intro { font-size: 14px; color: var(--ink-3); margin-bottom: 18px; }
.pane-empty { font-size: 14px; color: var(--ink-3); padding: 4px 0; }

/* Lesson content */
.lesson-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.lesson-title { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin-top: 8px; }
.lesson-lede { font-size: 17px; color: var(--ink-2); margin-top: 10px; max-width: 64ch; }
.lesson { margin-top: 22px; max-width: 68ch; }
.lesson > * + * { margin-top: 14px; }
.lesson p { color: var(--ink); }
.lesson-heading { font-size: 16px; font-weight: 600; margin-top: 26px !important; }
.lesson-list { padding-left: 20px; display: grid; gap: 6px; }
.lesson-code, .lesson pre {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
}
.lesson code, .task code, .note code, .hint-list code, .choice-desc code {
  font-size: .88em;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--paper-3);
}
.lesson pre code { padding: 0; background: none; font-size: inherit; }

.note {
  padding: 11px 14px;
  border-radius: var(--r);
  background: var(--paper-2);
  font-size: 15px;
  color: var(--ink-2);
}
.note strong { color: var(--ink); font-weight: 600; }
.note-warn { background: var(--amber-wash); color: var(--amber-ink); }
.note-warn strong { color: var(--amber-ink); }

.paywall-card {
  margin-top: 28px;
  padding: 24px;
  max-width: 56ch;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper-2);
}
.paywall-card p { margin-top: 12px; color: var(--ink-2); line-height: 1.6; }
.paywall-card .btn { margin-top: 18px; }

.task { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--ink); max-width: 68ch; }
.task-title { font-size: 17px; font-weight: 600; }
.task-text { margin-top: 8px; font-size: 16px; }
.task-text + .task-text { margin-top: 12px; }

.tables { margin-top: 28px; }
.table-block + .table-block { margin-top: 24px; }
.table-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.table-name .fine { font-family: var(--sans); font-weight: 400; }
.table-block .table-scroll { border: 1px solid var(--rule); border-radius: var(--r); max-height: 380px; overflow: auto; }
.table-block .data-table thead th { position: sticky; top: 0; z-index: 1; }
.table-block .data-table tbody tr:last-child td { border-bottom: 0; }
.col-name { display: block; }
.col-type { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* Hints & submissions */
.hint-list { list-style: none; display: grid; gap: 14px; margin-bottom: 20px; max-width: 64ch; }
.hint-list li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; }
.hint-num { font-family: var(--mono); font-size: 13px; color: var(--ink-3); padding-top: 2px; }
.submission { padding: 12px 0; }
.submission-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.submission-sql {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editor + output */
.ide-main {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(220px, 46%) minmax(0, 1fr);
}
.editor { min-height: 0; display: flex; flex-direction: column; background: var(--code-bg); }
.editor-bar {
  flex: none;
  height: 36px;
  display: flex;
  align-items: stretch;
  background: var(--code-bar);
  border-bottom: 1px solid #33363c;
}
.editor-file { display: flex; align-items: center; padding: 0 16px; font-family: var(--mono); font-size: 12.5px; color: var(--code-dim); }
.sql-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-ink);
  caret-color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  tab-size: 2;
}
.sql-editor::selection { background: #3d5a7a; }
.sql-editor:disabled { opacity: .65; }
.editor-actions {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.kbd-hint { margin-right: auto; font-size: 12px; color: var(--ink-3); font-family: var(--mono); }

.output { min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.output-head {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.output-body { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 24px; }
.output-body .table-scroll { border: 1px solid var(--rule); border-radius: var(--r); overflow: auto; }
.output-body .data-table tbody tr:last-child td { border-bottom: 0; }

.feedback {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.5;
}
.feedback strong { font-weight: 600; }
.feedback-pass { background: var(--green-wash); color: var(--green-ink); }
.feedback-fail { background: var(--red-wash); color: var(--red-ink); }

/* Sandbox editor tabs */
.sandbox-tabs { display: flex; min-width: 0; overflow-x: auto; }
.sandbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--code-dim);
  border-right: 1px solid #33363c;
  white-space: nowrap;
}
.sandbox-tab:hover { color: var(--code-ink); }
.sandbox-tab.is-active { color: var(--code-ink); background: var(--code-bg); }
.sandbox-tab-close { color: var(--code-dim); font-size: 14px; line-height: 1; padding: 2px; }
.sandbox-tab-close:hover { color: #fff; }
.sandbox-tab-add { width: 36px; color: var(--code-dim); font-size: 16px; }
.sandbox-tab-add:hover { color: var(--code-ink); }

/* Sandbox explorer */
.db-explorer { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 12px; }
.db-explorer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-left: 4px; }
.db-explorer-head .side-title { margin: 0; }
.db-tree { list-style: none; flex: 1; min-height: 0; overflow-y: auto; }
.db-table-row { display: flex; align-items: center; border-radius: var(--r-sm); }
.db-table-row:hover { background: var(--paper-3); }
.db-table-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  font-family: var(--mono);
  font-size: 13px;
  text-align: left;
}
.db-chevron { width: 12px; color: var(--ink-3); font-size: 11px; }
.db-table-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-table-export {
  flex: none;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--ink-3);
  visibility: hidden;
}
.db-table-row:hover .db-table-export, .db-table-export:focus-visible { visibility: visible; }
.db-table-export:hover { color: var(--green); }
.db-table-menu {
  flex: none;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1;
  color: var(--ink-3);
}
.db-table-menu:hover, .db-table-menu:focus-visible { background: var(--paper); color: var(--ink); }
.db-cols { list-style: none; margin: 2px 0 8px 22px; border-left: 1px solid var(--rule-2); }
.db-cols li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 6px 2px 10px; font-size: 12.5px; }
.db-col-name { font-family: var(--mono); }
.db-col-type { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.db-empty { font-size: 13px; color: var(--ink-3); padding: 4px; line-height: 1.5; }
.db-foot { flex: none; margin-top: auto; padding: 10px 4px 0; border-top: 1px solid var(--rule); font-size: 12px; color: var(--ink-3); }
.db-foot p { margin-bottom: 6px; }
.db-foot .link-danger { font-size: 12px; font-weight: 500; }

/* Sandbox onboarding */
.onboard { width: 100%; max-width: 620px; margin: 0 auto; padding: 72px 24px; overflow-y: auto; }
.onboard h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; }
.onboard .lede { font-size: 16px; margin-top: 10px; }
.choice-list { list-style: none; margin-top: 28px; border-top: 1px solid var(--ink); }
.choice-list li { border-bottom: 1px solid var(--rule); }
.choice {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 8px 16px 2px;
  text-align: left;
  transition: background-color .12s ease-out;
}
.choice:hover { background: var(--paper-2); }
.choice-title { font-size: 16px; font-weight: 600; color: var(--green); }
.choice-desc { font-size: 14px; color: var(--ink-2); }

/* ---------- Modals ---------- */

.sandbox-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 24, 27, .42);
}
.sandbox-modal {
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 6px;
  border: 1px solid var(--rule);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  outline: none;
}
.sandbox-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}
.sandbox-modal-header h2 { font-size: 17px; font-weight: 600; }
.sandbox-modal-close { width: 30px; height: 30px; border-radius: var(--r); font-size: 20px; line-height: 1; color: var(--ink-3); }
.sandbox-modal-close:hover { background: var(--paper-2); color: var(--ink); }
.sandbox-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 15px;
  color: var(--ink-2);
}
.sandbox-modal-body strong { color: var(--ink); }
.sandbox-modal-sm { width: min(400px, 100%); }
.sandbox-modal-sm .sandbox-modal-body { gap: 14px; }

/* Right-click / kebab context menu on a sandbox table */
.ctx-menu-overlay { position: fixed; inset: 0; z-index: 60; }
.ctx-menu {
  position: fixed;
  z-index: 61;
  min-width: 190px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.ctx-menu-label {
  padding: 6px 10px 7px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctx-menu-item {
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink);
}
.ctx-menu-item:hover, .ctx-menu-item:focus-visible { background: var(--paper-2); }
.ctx-menu-item.is-danger { color: var(--red); }
.sandbox-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--rule);
}

.sandbox-import-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink); }
.sandbox-import-field input[type="file"] { font-size: 14px; color: var(--ink-2); }
.sandbox-import-field input[type="file"]::file-selector-button {
  margin-right: 12px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.sandbox-import-field input[type="file"]::file-selector-button:hover { background: var(--paper-2); }
.file-chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-name { font-family: var(--mono); font-size: 13.5px; font-weight: 400; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chosen .btn { cursor: pointer; }
.file-chosen .btn:focus-within { box-shadow: var(--focus); }
.sandbox-import-preview-meta { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.sandbox-import-preview-label { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.sandbox-import-preview-label-spaced { margin-top: 18px; }
.sandbox-import-schema-table, .sandbox-import-preview-table {
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r);
}
.sandbox-import-schema-table .data-table td { padding-top: 5px; padding-bottom: 5px; }
.sandbox-import-type-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
}
.sandbox-import-hint { margin: 0; }
.sandbox-import-error { margin: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .landing { padding-top: 40px; }
  .landing-domains .domain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-points { grid-template-columns: minmax(0, 1fr); }
  .hero-slide { grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
  .track-layout { grid-template-columns: 1fr; gap: 40px; }
  .domain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side { position: static; order: -1; }
  .side-block { display: none; }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-row > div:nth-child(4) { padding-left: 0; border-left: 0; }
  .stat-row > div:nth-child(n+4) { border-top: 1px solid var(--rule); }
}

@media (max-width: 880px) {
  body:has(.work) { overflow: auto; }
  .work { height: auto; min-height: 100vh; }
  .ide, .ide-sandbox { grid-template-columns: minmax(0, 1fr); }
  .ide-pane, .ide-side, .ide-main { min-width: 0; }
  .ide-pane, .ide-side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .pane-scroll { overflow: visible; }
  .db-tree { max-height: 220px; }
  .ide-main { grid-template-rows: 300px auto; }
  .output-body { overflow: visible; min-height: 200px; }
}

@media (max-width: 640px) {
  .app-header-inner { height: auto; flex-wrap: wrap; row-gap: 0; column-gap: 16px; padding: 0 16px; }
  .brand { height: 48px; }
  .app-nav { order: 3; width: 100%; height: 42px; gap: 20px; border-top: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav .nav-link { flex: none; }
  .app-header-right .nav-link:not(#logout-btn):not(#login-pricing-btn):not(#pricing-to-login-btn):not(#login-signin-btn) { display: none; }
  .app-header-right { gap: 14px; }
  .auth-page { padding: 24px 16px 64px; }
  .page { padding: 28px 16px 72px; }
  .landing { padding: 32px 16px 64px; }
  .landing-main h1, .hero-title { font-size: 30px; }
  .landing-cta { flex-wrap: wrap; }
  .lede { font-size: 16px; }
  .continue { flex-direction: column; align-items: flex-start; }
  .domain-index-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .domain-grid, .landing-domains .domain-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .domain-brief > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .domain-tag { display: none; }
  .item-row { grid-template-columns: 16px minmax(0, 1fr); }
  .item-meta { grid-column: 2; justify-self: start; margin-top: 2px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row > div { padding-left: 0 !important; border-left: 0 !important; }
  .stat-row > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; }
  .history-kind { display: none; }
  .pane-tabs, .pane-scroll { padding-left: 16px; padding-right: 16px; }
  .work-header .crumb, .work-header .crumb + .crumb-sep { display: none; }
  .work-header .crumb-current { max-width: 45vw; }
  .kbd-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
