:root {
  --bg: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(248, 250, 252, 0.64);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --accent: #0066ff;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --accent-soft: rgba(0, 102, 255, 0.10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --warning: #b45309;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --brand-gradient: linear-gradient(135deg, #0066ff 0%, #4f7cff 38%, #8b5cf6 100%);
  --brand-gradient-wide: linear-gradient(100deg, #0066ff 0%, #06b6d4 42%, #8b5cf6 100%);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.10);
  --shadow-float: 0 28px 80px rgba(15, 23, 42, 0.16);
  --focus: 0 0 0 4px rgba(0, 102, 255, 0.14);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #070a12;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --faint: #94a3b8;
  --surface: rgba(15, 23, 42, 0.62);
  --surface-strong: rgba(15, 23, 42, 0.86);
  --surface-soft: rgba(30, 41, 59, 0.50);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent-soft: rgba(0, 102, 255, 0.18);
  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.36);
  --shadow-float: 0 34px 90px rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

body.front-page {
  min-height: 100dvh;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

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

.app-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(0, 102, 255, 0.14), transparent 32%),
    radial-gradient(circle at 78% 8%, rgba(139, 92, 246, 0.16), transparent 32%),
    radial-gradient(circle at 52% 86%, rgba(6, 182, 212, 0.10), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--bg));
}

.ambient {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 999px;
  filter: blur(74px);
  opacity: 0.42;
}

.ambient-blue {
  top: 8%;
  left: -160px;
  background: #38bdf8;
}

.ambient-violet {
  right: -150px;
  bottom: 4%;
  background: #8b5cf6;
}

.ambient-cyan {
  left: 42%;
  bottom: -210px;
  background: #22d3ee;
  opacity: 0.22;
}

.grain-layer {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.38) 1px, transparent 1px);
  background-size: 72px 72px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: clamp(360px, 30vw, 468px) minmax(0, 1fr);
  gap: 20px;
  height: 100dvh;
  padding: 18px;
}

.glass-panel,
.modal-panel,
.panel,
.metric,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-radius: var(--radius-xl);
  padding: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.32);
  background-clip: padding-box;
}

.sidebar-head {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

.brand-mark {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--brand-gradient);
  box-shadow: 0 14px 32px rgba(0, 102, 255, 0.30);
}

.brand-mark::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 4px solid #fff;
  border-radius: 999px;
  box-shadow: 10px 10px 0 -3px #fff;
}

.brand-copy,
.brand-copy strong,
.brand-copy span {
  display: block;
  min-width: 0;
}

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

.brand-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.status-capsule,
.mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.sidebar .status-capsule {
  width: 100%;
  flex-wrap: wrap;
  border-radius: 18px;
}

.sidebar .status-pill.soft {
  flex: 0 1 auto;
}

.sidebar .balance-chip {
  flex: 1 1 128px;
  min-width: 0;
}

.site-announcement {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(0, 102, 255, 0.18);
  border-radius: 16px;
  padding: 12px 13px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.12), rgba(6, 182, 212, 0.08)),
    var(--surface-soft);
}

.site-announcement strong {
  font-size: 13px;
  line-height: 1.35;
}

.site-announcement p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .site-announcement {
  border-color: rgba(96, 165, 250, 0.22);
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.18), rgba(6, 182, 212, 0.10)),
    rgba(15, 23, 42, 0.72);
}

.status-pill,
.account-pill,
.wallet-pill,
.chip,
.status-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill.soft {
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

[data-theme="dark"] .status-pill.soft {
  background: rgba(255, 255, 255, 0.07);
}

.balance-chip {
  min-height: 32px;
  max-width: 180px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 10px 26px rgba(0, 102, 255, 0.26);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .balance-chip {
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.24), rgba(139, 92, 246, 0.22)),
    rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    0 14px 34px rgba(0, 102, 255, 0.20),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.36);
}

[data-theme="dark"] .balance-chip:hover {
  border-color: rgba(96, 165, 250, 0.42);
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.34), rgba(139, 92, 246, 0.30)),
    rgba(15, 23, 42, 0.96);
}

.balance-chip.needs-recharge {
  animation: pulseGlow 1.8s ease-in-out infinite;
}

.nav-actions,
.auth-actions,
.account-strip,
.preview-actions,
.preview-modal-actions,
.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-actions {
  justify-content: space-between;
}

.account-strip {
  justify-content: flex-start;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1.2;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.primary-button {
  border: 1px solid transparent;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 12px 28px rgba(0, 102, 255, 0.26);
  padding: 10px 15px;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface-strong);
  padding: 10px 15px;
}

