:root {
  --umber: #28654f;
  --umber-deep: #163d31;
  --ochre: #648675;
  --gold: #c3d7a5;
  --olive: #387255;
  --sage: #e8f1eb;
  --linen: #f2f5f3;
  --parchment: #edf2ee;
  --stone: #617268;
  --stone-light: #dce5df;
  --ink: #24392e;
  --rust: #a24f3b;
  --white: #ffffff;
  --surface-soft: #f6f8f6;
  --surface-warm: #ffffff;
  --line: #e1e8e3;
  --line-strong: #b8c9bd;
  --focus: #528a6a;
  --shadow: 0 4px 24px rgba(22, 61, 49, 0.045);
  --radius: 12px;
  --nav-width: 216px;
  --ease: 180ms ease;
  color: var(--ink);
  background: var(--linen);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 0;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--linen);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.dropzone:focus-within,
.nav-item:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 80;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--umber);
  color: var(--white);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.atelier {
  display: grid;
  height: 100dvh;
  min-height: 0;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}

.atelier-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, #f8f9f1 0%, #f1f4e5 72%, #e9eedb 100%);
}

.nav-cover {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 168px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(247, 248, 238, 1) 0%, rgba(247, 248, 238, 0.08) 38%, transparent 58%),
    url("nav-cover.jpg") no-repeat center bottom / cover;
}

.atelier-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 0 18px 12px;
}

.atelier-stage main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  margin: 0 8px 22px;
  color: var(--umber);
  text-decoration: none;
}

.brand-sub {
  display: block;
  margin-top: 2px;
  color: var(--stone);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* ---- Brand: copperplate calligraphy wordmark (self-hosted, no Google dependency) ---- */
@font-face {
  font-family: "Pinyon Script";
  src: url("/fonts/pinyon-script-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.brand h1 {
  display: block;
  margin: 0;
  font-family: "Pinyon Script", "Snell Roundhand", "Segoe Script", cursive;
  font-size: 25px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 3px;
  width: 22px;
  height: 22px;
  padding-bottom: 1px;
}

.brand-mark span {
  display: block;
  width: 4px;
  background: currentColor;
  transform: skewY(-22deg);
}

.brand-mark span:nth-child(1) { height: 9px; opacity: 0.62; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: 0.78; }

.brand-wordmark {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.15;
}

.nav-label {
  margin: 18px 10px 8px;
  color: var(--stone);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-menu {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  align-content: start;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--umber);
  background: transparent;
  font-size: 14px;
  text-align: left;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-item:hover {
  background: rgba(143, 174, 114, 0.14);
}

.nav-item.is-active {
  color: var(--umber-deep);
  background: #a8c68f;
  box-shadow: inset 3px 0 0 var(--umber);
  font-weight: 700;
}

.nav-status {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  margin-top: auto;
  margin-bottom: 92px;
  padding: 12px;
  border: 1px solid rgba(46, 82, 49, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 248, 0.82);
  backdrop-filter: blur(10px);
}

.nav-status small {
  color: var(--stone);
  font-size: 11px;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  flex: 0 0 auto;
  min-height: 62px;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 241, 0.94);
  backdrop-filter: blur(12px);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  background: var(--white);
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--umber);
}

.library-search {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-warm);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.library-search::after {
  display: none;
}

.library-search:focus-within {
  border-color: var(--umber);
  box-shadow: 0 0 0 3px rgba(107, 138, 79, 0.15);
}

.library-search svg {
  width: 18px;
  height: 18px;
  color: var(--stone);
}

.library-search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.topbar-meta {
  display: flex;
  margin-left: auto;
  gap: 12px;
  align-items: center;
  color: var(--stone);
  font-size: 12px;
}

.billing-actions,
.session-billing,
.account-actions {
  display: inline-flex;
  gap: 0;
}

.recharge-trigger,
.redeem-trigger,
.account-trigger,
.account-register-trigger {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.recharge-trigger {
  border: 1px solid var(--umber);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  color: var(--white);
  background: var(--umber);
}

.recharge-trigger:hover {
  background: var(--umber-deep);
}

.redeem-trigger {
  border: 1px solid var(--umber);
  border-radius: 0 12px 12px 0;
  color: var(--umber);
  background: rgba(255, 248, 236, 0.8);
}

.redeem-trigger:hover {
  color: var(--white);
  background: var(--umber);
}

.account-trigger {
  border: 1px solid rgba(59, 36, 20, 0.35);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  color: var(--umber);
  background: rgba(255, 248, 236, 0.8);
}

.account-trigger:hover {
  color: var(--white);
  background: var(--umber);
}

.account-register-trigger {
  border: 1px solid var(--umber);
  border-radius: 0 12px 12px 0;
  color: var(--white);
  background: var(--umber);
}

.account-register-trigger:hover {
  background: var(--umber-deep);
}

.wallet-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(59, 36, 20, 0.2);
  border-radius: 999px;
  color: var(--umber);
  background: rgba(255, 248, 236, 0.8);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}

button.wallet-badge {
  cursor: pointer;
}

.wallet-badge[hidden] {
  display: none;
}

.local-badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--umber);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.local-badge i,
.status-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--olive);
  box-shadow: 0 0 0 4px rgba(107, 122, 74, 0.16);
}

.local-badge i[data-state="down"] {
  background: var(--rust);
  box-shadow: 0 0 0 4px rgba(139, 58, 42, 0.16);
}

main {
  padding-top: 12px;
}

.atelier-banner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 28px 28px 24px;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 88% -10%, rgba(232, 200, 114, 0.55), transparent 46%),
    linear-gradient(135deg, #2e5231 0%, #4a7a44 48%, #a8c68f 100%);
  color: var(--white);
}

.banner-copy {
  max-width: 560px;
}

.eyebrow,
.panel-index,
.panel-note,
.site-footer,
.character-count {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
}

.atelier-banner h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 500;
}

.atelier-banner p:last-child {
  margin: 0;
  color: rgba(255, 248, 236, 0.82);
  font-size: 14px;
  line-height: 1.65;
}

.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.banner-chip {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--umber-deep);
  background: var(--gold);
  font-weight: 700;
}

.banner-chip:hover {
  background: var(--white);
}

h2,
p {
  margin-top: 0;
}

