:root {
  color-scheme: light;
  --ink: #17201c;
  --ink-soft: #526058;
  --ink-muted: #738076;
  --paper: #f5f2eb;
  --paper-strong: #fbfaf6;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #fffdf8;
  --line: rgba(37, 49, 42, 0.13);
  --line-strong: rgba(37, 49, 42, 0.22);
  --accent: #2f6d57;
  --accent-ink: #f8fff9;
  --accent-soft: #dfeae3;
  --rust: #9a5b44;
  --amber: #d4a84d;
  --danger: #b94a43;
  --shadow: 0 28px 80px rgba(56, 47, 35, 0.14);
  --soft-shadow: 0 16px 46px rgba(56, 47, 35, 0.1);
  --radius: 8px;
  --radius-small: 6px;
  --mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(23, 32, 28, 0.05) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(0deg, rgba(23, 32, 28, 0.04) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(circle at 12% 18%, rgba(212, 168, 77, 0.18), transparent 30rem),
    radial-gradient(circle at 88% 8%, rgba(47, 109, 87, 0.14), transparent 31rem),
    var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.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;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1680px;
  margin: 0 auto 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: #17201c;
  color: #f3ecd9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-mark path:first-child {
  stroke: currentColor;
}

.brand-mark path:last-child {
  stroke: var(--amber);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rust);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2vw, 1.72rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.04rem;
  line-height: 1.1;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  line-height: 1.15;
}

.topbar-actions,
.stage-actions,
.result-actions,
.mask-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.promo-nav {
  display: flex;
  align-items: center;
  gap: 7px;
}

.promo-toplink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.promo-toplink:hover {
  border-color: rgba(47, 109, 87, 0.42);
  background: rgba(47, 109, 87, 0.08);
  color: var(--accent);
}

.promo-toplink:active {
  transform: translateY(1px) scale(0.99);
}

.promo-toplink svg {
  width: 1rem;
  height: 1rem;
}

.status-pill,
.fixed-chip,
.counter {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.76rem;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(212, 168, 77, 0.17);
}

.status-pill.ready .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 109, 87, 0.16);
}

.status-pill.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(185, 74, 67, 0.16);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(280px, 330px);
  gap: 14px;
  max-width: 1680px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel,
.edit-panel {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.control-panel {
  position: sticky;
  top: 18px;
}

.edit-panel {
  position: sticky;
  top: 18px;
}

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

.panel-section:last-child {
  border-bottom: 0;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading.inline,
.parameter-head,
.mask-header,
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.custom-size-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.field input,
.field select,
.custom-size-row input {
  min-height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 170px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.custom-size-row input:focus {
  border-color: rgba(47, 109, 87, 0.72);
  box-shadow: 0 0 0 4px rgba(47, 109, 87, 0.12);
  background: #fffefb;
}

.field.small {
  font-size: 0.76rem;
}

.key-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
}

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

.endpoint-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.check-row input {
  accent-color: var(--accent);
}

.mode-switch,
.preset-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(23, 32, 28, 0.04);
}

.preset-strip {
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
}

.segmented,
.preset-button,
.choice-chip,
.tool-button,
.ghost-button,
.icon-button,
.primary-action {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.segmented,
.preset-button {
  min-height: 34px;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.segmented.active,
.preset-button.active {
  background: var(--paper-strong);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 7px 16px rgba(56, 47, 35, 0.08);
}

.prompt-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.tool-button,
.choice-chip {
  min-height: 34px;
  padding: 0 10px;
  border-color: var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.tool-button:hover,
.choice-chip:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(47, 109, 87, 0.42);
  color: var(--accent);
}

.tool-button:active,
.choice-chip:active,
.ghost-button:active,
.icon-button:active,
.primary-action:active {
  transform: translateY(1px) scale(0.99);
}

.choice-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.choice-chip.disabled {
  cursor: not-allowed;
  opacity: 0.45;
  text-decoration: line-through;
}

.parameter-stack {
  display: grid;
  gap: 16px;
}

.parameter-block {
  display: grid;
  gap: 8px;
}

.parameter-head span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 850;
}

.parameter-head output {
  color: var(--rust);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.size-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.custom-size-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.custom-size-row label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
}

.stepper {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
}

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

.advanced-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 850;
}

.advanced-grid {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.icon-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-color: var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 850;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button.compact {
  width: 36px;
  min-height: 36px;
}

.ghost-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.compact-text {
  min-height: 32px;
  padding: 0 10px;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin: 16px;
  border-radius: var(--radius);
  border-color: rgba(23, 32, 28, 0.9);
  background: #17201c;
  color: #fffaf0;
  font-weight: 900;
  box-shadow: 0 16px 38px rgba(23, 32, 28, 0.22);
}

.primary-action:hover {
  background: #23372f;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.76;
}

.stage-panel {
  min-height: calc(100dvh - 110px);
  padding: 18px;
}

.stage-toolbar {
  margin-bottom: 14px;
}

.notice-bar {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(185, 74, 67, 0.22);
  border-radius: var(--radius-small);
  background: rgba(185, 74, 67, 0.08);
  color: #7d2c28;
  font-size: 0.86rem;
  line-height: 1.45;
}

.notice-bar.success {
  border-color: rgba(47, 109, 87, 0.22);
  background: rgba(47, 109, 87, 0.09);
  color: var(--accent);
}

.progress-bar {
  position: relative;
  height: 5px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 28, 0.08);
}

.progress-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--accent);
  animation: progressSlide 1.25s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes progressSlide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

