:root {
  --bg: #07080b;
  --panel: rgba(17, 19, 25, 0.78);
  --field: #0a0c11;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #e9ebf1;
  --muted: #8b92a3;
  --dim: #656c7c;
  --accent: #eaa45f;
  --accent-2: #f4ce97;
  --accent-ink: #1b1206;
  --danger: #ff9292;
  --radius: 15px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(52% 42% at 16% -4%, rgba(234, 164, 95, 0.13), transparent 66%),
    radial-gradient(46% 38% at 102% 6%, rgba(103, 133, 255, 0.08), transparent 64%),
    radial-gradient(40% 40% at 50% 112%, rgba(234, 164, 95, 0.04), transparent 70%);
}

::selection {
  background: rgba(234, 164, 95, 0.28);
}

.shell {
  position: relative;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 26px;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

.logo-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(234, 164, 95, 0.22), rgba(234, 164, 95, 0.03));
  border: 1px solid rgba(234, 164, 95, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.logo-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.015em;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  max-width: 46vw;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #72d79d;
  box-shadow: 0 0 0 3px rgba(114, 215, 157, 0.1);
}

/* ----------------------------------------------------------------- layout */
.studio {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.panel {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

/* ---------------------------------------------------------------- controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field label {
  margin-bottom: 5px;
  color: #9aa2b3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.field.grow {
  flex: 1;
}

.field.grow textarea {
  flex: 1;
  min-height: 100px;
  resize: vertical;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #232733;
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  padding: 9px 10px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #555c6b;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #2d323f;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(234, 164, 95, 0.6);
  box-shadow: 0 0 0 3px rgba(234, 164, 95, 0.11);
  background: #0b0d12;
}

select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m7 10 5 5 5-5' stroke='%238b92a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

select option {
  background: #11141a;
  color: var(--text);
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.hint {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
}

.mp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-suffix {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-suffix input {
  padding-right: 36px;
}

.input-suffix span {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.dims {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #232733;
  border-radius: 10px;
  background: var(--field);
  color: #cbd2df;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

/* --------------------------------------------------------------- advanced */
.advanced {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 1px;
}

.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #a6adbc;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.015em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.advanced summary::after {
  content: "+";
  color: var(--dim);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  transition: transform 160ms ease;
}

.advanced[open] summary::after {
  content: "−";
}

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

.advanced-grid .field:last-child {
  grid-column: 1 / -1;
}

.advanced-grid textarea {
  min-height: 52px;
}

/* ------------------------------------------------------------------ loras */
.lora-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lora-head label {
  margin: 0;
}

.lora-note {
  flex: none;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.lora-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lora-slot {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid #1d212b;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.012);
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.lora-slot.active {
  border-color: rgba(234, 164, 95, 0.3);
  background: rgba(234, 164, 95, 0.04);
}

.lora-slot select {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 32px;
  padding: 0 26px 0 8px;
  font-size: 12px;
  background-position: right 8px center;
}

.lora-slot select:disabled,
.lora-slot input:disabled {
  cursor: not-allowed;
}

.lora-slot select:disabled {
  opacity: 0.58;
}

.lora-strength {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  width: 62px;
}

.lora-strength input {
  width: 100%;
  height: 32px;
  padding: 0 16px 0 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: right;
}

.lora-strength input:disabled {
  opacity: 0.58;
}

.lora-strength span {
  position: absolute;
  right: 6px;
  color: var(--dim);
  font-size: 10px;
  pointer-events: none;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 30px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.field label.switch {
  margin: 0;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border: 1px solid #2a2f3b;
  border-radius: 999px;
  background: #151820;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #7b8394;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.switch input:checked + .switch-track {
  border-color: rgba(234, 164, 95, 0.7);
  background: rgba(234, 164, 95, 0.22);
}

.switch input:checked + .switch-track::after {
  transform: translateX(12px);
  background: var(--accent-2);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(234, 164, 95, 0.75);
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  cursor: not-allowed;
  opacity: 0.45;
}

/* ------------------------------------------------------------ notices etc */
.notice,
.error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.45;
}

.notice {
  border: 1px dashed rgba(234, 164, 95, 0.32);
  background: rgba(234, 164, 95, 0.06);
  color: #d8b58d;
}

.error {
  border: 1px solid rgba(255, 110, 110, 0.24);
  background: rgba(255, 90, 90, 0.07);
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

.generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #f3b771 0%, #e88f52 100%);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 10px 26px rgba(231, 141, 81, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 150ms ease,
    filter 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.generate:hover:not(:disabled) {
  filter: brightness(1.045);
  transform: translateY(-1px);
  box-shadow:
    0 14px 32px rgba(231, 141, 81, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.generate:active:not(:disabled) {
  transform: translateY(0);
}

.generate:disabled {
  cursor: progress;
  opacity: 0.62;
  filter: saturate(0.7);
  transform: none;
}

.generate kbd {
  padding: 2px 5px;
  border: 1px solid rgba(27, 18, 6, 0.22);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.055);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  opacity: 0.62;
}

/* ------------------------------------------------------------------ stage */
.stage {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 10px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1px 3px 10px;
}

.stage-title {
  color: #b7becc;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stage-sub {
  margin-left: 8px;
  color: var(--dim);
  font-size: 10.5px;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.live-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(234, 164, 95, 0.32);
  border-radius: 8px;
  background: rgba(234, 164, 95, 0.08);
  color: var(--accent-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.live-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-1px);
}

.download {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #12151b;
  color: #cbd2df;
  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.download svg {
  width: 15px;
  height: 15px;
}

.download:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-1px);
}

.canvas-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 1;
  min-height: 360px;
  padding: 8px 2px;
}

.canvas {
  position: relative;
  width: 100%;
  height: 60vh;
  overflow: hidden;
  border: 1px solid #20242d;
  border-radius: 14px;
  background:
    radial-gradient(80% 80% at 50% 40%, rgba(234, 164, 95, 0.035), transparent 70%),
    #08090c;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.45),
    0 18px 40px rgba(0, 0, 0, 0.22);
  transition:
    width 260ms ease,
    height 260ms ease;
}

.empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.018);
  color: #6e7586;
}

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

.empty p {
  margin: 0;
  color: #a9b0bf;
  font-size: 13px;
  font-weight: 500;
}

.empty span {
  margin-top: 6px;
  color: var(--dim);
  font-size: 11.5px;
}

#image {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #07080b;
  cursor: zoom-in;
}

