:root {
  color-scheme: dark;
  --bg: #0f1011;
  --panel: rgba(20, 21, 24, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f0e8;
  --muted: #b3aa9a;
  --performance-strong: #4e88ff;
  --performance-very-strong: #ff6b57;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  --radius-sm: 16px;
  --sans: "Segoe UI", "Aptos", system-ui, sans-serif;
  --display: "Aptos Display", "Segoe UI Semibold", "Trebuchet MS", sans-serif;
}

body.theme-light {
  color-scheme: light;
  --bg: #eef6ff;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(86, 126, 184, 0.16);
  --text: #14233d;
  --muted: #5e7598;
  --shadow: 0 24px 80px rgba(60, 94, 148, 0.16);
  background:
    radial-gradient(circle at top left, rgba(85, 220, 202, 0.24), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(137, 186, 255, 0.32), transparent 24%),
    linear-gradient(135deg, #f8fbff 0%, #edf5ff 45%, #dfeeff 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 69, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 210, 120, 0.12), transparent 26%),
    linear-gradient(180deg, #111214 0%, #0a0b0d 100%);
  color: var(--text);
  font-family: var(--sans);
}

body { padding: 20px; }
button, input, select { font: inherit; }

button, .faux-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.8rem 1rem;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(135deg, #ff8857, #ff5f36);
  color: #180f0a;
  border-color: transparent;
  font-weight: 700;
}

.app-shell {
  max-width: 1900px;
  margin: 0 auto;
}

.hero {
  display: block;
  margin-bottom: 18px;
}

.hero-copy, .panel, .stage, .dialog-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy, .stage, .panel { padding: 16px 18px; }

.hero-copy { display: grid; gap: 12px; }

.eyebrow, .visual-kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--accent);
  margin: 0;
}

h1, h2, h3, strong[data-i18n="footerTitle"] {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.95;
}

.lede {
  margin: 6px 0 0;
  max-width: none;
  font-size: clamp(0.98rem, 1.4vw, 1.1rem);
  color: var(--muted);
}

.title-row, .hero-status, .button-row, .dialog-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.header-actions, .toolbar-group, .footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-group {
  align-items: center;
}

.hero-meta {
  margin: 0;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(390px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.canvas-wrap {
  min-width: 0;
  margin-top: 0;
  position: sticky;
  top: 12px;
  z-index: 2;
  align-self: start;
  display: grid;
  gap: 16px;
}

.canvas-frame {
  position: relative;
  min-height: 0;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent), #090a0c;
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(5, 6, 7, 0.4), rgba(5, 6, 7, 0.7));
}

.canvas-overlay[hidden] { display: none; }
.canvas-hint, .panel-head p, .dialog-head p, #projectMetaText, #versionText { color: var(--muted); }

.side-panels {
  display: grid;
  gap: 18px;
  align-content: start;
}

.stage {
  position: static;
  align-self: auto;
}

.desktop-stage-panel {
  display: none;
}

.desktop-quick-actions {
  margin-top: 12px;
}

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

.field-grid > *,
.focus-pairs > *,
.campaign-groups > * {
  min-width: 0;
}

.field-grid.compact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.campaign-groups {
  display: grid;
  gap: 14px;
}

.campaign-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.campaign-group legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.field, .upload-tile {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.field {
  position: relative;
}

.field-strong {
  border-color: color-mix(in srgb, var(--performance-strong) 72%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--performance-strong) 12%, transparent), transparent 48%),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--performance-strong) 82%, transparent);
}

.field-very-strong {
  border-color: color-mix(in srgb, var(--performance-very-strong) 72%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--performance-very-strong) 16%, transparent), transparent 52%),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--performance-very-strong) 88%, transparent);
}

.field-strong::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--performance-strong) 82%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--performance-strong) 14%, transparent);
  pointer-events: none;
}