.workbench {
  display: grid;
  width: 100%;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  grid-template-columns: minmax(420px, 460px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
}

.panel {
  position: relative;
  border: 1px solid rgba(59, 36, 20, 0.12);
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.workbench-main,
.output-panel {
  padding: 12px 14px;
}

.workbench-main {
  display: flex;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(59, 36, 20, 0.1);
}

.compact-heading {
  margin-bottom: 8px;
  padding-bottom: 6px;
}

.compact-heading h2 {
  font-size: 20px;
}



.panel-index {
  display: block;
  margin-bottom: 2px;
  color: var(--ochre);
}

.workbench-main .panel-note,
#model-rail-hint {
  display: none;
}

.panel-heading h2 {
  margin: 0;
  color: var(--umber-deep);
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: 22px;
  font-weight: 500;
}

.panel-note {
  color: var(--stone);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-group {
  position: relative;
  margin-bottom: 8px;
}

.generate-form {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.generate-form > .prompt-group {
  display: flex;
  min-height: 88px;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.generate-form > .reference-group,
.generate-form > .ratio-group {
  flex: 0 0 auto;
}

.generate-form:has(#reference-group:not([hidden])) > .prompt-group {
  flex: 0 1 auto;
  min-height: 72px;
  max-height: 128px;
}

legend,
.control-label {
  display: flex;
  gap: 7px;
  align-items: baseline;
  margin-bottom: 6px;
  color: var(--umber);
  font-size: 12px;
  font-weight: 700;
}

.control-label {
  width: fit-content;
}

legend span {
  color: var(--stone);
  font-size: 11px;
  font-weight: 400;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--stone-light);
  border-radius: 14px;
  background: var(--parchment);
}

.full-segmented {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment,
.chip,
.ratio {
  border: 0;
  color: var(--stone);
  background: transparent;
}

.segment {
  min-height: 44px;
  min-width: 0;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 14px;
}

.segment.is-active,
.chip.is-active,
.ratio.is-active {
  color: var(--white);
  background: var(--umber);
}

.chip:disabled,
.chip[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--stone);
  background: rgba(109, 98, 84, 0.08);
  opacity: 0.62;
  pointer-events: none;
}

.chip[hidden] {
  display: none;
}

.resolution-availability {
  color: var(--rust);
}

.field-hint {
  margin: 4px 0 0;
  color: var(--stone);
  font-size: 11px;
  line-height: 1.4;
}

.model-controls {
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(59, 36, 20, 0.1);
}

.model-controls-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.model-controls-heading h3 {
  margin: 0;
  color: var(--umber-deep);
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 500;
}

.model-controls-heading .field-hint {
  margin: 0;
  text-align: right;
}

.model-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.model-tab {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  background: rgba(255, 248, 236, 0.7);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.model-tab:hover {
  border-color: var(--ochre);
  background: rgba(232, 200, 114, 0.12);
}

.model-tab.is-active {
  border-color: var(--umber);
  background: #f3e6c8;
  box-shadow: inset 3px 0 0 var(--ochre);
}

.model-tab.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.model-tab input {
  position: absolute;
  opacity: 0;
}

.model-tab-copy {
  min-width: 0;
}

.model-tab strong {
  display: block;
  overflow: hidden;
  color: var(--umber-deep);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-tab small {
  display: none;
}

.model-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--umber);
  background: rgba(196, 163, 90, 0.22);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.model-tab.is-active .model-badge {
  color: var(--white);
  background: var(--umber);
}

.output-rail {
  display: grid;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.output-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: center;
}

.output-rail .chip-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.output-rail .control-label {
  margin: 0;
}

.output-rail select {
  min-width: 0;
}

.output-rail .field-hint {
  margin: 0;
}

.output-rail legend {
  margin-bottom: 4px;
  font-size: 12px;
}

.quality-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.quality-control .control-label {
  margin: 0;
  white-space: nowrap;
}

select:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

textarea,
.mini-form input,
select {
  width: 100%;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 248, 236, 0.85);
}

select {
  min-height: 34px;
  padding: 4px 28px 4px 10px;
}

textarea {
  min-height: 72px;
  flex: 1 1 auto;
  resize: none;
  padding: 8px 10px;
  line-height: 1.5;
}

textarea::placeholder,
input::placeholder {
  color: #a39886;
}

.character-count {
  margin-top: 4px;
  color: var(--stone);
  text-align: right;
}

.dropzone {
  position: relative;
  display: flex;
  min-height: 120px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  border: 1px dashed rgba(143, 174, 114, 0.7);
  border-radius: 16px;
  color: var(--umber);
  background:
    url("leaf-sprig.svg") no-repeat right 8px bottom 4px / 72px auto,
    rgba(143, 174, 114, 0.08);
  text-align: center;
  transition: border-color var(--ease), background var(--ease);
}

.compact-dropzone {
  min-height: 0;
  padding: 10px;
}

.compact-dropzone .dropzone-icon {
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
  font-size: 16px;
}

.dropzone:hover,
.dropzone.is-drop-active {
  border-color: var(--olive);
  background: rgba(107, 122, 74, 0.1);
}

.dropzone.is-drop-active {
  border-style: solid;
  box-shadow: inset 0 0 0 1px rgba(107, 122, 74, 0.35);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.dropzone[role="button"] {
  cursor: pointer;
}

.dropzone.has-images {
  min-height: 0;
}

.dropzone-hint {
  width: 100%;
  margin-top: 6px;
  color: var(--stone);
  font-size: 11px;
  text-align: center;
}

.dropzone-icon {
  display: grid;
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  place-items: center;
  border: 1px solid var(--ochre);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 300;
}

.dropzone strong {
  font-size: 13px;
}

.dropzone small {
  margin-top: 5px;
  color: var(--stone);
  font-size: 11px;
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.reference-add {
  aspect-ratio: 1;
  border: 1px dashed rgba(143, 174, 114, 0.7);
  border-radius: 12px;
  color: var(--umber);
  background: rgba(255, 255, 255, 0.5);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.reference-add:hover {
  border-color: var(--olive);
  color: var(--white);
  background: var(--umber);
}

.reference-group .field-hint {
  display: none;
}

.reference-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  background: var(--stone-light);
  cursor: grab;
}

.reference-item.is-dragging {
  opacity: 0.5;
}

.reference-item.drag-over {
  border-color: var(--umber);
  outline: 2px solid var(--umber);
  outline-offset: 1px;
}

.reference-preview,
.reference-item img {
  width: 100%;
  height: 100%;
}

.reference-preview {
  display: block;
  padding: 0;
  border: 0;
  cursor: zoom-in;
  background: transparent;
}

.reference-item img {
  display: block;
  object-fit: cover;
}

.reference-item .reference-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: rgba(26, 18, 12, 0.78);
  font-size: 16px;
}

.reference-preview:hover img,
.result-preview:hover img {
  transform: scale(1.025);
}

.reference-preview img,
.result-preview img {
  transition: transform var(--ease);
}

.chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.chip {
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--stone-light);
  border-radius: 999px;
  font-size: 12px;
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.submit-row {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(59, 36, 20, 0.1);
}

.count-control {
  display: grid;
  gap: 6px;
  color: var(--umber);
  font-size: 12px;
  font-weight: 700;
}

.count-control input {
  width: 100%;
  height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  color: var(--ink);
  background: var(--white);
}

.submit-row .primary-button {
  width: 100%;
  min-width: 0;
  min-height: 36px;
}

.submit-row + .form-status {
  margin-top: 6px;
}

.ratio {
  min-height: 28px;
  padding: 4px 2px;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  font-size: 12px;
}

.form-status {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  color: var(--stone);
  font-size: 12px;
}

.form-status.is-error {
  color: var(--rust);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--umber);
  border-radius: 12px;
  color: var(--white);
  background: var(--umber);
  transition: background var(--ease), transform var(--ease), opacity var(--ease);
}

.primary-button {
  min-width: 176px;
  padding: 13px 17px;
  font-size: 14px;
  font-weight: 700;
}

.button-leaf {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.primary-button:hover,
.secondary-button:hover {
  background: var(--umber-deep);
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.mini-form {
  display: grid;
  gap: 11px;
}

.mini-form > label {
  display: grid;
  gap: 5px;
  color: var(--umber);
  font-size: 12px;
  font-weight: 700;
}

.mini-form input,
.mini-form select {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: end;
}

.code-row .code-input-label {
  display: grid;
  gap: 5px;
  color: var(--umber);
  font-size: 12px;
  font-weight: 700;
}

.code-row .code-send {
  width: auto;
  margin-top: 0;
  min-height: 44px;
  padding: 10px 14px;
  white-space: nowrap;
}

.code-row .code-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-button {
  width: 100%;
  margin-top: 3px;
  padding: 11px 13px;
  font-size: 13px;
}

.text-button {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: var(--olive);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

.text-button:hover {
  color: var(--rust);
}

.account-status {
  min-height: 29px;
  margin: 16px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--olive);
  border-radius: 0 10px 10px 0;
  color: var(--stone);
  background: rgba(107, 122, 74, 0.08);
  font-size: 12px;
  line-height: 1.45;
}

.account-status.is-error {
  border-color: var(--rust);
  color: var(--rust);
  background: rgba(139, 58, 42, 0.08);
}

.session-summary {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(196, 163, 90, 0.45);
  border-radius: 14px;
  background: rgba(196, 163, 90, 0.12);
}

.session-summary[hidden],
.mini-form[hidden] {
  display: none;
}

.session-summary strong {
  color: var(--umber-deep);
  font-family: Georgia, "Songti SC", serif;
  font-size: 18px;
  font-weight: 500;
}

.session-summary > span {
  color: var(--stone);
  font-size: 12px;
  line-height: 1.45;
}

.recharge-form,
.redeem-form,
.generate-codes-form,
.order-form {
  margin-top: 8px;
}

.recharge-buy {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.recharge-buy h3,
.recharge-buy .control-label {
  margin: 0;
  color: var(--umber-deep);
  font-size: 13px;
  font-weight: 700;
}

.buy-code-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 6px 0 2px;
  border-radius: 14px;
  color: var(--white);
  background: var(--umber);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}

.buy-code-button:hover {
  background: var(--umber-deep);
  transform: translateY(-1px);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 14px;
}

.plan-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 12px 13px 11px;
  border: 1px solid var(--stone-light);
  border-radius: 16px;
  color: inherit;
  background: rgba(255, 248, 236, 0.8);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.plan-card:hover {
  border-color: var(--ochre);
  transform: translateY(-1px);
}

.plan-card.is-active {
  border-color: var(--umber);
  background: #f3e6c8;
  box-shadow: inset 3px 0 0 var(--ochre);
}

.plan-card-wide {
  grid-column: 1 / -1;
}

.plan-amount {
  color: var(--umber-deep);
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1;
}

.plan-card strong {
  color: var(--umber-deep);
  font-size: 13px;
  font-weight: 700;
}

.plan-card small {
  color: var(--stone);
  font-size: 11px;
  line-height: 1.4;
}

.channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.channel-card {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--stone-light);
  border-radius: 999px;
  color: var(--umber);
  background: rgba(255, 248, 236, 0.8);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.channel-card.is-active {
  color: var(--white);
  border-color: var(--umber);
  background: var(--umber);
}

#order-submit {
  width: 100%;
}

.contact-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.contact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.contact-row[hidden] {
  display: none;
}

.contact-row dt {
  color: var(--stone);
  font-size: 11px;
}

.contact-row dd {
  margin: 0;
  color: var(--umber-deep);
  font-size: 13px;
  word-break: break-all;
}

.redeem-codes-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.redeem-codes-panel[hidden] {
  display: none;
}

.redeem-codes-panel h3,
.redeem-codes-panel h4 {
  margin: 0;
  color: var(--umber-deep);
  font-size: 13px;
  font-weight: 700;
}

.codes-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.codes-list li {
  color: var(--stone);
  font-size: 12px;
  line-height: 1.45;
}

.codes-list .code-copy {
  padding: 0;
  border: 0;
  background: none;
  color: var(--umber-deep);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
}

.users-panel {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.admin-balance-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.admin-balance-form label {
  display: grid;
  gap: 4px;
  color: var(--stone);
  font-size: 12px;
}

.admin-balance-form input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}

.admin-balance-form label:first-child input {
  min-width: 210px;
}

.admin-balance-form label:nth-child(2) input {
  width: 130px;
}

.users-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.users-panel-heading h4 {
  margin: 0;
}

.users-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.users-table th,
.users-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(59, 36, 20, 0.08);
  white-space: nowrap;
}

.users-table th {
  position: sticky;
  top: 0;
  color: var(--stone);
  font-weight: 700;
  background: var(--parchment);
}

.users-table tbody tr:last-child td {
  border-bottom: 0;
}

.users-table td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.user-jobs-dialog {
  width: min(560px, calc(100vw - 32px));
}

.user-jobs-list {
  display: grid;
  gap: 10px;
  max-height: min(60vh, 480px);
  overflow: auto;
  padding-right: 4px;
}

.user-job-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  background: var(--white);
}

.user-job-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.user-job-status {
  font-weight: 700;
}

.user-job-status.is-succeeded { color: #2e6b34; }
.user-job-status.is-partial { color: #b07a1f; }
.user-job-status.is-failed,
.user-job-status.is-cancelled { color: #b3261e; }
.user-job-status.is-queued,
.user-job-status.is-processing { color: #4a6fa5; }

.user-job-time {
  color: var(--stone);
}

.user-job-cost {
  margin-left: auto;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

.user-job-meta {
  margin: 0;
  color: var(--stone);
  font-size: 12px;
}

.user-job-prompt {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.user-job-message {
  margin: 0;
  color: #b3261e;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.user-job-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-job-thumbs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--stone-light);
  cursor: zoom-in;
}

.recharge-orders,
.pay-sheet {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.recharge-orders[hidden],
.pay-sheet[hidden] {
  display: none;
}

.recharge-orders h4,
.pay-sheet h4 {
  margin: 0;
  color: var(--umber-deep);
  font-size: 13px;
  font-weight: 700;
}

.pay-amount {
  margin: 0;
  color: var(--umber-deep);
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 500;
}

.pay-qr {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.pay-qr[hidden] {
  display: none;
}

.pay-qr img {
  width: 168px;
  height: 168px;
  background: #fff;
  border: 1px solid rgba(59, 36, 20, 0.12);
  border-radius: 12px;
}

.pay-qr figcaption {
  margin: 0;
  color: var(--stone);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.pay-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.orders-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.orders-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--stone);
  font-size: 12px;
  line-height: 1.45;
}

.orders-list .orders-empty {
  display: block;
}

.order-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.session-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.empty-output {
  display: grid;
  max-width: 220px;
  gap: 8px;
  justify-items: center;
  color: var(--stone);
  text-align: center;
}

.empty-output strong {
  color: var(--umber);
  font-family: Georgia, "Songti SC", serif;
  font-size: 18px;
  font-weight: 500;
}

.empty-output span {
  font-size: 12px;
  line-height: 1.55;
}

.empty-cross {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--ochre);
  border-radius: 50%;
  color: var(--ochre);
  font-size: 24px;
  font-weight: 300;
}

.warehouse-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.warehouse-heading,
.warehouse-scroll {
  position: relative;
  z-index: 1;
}

.warehouse-heading {
  align-items: center;
}

.warehouse-meta {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  flex-direction: column;
  color: var(--stone);
  font-size: 11px;
  line-height: 1.4;
}

.warehouse-meta span:first-child {
  color: var(--rust);
}

.warehouse-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 4px 12px 0;
  overscroll-behavior: contain;
  scrollbar-color: var(--ochre) rgba(196, 163, 90, 0.14);
  scrollbar-width: thin;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 14px;
  align-content: start;
  min-height: 100%;
}

.results-grid > .empty-output:only-child {
  width: 100%;
  max-width: 330px;
  margin: auto;
  grid-column: 1 / -1;
  align-self: center;
}

.library-load-more {
  display: block;
  width: min(100%, 240px);
  min-height: 44px;
  margin: 16px auto 4px;
  border: 1px solid var(--umber);
  border-radius: 12px;
  background: transparent;
  color: var(--umber);
  font-weight: 700;
  cursor: pointer;
}

.library-load-more[hidden] {
  display: none;
}

.library-load-more:hover:not(:disabled),
.library-load-more:focus-visible {
  background: var(--umber);
  color: var(--white);
}

.library-load-more:disabled {
  cursor: wait;
  opacity: 0.58;
}

.result-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  align-content: start;
  border: 1px solid var(--stone-light);
  border-radius: 16px;
  background: rgba(255, 248, 236, 0.85);
}

.result-card > header,
.result-card > footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.size-mismatch {
  color: var(--rust);
  font-size: 11px;
  font-weight: 700;
}

.result-card > header {
  flex-wrap: wrap;
  row-gap: 8px;
  border-bottom: 1px solid var(--stone-light);
  color: var(--umber-deep);
  font-size: 13px;
}

.result-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.result-card > header .job-model {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 生成模型标题：大字 + 绿色底 */
.model-controls .model-controls-heading h3 {
  display: inline-block;
  margin: 0;
  padding: 5px 16px;
  border-radius: 10px;
  color: #fff;
  background: var(--olive);
  font-size: 17px;
  font-weight: 700;
}

/* 搜索框聚焦：去掉绿色线框 */
.library-search:focus-within {
  border-color: var(--line-strong);
  box-shadow: none;
}

.library-search input:focus {
  outline: none;
}

.result-copy-prompt,
.result-restore,
.result-edit,
.result-download,
.result-delete {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--stone-light);
  border-radius: 8px;
  color: var(--umber);
  background: transparent;
}

.result-edit {
  width: auto;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.result-copy-prompt:hover,
.result-restore:hover,
.result-edit:hover,
.result-download:hover,
.result-delete:hover {
  border-color: var(--umber);
  color: var(--white);
  background: var(--umber);
}

.result-delete:hover {
  border-color: var(--rust);
  background: var(--rust);
}

.job-prompt {
  display: -webkit-box;
  margin: 0;
  padding: 8px 12px 0;
  overflow: hidden;
  color: var(--umber-deep);
  font-size: 12px;
  line-height: 1.45;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.result-card > footer {
  min-height: 39px;
  flex-wrap: wrap;
  border-top: 1px solid var(--stone-light);
  color: var(--stone);
  font-size: 11px;
  line-height: 1.4;
}

.job-status {
  color: var(--ochre);
  font-size: 11px;
}

.is-succeeded .job-status {
  color: var(--olive);
}

.is-failed .job-status {
  color: var(--rust);
}

.result-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  cursor: zoom-in;
  background: var(--stone-light);
}

.result-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.job-loading,
.job-failure {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, #f7f8ee 0%, #eef3e2 100%);
}

.job-loading {
  grid-auto-flow: column;
  gap: 7px;
}

.job-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ochre);
  animation: job-pulse 1.1s ease-in-out infinite;
}

.job-loading span:nth-child(2) {
  animation-delay: 120ms;
}

.job-loading span:nth-child(3) {
  animation-delay: 240ms;
}

.job-failure {
  gap: 12px;
  justify-items: center;
  color: var(--rust);
}

.job-failure p {
  max-width: 360px;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

@keyframes job-pulse {
  0%, 100% { opacity: 0.28; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.account-dialog {
  width: min(92vw, 410px);
  max-height: min(86vh, 680px);
  padding: 22px;
  overflow: auto;
  border: 1px solid rgba(59, 36, 20, 0.22);
  border-radius: 20px;
  color: var(--ink);
  background: var(--linen);
  box-shadow: 0 28px 90px rgba(26, 18, 12, 0.38);
}

.recharge-dialog,
.redeem-dialog {
  width: min(92vw, 520px);
  max-height: min(90vh, 820px);
}

.session-billing {
  gap: 8px;
  margin-top: 4px;
}

.account-dialog::backdrop {
  background: rgba(26, 18, 12, 0.64);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(59, 36, 20, 0.1);
}

.dialog-heading h2 {
  margin: 0;
  color: var(--umber-deep);
  font-family: Georgia, "Songti SC", serif;
  font-size: 26px;
  font-weight: 500;
}

.dialog-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  color: var(--umber);
  background: transparent;
  font-size: 22px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--stone-light);
  border-radius: 14px;
  background: var(--parchment);
}

.auth-tabs[hidden] {
  display: none;
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: var(--stone);
  background: transparent;
  font-size: 13px;
}

.auth-tabs button.is-active {
  color: var(--white);
  background: var(--umber);
}

.site-footer {
  display: none;
}

.site-footer span:first-child {
  color: var(--umber);
}

.viewer-dialog {
  width: min(96vw, 1400px);
  height: min(92vh, 920px);
  padding: 0;
  border: 1px solid rgba(255, 248, 236, 0.2);
  border-radius: 18px;
  color: var(--linen);
  background: var(--umber-deep);
  box-shadow: 0 30px 100px rgba(26, 18, 12, 0.5);
}

.viewer-dialog::backdrop {
  background: rgba(26, 18, 12, 0.88);
}

.viewer-close {
  position: absolute;
  top: 17px;
  right: 19px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 248, 236, 0.4);
  border-radius: 10px;
  color: var(--linen);
  background: transparent;
  font-size: 22px;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 68px 15px 19px;
  border-bottom: 1px solid rgba(255, 248, 236, 0.14);
  color: var(--sage);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.viewer-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
}

#viewer-time {
  color: rgba(255, 248, 236, 0.62);
  letter-spacing: 0.04em;
}

#viewer-resolution {
  color: #cfe0c8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.viewer-toolbar > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.viewer-control {
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 248, 236, 0.22);
  border-radius: 8px;
  color: var(--linen);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
}

.viewer-control:hover,
.viewer-close:hover {
  border-color: var(--gold);
  color: var(--gold);
}

#zoom-label {
  min-width: 42px;
  color: var(--linen);
  text-align: center;
}

.viewer-canvas {
  display: grid;
  width: 100%;
  height: calc(100% - 59px);
  overflow: hidden;
  place-items: center;
  cursor: default;
  touch-action: none;
  background:
    linear-gradient(rgba(255, 248, 236, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 248, 236, 0.04) 1px, transparent 1px),
    var(--umber-deep);
  background-size: 28px 28px;
}

.viewer-canvas.is-zoomed {
  cursor: grab;
}

.viewer-canvas.is-panning {
  cursor: grabbing;
}

#viewer-image {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 120ms ease;
  user-select: none;
  touch-action: none;
  cursor: inherit;
}

