/* SmithAPI Image Studio 样式表 — Midjourney Web × 即梦 AI × Sora 沉浸式暗夜玻璃工坊 */

:root {
  color-scheme: dark;
  --st-bg: #090a0d;
  --st-bg-elev: #12141a;
  --st-surface: rgba(20, 22, 29, 0.78);
  --st-surface-solid: #161821;
  --st-surface-hover: #1e212d;
  --st-border: rgba(255, 255, 255, 0.09);
  --st-border-strong: rgba(255, 255, 255, 0.16);
  --st-text: #f3f5f8;
  --st-muted: #98a2b3;
  --st-quiet: #667085;
  --st-accent: #14b8a6;
  --st-accent-bright: #2dd4bf;
  --st-accent-soft: rgba(20, 184, 166, 0.14);
  --st-cta-bg: #f8fafc;
  --st-cta-text: #090a0d;
  --st-danger: #f87171;
  --st-warn: #fbbf24;
  --st-shadow-dock: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --st-shadow-card: 0 12px 32px rgba(0, 0, 0, 0.36);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --st-bg: #f5f7f9;
  --st-bg-elev: #ffffff;
  --st-surface: rgba(255, 255, 255, 0.85);
  --st-surface-solid: #ffffff;
  --st-surface-hover: #eef2f5;
  --st-border: rgba(15, 23, 42, 0.09);
  --st-border-strong: rgba(15, 23, 42, 0.16);
  --st-text: #0f172a;
  --st-muted: #526071;
  --st-quiet: #7a8796;
  --st-accent: #0d9488;
  --st-accent-bright: #0f766e;
  --st-accent-soft: rgba(13, 148, 136, 0.11);
  --st-cta-bg: #0f172a;
  --st-cta-text: #ffffff;
  --st-danger: #dc2626;
  --st-warn: #d97706;
  --st-shadow-dock: 0 20px 54px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.08);
  --st-shadow-card: 0 8px 26px rgba(15, 23, 42, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--st-bg);
  color: var(--st-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

img {
  display: block;
}

.st-mono {
  font-family: var(--font-mono);
}

/* ==================== Slim 54px Top Bar ==================== */
.st-shell {
  min-height: 100vh;
  position: relative;
}

.st-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--st-surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--st-border);
}

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

.st-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.st-brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: cover;
}

.st-brand-name {
  font-weight: 760;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.st-studio-tag {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--st-border);
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.st-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--st-bg-elev);
  border: 1px solid var(--st-border);
}

.st-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--st-muted);
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.st-view-tab:hover {
  color: var(--st-text);
}

.st-view-tab.is-active {
  background: var(--st-surface-hover);
  color: var(--st-text);
}

.st-count-pill {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.st-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.st-key-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--st-border-strong);
  background: var(--st-bg-elev);
  font-size: 12px;
  font-weight: 600;
  max-width: 210px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.st-key-pill:hover {
  border-color: var(--st-accent);
}

.st-key-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--st-warn);
}

.st-dot[data-state="ok"] {
  background: var(--st-accent);
  box-shadow: 0 0 8px var(--st-accent);
}

.st-dot[data-state="err"] {
  background: var(--st-danger);
}

.st-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--st-border);
  background: var(--st-bg-elev);
  color: var(--st-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.st-icon-btn:hover {
  color: var(--st-text);
  border-color: var(--st-border-strong);
}

.st-sun { display: block; }
.st-moon { display: none; }
:root[data-theme="light"] .st-sun { display: none; }
:root[data-theme="light"] .st-moon { display: block; }

.st-nav-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--st-muted);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.st-nav-link:hover {
  color: var(--st-text);
  background: var(--st-bg-elev);
}

.st-nav-home {
  border: 1px solid var(--st-border);
  background: var(--st-bg-elev);
  color: var(--st-text);
}

/* ==================== Gallery & Masonry Stage ==================== */
.st-gallery-wrap {
  max-width: 1580px;
  margin: 0 auto;
  padding: 22px 24px 230px;
}

.st-section + .st-section {
  margin-top: 32px;
}

.st-sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.st-sec-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.st-sec-title-group h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.st-sec-sub {
  font-size: 12px;
  color: var(--st-muted);
}

.st-ghost-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--st-border);
  color: var(--st-muted);
  font-size: 12px;
  font-weight: 600;
}

.st-ghost-btn:hover {
  color: var(--st-text);
  border-color: var(--st-border-strong);
}

/* User Creations Responsive Grid */
.st-creations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

/* Mixed-Aspect CSS Masonry Showcase */
.st-masonry {
  columns: 4 260px;
  column-gap: 14px;
}