.field-very-strong::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 11px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: color-mix(in srgb, #ff6b57 88%, white);
  box-shadow:
    0 0 0 3px color-mix(in srgb, #ff6b57 16%, transparent),
    0 0 12px color-mix(in srgb, #ff6b57 28%, transparent);
  pointer-events: none;
}

.upload-tile { min-width: 230px; cursor: pointer; }
.upload-tile input { display: none; }
input[type="range"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
input[type="color"] { inline-size: 100%; block-size: 44px; border: 0; border-radius: 12px; background: transparent; }

.color-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.color-inline .field {
  grid-template-rows: 2.6em 44px auto;
}

.color-inline .field > span {
  line-height: 1.3;
}

.focus-block {
  display: grid;
  gap: 8px;
  margin-top: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.focus-block-head h3,
.focus-block-head p {
  margin: 0;
}

.focus-pairs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.focus-instruction {
  margin: 0 0 12px;
  color: var(--muted);
}

.focus-pair {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.focus-pair legend {
  padding: 0 6px;
  font-weight: 600;
}

.focus-pair-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.focus-pair-top input[type="color"] {
  min-width: 0;
}

.focus-pair .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.focus-swap-control {
  min-width: 0;
}

.focus-swap-control .field {
  grid-column: 1 / -1;
}

.focus-reset-control {
  display: grid;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.focus-reset-button {
  width: 100%;
  justify-self: stretch;
}

.filter-legend {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.filter-legend-title {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.filter-legend-description {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.filter-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.filter-legend-swatch {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.filter-legend-swatch-strong {
  background: var(--performance-strong);
  border: 1px solid color-mix(in srgb, var(--performance-strong) 80%, #2f64d6);
  box-shadow:
    inset 3px 0 0 rgba(255, 255, 255, 0.22),
    0 0 0 3px rgba(78, 136, 255, 0.18);
}

.filter-legend-swatch-very-strong {
  background: color-mix(in srgb, #ff6b57 88%, white);
  border: 1px solid color-mix(in srgb, #ff6b57 52%, var(--line));
  box-shadow:
    inset 4px 0 0 color-mix(in srgb, #ff6b57 88%, transparent),
    0 0 0 3px color-mix(in srgb, #ff6b57 16%, transparent);
}

.button-row + .button-row {
  margin-top: 12px;
}

.text-link { color: var(--text); text-decoration: none; }
.kofi-link img { display: block; height: 42px; }

.dialog { border: 0; padding: 0; background: transparent; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.56); }
.dialog-card { width: min(720px, calc(100vw - 24px)); padding: 20px; }
.dialog-head > div { min-width: 0; }
.dialog-body, .settings-group { display: grid; gap: 14px; }
.settings-group { padding-top: 10px; border-top: 1px solid var(--line); }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.4rem;
  flex: 0 0 auto;
  line-height: 1;
}
.dialog-status { margin: 0; color: var(--muted); }
.dialog-status.loading::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: var(--text);
  animation: spin 0.9s linear infinite;
}

.help-dialog-card { width: min(900px, calc(100vw - 24px)); }
.confirm-dialog-card { width: min(460px, calc(100vw - 24px)); }
.help-content {
  max-height: min(62vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(0,0,0,0.14);
  color: var(--muted);
  line-height: 1.65;
}
.help-content h1, .help-content h2, .help-content h3 { color: var(--text); }
.help-content a { color: inherit; }
.help-content pre, .help-content code { font-family: Consolas, "Courier New", monospace; }
.help-content pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
}

.collapsible {
  position: relative;
  padding: 0;
  overflow: hidden;
}

.panel-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px 10px;
  position: relative;
}

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

.panel-summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 18px;
  color: var(--muted);
  font-size: 1.2rem;
}

.collapsible[open] .panel-summary::after { content: "−"; }

.panel-head h2,
.panel-head p { margin: 0; }

.upload-title,
.field > span,
.panel-summary h2,
.dialog-head h2 {
  font-weight: 600;
}

.field-strong > span {
  color: color-mix(in srgb, var(--performance-strong) 82%, var(--text));
}

.field-very-strong > span {
  color: color-mix(in srgb, var(--performance-very-strong) 84%, var(--text));
}

.panel-body {
  padding: 0 16px 16px;
}

.project-actions {
  justify-content: flex-start;
}

.project-actions > * {
  flex: 1 1 calc(50% - 8px);
  text-align: center;
}

.mobile-image-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mobile-image-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 0.65rem 0.4rem;
  text-align: center;
  font-size: 0.88rem;
}

.mobile-project-panel {
  display: grid;
  gap: 14px;
}

.mobile-project-panel .panel-body {
  padding: 0;
}

.settings-kofi-link {
  display: inline-flex;
  width: fit-content;
}

.share-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.share-qr-image {
  width: 118px;
  height: 118px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: cover;
}

.share-card-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.share-url {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  user-select: all;
}

body.theme-light .canvas-frame {
  background: linear-gradient(135deg, rgba(255,255,255,0.28), transparent), #edf5ff;
}

body.theme-light .help-content {
  background: rgba(232, 242, 255, 0.82);
}

body.theme-light .dialog-status.loading::before {
  border: 2px solid rgba(86, 126, 184, 0.25);
  border-top-color: var(--text);
}

button:disabled,
.secondary:disabled,
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 821px) and (max-width: 1500px) {
  .field-grid.compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 821px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
    min-height: 0;
  }

  .hero { flex: 0 0 auto; }

  .workspace {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }

  .canvas-wrap,
  .side-panels {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .side-panels {
    display: flex;
    flex-direction: column;
  }

  .side-panels > * { flex: 0 0 auto; }

  .canvas-wrap {
    position: static;
    top: auto;
    align-self: stretch;
    align-content: start;
  }

  .canvas-frame { max-height: calc(100dvh - 160px); }
}

@media (min-width: 821px) and (max-width: 1180px) {
  .app-shell {
    height: auto;
    min-height: calc(100dvh - 40px);
  }

  .hero-copy {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .hero-copy > .eyebrow,
  .hero-copy > .hero-meta,
  .hero-copy > .title-row {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .canvas-wrap,
  .side-panels {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .side-panels {
    display: flex;
    flex-direction: column;
  }

  .side-panels > * {
    min-width: 0;
  }

  .field-grid,
  .field-grid.compact-grid,
  .focus-pairs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1181px) {
  .desktop-stage-panel {
    display: block;
  }

  .mobile-project-panel {
    display: none;
  }
}

@media (min-width: 1181px) {
  .workspace {
    grid-template-columns: minmax(560px, 1.5fr) minmax(520px, 1fr);
  }

  .canvas-wrap,
  .side-panels {
    min-width: 0;
  }
}

body.mobile-layout .workspace {
  grid-template-columns: 1fr;
}

body.mobile-layout .app-shell {
  display: block;
  height: auto;
  min-height: 0;
}

body.mobile-layout .workspace {
  height: auto;
  min-height: 0;
  overflow: visible;
}

body.mobile-layout .canvas-wrap,
body.mobile-layout .side-panels {
  height: auto;
  max-height: none;
  overflow: visible;
}

body.mobile-layout .stage {
  position: static;
  align-self: start;
}

body.mobile-landscape .workspace {
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  gap: 16px;
}

body.mobile-landscape .canvas-wrap {
  position: static;
  top: auto;
  align-content: start;
}

body.mobile-landscape .canvas-frame {
  max-height: calc(100dvh - 160px);
}

body.mobile-landscape .app-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 16px);
  height: calc(100dvh - 16px);
  min-height: 0;
}

body.mobile-landscape .workspace {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
  grid-template-rows: minmax(0, 1fr);
}

body.mobile-landscape .canvas-wrap,
body.mobile-landscape .side-panels {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.mobile-landscape .side-panels {
  display: flex;
  flex-direction: column;
}

body.mobile-landscape .side-panels > * { flex: 0 0 auto; }

@media (min-width: 821px) {
  body.mobile-landscape .desktop-stage-panel { display: block; }
  body.mobile-landscape .mobile-project-panel { display: none; }
}

@media (max-width: 820px) and (orientation: portrait) {
  body { padding: 8px; }
  .field-grid, .field-grid.compact-grid, .color-inline { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2.5rem, 15vw, 4.2rem); }
  .header-actions, .toolbar-group, .button-row { width: 100%; }
  .header-actions > *, .toolbar-group > *, .button-row > *, .footer-actions > * { flex: 1 1 100%; text-align: center; }
  .project-actions > * { flex-basis: 100%; }
  .share-card { grid-template-columns: 1fr; }
  .share-qr-image { width: min(180px, 100%); height: auto; aspect-ratio: 1; }
  .canvas-wrap {
    margin: 8px 0 14px;
    position: sticky;
    top: 0;
  }
  .stage {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  .canvas-frame {
    width: 100%;
    margin-inline: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #090a0c;
    max-height: 62svh;
  }
  .hero { margin-bottom: 12px; }
  .hero-copy { padding: 12px; }
  .workspace { gap: 14px; }
  .panel { border-radius: 18px; }
  .panel-summary { padding: 12px 14px 8px; }
  .panel-body { padding: 0 14px 14px; }
  .dialog-head {
    position: relative;
    align-items: flex-start;
    padding-right: 56px;
  }
  .dialog-head .icon-button {
    position: absolute;
    top: 0;
    right: 0;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  body { padding: 8px; }
  body.mobile-landscape .desktop-stage-panel { display: block; }
  body.mobile-landscape .mobile-project-panel { display: none; }
  body.mobile-landscape .app-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    min-height: 0;
  }
  body.mobile-landscape .hero { margin-bottom: 8px; }
  body.mobile-landscape .hero-copy { padding: 8px 12px; gap: 4px; }
  body.mobile-landscape .eyebrow,
  body.mobile-landscape .lede,
  body.mobile-landscape .hero-meta { display: none; }
  body.mobile-landscape h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
  body.mobile-landscape .header-actions { gap: 6px; }
  body.mobile-landscape .header-actions button { min-height: 38px; padding: 0.5rem 0.7rem; }
  body.mobile-landscape .workspace {
    grid-template-columns: minmax(0, 2.1fr) minmax(250px, 0.9fr);
    gap: 8px;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }
  body.mobile-landscape .canvas-wrap,
  body.mobile-landscape .side-panels {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.mobile-landscape .canvas-wrap { position: static; top: auto; align-content: start; }
  body.mobile-landscape .side-panels { display: flex; flex-direction: column; }
  body.mobile-landscape .side-panels > * { flex: 0 0 auto; }
  body.mobile-landscape .field-grid,
  body.mobile-landscape .field-grid.compact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  body.mobile-landscape .focus-pair .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  body.mobile-landscape .canvas-frame { max-height: none; }
}

@media (min-width: 901px) and (max-width: 1180px) and (orientation: landscape) {
  body.mobile-landscape .app-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    min-height: 0;
  }

  body.mobile-landscape .workspace {
    grid-template-columns: minmax(0, 2.1fr) minmax(270px, 0.9fr);
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }

  body.mobile-landscape .canvas-wrap,
  body.mobile-landscape .side-panels {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body.mobile-landscape .canvas-wrap { position: static; top: auto; }
  body.mobile-landscape .side-panels { display: flex; flex-direction: column; }
  body.mobile-landscape .side-panels > * { flex: 0 0 auto; }
  body.mobile-landscape .field-grid,
  body.mobile-landscape .field-grid.compact-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body.mobile-landscape .focus-pair .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  body.mobile-landscape .canvas-frame { max-height: none; }
}

@media (max-width: 1180px) and (orientation: landscape) {
  body.mobile-landscape button,
  body.mobile-landscape .faux-button {
    min-height: 38px;
    padding: 0.4rem 1rem;
  }

  body.mobile-landscape .header-actions button {
    padding: 0.4rem 1rem;
  }

  body.mobile-landscape .canvas-wrap {
    gap: 6px;
  }

  body.mobile-landscape .side-panels {
    gap: 6px;
  }

  body.mobile-landscape .panel-summary {
    padding: 8px 8px 6px;
  }

  body.mobile-landscape .panel-summary::after {
    right: 8px;
    top: 8px;
  }

  body.mobile-landscape .panel-body {
    padding: 0 8px 8px;
  }

  body.mobile-landscape .filter-legend {
    gap: 4px;
    margin-bottom: 6px;
    padding: 8px;
  }

  body.mobile-landscape .field-grid,
  body.mobile-landscape .field-grid.compact-grid,
  body.mobile-landscape .campaign-groups,
  body.mobile-landscape .focus-pairs {
    gap: 6px;
  }

  body.mobile-landscape .field {
    gap: 4px;
    padding: 6px 8px;
  }

  body.mobile-landscape .focus-instruction {
    margin-bottom: 6px;
  }

  body.mobile-landscape .focus-pair {
    gap: 6px;
    padding: 6px;
  }

  body.mobile-landscape .focus-pair-top {
    gap: 6px;
  }
}