.viewer-canvas.is-panning #viewer-image {
  transition: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 15px;
  border-left: 3px solid var(--ochre);
  border-radius: 12px;
  color: var(--linen);
  background: var(--umber-deep);
  box-shadow: 0 14px 40px rgba(26, 18, 12, 0.32);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--ease), transform var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.video-dialog {
  width: min(1080px, 94vw);
  max-height: min(88vh, 900px);
  padding: 22px 24px;
  border: 1px solid rgba(59, 36, 20, 0.12);
  border-radius: 22px;
  color: var(--ink);
  background: var(--linen);
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.video-dialog::backdrop {
  background: rgba(26, 18, 12, 0.5);
}

.gallery-open {
  display: block;
  width: calc(100% - 24px);
  margin: 4px 12px 12px;
  padding: 10px;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  color: var(--umber);
  background: rgba(255, 248, 236, 0.85);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.gallery-open:hover {
  border-color: var(--umber);
  color: var(--white);
  background: var(--umber);
}

.gallery-dialog {
  width: min(1280px, 96vw);
  max-height: min(90vh, 960px);
  padding: 22px 24px;
  border: 1px solid rgba(59, 36, 20, 0.12);
  border-radius: 22px;
  color: var(--ink);
  background: var(--linen);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-dialog::backdrop {
  background: rgba(26, 18, 12, 0.5);
}

.gallery-dialog:not([open]) {
  display: none;
}

.gallery-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 4px 12px 0;
  overscroll-behavior: contain;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gallery-hint {
  margin: 12px 0 4px;
  color: var(--stone);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.video-body {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
}

.video-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--stone-light);
  border-radius: 16px;
  background: var(--white);
}

.video-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--umber);
}

