/* Palette & fonts matched to TuxCode.net */
:root {
  --primary: #0ea5e9;        /* sky-500 */
  --primary-dark: #0284c7;   /* sky-600 */
  --primary-soft: #7dd3fc;   /* sky-300 */
  --secondary: #8b5cf6;
  --dark-bg: #111827;        /* gray-900 */
  --panel: #1f2937;          /* gray-800 */
  --card: #1f2937;           /* gray-800 */
  --card-border: #374151;    /* gray-700 */
  --line: #374151;
  --text: #f9fafb;           /* text-primary */
  --muted: #9ca3af;          /* text-secondary */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--dark-bg);
  color: var(--muted);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--dark-bg);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--card-border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reset-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

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

.ghost-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

.ghost-btn.copied {
  border-color: var(--primary);
  color: var(--primary-soft);
}

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

.reset-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

/* ---------- Page intro ---------- */
.page-intro {
  margin: 40px 0 32px;
}

.page-intro h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
}

.page-intro p {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}

/* ---------- Controls ---------- */
.controls {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  margin-bottom: 32px;
  z-index: 40; /* above the scrolling cards, below the header (z-50) */
}

/* When scrolled past, the controls become a slim fixed banner under the
   header. left/width are set in app.js to match the container; a spacer
   element preserves the document height so nothing jumps. */
.controls.is-fixed {
  position: fixed;
  top: var(--header-h, 64px);
  margin-bottom: 0;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.6);
  max-height: calc(100vh - var(--header-h, 64px) - 16px);
  overflow-y: auto;
}

.controls-body {
  display: grid;
  gap: 18px;
  padding: 22px 28px;
}

/* The compact banner only exists while fixed/collapsed. */
.controls-banner { display: none; }

.controls.is-fixed .controls-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: var(--panel);
  border: 0;
  border-radius: 14px;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  position: sticky; /* stay visible if the open panel scrolls */
  top: 0;
  z-index: 1;
}

.controls.is-fixed .controls-body { display: none; }
.controls.is-fixed.is-open .controls-body { display: grid; }

.controls-banner-summary {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls-banner-summary strong { color: var(--text); font-weight: 800; }

.controls-banner-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.controls.is-fixed .controls-banner:hover .controls-banner-chevron { color: var(--primary); }
.controls.is-open .controls-banner-chevron { transform: rotate(180deg); }

.controls.is-fixed .controls-banner:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

.control-row {
  display: grid;
  grid-template-columns: 230px 1fr 110px;
  align-items: center;
  gap: 18px;
}

label {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  /* Hand horizontal drags straight to the slider so it responds instantly
     after a scroll, while vertical swipes still scroll the page. */
  touch-action: pan-y;
}

input[type="text"] {
  width: 100%;
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  text-align: right;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  padding: 10px 12px;
}

input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

/* Read-only slider value (Cached input %) — derived, so no input box. */
.value-readout {
  display: block;
  width: 100%;
  text-align: right;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 10px 12px;
}

/* ---------- Batch toggle ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-label,
.control-label {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Keep the label/icon snug at the left of its grid column so the tooltip
   anchors near the panel edge and stays in view. */
.control-label { justify-self: start; }

.toggle-label > label[for="batchToggle"] {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.toggle-row .hint {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}

/* ---------- Info icon + tooltip ---------- */
button.info {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: 7px;
  line-height: 0;
  cursor: help;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

button.info:hover .info-icon {
  color: var(--primary);
  border-color: var(--primary);
}

button.info:focus-visible { outline: none; }

button.info:focus-visible .info-icon {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

.info-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  width: min(300px, calc(100vw - 40px));
  background: #0b1220;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}

.info-tip strong { color: var(--text); font-weight: 700; }

.info-tip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 14px;
  border: 6px solid transparent;
  border-bottom-color: var(--card-border);
}

button.info:hover ~ .info-tip,
button.info:focus ~ .info-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--card-border);
  border-radius: 9999px;
  transition: background 0.2s ease;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

/* ---------- Results toolbar (cheapest banner + sort) ---------- */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.cheapest-banner {
  flex: 1 1 320px;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
}

.cheapest-banner strong { color: var(--primary-soft); }
.cheapest-banner .amt { color: var(--muted); font-weight: 600; }

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.sort-control select {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  outline: none;
}

.sort-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.ghost-btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.muted { color: var(--muted); font-weight: 600; }

/* ---------- Token estimator ---------- */
.estimator {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 18px;
  margin-bottom: 32px;
}

.estimator > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.estimator > summary::-webkit-details-marker { display: none; }

.estimator > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: #111827;
  border: 1px solid var(--card-border);
  color: var(--primary);
  font-weight: 800;
  line-height: 1;
}

.estimator[open] > summary::before { content: "−"; }

.estimator-body { padding: 4px 0 18px; }

#estimatorText {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  outline: none;
}

