@font-face {
  font-family: "Rund Text";
  src: url("assets/fonts/rund-text.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rund Text";
  src: url("assets/fonts/rund-text-extrabold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rund Display";
  src: url("assets/fonts/rund-display.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --panel: #ffffff;
  --panel-soft: #ebebf6;
  --ink: #3232a0;
  --muted: #6767b5;
  --line: #3232a0;
  --accent: #46cf8a;
  --accent-dark: #2eaa6b;
  --danger: #d65350;
  --wall: #3232a0;
  --cube: #46cf8a;
  --lightblue: #a0dce6;
  --rose: #f5b4d2;
  --yellow: #fff482;
  --ral-blue-5002: #20214f;
  --ral-pink-3015: #e8aabf;
  --ral-white: #f1eee8;
  --ral-blue-edge: #111233;
  --ral-pink-edge: #a85f78;
  --ral-white-edge: #b9b5ad;
  --seat-blue: #7e9fd5;
  --seat-red: #d33536;
  --bank-pink: #c97896;
  --bank-edge: #b76382;
  --aluminium: #aeb4b8;
  --chair-base: #4b4f52;
  --stage-floor: #111214;
  --stage-wall: #252628;
  --stage-detail: #686a6d;
  --pdf-soft: #f3f3f9;
  --pdf-grid-minor: #dadaec;
  --pdf-grid-major: #b7b7d8;
  --pdf-seat-edge: #55556f;
  --variant-inactive: #dedeee;
  --surface-neutral: #f8f8fc;
  --surface-selected: #dcf7e9;
  --type-leading-body: 1.5;
  --type-leading-heading: 1.2;
  --type-leading-compact: 1.35;
  --type-tracking-normal: normal;
  --type-tracking-meta: 0.01875rem;
  font-family: "Rund Text", "Arial Rounded MT Bold", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--variant-inactive);
  color: var(--ink);
  font-weight: 300;
  font-kerning: normal;
  letter-spacing: var(--type-tracking-normal);
  line-height: var(--type-leading-body);
}

@media (any-pointer: coarse) {
  .editor-shell,
  .editor-shell * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .editor-shell input,
  .editor-shell textarea,
  .editor-shell [contenteditable="true"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
  }

  .editor-shell img {
    -webkit-user-drag: none;
  }
}

h1,
h2,
h3 {
  line-height: var(--type-leading-heading);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid currentColor;
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: var(--ink);
  background: var(--lightblue);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(520px, 1fr) 310px;
  height: 100vh;
  min-height: 0;
}

.panel {
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
}

.left {
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.right {
  border-left: 1px solid var(--line);
  min-height: 0;
}

.right .inspector {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.variants-section {
  flex: 0 0 auto;
  max-height: 42vh;
  overflow: auto;
}

.variants-section .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.variant-add,
.variant-action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
}

.variant-add {
  border-radius: 50%;
  background: var(--accent);
  font-size: 20px;
}

.variant-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 28px);
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  background: white;
}

.variant-row.active {
  box-shadow: inset 5px 0 0 var(--accent);
  background: #e7faef;
}

.variant-row[draggable="true"] {
  cursor: grab;
}

.variant-select {
  min-width: 0;
  min-height: 28px;
  overflow: hidden;
  border: 0;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-action {
  border: 0;
  background: transparent;
  font-size: 16px;
}

.variant-delete {
  color: var(--danger);
}

.variant-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  color: var(--ink);
}

.variant-dialog::backdrop {
  background: rgba(32, 33, 79, 0.42);
}

.variant-dialog form,
.variant-dialog fieldset {
  display: grid;
  gap: 12px;
}

.variant-dialog h2 {
  margin: 0;
}

.imprint-dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.imprint-dialog form { gap: 20px; }
.imprint-sections { display: grid; gap: 18px; }
.imprint-sections section { display: grid; gap: 5px; }
.imprint-sections h3 { margin: 0; font-size: 14px; }
.imprint-sections p,
.imprint-sections address { margin: 0; color: var(--muted); font-style: normal; line-height: var(--type-leading-body); }
.imprint-sections a { color: var(--ink); text-underline-offset: 3px; }

#variant-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

#variant-dialog fieldset {
  grid-template-columns: minmax(0, 1.55fr) minmax(270px, 1fr);
  align-items: start;
  gap: 16px;
}

#variant-dialog .variant-tribune-preview {
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  background: var(--stage-floor);
}

#variant-dialog .variant-tribune-preview .tribune-plan-preview {
  width: 100%;
  height: auto;
  aspect-ratio: 196 / 140;
}

#variant-dialog .variant-tribune-options {
  display: grid;
  gap: 12px;
}

#variant-dialog .variant-tribune-choice-list {
  display: grid;
  gap: 8px;
}

#variant-dialog .tribune-choice {
  grid-template-columns: 20px minmax(0, 1fr);
  min-height: 62px;
  padding: 8px 10px;
  border: 1px solid var(--line);
}

#variant-dialog .tribune-choice:has(input:checked) {
  border-color: var(--accent-dark);
  background: var(--surface-selected);
  box-shadow: inset 0 0 0 1px var(--accent-dark);
}

@media (max-width: 599px) {
  #variant-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  #variant-dialog fieldset { grid-template-columns: 1fr; gap: 10px; }
  #variant-dialog .variant-tribune-choice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #variant-dialog .tribune-choice {
    grid-template-columns: 18px minmax(0, 1fr);
    min-height: 92px;
    padding: 7px;
  }
}

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