.st-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--st-border);
  background: var(--st-bg-elev);
  box-shadow: var(--st-shadow-card);
  break-inside: avoid;
  margin-bottom: 14px;
  cursor: pointer;
}

.st-creations-grid .st-card {
  margin-bottom: 0;
}

.st-card img {
  width: 100%;
  height: auto;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.st-card:hover img {
  transform: scale(1.025);
}

.st-card-top-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(9, 10, 13, 0.68);
  backdrop-filter: blur(8px);
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.st-card-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 36px 12px 12px;
  background: linear-gradient(to top, rgba(9, 10, 13, 0.92) 0%, rgba(9, 10, 13, 0.56) 55%, transparent 100%);
  color: #f8fafc;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-card:hover .st-card-overlay,
.st-card:focus-within .st-card-overlay {
  opacity: 1;
}

.st-card-prompt {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(248, 250, 252, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.st-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.st-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.st-card-btn:hover {
  background: var(--st-accent);
  border-color: var(--st-accent);
  color: #090a0d;
}

.st-card-btn-primary {
  background: #ffffff;
  color: #090a0d;
}

/* Optimistic Skeleton Card */
.st-skeleton-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--st-accent) 40%, var(--st-border));
  background: var(--st-bg-elev);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  cursor: default;
}

.st-skeleton-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, transparent 15%, rgba(20, 184, 166, 0.14) 48%, transparent 80%);
  background-size: 220% 100%;
  animation: stPulseSweep 1.6s ease-in-out infinite;
}

@keyframes stPulseSweep {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.st-skel-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.st-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--st-border-strong);
  border-top-color: var(--st-accent);
  animation: stSpin 0.8s linear infinite;
}

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

.st-skel-timer {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--st-accent-bright);
}

.st-skel-prompt {
  font-size: 11.5px;
  color: var(--st-muted);
  max-width: 220px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.st-skel-cancel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(9, 10, 13, 0.66);
  color: #e5e7eb;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Empty Creations View */
.st-empty-view {
  padding: 56px 16px;
  display: flex;
  justify-content: center;
}

.st-empty-card {
  max-width: 440px;
  text-align: center;
  padding: 32px 24px;
  border-radius: 18px;
  border: 1px solid var(--st-border);
  background: var(--st-bg-elev);
}

.st-empty-orb {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-empty-card h3 {
  margin: 0;
  font-size: 16px;
}

.st-empty-card p {
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--st-muted);
}

/* ==================== Floating Bottom Command Dock ==================== */
.st-dock-anchor {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 24px));
  z-index: 40;
}

.st-dock {
  position: relative;
  border-radius: 22px;
  background: var(--st-surface);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border: 1px solid var(--st-border-strong);
  box-shadow: var(--st-shadow-dock);
  padding: 12px 14px 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.st-dock:focus-within {
  border-color: color-mix(in srgb, var(--st-accent) 55%, var(--st-border-strong));
}

.st-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 22px;
  background: rgba(20, 184, 166, 0.16);
  border: 2px dashed var(--st-accent);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--st-accent-bright);
}

.st-ref-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--st-border);
  flex-wrap: wrap;
}

.st-ref-thumbs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.st-ref-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--st-border-strong);
}

.st-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.st-ref-rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(9, 10, 13, 0.8);
  color: #ffffff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.st-ref-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.st-edits-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.st-mask-trigger,
.st-ref-clear {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--st-muted);
  cursor: pointer;
}

.st-mask-trigger:hover,
.st-ref-clear:hover {
  color: var(--st-text);
}

.st-prompt-input {
  width: 100%;
  min-height: 46px;
  max-height: 160px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--st-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  padding: 2px 4px;
}

.st-prompt-input::placeholder {
  color: var(--st-quiet);
}

.st-dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.st-dock-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.st-tool-btn,
.st-ctrl-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--st-border);
  background: var(--st-bg-elev);
  color: var(--st-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.st-tool-btn:hover,
.st-ctrl-pill:hover,
.st-ctrl-pill[aria-expanded="true"] {
  border-color: var(--st-accent);
  background: var(--st-surface-hover);
}

.st-pill-icon-light { display: none; }
.st-pill-icon-dark { display: block; }
:root[data-theme="light"] .st-pill-icon-light { display: block; }
:root[data-theme="light"] .st-pill-icon-dark { display: none; }

.st-ratio-glyph {
  display: inline-block;
  border: 1.5px solid var(--st-accent-bright);
  border-radius: 2.5px;
  width: 12px;
  height: 12px;
}
.st-ratio-glyph[data-ratio="1536x1024"] { width: 15px; height: 10px; }
.st-ratio-glyph[data-ratio="1024x1536"] { width: 10px; height: 15px; }
.st-ratio-glyph[data-ratio="auto"] { border-style: dashed; }

.st-gen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--st-cta-bg);
  color: var(--st-cta-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.st-gen-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.st-gen-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==================== Dock Floating Error Toast ==================== */
.st-dock-error {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--st-surface-solid);
  border: 1px solid color-mix(in srgb, var(--st-danger) 48%, var(--st-border));
  box-shadow: var(--st-shadow-dock);
}