.ghost-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
  padding: 10px 15px;
}

.danger-button {
  border: 1px solid rgba(220, 38, 38, 0.20);
  color: var(--danger);
  background: var(--danger-soft);
  padding: 10px 15px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface-strong);
  padding: 0;
}

.compact {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 12px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.text-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.account-pill {
  padding: 8px 11px;
  color: var(--accent);
  background: var(--accent-soft);
}

[data-theme="dark"] .account-pill {
  color: #dbeafe;
  background: rgba(0, 102, 255, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.wallet-pill {
  padding: 8px 11px;
  color: #fff;
  background: var(--ink);
}

[data-theme="dark"] .wallet-pill {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .secondary-button,
[data-theme="dark"] .icon-button {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .ghost-button {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.07);
}

.theme-toggle {
  margin-left: auto;
}

.sun-icon {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--brand-gradient);
}

[data-theme="dark"] .sun-icon::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-strong);
}

.creator-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 14px;
}

.control-block {
  display: grid;
  gap: 10px;
}

.block-title,
.section-heading,
.modal-head,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.block-title.inline {
  align-items: center;
}

.section-actions {
  display: flex;
  flex: 1 1 360px;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.user-search {
  width: min(420px, 100%);
}

.user-search input {
  min-height: 38px;
  border-radius: 999px;
  padding-inline: 15px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.18;
}

.creator-panel h1 {
  font-size: 21px;
}

h2 {
  font-size: 16px;
}

h3 {
  font-size: 16px;
}

.chip {
  padding: 8px 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.prompt-editor {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--surface-strong), var(--surface-strong)) padding-box,
    var(--brand-gradient) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.prompt-editor:focus-within {
  border-color: rgba(0, 102, 255, 0.34);
  box-shadow: var(--focus), inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.prompt-editor textarea {
  display: block;
  width: 100%;
  min-height: 218px;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 18px 18px 44px;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  line-height: 1.65;
}

.prompt-editor textarea::placeholder {
  color: var(--faint);
}

.prompt-counter {
  position: absolute;
  right: 16px;
  bottom: 14px;
  color: var(--faint);
  font-size: 12px;
}

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

.preset {
  position: relative;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease;
}

.preset::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 200ms ease;
}

.preset:hover,
.preset.active {
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

.preset:hover::before,
.preset.active::before {
  opacity: 1;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.switch-line input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.30);
  transition: background 180ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.20);
  transition: transform 180ms ease;
}

.switch-line input:checked + .switch {
  background: var(--brand-gradient);
}

.switch-line input:checked + .switch::after {
  transform: translateX(18px);
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 124px;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  overflow: hidden;
  border: 1px dashed rgba(99, 102, 241, 0.38);
  border-radius: var(--radius-lg);
  padding: 16px;
  background:
    linear-gradient(var(--surface-soft), var(--surface-soft)) padding-box,
    var(--brand-gradient-wide) border-box;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.upload-zone:hover,
.upload-zone.drag-over,
.upload-zone.paste-added {
  transform: translateY(-1px);
  box-shadow: 0 18px 48px rgba(0, 102, 255, 0.14);
}

.upload-zone.paste-added {
  border-color: rgba(34, 197, 94, 0.58);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.upload-icon::before,
.upload-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--brand-gradient);
  transform: translate(-50%, -50%);
}

.upload-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.upload-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.upload-copy strong {
  font-size: 14px;
}

.upload-copy small,
.upload-desc,
.hint,
.muted,
.field > span {
  color: var(--muted);
  font-size: 13px;
}

.paste-clipboard-button {
  grid-column: 2;
  justify-self: start;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--accent);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.paste-clipboard-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 102, 255, 0.34);
  box-shadow: 0 10px 28px rgba(0, 102, 255, 0.12);
}

.hint.success,
#saveStatus.success {
  color: var(--ok);
}

.hint.warning,
#saveStatus.warning {
  color: var(--warning);
}

.hint.error,
#saveStatus.error {
  color: var(--danger);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.key-binding-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.key-binding-badge.bound {
  color: var(--ok);
  background: var(--ok-soft);
}

.key-binding-badge.unbound {
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.masked-key-input {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok), transparent 55%);
  font-weight: 800;
}

.toast-stack {
  position: fixed;
  z-index: 80;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  font-weight: 800;
  animation: toast-in 180ms ease-out;
}

.toast.success {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok), transparent 70%);
}

.toast.warning {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning), transparent 70%);
}

.toast.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger), transparent 70%);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reference-limit {
  position: absolute;
  right: 14px;
  top: 14px;
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
}