.welcome-dialog {
  width: min(860px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  overflow: hidden;
}
.welcome-dialog::backdrop,
.help-dialog::backdrop { background: rgba(20, 21, 61, .62); }
.welcome-dialog[open] { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(360px, 1.2fr); }
.welcome-art {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 38px);
  background: var(--accent);
}
.welcome-cube { width: min(100%, 440px); height: auto; overflow: visible; }
.welcome-cube-shadow { fill: rgb(22 23 61 / .16); stroke: none; }
.welcome-cube-top,
.welcome-cube-white-side,
.welcome-cube-pink-side {
  transform-box: fill-box;
  transform-origin: center;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.welcome-dialog[open] .welcome-cube-white-side { animation: welcome-cube-slide-from-left 2200ms cubic-bezier(.16, 1, .3, 1) backwards; }
.welcome-dialog[open] .welcome-cube-pink-side { animation: welcome-cube-slide-from-right 2200ms cubic-bezier(.16, 1, .3, 1) 140ms backwards; }
.welcome-dialog[open] .welcome-cube-top { animation: welcome-cube-slide-from-top 2200ms cubic-bezier(.16, 1, .3, 1) 420ms backwards; }
@keyframes welcome-cube-slide-from-left {
  from { opacity: 0; transform: translateX(-90px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes welcome-cube-slide-from-right {
  from { opacity: 0; transform: translateX(90px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes welcome-cube-slide-from-top {
  from { opacity: 0; transform: translateY(-70px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-cube-top { fill: url("#welcome-cube-tiles"); }
.welcome-cube-white-side { fill: #eeeae7; }
.welcome-cube-pink-side { fill: #e8aabf; }
.welcome-cube-tile-grout { fill: #e8aabf; }
.welcome-cube-tile { fill: #20214f; }
.welcome-content { display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: clamp(32px, 6vw, 68px); }
.welcome-kicker { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: var(--type-tracking-meta); text-transform: uppercase; }
.welcome-content h2 { max-width: 520px; margin: 0; font-family: "Rund Display", sans-serif; font-size: clamp(36px, 5vw, 58px); }
.welcome-content p { max-width: 520px; margin: 0; font-size: 17px; line-height: var(--type-leading-body); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.welcome-actions button { min-height: 44px; padding: 0 18px; }

.help-dialog {
  width: min(1040px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  overflow: hidden;
}
.manual-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.manual-header { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 24px 28px 18px; border-bottom: 1px solid var(--line); }
.manual-header h2 { margin: 2px 0 0; font-family: "Rund Display", sans-serif; font-size: 36px; }
.manual-search { grid-column: 1 / -1; }
.manual-search input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); }
.manual-layout { display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); min-height: 0; }
.manual-nav { display: flex; flex-direction: column; gap: 2px; padding: 18px; border-right: 1px solid var(--line); overflow-y: auto; }
.manual-nav button {
  flex: 0 0 auto;
  min-height: 34px;
  height: auto;
  padding: 7px 10px;
  border-color: transparent;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: var(--type-leading-compact);
}
.manual-nav button[aria-current="true"] { border-color: var(--line); background: var(--surface-selected); }
.manual-content { padding: 28px clamp(24px, 5vw, 60px) 50px; overflow-y: auto; scroll-behavior: smooth; }
.manual-content section { max-width: 680px; }
.manual-content section + section { margin-top: 52px; padding-top: 4px; border-top: 1px solid var(--variant-inactive); }
.manual-content h3 { margin: 0 0 14px; font-family: "Rund Display", sans-serif; font-size: 28px; }
.manual-content p,
.manual-content li,
.manual-reference dd { line-height: var(--type-leading-body); }
.manual-content mark { background: var(--yellow); color: inherit; }
.manual-reference { display: grid; grid-template-columns: minmax(130px, .7fr) 1.3fr; gap: 10px 20px; }
.manual-reference dt { font-weight: 700; }
.manual-reference dd { margin: 0; }
.manual-empty { font-weight: 700; }
.manual-footer { display: flex; justify-content: space-between; gap: 10px; padding: 14px 28px; border-top: 1px solid var(--line); }
.manual-tour-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#recovery-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
#recovery-form > p { margin: 0; }
#recovery-list { display: grid; gap: 12px; margin: 8px 0; padding: 0; border: 0; }
#recovery-list[hidden], #recovery-continue[hidden] { display: none; }
#recovery-list legend { margin-bottom: 12px; }
#recovery-list label { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--line); cursor: pointer; }
#recovery-list label:has(input:checked) { border-color: var(--accent); }
#recovery-list span { min-width: 0; overflow-wrap: anywhere; }
#recovery-list strong, #recovery-list small { display: block; }
#recovery-list small { margin-top: 4px; color: var(--muted); }
.recovery-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
#recovery-error { color: var(--danger); }
.tutorial-layer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tutorial-layer[hidden] { display: none; }
body.tutorial-modal-open .tutorial-layer { display: none; }
.tutorial-shade { position: fixed; z-index: 1; background: rgba(20, 21, 61, .7); pointer-events: auto; }
.tutorial-shade[hidden] { display: none; }
.tutorial-focus { position: fixed; z-index: 2; border: 3px solid var(--yellow); box-shadow: 0 0 0 4px rgba(255, 244, 130, .25); pointer-events: none; }
.tutorial-layer.is-advancing .tutorial-focus { pointer-events: auto; }
.tutorial-focus[hidden] { display: none; }
.tutorial-card { position: fixed; z-index: 3; width: min(390px, calc(100vw - 24px)); padding: 24px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgba(17, 18, 51, .28); pointer-events: auto; }
.tutorial-title-row { display: flex; align-items: baseline; gap: 9px; padding-right: 28px; }
.tutorial-card h2 { margin: 6px 0 8px; font-family: "Rund Display", sans-serif; font-size: 26px; }
.tutorial-card p { margin: 0; line-height: var(--type-leading-body); }
.tutorial-progress { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: var(--type-tracking-meta); text-transform: uppercase; }
.tutorial-close { position: absolute; top: 10px; right: 10px; min-width: 34px; border-color: transparent; font-size: 24px; }
.tutorial-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.tutorial-actions button:first-child { margin-right: auto; }
.tutorial-actions button { min-width: 82px; }
.tutorial-completion { color: var(--accent-dark); font-size: 24px; font-weight: 800; line-height: 1; }
.tutorial-completion[hidden] { display: none; }
@media (max-width: 700px) {
  .welcome-dialog[open] { display: block; }
  .welcome-art { min-height: 190px; padding: 12px 24px; }
  .welcome-cube { max-height: 210px; }
  .welcome-content { padding: 28px 24px; }
  .welcome-content h2 { font-size: 38px; }
  .welcome-actions { flex-direction: column; }
  .help-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .manual-header { padding: 18px 18px 14px; }
  .manual-header h2 { font-size: 30px; }
  .manual-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .manual-nav { flex-direction: row; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .manual-nav button { flex: 0 0 auto; white-space: nowrap; }
  .manual-content { padding: 24px 20px 40px; }
  .manual-reference { grid-template-columns: 1fr; gap: 4px; }
  .manual-reference dd + dt { margin-top: 10px; }
  .manual-footer { align-items: flex-end; padding: 12px 18px; }
  .manual-tour-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-dialog[open] .welcome-cube-top,
  .welcome-dialog[open] .welcome-cube-white-side,
  .welcome-dialog[open] .welcome-cube-pink-side { animation: none; }
  .manual-content { scroll-behavior: auto; }
}

.share-dialog { width: min(680px, calc(100vw - 32px)); }
.share-dialog p { margin: 0; color: var(--muted); line-height: var(--type-leading-body); }
.share-dialog label { color: var(--muted); font-size: 12px; font-weight: 700; }
.share-dialog textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 8px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
#edit-shared-dialog p { margin: 0; color: var(--muted); line-height: var(--type-leading-body); }

.variant-dialog input[type="text"],
.variant-dialog > form > input,
#variant-name-control input {
  height: 38px;
  border: 1px solid var(--line);
  padding: 0 8px;
}

#variant-name-control { display: grid; gap: 6px; }
#variant-name-control[hidden] { display: none; }

.variant-dialog fieldset {
  border: 1px solid var(--line);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-button-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid currentColor;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.dialog-button-link:hover { background: var(--lightblue); }
.dialog-button-link[hidden] { display: none; }
.share-dialog .dialog-actions { flex-wrap: wrap; }

.brand,
.section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.left > .brand {
  border-top: 10px solid var(--accent);
}

.right > .brand {
  border-top: 10px solid var(--lightblue);
}

.left > .brand,
.left > .section:not(.inventory-section) {
  flex: 0 0 auto;
}

.inventory-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border-bottom: 0;
}

.brand h1 {
  margin: 0 0 5px;
  font-family: "Rund Display", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

/*.brand h1::after {
  content: "*";
  color: var(--accent);
  margin-left: 4px;
}*/

.right .brand h1::after {
  color: var(--lightblue);
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.production-field {
  display: grid;
  gap: 5px;
  margin-top: 14px;
}

.production-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.production-field input {
  width: 100%;
  height: 38px;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 0 2px;
  background: white;
  color: var(--ink);
}

.production-field input:focus {
  border-color: var(--accent);
  outline: 3px solid var(--lightblue);
  outline-offset: 2px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.inventory {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-gutter: stable;
}

.catalog {
  flex: 1 1 auto;
}

.locked-parts-empty { padding: 16px 4px; }

.catalog-group {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.catalog-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.catalog.tutorial-inventory-restricted .catalog-group.tutorial-inventory-disabled {
  opacity: 0.32;
  filter: grayscale(0.7);
}

.catalog-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 30px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.catalog-group-title:hover { background: var(--panel-soft); }
.catalog-group-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.catalog-group-heading { display: flex; align-items: center; gap: 6px; min-width: 0; }
.catalog-group-chevron {
  display: inline-grid;
  flex: 0 0 14px;
  place-items: center;
  width: 14px;
  height: 14px;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}
.catalog-group-chevron .ui-icon { width: 14px; height: 14px; }
.catalog-group-title[aria-expanded="true"] .catalog-group-chevron { transform: rotate(90deg); }
.catalog-group-items { display: grid; gap: 8px; }
.catalog-group-items[hidden] { display: none; }

.inventory-actions {
  flex: 0 0 auto;
  margin-top: 10px;
}

.catalog-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface-neutral);
  color: var(--ink);
  text-align: left;
}

.catalog-row.is-placed {
  box-shadow: inset 5px 0 0 var(--accent);
  background: var(--panel);
}

.catalog-row:hover {
  background: var(--lightblue);
}

.catalog-row[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: inset 5px 0 0 var(--accent);
  background: var(--surface-selected);
}

.catalog-preview {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: white;
}

.catalog-preview-image {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  user-select: none;
}

.catalog-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
}
.read-only-mode .catalog-row { grid-template-columns: 46px minmax(0, 1fr); }
.read-only-mode .catalog-actions { display: none; }

.catalog-remove {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: white;
  color: var(--danger);
  font-size: 18px;
  line-height: 1;
}

.ui-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.ui-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.catalog-add {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.part-row {
  display: grid;
  grid-template-columns: 38px 1fr auto 34px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  text-align: left;
  background: white;
}

.part-row[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: inset 5px 0 0 var(--accent);
  background: var(--surface-selected);
}

.symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 0;
  color: white;
  font-size: 18px;
  font-weight: 800;
}

.symbol.wall {
  background: var(--ink);
}

.symbol.cube {
  background: var(--accent);
  color: var(--ink);
}

.part-name {
  min-width: 0;
}

.part-name strong,
.part-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-name strong {
  font-size: 14px;
  line-height: 1.2;
}

.part-name span,
.part-state {
  color: var(--muted);
  font-size: 12px;
}

.control-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.control-line output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 10px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.switch[hidden] { display: none; }

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.text-button {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: white;
}

.danger {
  color: var(--danger);
}

.danger-primary {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.danger-primary:hover {
  border-color: #a93d3a;
  background: #a93d3a;
  color: white;
}

.destructive-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.viewer {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-soft);
}

#scene {
  display: block;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  outline: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: 8px 8px 0 rgba(50, 50, 160, 0.12);
}

.topbar strong {
  font-size: 14px;
  white-space: nowrap;
}

.status {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-buttons {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  width: var(--view-controls-width);
}

.view-buttons button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.view-buttons button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.view-buttons button[aria-pressed="true"]:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: white;
}

.view-buttons button:focus-visible {
  outline: 3px solid var(--lightblue);
  outline-offset: 2px;
}

.hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  max-width: 560px;
  padding: 9px 12px;
  border-radius: 0;
  background: rgba(50, 50, 160, 0.94);
  color: white;
  font-size: 13px;
  line-height: 1.35;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 68px;
  z-index: 4;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 0;
  background: var(--accent);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.toast.visible {
  opacity: 1;
}

.inspector {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.empty {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.inspector h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font-family: "Rund Display", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.part-lock-status {
  color: var(--muted);
  font-family: "Rund Text", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 38px;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 0 2px;
  background: white;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.field input.invalid {
  border-color: var(--danger);
  background: #fff4f1;
  box-shadow: 0 0 0 2px rgba(163, 59, 47, 0.14);
}

.form-feedback {
  min-height: 18px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

.metric-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.metric-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.metric-list span:last-child {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 1050px) {
  .app {
    grid-template-columns: 280px minmax(460px, 1fr);
  }

  .right {
    position: absolute;
    right: 12px;
    top: 76px;
    bottom: 12px;
    width: min(310px, calc(100vw - 320px));
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(31, 39, 42, 0.16);
  }
}

@media (min-width: 600px) and (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app {
    display: block;
    height: auto;
    min-height: 0;
  }

  .panel {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .left {
    overflow: visible;
  }

  .inventory-section {
    flex: none;
  }

  .inventory {
    max-height: 360px;
  }

  .viewer {
    height: 72vh;
    min-height: 520px;
  }

  .right {
    position: static;
    width: auto;
    box-shadow: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hint {
    right: 14px;
  }
}

/* Compact editor: active on tablets and narrow desktop viewports. */
html.compact-ui {
  --compact-touch-target-size: 44px;
  --compact-statusbar-height: 44px;
  --compact-viewer-control-gap: 12px;
}

.compact-sidebar-toggle,
.compact-sidebar-close,
.compact-sidebar-backdrop,
.compact-history-controls,
.mobile-toolbar-button,
.mobile-toolbar-menu {
  display: none;
}

.mobile-bottom-toolbar { display: none; }
html.compact-ui .mobile-bottom-toolbar { display: contents; }

#mobile-notes-open { display: none; }
.mobile-menu-separator { display: none; }

html.compact-ui body {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

html.compact-ui .editor-shell {
  height: 100dvh;
  min-height: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

html.compact-ui .editor-shell button,
html.compact-ui .editor-shell summary,
html.compact-ui .editor-shell label {
  touch-action: none;
}

html.compact-ui .inventory button {
  touch-action: pan-y;
}

html.compact-ui .audience-view-controls,
html.compact-ui .audience-view-controls output {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

html.compact-ui .editor-shell input,
html.compact-ui .editor-shell textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

html.compact-ui .editor-shell .app {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: 0;
}

html.compact-ui .project-brand span {
  display: none;
}

html.compact-ui .project-header {
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
}

html.compact-ui .workspace-panel {
  position: absolute;
  z-index: 16;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(360px, calc(100vw - 64px));
  padding-top: 0;
  border: 0;
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 30px rgba(31, 39, 42, .22);
  transform: translateX(calc(-100% - 16px));
  transition: transform 180ms ease;
  visibility: hidden;
}

html.compact-ui .workspace-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

html.compact-ui .compact-sidebar-toggle {
  position: absolute;
  z-index: 14;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  display: block;
  min-width: 108px;
  min-height: 44px;
  padding: 0 14px;
  border-color: var(--ink);
  background: rgba(255, 255, 255, .96);
}

html.compact-ui .compact-sidebar-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

html.compact-ui .compact-sidebar-toggle[aria-expanded="true"] {
  background: var(--ink);
  color: white;
}

html.compact-ui .compact-history-controls {
  position: absolute;
  z-index: 14;
  bottom: calc(var(--compact-statusbar-height) + var(--compact-viewer-control-gap));
  left: calc(12px + env(safe-area-inset-left));
  display: flex;
  gap: 6px;
}

html.compact-ui .compact-history-controls .icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

html.compact-ui .header-actions #undo,
html.compact-ui .header-actions #redo {
  display: none;
}

html.compact-ui .compact-sidebar-toggle:hover {
  border-color: var(--ink);
  background: var(--lightblue);
  color: var(--ink);
}

html.compact-ui .compact-sidebar-toggle[aria-pressed="true"]:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: white;
}

html.compact-ui .compact-sidebar-toggle[aria-expanded="true"]:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: white;
}

html.compact-ui .compact-sidebar-toggle:focus-visible {
  outline: 3px solid var(--lightblue);
  outline-offset: 2px;
}

html.compact-ui .compact-sidebar-close {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
}

html.compact-ui #properties-close {
  display: none;
}

html.compact-ui .compact-sidebar-backdrop {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: rgba(32, 33, 79, .24);
}

html.compact-ui .compact-sidebar-backdrop[hidden] {
  display: none;
}

html.compact-ui .stage-workspace {
  height: 100%;
}

html.compact-ui .editor-shell .viewer {
  height: auto;
  min-height: 0;
}

html.compact-ui button,
html.compact-ui .variant-menu summary {
  min-height: 44px;
}

html.compact-ui .icon-button,
html.compact-ui .panel-close,
html.compact-ui .selection-tools > button,
html.compact-ui .inspector-selection-tools > button,
html.compact-ui #audience-view-previous,
html.compact-ui #audience-view-next {
  width: 44px;
  min-width: 44px;
  height: 44px;
}

html.compact-ui .seating-rules-button {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  aspect-ratio: 1;
}

html.compact-ui .canvas-toolbar {
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
}

html.compact-ui .canvas-settings {
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(var(--compact-statusbar-height) + var(--compact-viewer-control-gap));
}

html.compact-ui .view-buttons button,
html.compact-ui .grid-menu-toggle,
html.compact-ui .tribune-menu-toggle,
html.compact-ui .audience-view-controls,
html.compact-ui .audience-view-controls button {
  height: var(--compact-touch-target-size);
  min-height: var(--compact-touch-target-size);
}

html.compact-ui .audience-view-controls output {
  min-width: 44px;
}

html.compact-ui .statusbar {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  height: var(--compact-statusbar-height);
  min-height: var(--compact-statusbar-height);
  padding-top: 0;
  padding-right: calc(14px + env(safe-area-inset-right));
  padding-bottom: 0;
  padding-left: calc(14px + env(safe-area-inset-left));
}

html.compact-ui #status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.compact-ui #scene-summary {
  display: none;
}

html.compact-ui .catalog-add,
html.compact-ui .catalog-remove {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

html.compact-ui #scene {
  touch-action: none;
}

@media (max-width: 860px) {
  html.compact-ui .canvas-toolbar {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

}

@media (orientation: portrait) and (min-width: 600px) {
  html.compact-ui .project-header {
    grid-template-columns: minmax(210px, .9fr) minmax(220px, 1.1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "brand notes actions"
      "production notes actions"
      "locked locked locked";
    align-items: stretch;
  }

  html.compact-ui .project-brand {
    align-self: start;
    padding: 6px 12px 2px;
  }

  html.compact-ui .project-brand h1 {
    font-size: 14px;
    line-height: 1.1;
  }

  html.compact-ui .header-production {
    align-self: start;
    padding: 0 12px 6px;
  }

  html.compact-ui .header-production label {
    display: none;
  }

  html.compact-ui .header-production input {
    height: 34px;
  }

  html.compact-ui .header-notes {
    align-self: stretch;
    width: 100%;
    padding: 6px 8px;
  }

  html.compact-ui .header-notes-toggle {
    height: 100%;
    min-height: 58px;
  }

  html.compact-ui .header-actions {
    align-self: center;
    padding: 6px 10px;
  }

  html.compact-ui .header-actions #undo,
  html.compact-ui .header-actions #redo {
    display: none;
  }
}

@media (orientation: landscape) and (min-width: 600px) and (min-height: 600px) {
  html.compact-ui .project-header {
    grid-template-columns:
      minmax(170px, 220px)
      minmax(180px, 1fr)
      minmax(220px, 1.2fr)
      minmax(0, .3fr)
      auto;
    grid-template-areas: "brand production notes locked actions";
    align-items: center;
  }

  html.compact-ui .project-brand {
    padding: 8px 12px;
  }

  html.compact-ui .project-brand h1 {
    font-size: 16px;
  }

  html.compact-ui .header-production {
    padding: 6px 10px;
  }

  html.compact-ui .header-notes {
    width: 100%;
    padding: 6px 8px;
  }

  html.compact-ui .header-actions {
    padding: 6px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.compact-ui .workspace-panel {
    transition: none;
  }
}

/* Desktop editor layout */
.editor-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.project-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 310px minmax(240px, 320px) minmax(240px, 280px) minmax(16px, 1fr) auto;
  grid-template-areas: "brand production notes locked actions";
  align-items: center;
  border-top: 10px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.project-brand {
  grid-area: brand;
  padding: 6px 16px;
  align-self: start;
}

.project-brand h1 {
  margin: 0;
  font-family: "Rund Display", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: clamp(25px, 1.7vw, 30px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-align: left;
  text-wrap: balance;
}

@media (min-width: 1051px) {
  .project-brand {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
  }

  .project-brand span {
    display: block;
    line-height: 1.3;
  }
}

.project-brand span,
.header-production label,
.panel-view-heading span {
  color: var(--muted);
  font-size: 12px;
}

.header-production {
  position: relative;
  grid-area: production;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 2px;
  width: 100%;
  padding: 6px 16px;
}

.header-production label { font-weight: 700; }
.production-name-input { position: relative; min-width: 0; }
.production-name-input input { width: 100%; }
.project-timestamps {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}
.project-timestamps span { display: block; white-space: nowrap; }
.project-timestamps-mobile { display: none; }

html.compact-ui .project-timestamps { display: none; }
html.compact-ui .project-timestamps-mobile {
  display: block;
  margin: 0;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 300;
  line-height: var(--type-leading-compact);
  white-space: normal;
}
.project-lock-icon {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--ink);
  pointer-events: none;
}
.project-lock-icon[hidden] { display: none; }
.read-only-mode .production-name-input input { padding-right: 32px; }
.project-provenance {
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 300;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-provenance:hover { border: 0; background: transparent; color: var(--ink); }
.project-provenance-popover {
  position: absolute;
  z-index: 95;
  top: calc(100% - 3px);
  left: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31,39,42,.18);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}
.project-provenance-popover[hidden] { display: none; }

.header-production input {
  height: 36px;
  border: 0;
  border-bottom: 2px solid var(--line);
  padding: 0 4px;
  color: var(--ink);
}

.header-notes {
  position: relative;
  grid-area: notes;
  width: min(280px, 100%);
  min-width: 0;
  padding: 6px 12px;
}

.header-notes-toggle {
  display: grid;
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  text-align: left;
}

.header-notes-toggle > span:first-child {
  color: var(--muted);
  font-size: 12px;
}

.header-notes-preview {
  overflow: hidden;
  font-size: 13px;
  font-weight: 300;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-notes-panel {
  position: absolute;
  z-index: 90;
  top: calc(100% - 1px);
  right: auto;
  left: 12px;
  display: grid;
  gap: 6px;
  width: min(520px, calc(100vw - 24px));
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31,39,42,.18);
}

.header-notes-panel[hidden] { display: none; }
.header-notes-panel label { color: var(--muted); font-size: 12px; font-weight: 700; }
.header-notes-panel textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 8px;
  color: var(--ink);
}
.header-notes-panel textarea:focus { outline: 3px solid var(--lightblue); outline-offset: 1px; }
.header-notes-counter { color: var(--muted); font-size: 11px; text-align: right; }

.share-view-status {
  grid-area: locked;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.share-view-status[hidden] { display: none; }
.share-view-status span { line-height: 1.3; white-space: nowrap; }
.share-view-status button { flex: 0 0 auto; white-space: nowrap; }
.read-only-mode .project-header { border-top-color: var(--yellow); }

html.compact-ui .share-view-status { justify-content: flex-start; }

.header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
}

.header-more { position: relative; }
.header-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31,39,42,.18);
}
.header-menu[hidden] { display: none; }
.header-menu button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  text-align: left;
}
.header-menu #pdf-export {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-menu hr {
  width: 100%;
  margin: 5px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.header-menu .header-menu-danger { color: var(--danger); }

.variant-bar {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 52px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.variant-scroll {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-end;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}

html.compact-ui .variant-scroll,
html.compact-ui .variant-scroll button,
html.compact-ui .variant-scroll summary {
  touch-action: pan-x;
}

.variant-bar .variant-list {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  align-items: stretch;
  gap: 0;
  margin: 0;
  overflow: visible;
}

.variant-bar .variant-add {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  align-self: center;
  width: auto;
  height: 36px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--accent-dark);
  border-radius: 0;
  background: var(--accent);
  color: var(--ink);
  font-size: 13px;
  margin-left: 8px;
  white-space: nowrap;
}

.variant-bar .variant-add:hover {
  background: var(--accent-dark);
  color: white;
}

.variant-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  flex: 0 0 auto;
  width: fit-content;
  min-width: 104px;
  max-width: 220px;
  gap: 0;
  padding: 0;
  min-height: 45px;
  border: 0;
  border-right: 1px solid var(--pdf-grid-major);
  background: var(--surface-neutral);
}

.variant-row:first-child {
  border-left: 1px solid var(--pdf-grid-major);
}

.variant-row.active {
  z-index: 1;
  margin-bottom: -1px;
  border-bottom: 1px solid var(--panel);
  box-shadow: inset 0 4px 0 var(--accent);
  background: var(--panel);
}

.variant-row.dragging {
  opacity: .52;
}

.variant-row.drop-before::before,
.variant-row.drop-after::after {
  position: absolute;
  z-index: 3;
  top: 3px;
  bottom: 3px;
  width: 3px;
  background: var(--accent-dark);
  content: "";
  pointer-events: none;
}

.variant-row.drop-before::before { left: -2px; }
.variant-row.drop-after::after { right: -2px; }

.variant-row:hover,
.variant-row:focus-within {
  background: var(--lightblue);
}

.variant-row.active:hover,
.variant-row.active:focus-within {
  border-bottom-color: var(--lightblue);
}

.variant-row:hover .variant-select,
.variant-row:hover .variant-menu summary,
.variant-row:focus-within .variant-select,
.variant-row:focus-within .variant-menu summary {
  background: transparent;
}

.variant-select {
  width: auto;
  min-width: 0;
  max-width: 190px;
  min-height: 45px;
  padding: 0 6px 0 9px;
}

.variant-name-input {
  field-sizing: content;
  width: auto;
  min-width: 74px;
  max-width: 190px;
  height: 45px;
  padding: 0 6px 0 9px;
  border: 0;
  border-bottom: 2px solid var(--accent-dark);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
}

.variant-name-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.variant-menu {
  position: relative;
  display: block;
  width: 30px;
  visibility: hidden;
  pointer-events: none;
}
.variant-row.active .variant-menu {
  visibility: visible;
  pointer-events: auto;
}
.variant-row.is-renaming .variant-menu {
  visibility: hidden;
  pointer-events: none;
}
.variant-menu summary {
  display: grid;
  place-items: center;
  width: 30px;
  height: 44px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.variant-menu summary::-webkit-details-marker { display: none; }
.variant-menu-popover {
  position: fixed;
  z-index: 50;
  display: grid;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 12px 30px rgba(31, 39, 42, .18);
}
.variant-menu-popover button {
  min-height: 34px;
  border: 0;
  text-align: left;
}
.variant-menu-popover .variant-menu-icon-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
}
.variant-menu-icon-item .ui-icon {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 17px;
  height: 17px;
}
.variant-menu-icon-item span {
  grid-column: 1;
  grid-row: 1;
}

.editor-shell .app {
  grid-template-columns: 310px minmax(0, 1fr);
  height: auto;
  min-height: 0;
}

.stage-workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.viewer-stack {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-panel { min-height: 0; overflow: hidden; }
.audience-control-mode .editor-shell .app {
  grid-template-columns: minmax(0, 1fr);
}
.audience-control-mode .workspace-panel,
.audience-control-mode .compact-sidebar-toggle,
.audience-control-mode .compact-sidebar-backdrop {
  display: none;
}
html.compact-ui body.audience-control-mode .workspace-panel,
html.compact-ui body.audience-control-mode .compact-sidebar-toggle,
html.compact-ui body.audience-control-mode .compact-sidebar-backdrop {
  display: none;
}
.panel-view { display: none; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.panel-view.active { display: flex; flex-direction: column; }
.panel-view-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-view-title { display: grid; gap: 3px; min-width: 0; }
.panel-view-heading strong { font-size: 19px; }
.panel-close {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
  font-size: 21px;
}
.workspace-panel .inspector { overflow: auto; }
.workspace-panel .inspector > .section:last-child { border-bottom: 0; }
.editor-shell .viewer { min-width: 0; min-height: 0; }
.canvas-toolbar {
  --view-controls-width: 300px;
  position: absolute;
  z-index: 12;
  top: 16px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.canvas-settings {
  position: absolute;
  z-index: 12;
  right: 18px;
  bottom: 54px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.editor-shell .view-buttons { position: static; display: flex; }
.audience-view-controls {
  display: flex;
  align-items: center;
  width: auto;
  height: 30px;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 6px 6px 0 rgba(50, 50, 160, 0.12);
}
.audience-view-controls[hidden] { display: none; }
.canvas-toolbar.audience-view-mode {
  display: grid;
  grid-template-columns: auto;
  justify-items: end;
}
.canvas-toolbar.audience-view-mode .view-buttons { grid-row: 1; }
.canvas-toolbar.audience-view-mode .audience-view-controls { grid-row: 2; }
.audience-view-controls button {
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 700;
}
#audience-view-previous,
#audience-view-next {
  display: grid;
  place-items: center;
  min-width: 30px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}
#audience-view-previous { border-right: 1px solid var(--line); }
#audience-view-next { border-right: 1px solid var(--line); }
#audience-view-previous span,
#audience-view-next span { transform: translateY(-1px); }
.audience-view-controls output {
  display: flex;
  align-items: center;
  align-self: stretch;
  justify-content: center;
  min-width: 40px;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.audience-view-controls output .ui-icon {
  width: 20px;
  height: 20px;
}
.canvas-toolbar.audience-view-mode .audience-view-controls output {
  flex: 0 0 40px;
}
#scene.audience-view-active { cursor: grab; touch-action: none; }
#scene.audience-view-active:active { cursor: grabbing; }
#scene.audience-view-active.audience-seat-hover { cursor: pointer; }
.grid-control,
.tribune-control { position: relative; }
.grid-menu-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.grid-status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: transparent;
}
.grid-menu-toggle.is-snapping .grid-status-dot {
  border-color: var(--accent-dark);
  background: var(--accent);
}
.grid-menu {
  position: absolute;
  bottom: calc(100% + 7px);
  right: 0;
  width: 270px;
  padding: 15px 16px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31,39,42,.18);
}
.tribune-menu-toggle {
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.grid-menu-toggle[aria-expanded="true"],
.tribune-menu-toggle[aria-expanded="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.grid-menu-toggle[aria-expanded="true"]:hover,
.tribune-menu-toggle[aria-expanded="true"]:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: white;
}

.grid-menu-toggle:focus-visible,
.tribune-menu-toggle:focus-visible {
  outline: 3px solid var(--lightblue);
  outline-offset: 2px;
}
.tribune-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  display: grid;
  gap: 8px;
  width: 260px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31,39,42,.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.tribune-menu[hidden] { display: none; }
.tribune-seat-count {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.choice-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  cursor: pointer;
  font-size: 13px;
}
.choice-line input { width: 17px; height: 17px; accent-color: var(--accent-dark); }
.tribune-choice {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) 98px;
  gap: 10px;
  min-height: 76px;
  padding: 3px 0;
}
.tribune-choice input { margin: 0; }
.tribune-choice > span { line-height: 1.2; }
.tribune-choice small { color: var(--muted); font-size: 11px; font-weight: 300; }
.tribune-plan-preview {
  display: block;
  width: 98px;
  height: 70px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}
.tribune-conflict-list {
  max-height: 180px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
  color: var(--ink);
  font-size: 13px;
}
.grid-menu[hidden] { display: none; }
.grid-menu .section-title { margin-bottom: 14px; }
.grid-menu .switch { margin-bottom: 0; }
.selection-tools {
  position: absolute;
  z-index: 13;
  top: 0;
  left: 0;
  display: flex;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 8px 24px rgba(31,39,42,.16);
}
.selection-tools[hidden] { display: none; }
.selection-tools.tutorial-selection-preview {
  top: 50% !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none;
}
html.mobile-ui .selection-tools.tutorial-selection-preview {
  top: 50% !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
}
.selection-tools > button {
  display: grid;
  place-items: center;
  min-width: 38px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
}
.selection-tools > button[hidden] { display: none !important; }
.selection-tools > button:last-of-type { border-right: 0; }
.selection-tools > button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
.selection-tools > .quick-properties[aria-expanded="true"] {
  background: var(--ink);
  color: white;
}
.selection-tools > .quick-properties { display: grid; }
.inspector-selection-tools {
  display: inline-flex;
  border: 1px solid var(--line);
  background: white;
}
.inspector-selection-tools > button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
}
.inspector-selection-tools > button:last-child { border-right: 0; }
.inspector-selection-tools > button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
.inspector-rotation-slider {
  margin-top: 10px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.inspector-rotation-slider[hidden] { display: none; }
.rotation-slider-popover,
.seating-layout-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  width: min(300px, calc(100vw - 32px));
  padding: 10px 12px 12px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 8px 24px rgba(31,39,42,.16);
}
.rotation-slider-popover[hidden],
.seating-layout-popover[hidden] { display: none; }
.rotation-slider-popover.is-below-selection,
.seating-layout-popover.is-below-selection {
  top: calc(100% + 8px);
  bottom: auto;
}
.seating-layout-popover {
  display: grid;
  gap: 8px;
  width: min(330px, calc(100vw - 32px));
  max-height: min(420px, calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.seating-layout-heading { display: flex; align-items: center; justify-content: space-between; min-height: 26px; font-size: 12px; }
.seating-rules-button {
  display: grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.seating-rules-button:hover,
.seating-rules-button:focus-visible { border-color: var(--ink); background: var(--ink); color: white; outline: none; }
.seating-rules-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  overflow-y: auto;
}
.seating-rules-dialog::backdrop { background: rgba(32, 33, 79, 0.42); }
.seating-rules-dialog form { display: grid; padding: clamp(20px, 4vw, 30px); }
.seating-rules-dialog h2 { margin: 0 0 16px; }
.seating-rules-dialog ul { display: grid; gap: 9px; margin: 0; padding-left: 20px; }
.seating-rules-dialog p { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }
.seating-rules-dialog .dialog-actions { margin-top: 20px; }
.seating-layout-popover label { display: grid; grid-template-columns: 1fr 116px; align-items: center; gap: 10px; font-size: 12px; }
.seating-layout-popover input { min-width: 0; }
.seating-layout-popover output { color: var(--ink); font-size: 12px; font-weight: 700; }
.number-stepper { display: grid; grid-template-columns: 32px minmax(44px, 1fr) 32px; align-items: stretch; }
.number-stepper input { width: 100%; min-width: 0; border-radius: 0; text-align: center; }
.number-stepper button { min-width: 0; padding: 5px; border: 1px solid var(--line); background: var(--panel-soft); color: var(--ink); font-weight: 800; }
.number-stepper button:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.number-stepper button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.tribune-seat-count.is-insufficient { color: var(--danger); }
.seating-check-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}
.tribune-menu-toggle,
#mobile-tools-toggle,
#mobile-tribune-open { position: relative; }
.tribune-menu-toggle.has-warnings::after,
#mobile-tools-toggle.has-seating-warnings::after,
#mobile-tribune-open.has-seating-warnings::after {
  content: attr(data-warning-count);
  display: inline-grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  margin-left: 7px;
  padding: 0;
  border-radius: 50%;
  background: #d39a2c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.seating-check-button[hidden] { display: none; }
.seating-check-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--success, #448b67); }
.seating-check-button.has-warnings .seating-check-dot { background: #d39a2c; }
.planning-issue-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
#seating-check-summary { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--success, #448b67); background: var(--panel-soft); color: var(--ink); }
#seating-check-dialog.has-warnings #seating-check-summary { border-left-color: var(--danger); }
.planning-issue-list li { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--danger); background: var(--panel-soft); }
.planning-issue-list .planning-issue-code { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.planning-issue-list button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; line-height: var(--type-leading-body); }
.seating-rules-dialog h3 { margin: 18px 0 8px; font-size: 14px; }
.seating-technical-note { color: var(--muted); font-size: 12px; line-height: 1.4; }
.rotation-slider-header { display: flex; align-items: center; }
.rotation-slider-header { justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.rotation-slider-header output { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.rotation-slider-control { position: relative; padding-bottom: 21px; }
.rotation-slider-control input { display: block; min-width: 0; margin: 0; }
.rotation-slider-marks { position: absolute; right: 8px; bottom: 0; left: 8px; height: 18px; color: var(--muted); font-size: 9px; }
.rotation-slider-marks span {
  position: absolute;
  top: 0;
  left: var(--mark);
  width: 1px;
  height: 6px;
  transform: translateX(-50%);
  background: var(--line);
}
.rotation-slider-marks span.major { height: 8px; background: var(--muted); }
.rotation-slider-marks span.major::after {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  content: attr(data-label);
  white-space: nowrap;
}
.statusbar {
  position: relative;
  z-index: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 40px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  color: var(--muted);
  font-size: 12px;
}
.status-links { display: flex; align-items: center; gap: 2px; }
.status-link { min-height: 28px; padding: 0 7px; border: 0; background: transparent; font-size: 12px; }
.status-link + .status-link { position: relative; margin-left: 2px; }
.status-link + .status-link::before { position: absolute; top: 7px; bottom: 7px; left: -2px; width: 1px; background: var(--line); content: ""; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; }

@media (min-width: 1051px) and (max-width: 1450px) {
  .project-header {
    grid-template-columns: minmax(220px, 260px) minmax(220px, 280px) minmax(280px, 1fr) auto;
    grid-template-areas: "brand production notes actions";
  }
  .read-only-mode .project-header {
    grid-template-columns: minmax(200px, 240px) minmax(220px, 260px) minmax(280px, 1fr) max-content auto;
    grid-template-areas: "brand production notes locked actions";
  }
  .project-brand h1 {
    font-size: 25px;
    line-height: 1.04;
  }
  .project-brand span {
    display: block;
    font-size: 11px;
  }
  .header-notes {
    width: 100%;
  }
  .share-view-status {
    justify-content: flex-start;
  }
  .header-actions {
    padding-right: 12px;
    padding-left: 12px;
  }
  .read-only-mode .header-actions #undo,
  .read-only-mode .header-actions #redo {
    display: none;
  }
}

@media (min-width: 1051px) and (max-width: 1250px) {
  .read-only-mode .header-actions #share {
    display: none;
  }
}

@media (max-width: 1050px) {
  .project-header {
    grid-template-columns: 240px minmax(220px, 1fr) auto;
    grid-template-areas: "brand production actions" "brand notes actions" "brand locked actions";
  }
  .project-brand span { display: none; }
  .editor-shell .app { grid-template-columns: minmax(0, 1fr); position: relative; }
  .workspace-panel {
    position: absolute;
    z-index: 10;
    top: 12px;
    bottom: 52px;
    left: 12px;
    width: min(310px, calc(100vw - 48px));
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(31,39,42,.18);
  }
}

@media (min-width: 600px) and (max-width: 760px) {
  .editor-shell { height: auto; min-height: 100vh; }
  .project-header { grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "production production" "notes notes" "locked locked"; }
  .project-brand { padding: 10px 12px; }
  .project-brand h1 { font-size: 17px; }
  .header-production { padding: 6px 12px; }
  .header-notes { width: 100%; padding: 0 12px 8px; }
  .header-notes-panel { right: auto; left: 12px; }
  .share-view-status { justify-content: space-between; padding: 0 12px 8px; }
  .header-actions { padding: 6px 10px; }
  .header-actions #undo, .header-actions #redo { display: none; }
  .editor-shell .app { display: block; height: 76vh; min-height: 560px; }
  .stage-workspace { height: 100%; }
  .editor-shell .viewer { height: auto; min-height: 0; }
  .workspace-panel { top: auto; right: 10px; bottom: 48px; left: 10px; width: auto; height: 42%; }
  .canvas-toolbar { top: 10px; right: 10px; flex-direction: column; align-items: flex-end; gap: 5px; }
  .canvas-settings { right: 10px; bottom: 50px; gap: 5px; }
  .grid-button-label, .grid-button-separator { display: none; }
  .grid-menu { width: min(270px, calc(100vw - 20px)); }
  .tribune-menu { width: min(260px, calc(100vw - 20px)); }
  .statusbar { grid-template-columns: 1fr auto; }
  #scene-summary { display: none; }
  .variant-bar { min-height: 48px; padding: 4px 7px 0; }
  .variant-add-long { display: none; }
  .variant-bar .variant-add { padding: 0 9px; }
  .variant-scroll, .variant-bar .variant-list { gap: 0; }
}

/* Smartphone editor: full-screen workspace with thumb-reachable controls. */
@media (max-width: 599px), (any-pointer: coarse) and (max-width: 1050px) and (max-height: 599px) {
  html.mobile-ui {
    --mobile-toolbar-height: 56px;
    --mobile-toolbar-gap: 8px;
    --mobile-context-height: 46px;
  }

  html.mobile-ui,
  html.mobile-ui body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  html.mobile-ui .editor-shell {
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }

  html.mobile-ui .project-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand brand" "production actions" "locked locked";
    min-height: 54px;
    padding-top: env(safe-area-inset-top);
    border-top-width: 6px;
  }

  html.mobile-ui .header-notes-toggle {
    display: none;
  }

  html.mobile-ui .project-brand {
    display: block;
    padding: 5px calc(10px + env(safe-area-inset-right)) 1px calc(10px + env(safe-area-inset-left));
  }

  html.mobile-ui .project-brand h1 {
    font-size: 15px;
    line-height: 1.1;
    letter-spacing: -0.015em;
  }

  html.mobile-ui .header-production {
    align-self: center;
    padding: 6px 4px 6px calc(10px + env(safe-area-inset-left));
  }

  html.mobile-ui .header-production label { display: none; }
  html.mobile-ui .header-production input {
    width: 100%;
    height: 40px;
    min-height: 40px;
    font-size: 16px;
  }

  html.mobile-ui .header-actions {
    gap: 5px;
    padding: 6px calc(8px + env(safe-area-inset-right)) 6px 4px;
  }

  html.mobile-ui .header-actions #share {
    min-height: 40px;
    padding: 0 10px;
    white-space: nowrap;
  }

  html.mobile-ui .header-actions #header-menu-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  html.mobile-ui #mobile-notes-open { display: block; }
  html.mobile-ui .mobile-menu-separator { display: block; }
  html.mobile-ui .header-menu {
    position: fixed;
    top: calc(76px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    width: min(240px, calc(100vw - 16px));
    max-height: calc(100dvh - 70px - env(safe-area-inset-top));
    overflow-y: auto;
  }

  html.mobile-ui .header-notes {
    position: absolute;
    inset: 0;
    width: 0;
    height: 0;
    padding: 0;
  }

  html.mobile-ui .header-notes-panel {
    position: fixed;
    z-index: 90;
    top: calc(84px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    left: calc(8px + env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  html.mobile-ui body.tutorial-active .header-notes-panel {
    max-height: calc(100dvh - 78px - var(--mobile-toolbar-height) - var(--tutorial-card-height, 190px) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  html.mobile-ui .share-view-status {
    grid-column: 1 / -1;
    padding: 0 10px 6px;
  }

  html.mobile-ui .editor-shell .app {
    position: relative;
    display: grid;
    height: auto;
    min-height: 0;
  }

  html.mobile-ui .stage-workspace {
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }

  html.mobile-ui .viewer-stack {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  html.mobile-ui body.tutorial-active .viewer-stack {
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  html.mobile-ui .viewer-stack > .tutorial-layer {
    position: static;
    display: contents;
  }

  /* display: contents removes the layer's stacking context on mobile. */
  html.mobile-ui .viewer-stack > .tutorial-layer > .tutorial-focus {
    z-index: 1002;
  }

  html.mobile-ui .viewer-stack > .tutorial-layer[hidden] {
    display: none;
  }

  html.mobile-ui body.tutorial-modal-open .viewer-stack > .tutorial-layer {
    display: none;
  }

  html.mobile-ui .viewer-stack > .tutorial-layer > .tutorial-card {
    position: relative;
    z-index: 1003;
    grid-row: 2;
    width: 100%;
    max-height: min(280px, 42dvh);
    padding: 14px 16px;
    overflow-y: auto;
    border-width: 1px 0 0;
    box-shadow: 0 -8px 24px rgba(17, 18, 51, .14);
  }

  html.mobile-ui .viewer-stack > .tutorial-layer > .tutorial-card h2 {
    margin: 3px 0 5px;
    font-size: 21px;
  }

  html.mobile-ui .viewer-stack > .tutorial-layer > .tutorial-card p {
    line-height: 1.35;
  }

  html.mobile-ui .viewer-stack > .tutorial-layer > .tutorial-card .tutorial-actions {
    margin-top: 12px;
  }

  html.mobile-ui .variant-bar {
    min-height: 44px;
    padding: 3px 6px 0;
  }

  html.mobile-ui .variant-row,
  html.mobile-ui .variant-select { min-height: 40px; }
  html.mobile-ui .variant-row { min-width: 92px; }
  html.mobile-ui .variant-name-input { min-width: 62px; height: 40px; }
  html.mobile-ui .variant-menu summary { height: 40px; }
  html.mobile-ui .variant-add-long { display: none; }
  html.mobile-ui .variant-bar .variant-add {
    height: 38px;
    min-height: 38px;
    margin-left: 5px;
    padding: 0 8px;
  }

  html.mobile-ui .editor-shell .viewer {
    height: auto;
    min-height: 0;
  }

  html.mobile-ui .workspace-panel {
    position: absolute;
    z-index: 30;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    border: 0;
    box-shadow: none;
    transform: translateY(24px);
    opacity: 0;
    overflow: hidden;
    transition: transform 160ms ease, opacity 160ms ease;
  }

  html.mobile-ui .workspace-panel.is-open {
    transform: translateY(0);
    opacity: 1;
  }

  html.mobile-ui body.tutorial-panel-step .workspace-panel.is-open {
    bottom: calc(var(--mobile-toolbar-height) + env(safe-area-inset-bottom) + var(--tutorial-card-height, 190px));
    height: auto;
  }

  html.mobile-ui .panel-view-heading {
    min-height: 58px;
    padding: 7px 10px 7px 16px;
  }

  html.mobile-ui .inventory,
  html.mobile-ui .workspace-panel .inspector {
    max-height: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.mobile-ui .compact-sidebar-backdrop { display: none; }

  html.mobile-ui .mobile-bottom-toolbar {
    position: relative;
    z-index: 20;
    grid-row: 2;
    display: grid;
    width: 100%;
    grid-template-columns: minmax(64px, 1.25fr) minmax(68px, 1.25fr) 44px 44px minmax(68px, 1.25fr);
    align-items: center;
    gap: 4px;
    min-height: calc(var(--mobile-toolbar-height) + env(safe-area-inset-bottom));
    padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
  }

  html.mobile-ui body.tutorial-active .mobile-bottom-toolbar {
    grid-row: 3;
  }

  html.mobile-ui .compact-sidebar-toggle,
  html.mobile-ui .compact-history-controls,
  html.mobile-ui .mobile-toolbar-button {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 7px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.mobile-ui .compact-sidebar-toggle {
    width: 100%;
    border-color: var(--line);
    background: white;
  }

  html.mobile-ui body.audience-control-mode .mobile-bottom-toolbar {
    grid-template-columns: minmax(80px, 1fr) 44px 44px minmax(76px, 1fr);
  }
  html.mobile-ui body.audience-control-mode .mobile-view-control { grid-column: 1; }

  html.mobile-ui .compact-history-controls {
    display: contents;
  }

  html.mobile-ui .compact-history-controls .icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  html.mobile-ui .mobile-menu-control { position: relative; min-width: 0; }
  html.mobile-ui .mobile-toolbar-button {
    display: flex;
    width: 100%;
    border-color: var(--line);
    background: white;
    font-weight: 700;
  }

  html.mobile-ui .mobile-toolbar-button[aria-expanded="true"],
  html.mobile-ui .mobile-toolbar-button.is-active {
    border-color: var(--ink);
    background: var(--ink);
    color: white;
  }

  html.mobile-ui .mobile-toolbar-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    display: grid;
    width: min(210px, calc(100vw - 16px));
    padding: 6px;
    border: 1px solid var(--line);
    background: white;
    box-shadow: 0 12px 30px rgba(31, 39, 42, .2);
  }

  html.mobile-ui body.tutorial-active .mobile-toolbar-menu {
    bottom: calc(100% + var(--tutorial-card-height, 190px) + 12px);
  }

  html.mobile-ui .mobile-view-menu { left: 0; right: auto; }
  html.mobile-ui .mobile-toolbar-menu[hidden] { display: none; }
  html.mobile-ui .mobile-toolbar-menu button {
    min-height: 44px;
    border: 0;
    text-align: left;
  }
  html.mobile-ui .mobile-toolbar-menu button[aria-pressed="true"],
  html.mobile-ui .mobile-toolbar-menu button[aria-expanded="true"] {
    background: var(--ink);
    color: white;
  }

  html.mobile-ui .canvas-toolbar {
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
  }
  html.mobile-ui .canvas-toolbar .view-buttons { display: none; }
  html.mobile-ui .canvas-toolbar.audience-view-mode {
    top: auto;
    right: auto;
    bottom: var(--mobile-toolbar-gap);
    left: 50%;
    display: block;
    transform: translateX(-50%);
  }
  html.mobile-ui .audience-view-controls { height: 44px; }

  html.mobile-ui .canvas-settings {
    position: static;
    display: block;
  }
  html.mobile-ui .canvas-settings.menu-open { z-index: 14; }
  html.mobile-ui .grid-control,
  html.mobile-ui .tribune-control { position: static; }
  html.mobile-ui .grid-menu-toggle,
  html.mobile-ui .tribune-menu-toggle { display: none; }
  html.mobile-ui .grid-menu,
  html.mobile-ui .tribune-menu {
    position: absolute;
    z-index: 25;
    right: calc(8px + env(safe-area-inset-right));
    bottom: 10px;
    width: min(290px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(100% - 28px);
    overflow-y: auto;
  }

  html.mobile-ui .selection-tools {
    position: absolute;
    top: auto !important;
    right: auto;
    bottom: var(--mobile-toolbar-gap);
    left: 50% !important;
    height: var(--mobile-context-height);
    transform: translateX(-50%) !important;
  }
  html.mobile-ui .selection-tools > button {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
  html.mobile-ui .rotation-slider-popover,
  html.mobile-ui .seating-layout-popover {
    width: min(300px, calc(100vw - 16px));
  }

  html.mobile-ui .statusbar { display: none; }
  html.mobile-ui .toast {
    bottom: 10px;
    width: max-content;
    max-width: calc(100% - 20px);
    padding: 9px 11px;
    font-size: 12px;
    text-align: center;
  }
  html.mobile-ui .selection-tools:not([hidden]) ~ .toast {
    bottom: calc(var(--mobile-context-height) + 16px);
  }
  html.mobile-ui body.audience-control-mode .toast {
    bottom: calc(var(--mobile-context-height) + 16px);
  }

  html.mobile-ui dialog {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }
}

@media (max-width: 599px) and (orientation: landscape), (any-pointer: coarse) and (max-width: 1050px) and (max-height: 599px) and (orientation: landscape) {
  html.mobile-ui .project-header {
    min-height: 48px;
    border-top-width: 4px;
  }
  html.mobile-ui .header-production,
  html.mobile-ui .header-actions { padding-top: 3px; padding-bottom: 3px; }
  html.mobile-ui .project-brand { padding-top: 3px; padding-bottom: 0; }
  html.mobile-ui .header-menu { top: calc(68px + env(safe-area-inset-top)); }
  html.mobile-ui .header-notes-panel { top: calc(76px + env(safe-area-inset-top)); }
  html.mobile-ui .variant-bar { min-height: 40px; padding-top: 1px; }
  html.mobile-ui .variant-row,
  html.mobile-ui .variant-select { min-height: 36px; }
  html.mobile-ui .variant-name-input { height: 36px; }
  html.mobile-ui .variant-menu summary { height: 36px; }
  html.mobile-ui .variant-bar .variant-add { height: 34px; min-height: 34px; }
}