.video-form textarea {
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--stone-light);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  resize: vertical;
}

.video-refs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--stone);
  font-size: 12px;
}

.video-ref-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.video-ref-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--stone);
  font-size: 11px;
  line-height: 1.5;
}

.video-ref-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--stone-light);
  border-radius: 10px;
  background: var(--stone-light);
}

.video-ref-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-ref-item button:first-child {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.video-ref-item .reference-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: rgba(26, 18, 12, 0.78);
  font-size: 13px;
}

.video-duration {
  display: flex;
  gap: 8px;
  padding: 0;
  border: 0;
}

.video-results {
  display: grid;
  min-height: 240px;
  gap: 12px;
  align-content: start;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--stone-light);
  border-radius: 16px;
  background: var(--white);
}

.video-media video {
  display: block;
  width: 100%;
  max-height: 320px;
  background: #10140f;
}

.video-loading {
  display: grid;
  aspect-ratio: 16 / 9;
  place-content: center;
  grid-auto-flow: column;
  gap: 7px;
  background: linear-gradient(180deg, #f7f8ee 0%, #eef3e2 100%);
}

.video-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ochre);
  animation: job-pulse 1.1s ease-in-out infinite;
}

.video-loading span:nth-child(2) {
  animation-delay: 120ms;
}

.video-loading span:nth-child(3) {
  animation-delay: 240ms;
}

