:root {
  color-scheme: dark;
  --bg: #0d0f13;
  --panel: #15181e;
  --panel-strong: #1b1f27;
  --panel-soft: #11141a;
  --line: #292e38;
  --line-strong: #3a414d;
  --text: #f4f6f8;
  --muted: #9ca5b4;
  --accent: #8de5c5;
  --accent-strong: #4ac99e;
  --accent-ink: #07150f;
  --danger: #ff8b8b;
  --warning: #f5c76f;
  --radius: 16px;
  --shadow: 0 20px 60px rgb(0 0 0 / 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
.drop-zone {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled,
fieldset:disabled {
  opacity: 0.55;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100dvh;
  background:
    radial-gradient(circle at 62% 0%, rgb(82 188 151 / 0.09), transparent 34rem),
    var(--bg);
}

.global-drop-overlay {
  position: fixed;
  inset: 12px;
  z-index: 100;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.992);
  border: 2px dashed transparent;
  border-radius: 20px;
  background: rgb(7 21 15 / 0);
  backdrop-filter: blur(0);
  transition: opacity 140ms ease, transform 140ms ease, border-color 140ms ease, background 140ms ease, backdrop-filter 140ms ease;
}

.global-drop-overlay.is-active {
  opacity: 1;
  transform: scale(1);
  border-color: var(--accent);
  background: rgb(7 21 15 / 0.72);
  backdrop-filter: blur(5px);
}

.global-drop-card {
  display: grid;
  min-width: min(360px, calc(100vw - 64px));
  place-items: center;
  gap: 7px;
  padding: 30px 34px;
  border: 1px solid rgb(141 229 197 / 0.42);
  border-radius: 18px;
  background: rgb(17 28 24 / 0.94);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.44);
  text-align: center;
}

.global-drop-card .drop-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 5px;
  font-size: 26px;
  background: var(--accent);
  color: var(--accent-ink);
}

.global-drop-card strong {
  font-size: 17px;
}

.global-drop-card > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgb(13 15 19 / 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand img {
  border-radius: 10px;
  box-shadow: 0 6px 18px rgb(80 218 168 / 0.16);
}

.brand div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand strong {
  overflow: hidden;
  font-size: 15px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand span,
.selected-copy span,
.sidebar-heading span,
.range-labels,
.control-card p,
.face-model-line,
.field-row,
.empty-list {
  color: var(--muted);
  font-size: 12px;
}

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgb(141 229 197 / 0.2);
  border-radius: 999px;
  background: rgb(141 229 197 / 0.06);
  color: #c8f8e7;
  font-size: 12px;
  font-weight: 700;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgb(141 229 197 / 0.1);
}

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

.button,
.icon-button {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

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

.button.primary:hover:not(:disabled) {
  background: #a2efd3;
}

.button.secondary {
  border-color: var(--line-strong);
  background: #232833;
}

.button.secondary:hover:not(:disabled),
.button.secondary.is-active {
  border-color: rgb(141 229 197 / 0.55);
  background: rgb(141 229 197 / 0.1);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
  color: #c9cfda;
}

.button.ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgb(255 255 255 / 0.04);
}

.button.compact {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 11px;
}

.button.full {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.icon-button:hover {
  background: rgb(255 255 255 / 0.06);
  color: var(--text);
}

.compatibility-warning {
  padding: 8px 16px;
  border-bottom: 1px solid rgb(255 139 139 / 0.25);
  background: rgb(255 139 139 / 0.09);
  color: #ffd5d5;
  font-size: 12px;
  text-align: center;
}

.app-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgb(17 20 26 / 0.78);
}

.drop-zone {
  display: grid;
  min-height: 112px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px dashed #414957;
  border-radius: 14px;
  background: rgb(255 255 255 / 0.018);
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone:focus-within,
.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent-strong);
  background: rgb(141 229 197 / 0.07);
  transform: translateY(-1px);
}

.drop-zone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-zone strong {
  font-size: 13px;
}

.drop-zone > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.drop-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 21px;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 2px;
}

.sidebar-heading strong {
  font-size: 13px;
}

.thumbnail-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.empty-list {
  align-self: start;
  margin: 18px 4px;
  text-align: center;
}

.thumbnail-item {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 26px;
  gap: 9px;
  align-items: center;
  margin-bottom: 7px;
  padding: 7px;
  content-visibility: auto;
  contain-intrinsic-block-size: 60px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}

.thumbnail-item:hover {
  background: rgb(255 255 255 / 0.03);
}

.thumbnail-item.is-selected {
  border-color: rgb(141 229 197 / 0.32);
  background: rgb(141 229 197 / 0.075);
}