.st-dock-error-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.st-err-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--st-danger) 18%, transparent);
  color: var(--st-danger);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.st-err-text {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.st-err-text span {
  color: var(--st-muted);
}

.st-err-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-mini-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--st-border-strong);
  background: var(--st-bg-elev);
  color: var(--st-text);
  font-size: 11.5px;
  font-weight: 600;
}

.st-mini-pill:hover {
  border-color: var(--st-accent);
  color: var(--st-accent-bright);
}

.st-mini-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--st-muted);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.st-err-raw {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: #0b0d12;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==================== Upward Glass Popovers ==================== */
.st-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(360px, 100%);
  padding: 14px;
  border-radius: 16px;
  background: var(--st-surface-solid);
  border: 1px solid var(--st-border-strong);
  box-shadow: var(--st-shadow-dock);
  z-index: 45;
}

.st-popover-ratio { left: 100px; width: min(340px, 100%); }
.st-popover-opts { left: 190px; width: min(360px, 100%); }

.st-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 10px;
}

.st-pop-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--st-muted);
}

.st-model-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
}

.st-model-item {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.st-model-item:hover {
  background: var(--st-surface-hover);
}

.st-model-item.is-selected {
  background: var(--st-accent-soft);
  border-color: color-mix(in srgb, var(--st-accent) 40%, transparent);
}

.st-model-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
}

.st-model-desc {
  font-size: 11px;
  color: var(--st-muted);
}

.st-custom-model-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--st-border);
  display: flex;
  gap: 6px;
}

.st-pop-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  color: var(--st-text);
  font-size: 12px;
  outline: none;
}

.st-pop-input:focus {
  border-color: var(--st-accent);
}

/* Visual Aspect Ratio Grid */
.st-ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.st-ratio-card {
  padding: 10px 6px;
  border-radius: 11px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.st-ratio-card:hover {
  border-color: var(--st-border-strong);
}

.st-ratio-card.is-selected {
  border-color: var(--st-accent);
  background: var(--st-accent-soft);
}

.st-ratio-box {
  border: 1.8px solid var(--st-muted);
  border-radius: 4px;
}

.st-ratio-card.is-selected .st-ratio-box {
  border-color: var(--st-accent-bright);
}

.st-ratio-card strong {
  font-size: 12px;
}

.st-ratio-card small {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--st-muted);
}

/* Segmented Option Groups */
.st-pop-group + .st-pop-group {
  margin-top: 10px;
}

.st-pop-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--st-muted);
  margin-bottom: 6px;
}

.st-seg-row {
  display: flex;
  gap: 5px;
}

.st-seg-opt {
  flex: 1;
  height: 29px;
  border-radius: 8px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  color: var(--st-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.st-seg-opt.is-active {
  border-color: var(--st-accent);
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
}

.st-opt-notice {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--st-accent-bright);
}

/* ==================== Custom Switch & Modals ==================== */
.st-switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--st-border-strong);
  transition: background 0.16s ease;
  flex-shrink: 0;
}

.st-switch.is-on {
  background: var(--st-accent);
}

.st-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.16s ease;
}

.st-switch.is-on .st-switch-thumb {
  transform: translateX(16px);
}

.st-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.st-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 10, 0.78);
  backdrop-filter: blur(8px);
}

.st-modal-card {
  position: relative;
  z-index: 1;
  width: min(500px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  background: var(--st-surface-solid);
  border: 1px solid var(--st-border-strong);
  box-shadow: var(--st-shadow-dock);
  padding: 20px;
}

.st-modal-wide {
  width: min(680px, 100%);
}

.st-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.st-modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.st-modal-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--st-muted);
}

.st-modal-head code,
.st-switch-label code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--st-bg);
}

.st-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--st-bg-elev);
  color: var(--st-muted);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.st-vault-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--st-muted);
}

.st-vault-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-vault-empty {
  padding: 14px;
  border-radius: 10px;
  border: 1px dashed var(--st-border);
  text-align: center;
  font-size: 12px;
  color: var(--st-muted);
}

.st-vault-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  cursor: pointer;
}

.st-vault-item.is-active {
  border-color: var(--st-accent);
  background: var(--st-accent-soft);
}

.st-vault-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.st-vault-item-info strong {
  font-size: 12.5px;
}