.video-failed {
  display: grid;
  aspect-ratio: 16 / 9;
  place-content: center;
  padding: 16px;
  color: var(--rust);
  font-size: 12px;
  background: linear-gradient(180deg, #f7f8ee 0%, #eef3e2 100%);
}

.video-card > footer {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--stone-light);
  color: var(--stone);
  font-size: 11px;
}

.video-prompt {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--umber-deep);
  font-size: 12px;
  line-height: 1.45;
}

.video-empty {
  margin: 0;
  padding: 32px 12px;
  color: var(--stone);
  font-size: 12px;
  text-align: center;
}

.video-duration .chip {
  min-height: 34px;
  padding: 0 14px;
}

@media (max-width: 900px) {
  .video-body {
    grid-template-columns: 1fr;
  }

  .video-ref-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.is-loading {
  opacity: 0.58;
  pointer-events: none;
}

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(26, 18, 12, 0.45);
}

.nav-scrim[hidden] {
  display: none;
}

.loading-line {
  color: var(--stone);
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1100px) {
  .atelier {
    grid-template-columns: 1fr;
  }

  .atelier-nav {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    width: min(84vw, 280px);
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow);
  }

  body.nav-open .atelier-nav {
    transform: none;
  }

  .nav-toggle {
    display: flex;
  }

  .atelier-stage {
    padding: 0 18px 20px;
  }
}