.thumbnail-image-wrap {
  position: relative;
  width: 58px;
  height: 46px;
  overflow: hidden;
  border-radius: 8px;
  background: #080a0d;
}

.thumbnail-image,
.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  background: linear-gradient(135deg, #1c2028, #101319);
}

.thumbnail-status {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgb(0 0 0 / 0.72);
  color: #dfe5ec;
  font-size: 8px;
  font-weight: 750;
}

.thumbnail-status.error {
  color: #ffc1c1;
}

.thumbnail-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.thumbnail-copy strong {
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.thumbnail-copy span {
  color: var(--muted);
  font-size: 9px;
}

.remove-thumbnail {
  width: 26px;
  height: 26px;
  opacity: 0;
  font-size: 16px;
}

.thumbnail-item:hover .remove-thumbnail,
.thumbnail-item:focus-within .remove-thumbnail {
  opacity: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-width: 0;
  min-height: 0;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 2px 10px;
}

.selected-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selected-copy strong,
.selected-copy span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.selected-copy strong {
  font-size: 13px;
}

.preview-stage {
  position: relative;
  min-width: 0;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid #242a33;
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #0c0e12 25%, transparent 25%),
    linear-gradient(-45deg, #0c0e12 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0c0e12 75%),
    linear-gradient(-45deg, transparent 75%, #0c0e12 75%),
    #101318;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  box-shadow: inset 0 0 80px rgb(0 0 0 / 0.18);
}

.preview-content {
  --preview-scale: 1;
  --preview-pan-x: 0px;
  --preview-pan-y: 0px;
  position: absolute;
  inset: 0;
  transform: translate3d(var(--preview-pan-x), var(--preview-pan-y), 0) scale(var(--preview-scale));
  transform-origin: center;
  will-change: transform;
}

.preview-stage.is-zoomed {
  cursor: grab;
  touch-action: none;
}

.preview-stage.is-panning {
  cursor: grabbing;
  user-select: none;
}

.preview-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-image.original {
  z-index: 1;
}

.preview-image.processed {
  z-index: 2;
  transition: opacity 100ms linear;
}

.preview-stage.show-original .preview-image.processed {
  opacity: 0;
}

.preview-stage.is-mosaic-pending .preview-content {
  visibility: hidden;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.preview-empty strong {
  max-width: 430px;
  color: #c7ced8;
  font-size: 14px;
}

.preview-empty span:last-child {
  font-size: 11px;
}

.preview-empty-icon {
  color: #596272;
  font-size: 46px;
}

.preview-busy {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(11 13 17 / 0.86);
  box-shadow: var(--shadow);
  color: #dce2ea;
  font-size: 11px;
  backdrop-filter: blur(12px);
}

.preview-stage.is-mosaic-pending .preview-busy {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  padding: 10px 14px;
  transform: translate(-50%, -50%);
}

.zoom-reset-button {
  position: absolute;
  z-index: 5;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(11 13 17 / 0.86);
  box-shadow: var(--shadow);
  color: #dce2ea;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.zoom-reset-button:hover,
.zoom-reset-button:focus-visible {
  border-color: rgb(141 229 197 / 0.48);
  color: white;
  outline: none;
}

.zoom-reset-button span:first-child {
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.face-overlay {
  position: absolute;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.face-overlay.manual-mode {
  cursor: crosshair;
  pointer-events: auto;
}

.face-region,
.face-box {
  pointer-events: auto;
  cursor: pointer;
}

.face-box {
  fill: rgb(141 229 197 / 0.08);
  stroke: var(--accent);
  stroke-width: 0.004;
  vector-effect: non-scaling-stroke;
}

.face-box.is-manual {
  stroke: #f3c875;
}

.face-region:hover .face-box {
  fill: rgb(255 139 139 / 0.14);
  stroke: var(--danger);
}

.face-label {
  fill: white;
  font-size: 0.028px;
  font-weight: 800;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgb(0 0 0 / 0.8);
  stroke-width: 0.006px;
}

.drag-box {
  fill: rgb(243 200 117 / 0.16);
  stroke: #f3c875;
  stroke-dasharray: 0.012 0.008;
  stroke-width: 0.004;
  vector-effect: non-scaling-stroke;
}

.warning {
  margin: 9px 2px 0;
  padding: 9px 11px;
  border: 1px solid rgb(245 199 111 / 0.25);
  border-radius: 9px;
  background: rgb(245 199 111 / 0.075);
  color: #f7d99d;
  font-size: 11px;
}

.control-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 18px 0;
  border-left: 1px solid var(--line);
  background: rgb(17 20 26 / 0.58);
  scrollbar-width: thin;
}

.control-panel fieldset {
  display: grid;
  gap: 10px;
  padding-left: 14px;
}

.control-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.control-card.hero-control {
  background:
    radial-gradient(circle at 50% 12%, rgb(141 229 197 / 0.08), transparent 58%),
    var(--panel);
}

.control-card h2,
.control-card h3,
.dialog-heading h2 {
  margin: 0;
}

.control-card h2 {
  font-size: 18px;
}

.control-card h3 {
  font-size: 13px;
}

.control-card p {
  margin: 10px 0 0;
  line-height: 1.55;
}

.control-title,
.switch-row,
.field-row,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-title output {
  min-width: 58px;
  color: var(--accent);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-align: right;
}

.control-title.small span {
  color: var(--muted);
  font-size: 10px;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-strong);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.knob-visual {
  --knob-progress: 55%;
  position: relative;
  width: 82px;
  height: 82px;
  margin: 12px auto 6px;
  border-radius: 50%;
  background: conic-gradient(from 225deg, var(--accent) 0 var(--knob-progress), #2a303a var(--knob-progress) 75%, transparent 75% 100%);
  filter: drop-shadow(0 10px 22px rgb(0 0 0 / 0.28));
  transform: rotate(45deg);
}

.knob-visual::before {
  position: absolute;
  inset: 7px;
  border: 1px solid #353c47;
  border-radius: inherit;
  background: linear-gradient(145deg, #252b34, #12151b);
  content: "";
}

.knob-visual span {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 50%;
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  transform: translateX(-50%);
  transform-origin: 50% 29px;
}

input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 6px 0;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

input[type="range"]:active {
  cursor: grabbing;
}

.main-range {
  margin-top: 2px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
}

.switch-row p {
  margin-top: 4px;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 25px;
}

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

.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #303641;
  cursor: pointer;
  transition: background 130ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 130ms ease;
}

.switch input:checked + span {
  background: var(--accent-strong);
}

.switch input:checked + span::after {
  transform: translateX(19px);
}

.face-model-line {
  margin-top: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.face-model-line strong {
  color: #dce3eb;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}

.manual-hint {
  color: #f3d8a2 !important;
}

.field-row {
  margin-top: 12px;
}

.field-row select,
.export-dialog select {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #20252e;
  color: var(--text);
}

.field-row input[type="range"] {
  max-width: 150px;
}

.privacy-note {
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.recipe-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recipe-card-heading > div {
  display: grid;
  gap: 2px;
}

.recipe-card-heading span,
.recipe-group summary small {
  color: var(--muted);
  font-size: 9px;
}

.recipe-reset-all,
.recipe-auto-button {
  border: 1px solid rgb(141 229 197 / 0.28);
  border-radius: 999px;
  background: rgb(141 229 197 / 0.06);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.recipe-reset-all {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 9px;
  font-size: 9px;
  font-weight: 700;
}

.recipe-reset-all:hover:not(:disabled),
.recipe-auto-button:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: rgb(141 229 197 / 0.12);
}

.recipe-reset-all:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  cursor: default;
  opacity: 0.6;
}

.recipe-help {
  margin-top: 7px !important;
  font-size: 9px;
}

.recipe-editor {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.recipe-editor > .muted {
  margin: 0;
}

.recipe-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.recipe-group summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 8px 9px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.recipe-group summary:focus-visible {
  border-radius: 8px;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

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

.recipe-group summary::before {
  color: var(--muted);
  content: "›";
  font-size: 15px;
  line-height: 1;
  transform-origin: center;
  transition: transform 120ms ease;
}

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

.recipe-group summary span {
  font-size: 10px;
  font-weight: 750;
}

.recipe-group-controls {
  padding: 0 9px 6px;
}

.recipe-control {
  padding: 6px 0 4px;
  border-top: 1px solid rgb(255 255 255 / 0.045);
}

.recipe-control-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.recipe-control label {
  overflow: hidden;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.recipe-control output {
  min-width: 42px;
  color: #c8cfd8;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.recipe-control.is-manual output {
  color: var(--accent);
  font-weight: 750;
}

.recipe-auto-button {
  min-width: 38px;
  min-height: 24px;
  padding: 2px 6px;
  font-size: 9px;
}

.recipe-auto-button:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  cursor: default;
  opacity: 0.68;
}

.recipe-control input[type="range"] {
  height: 24px;
  margin: 1px 0 0;
}

.notice,
.export-progress {
  position: fixed;
  z-index: 50;
  left: 50%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgb(25 29 36 / 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.notice {
  bottom: 22px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 15px;
  color: #e7ebf0;
  font-size: 12px;
  text-align: center;
}

.export-progress {
  bottom: 22px;
  display: grid;
  grid-template-columns: auto auto minmax(120px, 260px);
  gap: 10px;
  align-items: center;
  padding: 10px 13px;
  font-size: 11px;
}

.export-progress progress {
  width: 100%;
  accent-color: var(--accent-strong);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #48505c;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

.export-dialog {
  width: min(440px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #171b21;
  color: var(--text);
  box-shadow: var(--shadow);
}

.export-dialog::backdrop {
  background: rgb(0 0 0 / 0.66);
  backdrop-filter: blur(4px);
}

.export-dialog form {
  display: grid;
  gap: 15px;
  padding: 20px;
}

.export-dialog label {
  display: grid;
  gap: 7px;
  color: #cbd2dc;
  font-size: 12px;
}

.export-dialog label > span {
  display: flex;
  justify-content: space-between;
}

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

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

[hidden] {
  display: none !important;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .app-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .privacy-pill {
    display: none;
  }

  .app-layout,
  .workspace {
    display: block;
  }

  .sidebar {
    display: block;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .drop-zone {
    min-height: 86px;
  }

  .sidebar-heading,
  .empty-list {
    display: none;
  }

  .thumbnail-list {
    display: flex;
    gap: 7px;
    margin-top: 9px;
    overflow-x: auto;
  }

  .thumbnail-item {
    flex: 0 0 168px;
    grid-template-columns: 48px minmax(0, 1fr);
    margin: 0;
    padding-right: 34px;
  }

  .thumbnail-image-wrap {
    width: 48px;
    height: 42px;
  }

  .remove-thumbnail {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    opacity: 0.78;
    transform: translateY(-50%);
  }

  .preview-panel {
    min-height: 60vh;
  }

  .preview-stage {
    min-height: 48vh;
  }

  .control-panel {
    padding: 0 14px 30px;
    border-left: 0;
  }

  .control-panel fieldset {
    grid-template-columns: 1fr 1fr;
    padding-left: 0;
  }

  .hero-control {
    grid-column: 1;
    grid-row: 1;
  }

  .face-card {
    grid-column: 2;
    grid-row: 1;
  }

  .recipe-card {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 580px) {
  .topbar {
    min-height: 60px;
    padding: 8px 10px;
  }

  .brand span,
  .topbar .ghost {
    display: none;
  }

  .preview-panel {
    padding: 10px;
  }

  .preview-heading {
    padding-bottom: 8px;
  }

  .control-panel {
    padding: 0 10px 24px;
  }

  .control-panel fieldset {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-control,
  .face-card,
  .recipe-card {
    grid-column: auto;
    grid-row: auto;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .export-progress {
    grid-template-columns: auto 1fr;
    width: calc(100vw - 28px);
  }

  .export-progress progress {
    grid-column: 1 / -1;
  }
}

@media (hover: none) {
  .remove-thumbnail {
    opacity: 0.78;
  }
}

@media (pointer: coarse) {
  input[type="range"] {
    min-height: 32px;
  }

  .recipe-control input[type="range"] {
    height: 32px;
  }

  .recipe-auto-button {
    min-width: 44px;
    min-height: 30px;
  }
}

.device-benchmark {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgb(7 10 13 / 92%);
  overflow: auto;
}

.device-benchmark-card {
  width: min(720px, 100%);
  max-height: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
  overflow: auto;
}

.device-benchmark-card header,
.device-benchmark-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-benchmark-card h1 {
  margin: 2px 0 0;
  font-size: clamp(22px, 5vw, 32px);
}

.device-benchmark-card small {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.14em;
}

.device-benchmark-card p,
.device-benchmark-card output {
  color: var(--muted);
  line-height: 1.65;
}

.device-benchmark-card [data-close] {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
}

.device-benchmark-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin: 18px 0;
}

.device-benchmark-card [data-start] {
  background: var(--accent);
  color: #07110e;
}

.device-benchmark-card output {
  display: block;
  min-height: 26px;
  margin-bottom: 10px;
}

.device-benchmark-card pre {
  min-height: 180px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0d11;
  color: #dce7e5;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .device-benchmark {
    display: block;
    padding: 0;
  }

  .device-benchmark-card {
    min-height: 100%;
    max-height: none;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
  }

  .device-benchmark-actions > button {
    flex: 1 1 160px;
    min-height: 46px;
  }
}
