:root {
  color-scheme: dark;
  --bg: #060a13;
  --bg-raised: #0a1120;
  --surface: rgba(14, 23, 41, 0.9);
  --surface-strong: #111c31;
  --surface-soft: rgba(17, 28, 49, 0.64);
  --line: rgba(164, 190, 226, 0.15);
  --line-strong: rgba(164, 205, 255, 0.28);
  --text: #f5f8ff;
  --text-soft: #a8b5ca;
  --text-faint: #718096;
  --cyan: #63e6ff;
  --cyan-strong: #18badb;
  --violet: #7567ff;
  --green: #51e3a4;
  --amber: #ffc96b;
  --red: #ff7085;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --focus: 0 0 0 3px rgba(99, 230, 255, 0.24);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 14% -4%, rgba(38, 174, 214, 0.14), transparent 32rem),
    radial-gradient(circle at 89% 2%, rgba(109, 92, 255, 0.13), transparent 30rem),
    linear-gradient(180deg, #07111f 0%, var(--bg) 38%, #060911 100%);
  font-size: 16px;
  line-height: 1.55;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(156, 195, 232, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 195, 232, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

a {
  color: inherit;
}

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

code {
  color: #bfebff;
  font-size: 0.92em;
}

.hidden {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 10px;
  color: #041019;
  background: var(--cyan);
  font-weight: 700;
}

.skip-link:focus {
  transform: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 19, 0.78);
  backdrop-filter: blur(22px) saturate(140%);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1440px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(99, 230, 255, 0.3);
  border-radius: 14px;
  color: var(--cyan);
  background: linear-gradient(145deg, rgba(99, 230, 255, 0.12), rgba(117, 103, 255, 0.14));
  box-shadow: inset 0 0 24px rgba(99, 230, 255, 0.05);
}

.brand__mark svg {
  width: 30px;
  height: 30px;
  stroke-width: 2;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 1px;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.topbar__actions,
.gallery-tools,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(14, 23, 41, 0.62);
  font-size: 0.82rem;
  white-space: nowrap;
}

.connection-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 4px rgba(113, 128, 150, 0.12);
}

.connection-pill[data-state="ready"] {
  color: #baf8dd;
  border-color: rgba(81, 227, 164, 0.22);
}

.connection-pill[data-state="ready"] .connection-pill__dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(81, 227, 164, 0.12), 0 0 14px rgba(81, 227, 164, 0.45);
}

.connection-pill[data-state="partial"] {
  color: #ffe1a8;
  border-color: rgba(255, 201, 107, 0.22);
}

.connection-pill[data-state="partial"] .connection-pill__dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 201, 107, 0.12);
}

.button,
.icon-button,
.text-action,
.filter-tab,
.card-action {
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

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

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

.button:focus-visible,
.icon-button:focus-visible,
.text-action:focus-visible,
.filter-tab:focus-visible,
.card-action:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.dropzone:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button--compact {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  font-size: 0.88rem;
}

.button--primary {
  color: #031017;
  background: linear-gradient(135deg, var(--cyan), #81c7ff 54%, #a59cff);
  box-shadow: 0 12px 34px rgba(43, 181, 218, 0.23);
}

.button--primary:hover:not(:disabled) {
  box-shadow: 0 15px 40px rgba(43, 181, 218, 0.32);
}

.button--secondary {
  border-color: rgba(99, 230, 255, 0.18);
  background: rgba(99, 230, 255, 0.08);
}

.button--ghost {
  border-color: var(--line);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
}

.button--ghost:hover:not(:disabled),
.button--secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.button--danger {
  border-color: rgba(255, 112, 133, 0.26);
  color: #ffd4db;
  background: rgba(255, 112, 133, 0.1);
}

.button svg {
  width: 18px;
  height: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(520px, 1.38fr);
  width: min(1440px, calc(100% - 40px));
  margin: 30px auto 0;
  gap: 24px;
  align-items: start;
}

.creator-panel,
.gallery-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(15, 25, 45, 0.94), rgba(9, 16, 29, 0.92));
  box-shadow: var(--shadow);
}