#estimatorText:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.estimator-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.estimator-readout {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.estimator-readout strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.estimator-actions { display: flex; gap: 8px; }

.estimator-note {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

/* ---------- Comparison panel ---------- */
.compare-panel {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 28px;
}

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.compare-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.compare-headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
}

.compare-headline .save { color: #34d399; } /* emerald-400 */

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 14px;
}

.compare-col {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px 16px 18px;
}

.compare-col.baseline { border-color: var(--secondary); }

.compare-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.compare-remove:hover { color: var(--text); background: #111827; }

.compare-provider {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.compare-model {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  padding-right: 20px;
}

.compare-monthly {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}

.compare-annual {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
}

.compare-col .suffix { font-size: 13px; }

.delta {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.delta.save { color: #34d399; }
.delta.muted { color: var(--muted); font-weight: 600; }

/* ---------- Summary ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 34px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 22px 24px;
  min-height: 95px;
}

.summary-card .label {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 6px;
}

.summary-card .value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

/* ---------- Tiers & model cards ---------- */
.tier { margin-bottom: 32px; }

.tier-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.model-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  min-height: 245px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.model-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
  border-color: var(--primary);
}

.model-card.lowest {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.15);
}

.model-card.comparing {
  border-color: var(--secondary);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.compare-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.compare-toggle input {
  accent-color: var(--secondary);
  cursor: pointer;
  margin: 0;
}

.compare-toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.compare-toggle.disabled input { cursor: not-allowed; }

.provider {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}

.provider-link {
  color: inherit;
  text-decoration: none;
}

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

.model {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.cost-call {
  font-size: 18px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0 16px;
}

.monthly {
  font-size: 30px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 8px;
}

.annual {
  font-size: 22px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 16px;
}

.suffix {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.rates {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.card-note {
  color: var(--primary-soft);
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

.card-tier {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  padding: 3px 10px;
}

.badge {
  color: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
  margin-top: 10px;
}

.footer-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 24px;
}

.pricing-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0 0;
}

.pricing-note strong { color: var(--text); }

.pricing-note a {
  color: var(--primary-soft);
  text-decoration: none;
}

.pricing-note a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--card-border);
  margin-top: 48px;
}

.site-footer .container {
  padding-top: 32px;
  padding-bottom: 32px;
  text-align: center;
}

.site-footer p {
  color: #6b7280; /* gray-500 */
  margin: 0;
  font-size: 14px;
}

/* ---------- Custom scrollbar (matches TuxCode.net) ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 850px) {
  .nav-links { display: none; }

  .page-intro h1 { font-size: 26px; }

  /* Compact two-line layout so the pinned adjuster doesn't eat the screen:
     label + value on one line, slider full-width below. */
  .control-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label value"
      "slider slider";
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
  }

  .control-row .control-label { grid-area: label; }

  .control-row input[type="range"] { grid-area: slider; }

  .control-row input[type="text"] {
    grid-area: value;
    width: 110px;
    text-align: right;
  }

  .control-row .value-readout {
    grid-area: value;
    width: 110px;
    text-align: right;
    padding: 10px 0;
  }

  .summary,
  .cards {
    grid-template-columns: 1fr;
  }

  .controls-body {
    padding: 16px 18px;
    gap: 14px;
  }
}

/* ---------- Guided setup, filters & budget ---------- */
.page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-intro p { max-width: 700px; line-height: 1.6; }
.verified-badge { flex: 0 0 auto; color: var(--muted); background: var(--panel); border: 1px solid var(--card-border); border-radius: 999px; padding: 7px 12px; font-size: 12px; }
.verified-badge strong { color: var(--primary-soft); }
.presets { margin-bottom: 22px; }
.section-heading h2, .budget-planner h2 { color: var(--text); font-size: 18px; margin: 0 0 4px; }
.section-heading p, .budget-planner p { margin: 0; font-size: 14px; line-height: 1.5; }
.preset-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.preset-btn { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--card-border); border-radius: 10px; padding: 13px 14px; cursor: pointer; }
.preset-btn span { color: var(--muted); font-size: 12px; }
.preset-btn:hover, .preset-btn.active { border-color: var(--primary); background: rgba(14, 165, 233, .08); }
.preset-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.budget-planner { display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(135deg, rgba(14,165,233,.10), rgba(139,92,246,.08)); border: 1px solid var(--card-border); border-radius: 12px; padding: 18px 20px; margin: -12px 0 28px; }
.budget-input { display: flex; align-items: center; gap: 10px; font-size: 14px; white-space: nowrap; }
.money-input { display: flex; align-items: center; color: var(--muted); background: #111827; border: 1px solid var(--card-border); border-radius: 8px; padding-left: 10px; }
.money-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(14,165,233,.25); }
.money-input input { width: 90px; color: var(--text); background: transparent; border: 0; outline: 0; font: inherit; font-weight: 700; padding: 9px; }
.result-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.cheapest-banner small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.empty-results { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 180px; background: var(--panel); border: 1px solid var(--card-border); border-radius: 12px; color: var(--text); }
.budget-result { color: #34d399; font-size: 13px; font-weight: 600; padding: 10px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.rates { display: grid; gap: 5px; margin: 0; }
.rates div { display: flex; justify-content: space-between; gap: 10px; }
.rates dt { color: var(--muted); }
.rates dd { color: var(--text); margin: 0; }
.calculation { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; font-size: 12px; }
.calculation summary { color: var(--primary-soft); cursor: pointer; font-weight: 700; }
.calculation p { margin: 7px 0; line-height: 1.4; }
.calculation a { color: var(--primary-soft); }
.compare-actions { display: flex; align-items: center; gap: 8px; }
.compare-close, .compare-tray, .compare-backdrop { display: none; }
.model-card { min-height: 0; }

@media (max-width: 850px) {
  .page-intro { flex-direction: column; margin: 28px 0 22px; gap: 12px; }
  .preset-list { grid-template-columns: repeat(2, 1fr); }
  .budget-planner { align-items: stretch; flex-direction: column; gap: 14px; }
  .budget-input { justify-content: space-between; }
  .results-toolbar { align-items: stretch; }
  .result-controls { width: 100%; display: grid; grid-template-columns: 1fr; }
  .sort-control { justify-content: space-between; }
  .sort-control select { min-width: 170px; }
  .compare-panel { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; margin: 0; border-radius: 18px 18px 0 0; padding: 18px; box-shadow: 0 -18px 45px rgba(0,0,0,.55); }
  .compare-panel[hidden] { display: none; }
  .compare-grid { grid-template-columns: 1fr; }
  .compare-close { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--card-border); background: transparent; color: var(--text); font-size: 22px; cursor: pointer; }
  .compare-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.65); }
  .compare-tray:not([hidden]) { display: block; position: fixed; left: 50%; bottom: 14px; z-index: 75; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 12px 20px; background: var(--secondary); color: white; font: inherit; font-weight: 800; box-shadow: 0 8px 24px rgba(0,0,0,.45); cursor: pointer; }
  body.comparison-open { overflow: hidden; }
}