.progress {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: rgba(7, 8, 11, 0.82);
  backdrop-filter: blur(10px);
  text-align: center;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.09);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.progress-copy strong {
  display: block;
  color: #e9ebf1;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.progress-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.bar {
  width: min(300px, 78%);
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e79a54, #f4ce97);
  transition: width 350ms ease;
}

.progress.indeterminate .bar-fill {
  width: 34% !important;
  animation: slide 1.25s ease-in-out infinite;
}

.stage-error {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px;
  background:
    radial-gradient(70% 70% at 50% 42%, rgba(255, 90, 90, 0.075), transparent 70%),
    rgba(7, 8, 11, 0.93);
  text-align: center;
}

.error-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 110, 110, 0.3);
  border-radius: 50%;
  background: rgba(255, 90, 90, 0.09);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
}

.stage-error strong {
  color: #f1c4c4;
  font-size: 13px;
  font-weight: 550;
}

.stage-error p {
  max-width: 420px;
  margin: 0;
  color: #a98484;
  font-size: 11.5px;
  line-height: 1.55;
}

.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 26px;
  padding: 8px 4px 1px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
}

#meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.foot-hint {
  flex: none;
  color: #575e6d;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------ result info */
.result-info {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--line);
}

.result-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.result-label {
  padding-top: 2px;
  color: #6f7889;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.result-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #c9d0dd;
  font-size: 11.5px;
  line-height: 1.5;
}

.result-model-label {
  color: #d7dce6;
}

.result-model-id {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  overflow-wrap: anywhere;
}

.result-none {
  color: var(--dim);
}

.lora-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid rgba(234, 164, 95, 0.2);
  border-radius: 999px;
  background: rgba(234, 164, 95, 0.05);
  color: #d8b58d;
  font-size: 10.5px;
  line-height: 1.4;
}

.lora-pill b {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
}

.prompt-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.012);
}

.prompt-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  color: #9aa2b3;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.prompt-details summary::after {
  content: "+";
  color: var(--dim);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
}

.prompt-details[open] summary::after {
  content: "−";
}

.prompt-details p {
  margin: 0;
  padding: 0 9px 9px;
  color: #b9c0ce;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------- tray */
.tray {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px 13px;
}

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 20px;
}

.tray-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tray-title {
  color: #b7becc;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tray-count {
  min-width: 19px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.35;
  text-align: center;
}

.tray-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tray-note {
  color: #575e6d;
  font-size: 10.5px;
  white-space: nowrap;
}

.queue-badge {
  padding: 3px 8px;
  border: 1px solid rgba(234, 164, 95, 0.22);
  border-radius: 999px;
  background: rgba(234, 164, 95, 0.06);
  color: #d8b58d;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ queue */
.queue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 0 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.queue-label {
  flex: none;
  color: #6f7889;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.queue-list {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #2b303b transparent;
}

.queue-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  width: 260px;
  min-height: 42px;
  padding: 6px 7px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0c0e13;
}