.creator-panel::after,
.gallery-panel::after {
  position: absolute;
  z-index: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  filter: blur(20px);
}

.creator-panel::after {
  top: -150px;
  right: -100px;
  background: rgba(99, 230, 255, 0.12);
}

.gallery-panel::after {
  right: 20%;
  bottom: -190px;
  background: rgba(117, 103, 255, 0.11);
}

.creator-panel {
  position: sticky;
  top: 102px;
  padding: 28px;
}

.gallery-panel {
  min-height: 720px;
  padding: 28px;
}

.creator-panel > *,
.gallery-panel > * {
  position: relative;
  z-index: 1;
}

.section-heading,
.gallery-heading,
.field-heading,
.key-card__heading,
.submit-row,
.result-card__footer,
.result-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

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

h1 {
  max-width: 420px;
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  line-height: 1.24;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 3px;
  font-size: 1.38rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.05rem;
}

.model-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 11px;
  gap: 7px;
  border: 1px solid rgba(117, 103, 255, 0.24);
  border-radius: 999px;
  color: #c8c2ff;
  background: rgba(117, 103, 255, 0.09);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.model-badge span {
  color: var(--cyan);
}

.prompt-wrap,
.key-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(4, 10, 20, 0.46);
}

.prompt-wrap {
  position: relative;
  padding: 18px 18px 12px;
}

.prompt-wrap label,
.field-label,
.control-field > span,
.compression-row label,
.key-card > label {
  color: #dbe6f7;
  font-size: 0.86rem;
  font-weight: 720;
}

.prompt-wrap label {
  display: block;
  margin-bottom: 9px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 156px;
  resize: vertical;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 1rem;
  line-height: 1.72;
}

textarea::placeholder,
input::placeholder {
  color: #56677f;
}

.prompt-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 28px;
  padding-top: 6px;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.text-action {
  padding: 3px 5px;
  border: 0;
  border-radius: 7px;
  color: var(--cyan);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
}

.text-action:hover {
  color: #c5f8ff;
}

.reference-block {
  margin-top: 18px;
}

.field-heading {
  align-items: flex-end;
  margin-bottom: 10px;
}

.field-heading > div > span {
  display: block;
}

.field-help {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.73rem;
}

.dropzone {
  display: flex;
  width: 100%;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  gap: 12px;
  border: 1px dashed rgba(151, 191, 232, 0.28);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: rgba(5, 12, 23, 0.36);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: rgba(99, 230, 255, 0.62);
  background: rgba(99, 230, 255, 0.055);
}

.dropzone__icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--cyan);
  background: rgba(99, 230, 255, 0.08);
}

.dropzone__icon svg {
  width: 21px;
  height: 21px;
}

.dropzone strong,
.dropzone small {
  display: block;
}

.dropzone strong {
  color: #dce7f7;
  font-size: 0.84rem;
}

.dropzone small {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  gap: 8px;
}

.reference-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
}

.reference-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: white;
  background: rgba(0, 0, 0, 0.66);
  cursor: pointer;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
  gap: 13px;
}

.control-field {
  display: block;
}

.control-field > span {
  display: block;
  margin: 0 0 7px 2px;
}

select,
input[type="search"],
.secret-input input {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: #0a1425;
}

select {
  min-height: 46px;
  padding: 0 38px 0 13px;
  border-radius: 12px;
  cursor: pointer;
}

.compression-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 44px;
  align-items: center;
  margin-top: 18px;
  gap: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan-strong);
}

.compression-row output {
  color: #d9e9fb;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.route-notice,
.privacy-note {
  display: flex;
  align-items: flex-start;
  padding: 12px 13px;
  gap: 9px;
  border: 1px solid rgba(255, 201, 107, 0.16);
  border-radius: 12px;
  color: #c9b991;
  background: rgba(255, 201, 107, 0.055);
  font-size: 0.75rem;
}

.route-notice {
  margin-top: 18px;
}

.route-notice svg,
.privacy-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.submit-row {
  margin-top: 20px;
}

.cost-note strong,
.cost-note span {
  display: block;
}

.cost-note strong {
  font-size: 0.9rem;
}

.cost-note span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.button--generate {
  min-width: 168px;
}

.button__spark {
  font-size: 1.05rem;
}

.button--generate.is-loading .button__spark {
  animation: pulse-spin 1.4s linear infinite;
}

@keyframes pulse-spin {
  0% { transform: rotate(0deg) scale(0.9); opacity: 0.55; }
  50% { transform: rotate(180deg) scale(1.12); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.9); opacity: 0.55; }
}