.reference-list {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 0;
  padding-left: 8px;
}

.reference-card {
  position: relative;
  width: 64px;
  height: 64px;
  margin-left: -8px;
  overflow: hidden;
  border: 2px solid var(--surface-strong);
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  transition: transform 180ms ease, z-index 180ms ease;
}

.reference-card:hover {
  z-index: 2;
  transform: translateY(-5px) scale(1.04);
}

.reference-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-card div {
  position: absolute;
  inset: auto 4px 4px 4px;
  display: grid;
  gap: 3px;
}

.reference-card span {
  display: none;
}

.reference-card .text-button {
  min-height: 22px;
  border: 0;
  padding: 0 6px;
  color: #fff;
  background: rgba(15, 23, 42, 0.60);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

.settings-zone details {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--surface-soft);
}

.settings-zone summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

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

.summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-gradient);
  box-shadow: 0 0 16px rgba(0, 102, 255, 0.60);
}

.setting-item {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.16);
}

.segmented button,
.ratio-card,
.mode-tabs button {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segmented button {
  min-height: 34px;
  border-radius: 12px;
}

.segmented button.active,
.mode-tabs button.active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

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

.ratio-card {
  display: grid;
  height: 68px;
  place-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  font-size: 12px;
}

.ratio-card.active {
  color: var(--ink);
  border-color: rgba(0, 102, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.08);
}

.ratio {
  display: block;
  border-radius: 5px;
  background: var(--brand-gradient);
}

.ratio-auto {
  width: 26px;
  height: 22px;
  border-radius: 999px;
}

.ratio-1-1 { width: 22px; height: 22px; }
.ratio-2-3 { width: 18px; height: 28px; }
.ratio-3-2 { width: 30px; height: 20px; }

.generate-footer {
  position: sticky;
  bottom: -20px;
  z-index: 5;
  margin-top: auto;
  padding-top: 12px;
  padding-bottom: 20px;
  background: linear-gradient(180deg, transparent, var(--surface) 24%, var(--surface) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.checkout-strip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.checkout-strip strong {
  color: var(--ink);
}

.generate-btn {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow:
    0 18px 40px rgba(0, 102, 255, 0.30),
    0 0 0 1px rgba(255, 255, 255, 0.20) inset;
  font-size: 16px;
  font-weight: 900;
  transition: transform 140ms ease, box-shadow 180ms ease;
}

.generate-btn::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: translateX(-64%) rotate(18deg);
  animation: sheen 2.9s ease-in-out infinite;
}

.generate-btn span {
  position: relative;
  z-index: 2;
}

.generate-btn:hover {
  box-shadow:
    0 24px 58px rgba(0, 102, 255, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.26) inset;
}

.generate-btn:active {
  transform: scale(0.985);
}

.generate-btn.is-loading {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.26) var(--progress, 48%), transparent 0),
    var(--brand-gradient);
}

.canvas-area {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: 56px minmax(0, 1fr) 120px;
  gap: 14px;
}

.canvas-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-tabs button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 16px;
}

.status-chip {
  max-width: min(420px, 42vw);
  overflow: hidden;
  padding: 9px 13px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  text-overflow: ellipsis;
}

.stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.24)),
    radial-gradient(circle at 50% 14%, rgba(0, 102, 255, 0.12), transparent 38%);
  box-shadow: var(--shadow-soft);
}

[data-theme="dark"] .stage {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.42)),
    radial-gradient(circle at 50% 14%, rgba(0, 102, 255, 0.16), transparent 38%);
}

.stage-orb {
  position: absolute;
  width: 46vw;
  max-width: 760px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(0, 102, 255, 0.07) 36%, transparent 66%);
  filter: blur(8px);
}

.empty-state {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.ai-orbit-loader {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background:
    radial-gradient(circle, var(--surface-strong) 0 28%, transparent 29%),
    conic-gradient(from 0deg, #0066ff, #8b5cf6, #06b6d4, #0066ff);
  filter: drop-shadow(0 18px 34px rgba(0, 102, 255, 0.28));
  animation: spin 3.2s linear infinite;
}

.gallery {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  padding: 24px;
}

.result-preview {
  display: grid;
  width: min(100%, 1180px);
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
}

.preview-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
}

.preview-main {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
}

.preview-main img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100dvh - 286px);
  border-radius: 24px;
  object-fit: contain;
  box-shadow: var(--shadow-float);
}

.floating-actions {
  position: absolute;
  left: 50%;
  bottom: 18px;
  display: flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.58);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.preview-stage:hover .floating-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.floating-actions button,
.floating-actions a {
  display: inline-flex;
  min-width: 40px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease;
}