.queue-chip.running {
  border-color: rgba(234, 164, 95, 0.24);
  background: rgba(234, 164, 95, 0.045);
}

.queue-pos {
  display: grid;
  place-items: center;
  width: 24px;
  flex: none;
  color: #8b92a3;
  font-family: var(--mono);
  font-size: 10px;
}

.queue-chip.running .queue-pos {
  width: 10px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(234, 164, 95, 0.32);
  animation: pulse 1.8s ease-out infinite;
}

.queue-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.queue-prompt {
  overflow: hidden;
  color: #c9d0dd;
  font-size: 11.5px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.queue-sub {
  overflow: hidden;
  color: #6f7889;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.queue-mini {
  height: 2px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.queue-mini-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e79a54, #f4ce97);
  transition: width 350ms ease;
}

.queue-cancel {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #6f7889;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.queue-cancel:hover {
  border-color: rgba(255, 110, 110, 0.25);
  background: rgba(255, 90, 90, 0.08);
  color: var(--danger);
}

/* ---------------------------------------------------------------- history */
.history-strip {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 2px 1px 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #2b303b transparent;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
  width: 122px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b0d12;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.history-card:hover {
  border-color: var(--line-strong);
  background: #0e1016;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.history-card.selected {
  border-color: rgba(234, 164, 95, 0.62);
  background: rgba(234, 164, 95, 0.045);
  box-shadow:
    0 0 0 1px rgba(234, 164, 95, 0.14),
    0 10px 24px rgba(0, 0, 0, 0.25);
}

.history-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 78px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 8px;
  background:
    radial-gradient(80% 80% at 50% 40%, rgba(234, 164, 95, 0.04), transparent 70%),
    #07080b;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.history-card:hover .history-thumb img {
  transform: scale(1.035);
}

.history-thumb.error {
  border-color: rgba(255, 110, 110, 0.15);
  background:
    radial-gradient(80% 80% at 50% 45%, rgba(255, 90, 90, 0.07), transparent 72%),
    #0a0809;
}

.history-error-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 110, 110, 0.25);
  border-radius: 50%;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 14px;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0 2px 1px;
  color: #6f7889;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}

.history-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 88px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.011);
}

.history-empty-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #626a7a;
}

.history-empty-icon svg {
  width: 17px;
  height: 17px;
}

.history-empty-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-empty-copy strong {
  color: #9aa2b3;
  font-size: 12px;
  font-weight: 500;
}

.history-empty-copy small {
  color: #5e6575;
  font-size: 11px;
}

/* ----------------------------------------------------------------- footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 16px;
  color: #555c6b;
  font-size: 10.5px;
  letter-spacing: 0.015em;
}

.footer-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #3d4350;
}

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(90vw, 520px);
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(20, 23, 30, 0.96);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #cbd2df;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  animation: toast-in 180ms ease both;
}

/* ------------------------------------------------------------- animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slide {
  0% {
    transform: translateX(-105%);
  }
  50% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(300%);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 164, 95, 0.3);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(234, 164, 95, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 164, 95, 0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

:focus-visible {
  outline: 2px solid rgba(234, 164, 95, 0.75);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .studio {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 14px;
  }

  .shell {
    padding: 18px 20px 24px;
  }

  .controls {
    padding: 14px;
  }
}

@media (max-width: 900px) {
  .studio {
    grid-template-columns: 1fr;
  }

  .canvas-wrap {
    min-height: 300px;
  }

  .field.grow textarea {
    min-height: 100px;
  }

  .tray {
    margin-top: 14px;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 14px 12px 22px;
  }

  .topbar {
    margin-bottom: 13px;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .top-meta {
    display: none;
  }

  .controls {
    padding: 13px;
    gap: 11px;
  }

  .panel {
    border-radius: 12px;
  }

  .mp-row {
    align-items: stretch;
  }

  .dims {
    font-size: 10.5px;
    padding: 0 10px;
  }

  .canvas-wrap {
    min-height: 260px;
  }

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

  .lora-note {
    display: none;
  }

  .lora-slot {
    gap: 6px;
  }

  .lora-strength {
    width: 56px;
  }

  .result-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
  }

  .tray {
    padding: 11px 11px 12px;
  }

  .tray-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .tray-note {
    display: none;
  }

  .queue-label {
    display: none;
  }

  .queue-chip {
    width: 220px;
  }

  .history-card {
    width: 108px;
  }

  .history-thumb {
    height: 68px;
  }

  .history-empty {
    justify-content: flex-start;
    padding: 12px;
  }

  .footer {
    font-size: 10px;
  }
}

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