.empty-state {
  display: grid;
  min-height: 58dvh;
  place-items: center;
  align-content: center;
  gap: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink-muted);
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  font-weight: 750;
}

.empty-mark {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
}

.empty-mark svg {
  width: 44px;
  height: 44px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  transform: translateY(6px);
  opacity: 0;
  animation: cardIn 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card.selected {
  border-color: rgba(47, 109, 87, 0.72);
  box-shadow: 0 0 0 4px rgba(47, 109, 87, 0.1);
}

.result-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background:
    linear-gradient(45deg, rgba(23, 32, 28, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 28, 0.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(23, 32, 28, 0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(23, 32, 28, 0.055) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  cursor: pointer;
}

.result-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid var(--line);
}

.result-time {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
}

.mask-workbench {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mask-header {
  margin-bottom: 12px;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  width: min(100%, 820px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(23, 32, 28, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 28, 0.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(23, 32, 28, 0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(23, 32, 28, 0.055) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  touch-action: none;
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

#maskCanvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.brush-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.brush-row label {
  display: grid;
  gap: 6px;
}

.dropzone {
  display: grid;
  min-height: 118px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone.dragging,
.dropzone:hover {
  border-color: rgba(47, 109, 87, 0.55);
  background: rgba(47, 109, 87, 0.08);
  color: var(--accent);
}

.dropzone svg {
  width: 28px;
  height: 28px;
}

.reference-list,
.history-list,
.recipe-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.promo-section {
  background: linear-gradient(180deg, rgba(47, 109, 87, 0.06), rgba(255, 255, 255, 0));
}

.promo-resource-list {
  display: grid;
  gap: 8px;
}

.promo-resource-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.52);
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease;
}

.promo-resource-card:hover {
  border-color: rgba(47, 109, 87, 0.44);
  background: rgba(255, 255, 255, 0.72);
}

.promo-resource-card:active {
  transform: translateY(1px) scale(0.995);
}

.promo-resource-card > svg {
  color: var(--ink-muted);
}

.promo-resource-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(47, 109, 87, 0.2);
  border-radius: var(--radius-small);
  background: rgba(47, 109, 87, 0.1);
  color: var(--accent);
}

.promo-resource-icon.amber {
  border-color: rgba(212, 168, 77, 0.28);
  background: rgba(212, 168, 77, 0.12);
  color: #8a6320;
}

.promo-resource-icon.rust {
  border-color: rgba(154, 91, 68, 0.25);
  background: rgba(154, 91, 68, 0.1);
  color: var(--rust);
}

.promo-resource-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.promo-resource-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.promo-resource-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-resource-copy span {
  color: var(--ink-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.qq-card {
  cursor: default;
}

.api-guide-section {
  display: grid;
  gap: 12px;
}

.api-lesson-list {
  display: grid;
  gap: 8px;
}

.api-lesson-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.5);
}

.api-lesson-item > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.api-lesson-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.78rem;
}

.api-lesson-item code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.35;
}

.api-code-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(23, 32, 28, 0.045);
}

.api-code-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px 6px 11px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.api-code-block pre {
  max-height: 280px;
  margin: 0;
  overflow: auto;
  padding: 11px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.66);
}

.api-code-block code {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre;
}

.reference-item,
.history-item {
  display: grid;
  grid-template-columns: 52px 1fr 34px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.52);
}

.reference-item.primary {
  border-color: rgba(47, 109, 87, 0.55);
  background: rgba(47, 109, 87, 0.08);
}

.reference-item img,
.history-item img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-small);
  object-fit: cover;
  background: #eee8dc;
}

.reference-info,
.history-info {
  min-width: 0;
}

.reference-info strong,
.history-info strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-info span,
.history-info span {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.recipe-list {
  grid-template-columns: 1fr;
}

.recipe-chip {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 780;
  line-height: 1.35;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.recipe-chip:hover {
  border-color: rgba(47, 109, 87, 0.44);
  color: var(--accent);
  background: rgba(47, 109, 87, 0.08);
}

.history-section {
  max-height: 45dvh;
  overflow: auto;
}

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

  .edit-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

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

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .promo-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    order: 3;
    width: 100%;
  }

  .promo-toplink {
    justify-content: center;
  }

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

  .control-panel,
  .edit-panel {
    position: static;
  }

  .stage-panel {
    min-height: auto;
  }

  .stage-toolbar,
  .section-heading.inline,
  .mask-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage-actions {
    width: 100%;
  }

  .stage-actions .ghost-button {
    flex: 1;
  }

  .chip-grid,
  .size-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .brush-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