.floating-actions button:hover,
.floating-actions a:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.24);
}

.preview-arrow,
.preview-nav-button {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  font-size: 28px;
  line-height: 1;
}

.preview-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
}

.preview-arrow.left { left: 18px; }
.preview-arrow.right { right: 18px; }

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 10px 12px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.preview-summary {
  display: grid;
  min-width: 0;
  gap: 3px;
}

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

.preview-summary span {
  color: var(--muted);
  font-size: 13px;
}

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

.result-thumb {
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 0;
  background: var(--surface-strong);
}

.result-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.result-thumb span {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.result-thumb.active {
  border-color: var(--accent);
}

.prompt-preview {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 11px 13px;
  background: var(--surface);
}

.prompt-preview summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.prompt-preview p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.view-panel {
  display: grid;
  width: min(100%, 1080px);
  max-height: 100%;
  min-height: min(520px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.empty-view {
  place-items: center;
  justify-content: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.empty-view strong {
  font-size: 22px;
}

.empty-view span {
  color: var(--muted);
  font-size: 14px;
}

.library-view {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.library-head h2 {
  font-size: 22px;
}

.library-head > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 900;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 2px 2px 10px;
}

.library-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-strong);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.library-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 102, 255, 0.28);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.library-card > button:not(.remove-favorite) {
  display: grid;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.library-card img,
.library-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 1.12;
  object-fit: cover;
  background:
    radial-gradient(circle at 30% 20%, rgba(0, 102, 255, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(219, 234, 254, 0.86), rgba(237, 233, 254, 0.86));
}

.library-card-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 12px;
}

.library-card-copy strong,
.library-card-copy small,
.library-card-copy em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.library-card-copy small,
.library-card-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.remove-favorite {
  position: absolute;
  right: 10px;
  top: 10px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: rgba(15, 23, 42, 0.58);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.feedback-card {
  position: relative;
  display: grid;
  width: min(520px, 90%);
  justify-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.fluid-skeleton {
  width: 170px;
  height: 170px;
  border-radius: 36px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.82), transparent 20%),
    linear-gradient(135deg, rgba(0, 102, 255, 0.78), rgba(139, 92, 246, 0.70), rgba(6, 182, 212, 0.72));
  box-shadow: 0 28px 80px rgba(0, 102, 255, 0.26);
  animation: fluid 2.8s ease-in-out infinite;
}

.feedback-card strong {
  font-size: 20px;
}

.feedback-card span,
.feedback-card small {
  color: var(--muted);
}

.feedback-timer {
  display: inline-flex;
  border: 1px solid rgba(0, 102, 255, 0.16);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent) !important;
  background: var(--accent-soft);
  font-weight: 900;
}

.feedback-note {
  line-height: 1.55;
}

.feedback-card.pending {
  background: color-mix(in srgb, var(--accent-soft), var(--surface) 70%);
}

.feedback-card.pending .fluid-skeleton {
  animation-duration: 3.8s;
}

.feedback-card.error {
  background: color-mix(in srgb, var(--danger-soft), var(--surface) 72%);
}

.feedback-card.error strong {
  color: var(--danger);
}

.job-history-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.compact-heading {
  align-items: center;
}

.job-history-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 2px 2px;
}

.job-history-item {
  display: grid;
  flex: 0 0 270px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  background: var(--surface-strong);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.job-history-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.job-history-open {
  display: grid;
  min-width: 0;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.job-history-open img,
.job-history-placeholder {
  display: block;
  width: 58px;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface-soft);
}

.job-history-open span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.job-history-open strong,
.job-history-open small,
.job-history-open em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-history-open strong {
  font-size: 13px;
}

.job-history-open small,
.job-history-open em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.job-history-item a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.field,
.form-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.form-stack {
  gap: 15px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface-strong);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: rgba(0, 102, 255, 0.42);
  box-shadow: var(--focus);
  outline: none;
}

.text-button {
  border: 0;
  color: var(--accent);
  background: transparent;
  padding: 4px 0;
}

.text-button.center {
  justify-self: center;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.modal-panel {
  display: grid;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 36px);
  gap: 18px;
  overflow: auto;
  border-radius: 26px;
  padding: 22px;
}

.modal-panel.wide {
  max-width: 680px;
}

.captcha-row,
.recharge-grid,
.control-grid,
.control-grid.two {
  display: grid;
  gap: 12px;
}

.captcha-row {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
}

.recharge-grid,
.control-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.amount-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.amount-preset {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-strong);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.amount-preset:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), transparent 35%);
}

.amount-preset.active {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent), transparent 20%);
  background: var(--accent-soft);
}

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