@media (max-width: 799px) {
  html,
  body {
    height: auto;
    overflow: auto;
    overflow-x: hidden;
  }

  .atelier,
  .atelier-stage {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .workbench {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    align-items: start;
    overflow: visible;
  }

  .workbench-main,
  .warehouse-panel {
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .generate-form {
    overflow: visible;
  }

  .generate-form > .prompt-group,
  .generate-form:has(#reference-group:not([hidden])) > .prompt-group,
  textarea {
    flex: none;
    max-height: none;
  }

  textarea {
    min-height: 96px;
    resize: vertical;
  }

  .output-row {
    grid-template-columns: 1fr;
  }

  .atelier-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .model-controls-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .model-controls-heading .field-hint {
    text-align: left;
  }

}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    min-height: 64px;
    padding: 8px 0;
  }

  .library-search {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }

  .warehouse-panel {
    min-height: 420px;
  }

  .site-footer {
    flex-direction: column;
    gap: 8px;
  }

  .primary-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 18px;
  }

  .local-badge {
    display: none;
  }

  .topbar-meta {
    gap: 6px;
  }

  .account-trigger,
  .recharge-trigger,
  .redeem-trigger,
  .account-register-trigger {
    min-height: 40px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .submit-row {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .ratio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .warehouse-heading {
    gap: 12px;
    flex-direction: column;
  }

  .warehouse-meta {
    align-items: flex-start;
  }

  .viewer-toolbar {
    gap: 10px;
    align-items: flex-start;
    flex-direction: column;
    padding-right: 58px;
  }

  #viewer-title {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .viewer-canvas {
    height: calc(100% - 92px);
  }
}

/* Landscape workspace: quiet surfaces, evergreen navigation and a pinned
   creation action. This replaces the earlier comfort layer. */
[hidden] { display: none !important; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.atelier-nav {
  padding: 28px 16px 18px;
  border: 0;
  color: #eef5ed;
  background: var(--umber-deep);
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand { gap: 10px; margin: 0 4px 38px; color: #f0f5eb; }
.brand-wordmark { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: #f0f5eb; }
.brand-sub { max-width: 125px; margin-top: 5px; color: #b4c6bb; font-size: 8px; line-height: 1.5; letter-spacing: .17em; }
.brand-mark { width: 22px; height: 22px; }
.nav-label { margin: 16px 12px 9px; color: #afc5b7; font-size: 11px; font-weight: 400; letter-spacing: .16em; }
.side-menu { gap: 6px; }
.nav-item { min-height: 46px; gap: 12px; padding: 0 14px; color: #d0dfd4; border-radius: 10px; font-size: 13px; }
.nav-item svg { width: 18px; height: 18px; opacity: .9; }
.nav-item:hover { background: rgba(218,236,218,.08); color: #fff; }
.nav-item.is-active { color: #183e2f; background: #d1e2bf; box-shadow: none; font-weight: 650; }
.nav-item:focus-visible { outline-color: #c3d7a5; }
.nav-status { margin-top: auto; margin-bottom: 0; padding: 14px 10px 2px; border: 0; border-top: 1px solid #3a5949; border-radius: 0; background: transparent; backdrop-filter: none; }
.nav-status small { color: #b4c6bb; font-size: 11px; line-height: 1.7; }
.local-badge { color: #d6e6d7; font-size: 10px; letter-spacing: .05em; }
.local-badge i { background: #abc78d; box-shadow: 0 0 0 3px rgba(171,199,141,.12); }
.nav-cover {
  position: relative;
  min-height: 108px;
  height: 108px;
  margin: 24px -16px 0;
  flex-shrink: 0;
  background: repeating-radial-gradient(ellipse at 115% 110%, transparent 0 14px, rgba(195,215,165,.11) 15px 16px, transparent 17px 30px);
  opacity: .85;
}
.atelier-stage { padding: 0 24px 20px; }
.topbar { min-height: 76px; gap: 22px; border: 0; background: var(--linen); backdrop-filter: none; }
.workspace-title { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.workspace-title strong { display: block; font-size: 14px; font-weight: 650; color: var(--umber-deep); }
.workspace-title small { display: block; margin-top: 4px; color: var(--stone); font-size: 9px; letter-spacing: .12em; }
.workspace-symbol { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #d2dfd4; border-radius: 9px; color: var(--umber); font: italic 22px Georgia, serif; background: #e6eee7; }
.library-search { max-width: 330px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.75); padding: 0 12px; }
.library-search input { min-height: 38px; font-size: 12px; outline-offset: 0; }
.library-search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(82,138,106,.1); }
.topbar-meta { gap: 12px; }
.billing-actions, .account-actions { gap: 4px; }
.recharge-trigger, .redeem-trigger, .account-trigger, .account-register-trigger {
  min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px;
  color: var(--umber-deep); background: transparent; font-size: 12px; font-weight: 600;
  transition: background var(--ease), color var(--ease);
}
.recharge-trigger { background: #e3ece4; }
.account-trigger { background: #fff; border-color: var(--line); max-width: 168px; overflow: hidden; text-overflow: ellipsis; }
.account-register-trigger { background: var(--umber); color: white; }
.recharge-trigger:hover, .redeem-trigger:hover, .account-trigger:hover { background: #dce9de; color: var(--umber-deep); }
.account-register-trigger:hover { background: var(--umber-deep); }
.wallet-badge { min-height: 40px; border: 0; padding: 0 10px; background: transparent; font-weight: 600; }
main { padding-top: 0; }
.workbench { grid-template-columns: 384px minmax(0, 1fr); gap: 22px; }
.panel { border-color: var(--line); border-radius: 18px; box-shadow: var(--shadow); background: var(--white); }
.workbench-main { padding: 0; }
.generate-form { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; overflow: hidden; gap: 0; }
.composer-scroll { flex: 1; min-height: 0; padding: 20px 20px 16px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #c8d6cc transparent; scroll-padding: 12px; }
.creation-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 20px; background: #edf2ee; border-radius: 11px; }
.creation-modes .segment { display: flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 7px; border: 0; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--stone); background: transparent; }
.creation-modes .segment.is-active { color: var(--umber); background: #fff; box-shadow: 0 2px 5px rgba(22,61,49,.07); font-weight: 650; }
.creation-modes svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.model-controls { margin: 0 0 20px; padding: 0; border: 0; border-radius: 0; background: none; }
.model-controls-heading { margin-bottom: 10px; }
.model-controls-heading h3, legend, .control-label { color: var(--ink); font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.5; }
.model-tabs { gap: 8px; }
.model-tab { min-height: 44px; gap: 6px; padding: 10px; border-color: var(--line); border-radius: 10px; background: #fff; }
.model-tab strong { font-size: 12px; font-weight: 600; }
.model-tab:hover { border-color: #9cbaa8; background: var(--surface-soft); }
.model-tab.is-active { border-color: #729a80; background: #edf5ef; box-shadow: inset 0 0 0 1px #729a8033; }
.model-tab:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.model-tab input:focus-visible { outline: 0; }
.model-badge { font-size: 9px; letter-spacing: .04em; padding: 3px 5px; color: var(--stone); background: var(--parchment); border-radius: 4px; }
.model-tab.is-active .model-badge { background: #d9e9dc; color: var(--umber); }
.output-rail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); gap: 8px; grid-template-columns: minmax(0,1fr) 86px; }
.output-row { display: contents; }
.output-rail .chip-row { grid-column: 1 / -1; grid-row: 1; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.output-rail .quality-control { grid-column: 2; grid-row: 2; }
.output-rail > .field-hint { grid-column: 1; grid-row: 2; }
.output-rail > .resolution-availability, .output-rail > #quality-hint { grid-column: 1 / -1; grid-row: auto; }
.output-rail [data-resolution="4K-HIGH"] { font-size: 10px; }
.output-rail .chip { min-height: 36px; padding: 5px 3px; font-size: 11px; border-radius: 8px; border-color: var(--line); background: var(--surface-soft); }
.output-rail .chip.is-active { color: var(--umber-deep); background: var(--sage); border-color: #acc5b3; box-shadow: none; }
.output-rail .chip:hover:not(:disabled) { border-color: var(--focus); }
.quality-control { gap: 6px; }
.quality-control label { font-size: 11px; }
select { min-height: 36px; padding: 4px 4px 4px 8px; border-color: var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 12px; }
.field-hint { color: var(--stone); font-size: 11px; line-height: 1.65; }
.control-group { margin: 0 0 20px; }
.prompt-group { display: block; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; overflow: visible; }
.prompt-group .control-label { margin-bottom: 10px; font-size: 13px; }
#prompt {
  display: block; min-height: 142px; height: 156px; max-height: none; flex: none; resize: vertical;
  padding: 14px; border: 1px solid #ccdacf; border-radius: 12px; background: #f9fbf9;
  color: var(--ink); font-size: 13px; line-height: 1.85;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
#prompt:hover { border-color: #95b19e; }
#prompt:focus { border-color: var(--focus); background: #fff; box-shadow: 0 0 0 3px rgba(82,138,106,.1); }
textarea::placeholder, input::placeholder { color: #6e8074; opacity: 1; }
.character-count { margin-top: 7px; font-size: 10px; letter-spacing: .025em; font-variant-numeric: tabular-nums; color: var(--stone); }
.reference-group legend { margin-bottom: 10px; }
.compact-dropzone { min-height: 0; padding: 10px; border-color: #b0c8b7; border-radius: 11px; background: #f2f7f2; }
.compact-dropzone .dropzone-icon { width: 26px; height: 26px; margin-bottom: 6px; border-radius: 7px; border-color: #c3d7c7; font-size: 18px; }
.dropzone strong { font-size: 12px; font-weight: 500; }
.dropzone small { font-size: 10px; line-height: 1.65; }
.reference-list { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.reference-item { border-radius: 8px; border-color: var(--line); }
.ratio-group { margin-top: 0; margin-bottom: 0; }
.ratio-group legend { margin-bottom: 10px; }
.ratio-grid { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.ratio { display: flex; min-height: 46px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 6px 2px; border-color: var(--line); border-radius: 8px; color: var(--stone); background: #fff; font-size: 10px; line-height: 1; }
.ratio::before { content: ""; display: block; width: var(--ratio-w,12px); height: var(--ratio-h,12px); border: 1.2px solid currentColor; border-radius: 2px; opacity: .8; }
.ratio[data-ratio="2:3"] { --ratio-w: 9px; --ratio-h: 14px; }
.ratio[data-ratio="3:2"] { --ratio-w: 16px; --ratio-h: 10px; }
.ratio[data-ratio="3:4"], .ratio[data-ratio="4:5"] { --ratio-w: 10px; --ratio-h: 14px; }
.ratio[data-ratio="4:3"], .ratio[data-ratio="5:4"] { --ratio-w: 15px; --ratio-h: 11px; }
.ratio[data-ratio="9:16"] { --ratio-w: 8px; --ratio-h: 14px; }
.ratio[data-ratio="16:9"] { --ratio-w: 18px; --ratio-h: 10px; }
.ratio[data-ratio="21:9"] { --ratio-w: 22px; --ratio-h: 9px; }
.ratio.is-active { color: var(--umber); border-color: #8eb39b; background: #edf5ef; box-shadow: none; font-weight: 700; }
.ratio:hover:not(.is-active) { border-color: #9cbaa8; color: var(--umber); background: var(--surface-soft); }
.composer-actions { position: relative; z-index: 2; flex: 0 0 auto; padding: 14px 20px 12px; border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -6px 18px rgba(22,61,49,.025); }
.submit-row { grid-template-columns: 72px minmax(0,1fr); gap: 12px; margin: 0; padding: 0; border: 0; }
.count-control { gap: 5px; font-size: 10px; font-weight: 500; color: var(--stone); }
.count-control input { height: 44px; padding: 8px 10px; border-color: var(--line); border-radius: 10px; background: #f8faf8; font-size: 13px; }
.submit-row .primary-button { min-height: 44px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 10px rgba(40,101,79,.14); }
.primary-button:hover, .secondary-button:hover { transform: none; background: #1e513e; }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.button-leaf { width: 15px; height: 15px; flex-basis: 15px; opacity: .8; }
.form-status { min-height: 16px; margin-top: 9px; padding: 0 2px; gap: 7px; font-size: 10px; line-height: 1.5; }
.status-pip { width: 5px; height: 5px; flex: 0 0 5px; box-shadow: none; background: #71957b; }
.form-status.is-error .status-pip { background: var(--rust); }
.warehouse-panel { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.warehouse-scroll { display: flex; flex-direction: column; min-height: 0; padding: 0 4px 8px 0; scrollbar-color: #c8d6cc transparent; }
.results-grid { flex: 1; min-height: 0; grid-template-columns: repeat(auto-fill,minmax(min(320px,100%),1fr)); grid-auto-rows: max-content; gap: 18px; align-content: start; align-items: start; }
.results-grid:has(> .empty-output:only-child) { grid-template-rows: 1fr; min-height: 320px; border: 1px dashed #c8d7cc; border-radius: 18px; background: #f8faf8; }
.results-grid > .empty-output:only-child { max-width: 300px; padding: 24px; align-self: center; }
.empty-output { gap: 10px; }
.empty-output strong { margin-top: 6px; color: var(--umber-deep); font-family: inherit; font-size: 17px; font-weight: 600; }
.empty-output span { max-width: 230px; color: var(--stone); font-size: 12px; line-height: 1.85; }
.empty-cross { width: 68px; height: 68px; border: 1px solid #d2e2d5; border-radius: 20px; color: #688f72; background: #e9f1e8; }
.empty-cross svg { width: 32px; height: 32px; }
.result-card { display: flex; flex-direction: column; border: 1px solid #dfe8e1; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(22,61,49,.025); transition: border-color var(--ease), box-shadow var(--ease); }
.result-card > * { flex: 0 0 auto; }
.result-card:hover, .result-card:focus-within { border-color: #b3cabb; box-shadow: 0 5px 20px rgba(22,61,49,.075); }
.result-preview { aspect-ratio: 16 / 10; background: #e9eeea; }
.result-preview img { object-fit: contain; }
.result-preview:hover img { transform: none; }
.result-card > header { min-height: 54px; padding: 9px 12px; gap: 8px; border: 0; font-size: 12px; }
.result-card > header .job-model { font-size: 12px; font-weight: 650; color: var(--umber-deep); }
.result-actions { gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.result-copy-prompt, .result-restore, .result-download, .result-delete { width: 30px; height: 32px; border-color: transparent; color: #6b7e70; background: transparent; border-radius: 7px; }
.result-actions svg { display: block; width: 15px; height: 15px; pointer-events: none; }
.result-edit { width: auto; height: 32px; padding: 0 8px; border-color: transparent; border-radius: 7px; font-size: 11px; font-weight: 500; color: var(--umber); background: var(--sage); }
.result-copy-prompt:hover, .result-restore:hover, .result-download:hover, .result-edit:hover { border-color: transparent; color: var(--umber-deep); background: #dfece1; }
.result-delete:hover { border-color: transparent; color: #a24f3b; background: #f9ebe6; }
.job-prompt { padding: 0 14px; margin-bottom: 12px; color: #415c4c; font-size: 12px; line-height: 1.7; -webkit-line-clamp: 2; line-clamp: 2; }
.result-card > footer { min-height: 48px; padding: 10px 14px; border-top: 1px solid #edf1ee; color: var(--stone); background: #fbfcfb; font-size: 11px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.job-loading, .job-failure { aspect-ratio: 16 / 10; background: #eaf1eb; }
.job-status { color: var(--umber); font-size: 10px; }
.gallery-open { width: 100%; flex: 0 0 auto; min-height: 40px; margin: 12px 0 0; padding: 8px 16px; border: 1px solid #d8e3db; border-radius: 10px; color: var(--umber); background: #e7eee7; font-size: 12px; font-weight: 500; }
.gallery-open:hover { color: var(--umber-deep); background: #dce9dc; }
.account-dialog, .video-dialog, .gallery-dialog { border-color: #d5e2d9; border-radius: 18px; background: #fff; box-shadow: 0 24px 80px #163d3133; }
.account-dialog::backdrop, .video-dialog::backdrop, .gallery-dialog::backdrop { background: #102e226b; backdrop-filter: blur(5px); }
.dialog-heading h2 { font: 600 21px/1.5 "Segoe UI","Microsoft YaHei UI",sans-serif; }
.dialog-heading { border-bottom-color: var(--line); }
.dialog-close { width: 40px; height: 40px; border-color: var(--line); background: #f6f8f6; }
.mini-form input, .mini-form select { background: #f8faf8; border-color: var(--line-strong); border-radius: 9px; }
.auth-tabs { background: #edf2ee; border: 0; border-radius: 11px; }
.auth-tabs button { min-height: 44px; }
.auth-tabs button.is-active { color: var(--umber); background: #fff; box-shadow: 0 2px 5px #163d3110; }
.account-status { color: var(--stone); background: #f0f5ef; border-color: #9dbaa1; }
.session-summary { background: #eff5ef; border-color: #ccdece; }
.gallery-grid { gap: 18px; }
.gallery-dialog .result-card > header { flex-wrap: wrap; }
.viewer-dialog { display: flex; flex-direction: column; background: #18362b; }
.viewer-dialog:not([open]) { display: none; }
.viewer-toolbar { flex: 0 0 auto; flex-wrap: wrap; gap: 12px; padding-right: 70px; }
.viewer-toolbar > div { flex-wrap: wrap; }
.viewer-canvas { flex: 1; min-height: 0; height: auto; }
@media (max-width: 1300px) and (min-width: 1101px) {
  :root { --nav-width: 196px; }
  .atelier-stage { padding-right: 18px; padding-left: 18px; }
  .workbench { grid-template-columns: 344px minmax(0,1fr); gap: 18px; }
  .workspace-title { display: none; }
  .result-card > header { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .atelier { grid-template-columns: minmax(0,1fr); }
  .atelier-nav { width: 240px; }
  .atelier-stage { padding: 0 20px 18px; }
  .nav-toggle { flex-shrink: 0; width: 40px; height: 40px; border-color: var(--line); border-radius: 10px; }
  .topbar { gap: 14px; }
  .workspace-title { display: none; }
  .workbench { grid-template-columns: 350px minmax(0,1fr); gap: 18px; }
  .composer-scroll { padding: 18px; }
  .composer-actions { padding-right: 18px; padding-left: 18px; }
}
@media (max-height: 800px) and (min-width: 800px) {
  .topbar { min-height: 64px; }
  .atelier-stage { padding-bottom: 14px; }
  .atelier-nav { padding-top: 22px; }
  .brand { margin-bottom: 24px; }
  .nav-cover { min-height: 60px; height: 60px; margin-top: 12px; }
  .composer-scroll { padding-top: 14px; padding-bottom: 14px; }
  .creation-modes { margin-bottom: 14px; }
  .model-controls { margin-bottom: 14px; }
  .control-group { margin-bottom: 14px; }
  #prompt { height: 142px; }
  .composer-actions { padding-top: 10px; padding-bottom: 10px; }
}
@media (max-width: 799px) {
  html { height: auto; min-height: 100%; overflow: auto; }
  body { height: auto; min-height: 100%; overflow: visible; }
  .atelier, .atelier-stage { height: auto; min-height: 100dvh; overflow: visible; }
  .atelier-stage main { display: block; overflow: visible; }
  .workbench { display: grid; grid-template-columns: minmax(0,1fr); height: auto; overflow: visible; gap: 20px; }
  .workbench-main, .warehouse-panel { height: auto; overflow: visible; min-height: 0; }
  .generate-form { height: auto; overflow: visible; }
  .composer-scroll { flex: none; overflow: visible; padding: 20px; }
  .composer-actions { position: static; padding: 12px 20px max(12px,env(safe-area-inset-bottom)); border-radius: 0 0 18px 18px; }
  .output-row { grid-template-columns: minmax(0,1fr) 94px; }
  .model-controls-heading { flex-direction: row; align-items: center; }
  #prompt { height: 180px; font-size: 16px; }
  .ratio { min-height: 50px; }
  .model-tab { min-height: 48px; }
  .output-rail .chip, .quality-control select { min-height: 44px; }
  .quality-control select, .count-control input, .mini-form input, .library-search input { font-size: 16px; }
  .results-grid { flex: none; min-height: 0; gap: 16px; }
  .results-grid:has(> .empty-output:only-child) { min-height: 340px; }
  .warehouse-scroll { overflow: visible; }
  .result-copy-prompt, .result-restore, .result-download, .result-delete, .result-edit { min-width: 40px; min-height: 44px; }
  .result-card > header { flex-wrap: wrap; }
  .gallery-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 720px) {
  .atelier-stage { padding: 0 14px 20px; }
  .topbar { min-height: 0; padding: 12px 0 16px; gap: 10px; }
  .topbar-meta { gap: 4px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
  .library-search { max-width: none; min-height: 44px; }
  .library-search input { min-height: 42px; }
  .account-trigger { max-width: 118px; }
  .recharge-trigger, .redeem-trigger, .account-trigger, .account-register-trigger, .wallet-badge { min-height: 44px; padding: 7px 9px; font-size: 11px; }
  .nav-toggle { width: 44px; height: 44px; }
  .billing-actions, .account-actions { gap: 2px; }
  .wallet-badge { min-height: 30px; }
}
@media (max-width: 420px) {
  .topbar-meta { max-width: calc(100% - 54px); }
  .composer-scroll { padding: 16px; }
  .composer-actions { padding-right: 16px; padding-left: 16px; }
  .model-tabs { gap: 8px; }
  .model-tab { padding: 8px; }
  .model-badge { font-size: 8px; padding: 3px 4px; }
  .ratio-grid { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; }
  .local-badge { display: inline-flex; }
  .brand h1 { font-size: 22px; }
  .viewer-toolbar { padding: 14px 58px 14px 14px; }
  .viewer-toolbar > div { gap: 5px; }
  .viewer-control { min-height: 40px; }
}
@media (pointer: coarse) {
  .result-copy-prompt, .result-restore, .result-download, .result-delete, .result-edit { min-width: 44px; min-height: 44px; }
  .reference-item .reference-remove { min-width: 36px; min-height: 36px; }
}

/* Slim card title row above the image */
.result-card > header {
  order: -1;
  min-height: 0;
  padding: 6px 12px;
}

.result-card > header .job-model {
  color: #000;
  font-size: 15px;
  font-weight: 800;
}

.result-card > header .result-actions button,
.result-card > header .job-status {
  color: #000;
}

/* Model icons */
.model-icon {
  display: inline-flex;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.model-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.model-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.job-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.model-tab-copy strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.model-tab .model-icon {
  width: 18px;
  height: 18px;
}

.result-card > header .job-model .model-icon {
  width: 18px;
  height: 18px;
}

/* ---- Model wordmarks (艺术字) ---- */
.model-tab {
  position: relative;
}

.model-wordmark {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.wordmark-gpt-image-2 {
  color: #1f4d2a;
  text-shadow: 0 1px 0 rgba(31, 77, 42, 0.18);
}

.wordmark-banana2 {
  background: linear-gradient(100deg, #7b5ce6 0%, #5f7ce0 45%, #3fb6c9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 6px rgba(95, 124, 224, 0.35));
}

.wordmark-bananapro {
  background: linear-gradient(100deg, #8a6420 0%, #d9a83f 40%, #f3d27a 55%, #a97b28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 1px rgba(138, 100, 32, 0.35));
}

.wordmark-grok2 {
  color: #16181a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.model-tab .model-wordmark {
  font-size: 15px;
}

.result-card > header .job-model .model-wordmark {
  font-size: 17px;
}

/* ---- HOT flame tag on the GPT Image 2 tab ---- */
.model-hot {
  position: absolute;
  top: 0;
  right: 10px;
  transform: translateY(-45%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff6b4a, #dd2f1c);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  letter-spacing: 0.06em;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(221, 47, 28, 0.4);
  pointer-events: none;
}

.model-hot svg {
  width: 10px;
  height: 10px;
}

.model-hot.is-sunburst {
  background: linear-gradient(180deg, #f5c94a, #d99a1f);
  box-shadow: 0 2px 6px rgba(217, 154, 31, 0.42);
}

.model-hot.is-flare {
  background: linear-gradient(180deg, #37b6ff, #1273e6);
  box-shadow: 0 2px 6px rgba(18, 115, 230, 0.4);
}

/* ---- Brand: italic cursive lettering ---- */
.brand h1 {
  font-family: "Pinyon Script", "Snell Roundhand", "Segoe Script", cursive;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #b9e39c;
  text-shadow:
    0 1px 0 rgba(16, 42, 26, 0.9),
    0 2px 3px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 0 22px rgba(185, 227, 156, 0.28);
}

/* ---- Model tab: show full model name (badge removed) ---- */
.model-tab-copy strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.model-tab .model-wordmark {
  font-size: 14px;
  letter-spacing: 0;
}

/* ---- Enlarge the trailing "2" in model wordmarks ---- */
.model-wordmark .wordmark-digit {
  font-size: 1.3em;
  font-weight: 800;
  line-height: 1;
}