.st-vault-item-info span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--st-muted);
}

.st-vault-del {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--st-danger);
}

.st-probe-banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  font-size: 12px;
}

.st-vault-divider {
  height: 1px;
  background: var(--st-border);
  margin: 16px 0;
}

.st-vault-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-modal-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  color: var(--st-text);
  font-size: 12.5px;
  outline: none;
}

.st-modal-input:focus {
  border-color: var(--st-accent);
}

.st-secret-row {
  position: relative;
  display: flex;
  align-items: center;
}

.st-secret-row .st-modal-input {
  padding-right: 54px;
}

.st-secret-btn {
  position: absolute;
  right: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--st-surface-hover);
  color: var(--st-muted);
  font-size: 11px;
  font-weight: 600;
}

.st-vault-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.st-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--st-muted);
}

.st-pill-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--st-cta-bg);
  color: var(--st-cta-text);
  font-size: 12.5px;
  font-weight: 700;
}

.st-secondary-action {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--st-border-strong);
  background: var(--st-bg);
  color: var(--st-text);
  font-size: 12px;
  font-weight: 600;
}

.st-secondary-action:hover {
  border-color: var(--st-accent);
  color: var(--st-accent-bright);
}

/* Code Modal */
.st-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.st-code-tabs {
  display: flex;
  gap: 6px;
}

.st-code-tab {
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--st-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--st-muted);
}

.st-code-tab.is-active {
  border-color: var(--st-accent);
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
}

.st-code-pre {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #0a0d12;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
}

/* Split-Panel Detail Lightbox */
.st-lightbox-card {
  position: relative;
  z-index: 1;
  width: min(1080px, 95vw);
  max-height: 90vh;
  border-radius: 18px;
  overflow: hidden;
  background: var(--st-surface-solid);
  border: 1px solid var(--st-border-strong);
  box-shadow: var(--st-shadow-dock);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
}

.st-lightbox-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(9, 10, 13, 0.72);
  color: #ffffff;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.st-lb-media {
  position: relative;
  background: #06070a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 340px;
}

.st-lb-media.is-checkerboard {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #e5ecef 25%, transparent 25%),
    linear-gradient(-45deg, #e5ecef 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5ecef 75%),
    linear-gradient(-45deg, transparent 75%, #e5ecef 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.st-lb-media img {
  max-width: 100%;
  max-height: calc(90vh - 80px);
  object-fit: contain;
  border-radius: 8px;
}

.st-lb-media-bar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(9, 10, 13, 0.75);
  color: #f3f5f8;
  font-size: 11.5px;
}

.st-lb-side {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid var(--st-border);
  overflow-y: auto;
}

.st-lb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 36px;
}

.st-lb-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--st-accent-soft);
  color: var(--st-accent-bright);
  font-size: 11px;
  font-weight: 600;
}

.st-lb-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--st-muted);
  margin-bottom: 6px;
}

.st-lb-prompt,
.st-lb-revised {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--st-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.st-lb-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.st-lb-meta-grid > div {
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--st-bg);
  border: 1px solid var(--st-border);
}

.st-lb-meta-grid small {
  display: block;
  font-size: 10.5px;
  color: var(--st-muted);
}

.st-lb-meta-grid strong {
  font-size: 12px;
}

.st-lb-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-lb-btn-full {
  width: 100%;
}

.st-lb-btn-row {
  display: flex;
  gap: 8px;
}

/* ==================== Responsive Mobile ==================== */
@media (max-width: 900px) {
  .st-view-tabs {
    display: none;
  }
  .st-lightbox-card {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow-y: auto;
  }
  .st-lb-side {
    border-left: 0;
    border-top: 1px solid var(--st-border);
  }
  .st-popover-ratio,
  .st-popover-opts {
    left: 0;
  }
}

@media (max-width: 580px) {
  .st-topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .st-brand-name,
  .st-studio-tag,
  .st-nav-link:not(.st-nav-home),
  .st-pill-hide-xs {
    display: none;
  }
  .st-key-pill {
    max-width: 152px;
    padding: 0 9px;
    font-size: 11.5px;
  }
  .st-gallery-wrap {
    padding: 14px 12px 220px;
  }
  .st-masonry {
    columns: 2 150px;
    column-gap: 10px;
  }
  .st-card {
    margin-bottom: 10px;
    border-radius: 12px;
  }
  .st-dock-anchor {
    bottom: 10px;
    width: calc(100vw - 16px);
  }
  .st-dock {
    padding: 10px 10px 8px;
    border-radius: 18px;
  }
  .st-gen-btn {
    padding: 0 14px;
    height: 34px;
  }
}