.captcha-image {
  display: block;
  width: 100%;
  height: 66px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface-soft);
}

.history-block {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.history-list {
  display: grid;
  gap: 9px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--surface-strong);
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-pill.pending,
.status-pill.paying {
  padding: 8px 11px;
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pill.approved,
.status-pill.active {
  padding: 8px 11px;
  color: var(--ok);
  background: var(--ok-soft);
}

.status-pill.rejected {
  padding: 8px 11px;
  color: var(--danger);
  background: var(--danger-soft);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px;
  background: rgba(7, 10, 18, 0.94);
}

.preview-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  color: #fff;
}

.preview-modal-bar .eyebrow,
.preview-modal-bar .muted {
  color: rgba(255, 255, 255, 0.70);
}

.preview-modal-stage {
  display: grid;
  min-height: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.preview-modal-stage img {
  display: block;
  justify-self: center;
  max-width: 100%;
  max-height: calc(100vh - 132px);
  border-radius: 22px;
  object-fit: contain;
}

.preview-modal .icon-button,
.preview-modal .secondary-button,
.preview-modal .preview-nav-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.admin-layout {
  width: min(1320px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(14px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg), transparent 10%);
  backdrop-filter: blur(18px);
}

.studio-shell,
.workspace-banner,
.workspace-metrics,
.studio-grid {
  display: none;
}

.admin-content,
.stats-row,
.api-key-box,
.management-form,
.table-wrap {
  display: grid;
  gap: 16px;
}

.stats-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.panel,
.metric,
.stat,
.api-key-box,
.management-form {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.announcement-config {
  display: grid;
  gap: 13px;
}

.announcement-config textarea {
  resize: vertical;
}

.admin-switch {
  flex: 0 0 auto;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 900;
}

td.prompt-cell {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.inline-money,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-strong);
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent);
}

.check-row span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.inline-money input {
  max-width: 110px;
}

.settings-actions {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: color-mix(in srgb, var(--surface), transparent 4%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.settings-actions .primary-button {
  flex: 0 0 auto;
}

.settings-actions .hint {
  margin: 0;
}

@keyframes sheen {
  0% { transform: translateX(-72%) rotate(18deg); opacity: 0; }
  28% { opacity: 1; }
  58% { transform: translateX(72%) rotate(18deg); opacity: 0; }
  100% { transform: translateX(72%) rotate(18deg); opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 10px 26px rgba(0, 102, 255, 0.26); }
  50% { box-shadow: 0 14px 38px rgba(139, 92, 246, 0.42); }
}

@keyframes fluid {
  0%, 100% { border-radius: 36px 52px 34px 48px; transform: rotate(0deg) scale(1); }
  50% { border-radius: 52px 34px 52px 36px; transform: rotate(8deg) scale(1.04); }
}

@media (max-width: 1180px) {
  body.front-page {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100dvh;
  }

  .sidebar {
    order: 1;
  }

  .canvas-area {
    order: 2;
    min-height: 78dvh;
  }
}

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

  .sidebar,
  .stage {
    border-radius: 24px;
  }

  .status-capsule {
    width: 100%;
    flex-wrap: wrap;
    border-radius: 18px;
  }

  .canvas-topbar,
  .preview-toolbar,
  .preview-modal-bar,
  .block-title,
  .modal-head,
  .section-heading {
    display: grid;
    align-items: stretch;
  }

  .canvas-area {
    grid-template-rows: auto minmax(520px, 64dvh) auto;
  }

  .ratio-grid,
  .amount-presets,
  .control-grid,
  .control-grid.two,
  .recharge-grid,
  .captcha-row {
    grid-template-columns: 1fr;
  }

  .result-preview {
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  .preview-main img {
    max-height: 56dvh;
  }

  .floating-actions {
    position: static;
    justify-self: center;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 18px;
  }

  .preview-arrow {
    width: 36px;
    height: 36px;
  }

  .job-history-item {
    flex-basis: 240px;
  }

  .preview-modal-stage {
    grid-template-columns: 1fr;
  }

  .preview-modal-stage .preview-nav-button {
    display: none;
  }
}

@media (max-width: 520px) {
  .prompt-editor textarea {
    min-height: 178px;
  }

  .mode-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .mode-tabs button {
    flex: 1;
    padding: 0 10px;
  }

  .checkout-strip,
  .nav-actions {
    display: grid;
    justify-content: stretch;
  }

  .auth-actions,
  .account-strip {
    width: 100%;
  }

  .auth-actions > *,
  .account-strip > * {
    flex: 1 1 auto;
  }
}