.gallery-heading {
  align-items: flex-end;
  margin-bottom: 21px;
}

.gallery-heading p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.search-field {
  position: relative;
  display: block;
  width: min(220px, 25vw);
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--text-faint);
}

input[type="search"] {
  min-height: 40px;
  padding: 0 12px 0 37px;
  border-radius: 11px;
  font-size: 0.86rem;
}

.filter-tabs {
  display: flex;
  margin-bottom: 18px;
  gap: 7px;
}

.filter-tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-faint);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
}

.filter-tab span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.7rem;
}

.filter-tab.is-active {
  border-color: rgba(99, 230, 255, 0.18);
  color: #cffaff;
  background: rgba(99, 230, 255, 0.08);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 11, 22, 0.64);
  transition: transform 170ms ease, border-color 170ms ease;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: rgba(164, 205, 255, 0.25);
}

.result-card__media {
  position: relative;
  display: grid;
  min-height: 260px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(99, 230, 255, 0.055), rgba(117, 103, 255, 0.08)),
    #08111f;
}

.result-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}

.result-card__media--loading::before {
  width: 66%;
  aspect-ratio: 1;
  border: 1px solid rgba(99, 230, 255, 0.15);
  border-radius: 50%;
  content: "";
  background: radial-gradient(circle, rgba(99, 230, 255, 0.16), rgba(117, 103, 255, 0.04) 56%, transparent 69%);
  animation: breathe 2.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.86); opacity: 0.55; }
  50% { transform: scale(1.03); opacity: 1; }
}

.loading-copy,
.error-copy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 26px;
  gap: 8px;
  text-align: center;
}

.loading-copy strong,
.error-copy strong {
  font-size: 0.96rem;
}

.loading-copy span,
.error-copy span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.elapsed {
  color: var(--cyan) !important;
  font-variant-numeric: tabular-nums;
}

.error-copy svg {
  width: 28px;
  height: 28px;
  color: var(--red);
}

.result-card__body {
  padding: 14px;
}

.result-card__prompt {
  display: -webkit-box;
  min-height: 43px;
  margin: 0 0 12px;
  overflow: hidden;
  color: #dbe5f4;
  font-size: 0.86rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-card__meta {
  justify-content: flex-start;
  margin-bottom: 13px;
  gap: 7px;
  color: var(--text-faint);
  font-size: 0.7rem;
}

.meta-chip,
.status-chip,
.route-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.meta-chip {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.result-card__footer {
  padding-top: 11px;
  border-top: 1px solid rgba(164, 190, 226, 0.1);
}

.result-card__time {
  color: var(--text-faint);
  font-size: 0.7rem;
}

.result-card__actions {
  display: flex;
  gap: 6px;
}

.card-action {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
}

.card-action:hover {
  color: var(--cyan);
  border-color: rgba(99, 230, 255, 0.25);
}

.card-action svg {
  width: 16px;
  height: 16px;
}

.empty-state {
  display: flex;
  min-height: 470px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 48px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state__orb {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(99, 230, 255, 0.19);
  border-radius: 24px;
  color: var(--cyan);
  background: linear-gradient(145deg, rgba(99, 230, 255, 0.08), rgba(117, 103, 255, 0.1));
  box-shadow: 0 16px 50px rgba(27, 149, 186, 0.1);
  font-size: 1.65rem;
}

.empty-state h3 {
  margin-bottom: 6px;
  color: #dfe9f7;
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 18px;
  color: var(--text-faint);
  font-size: 0.86rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  width: min(1440px, calc(100% - 40px));
  margin: 22px auto 0;
  padding: 18px 4px max(24px, env(safe-area-inset-bottom));
  gap: 18px;
  color: var(--text-faint);
  font-size: 0.75rem;
}

dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgba(1, 4, 10, 0.74);
  backdrop-filter: blur(8px);
}

.settings-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #0b1424;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
}

.dialog-shell {
  padding: 26px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 20px;
}

.dialog-header h2 {
  margin-bottom: 6px;
}

.dialog-header p:not(.eyebrow) {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.key-card {
  padding: 17px;
  margin-bottom: 13px;
}

.key-card__heading {
  margin-bottom: 14px;
}

.key-card__heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.key-card__heading strong {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.route-chip {
  min-height: 27px;
  padding: 0 9px;
  font-size: 0.73rem;
  font-weight: 800;
}

.route-chip--medium {
  color: #bff7ff;
  background: rgba(99, 230, 255, 0.1);
}

.route-chip--high {
  color: #d7d2ff;
  background: rgba(117, 103, 255, 0.13);
}

.key-status {
  color: var(--text-faint);
  font-size: 0.74rem;
}

.key-status.is-ready {
  color: var(--green);
}

.key-status.is-testing {
  color: var(--amber);
}

.key-status.is-error {
  color: var(--red);
}

.key-card > label {
  display: block;
  margin-bottom: 7px;
}

.secret-input {
  position: relative;
  display: flex;
}

.secret-input input {
  min-height: 47px;
  padding: 0 72px 0 13px;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
}

.secret-input button {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: 34px;
  padding: 0 10px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(99, 230, 255, 0.06);
  cursor: pointer;
  font-size: 0.76rem;
}

.key-test {
  margin-top: 8px;
}

.privacy-note {
  margin-top: 18px;
  border-color: rgba(81, 227, 164, 0.15);
  color: #9fcab9;
  background: rgba(81, 227, 164, 0.045);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.preview-dialog {
  width: min(1100px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #050a12;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
}

.preview-dialog__close {
  position: sticky;
  top: 2px;
  z-index: 2;
  float: right;
  width: 40px;
  height: 40px;
  margin: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: white;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
  font-size: 1.45rem;
}

.preview-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 130px);
  object-fit: contain;
  border-radius: 14px;
}

.preview-dialog__caption {
  padding: 12px 8px 4px;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  display: grid;
  width: min(380px, calc(100% - 40px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--text);
  background: rgba(12, 22, 39, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  font-size: 0.84rem;
  animation: toast-in 180ms ease-out;
}

.toast--success {
  border-color: rgba(81, 227, 164, 0.28);
}

.toast--error {
  border-color: rgba(255, 112, 133, 0.32);
}

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

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

  .creator-panel {
    position: relative;
    top: 0;
  }

  .gallery-panel {
    min-height: 560px;
  }

  .result-card__media {
    min-height: 300px;
  }
}

@media (max-width: 720px) {
  .topbar__inner,
  .workspace,
  .site-footer {
    width: min(100% - 24px, 1440px);
  }

  .topbar__inner {
    min-height: 64px;
  }

  .brand small,
  .connection-pill,
  .desktop-only {
    display: none;
  }

  .creator-panel,
  .gallery-panel {
    padding: 20px;
    border-radius: 22px;
  }

  .workspace {
    margin-top: 16px;
    gap: 16px;
  }

  .section-heading,
  .gallery-heading {
    align-items: flex-start;
  }

  .gallery-heading {
    flex-direction: column;
  }

  .gallery-tools,
  .search-field {
    width: 100%;
  }

  .gallery-tools .button {
    flex: 0 0 auto;
  }

  .controls-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .result-card__media {
    min-height: 260px;
  }

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

  .button--generate,
  .submit-row .button {
    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .dialog-shell {
    padding: 20px;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar__actions {
    gap: 6px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
  }

  .topbar__actions .button {
    padding: 0 10px;
  }

  .model-badge {
    display: none;
  }

  .creator-panel,
  .gallery-panel {
    padding: 17px;
  }

  .compression-row {
    grid-template-columns: 1fr 44px;
  }

  .compression-row label {
    grid-column: 1 / -1;
  }

  .filter-tabs {
    overflow-x: auto;
  }

  .filter-tab {
    flex: 0 0 auto;
  }
}

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