:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-soft: rgba(229, 231, 235, 0.72);
  --text: #111827;
  --muted: #6b7280;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --danger: #dc2626;
  --shadow: 0 20px 50px -24px rgba(15, 23, 42, 0.25);
  --shadow-soft: 0 14px 32px -26px rgba(15, 23, 42, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, "Noto Sans SC", system-ui, sans-serif; height: 100%; overflow: hidden; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

body.boot-loading .app-shell {
  opacity: 0;
  pointer-events: none;
}

.gallery-boot-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #eef7ff;
  background:
    radial-gradient(circle at 50% 48%, rgba(65, 148, 255, .22), transparent 22%),
    radial-gradient(circle at 22% 18%, rgba(83, 110, 255, .24), transparent 26%),
    radial-gradient(circle at 78% 76%, rgba(0, 218, 255, .14), transparent 28%),
    linear-gradient(135deg, #020716 0%, #06142b 52%, #01030b 100%);
  transition: opacity .7s ease, visibility .7s ease;
}

.gallery-boot-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gallery-boot-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gallery-boot-orbit {
  position: absolute;
  width: min(72vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, .16);
  box-shadow:
    inset 0 0 72px rgba(56, 189, 248, .12),
    0 0 110px rgba(37, 99, 235, .18);
  animation: boot-orbit 9s linear infinite;
}

.gallery-boot-orbit::before,
.gallery-boot-orbit::after {
  content: '';
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, .18);
  transform: rotateX(64deg) rotateZ(22deg);
}

.gallery-boot-orbit::after {
  inset: 24%;
  border-color: rgba(45, 212, 191, .18);
  transform: rotateX(58deg) rotateZ(-34deg);
}

@keyframes boot-orbit {
  to { transform: rotate(360deg); }
}

.gallery-boot-content {
  position: relative;
  z-index: 1;
  width: min(88vw, 560px);
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 34px 28px;
}

.gallery-boot-mark {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 28px;
  font-weight: 950;
  background: linear-gradient(135deg, #2563eb, #67e8f9);
  box-shadow: 0 0 38px rgba(96, 165, 250, .72);
}

.gallery-boot-content h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 0 34px rgba(125, 211, 252, .32);
}

.gallery-boot-content p {
  margin: 0;
  color: #9fc2e8;
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 700;
}

.gallery-boot-progress {
  width: min(420px, 74vw);
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(132, 166, 214, .16);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .14);
}

.gallery-boot-progress span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #22d3ee, #a78bfa);
  box-shadow: 0 0 24px rgba(34, 211, 238, .58);
  transition: width .28s ease;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.45); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { height: 100vh; display: grid; grid-template-columns: 1fr; background: linear-gradient(180deg, #f8faff 0%, #f5f7fb 100%); overflow: hidden; }
.sidebar { background: rgba(251,252,255,.92); backdrop-filter: blur(18px); border-right: 1px solid var(--border-soft); padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand h1 { margin: 0; font-size: 18px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.sidebar-section { display: grid; gap: 8px; }
.sidebar-section.grow { flex: 1 1 auto; min-height: 0; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  margin-bottom: 0;
  min-height: 20px;
}
.section-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef2ff 0%, #f5f3ff 100%);
  color: #6366f1;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(99,102,241,.12);
  line-height: 1.2;
  white-space: nowrap;
}
.section-link-btn:hover {
  border-color: rgba(99,102,241,.28);
  color: #4f46e5;
  transform: translateY(-1px);
}
.field-label { color: var(--muted); font-size: 12px; }
.key-row { display: grid; grid-template-columns: 1fr 40px; gap: 8px; }

input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: #fff; color: var(--text); padding: 12px 14px; outline: none; }
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.12); }

button { border: 1px solid transparent; cursor: pointer; }
.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 700; box-shadow: 0 16px 32px -18px rgba(99,102,241,.55); }
.secondary { background: #fff; border-color: var(--border); color: var(--text); border-radius: 14px; padding: 11px 14px; }
.secondary:hover, .icon-btn:hover { border-color: #c7d2fe; color: var(--primary); }
.full, .ghost-full { width: 100%; }
.ghost-full { background: #eef2ff; color: var(--primary); border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.icon-btn { background: #fff; border: 1px solid var(--border); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; }
.hint { color: var(--muted); font-size: 12px; }

.model-card { border: 1px solid var(--border); background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%); border-radius: 16px; padding: 12px 14px; display: grid; gap: 4px; box-shadow: 0 10px 24px -20px rgba(15,23,42,.18); }
.model-card span { color: var(--muted); font-size: 12px; }
.conversation-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 6px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
}
.conversation-item {
  position: relative;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  transition: all .22s ease;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}
.conversation-thumb {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid rgba(99,102,241,.14);
  display: grid;
  place-items: center;
  color: #6366f1;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}
.conversation-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.conversation-info {
  min-width: 0;
}
.conversation-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background .22s ease;
}
.conversation-item:hover {
  border-color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 18px 32px -24px rgba(99,102,241,.18);
}
.conversation-item:hover::before {
  background: rgba(99,102,241,.35);
}
.conversation-item.active {
  border-color: rgba(99,102,241,.36);
  background: linear-gradient(180deg, #eef2ff 0%, #f7f4ff 100%);
  box-shadow: 0 18px 34px -22px rgba(99,102,241,.28);
}
.conversation-item.active::before {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}
.conversation-item .title {
  font-weight: 700;
  color: #1f2937;
  line-height: 1.35;
  font-size: 13px;
  padding-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-item .meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(229,231,235,.8);
}

.sidebar-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
  padding-right: 6px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
}
.sidebar-gallery-item {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  background: #eef2ff;
  box-shadow: var(--shadow-soft);
  transition: all .2s ease;
}
.sidebar-gallery-item:hover {
  border-color: rgba(99,102,241,.35);
  transform: translateY(-1px);
}
.sidebar-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sidebar-gallery-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(99,102,241,.22);
  border-radius: 16px;
  padding: 18px 14px;
  color: #6b7280;
  background: #f8faff;
  font-size: 12px;
  line-height: 1.5;
}
.sidebar { display: none; }
.workspace { display: grid; grid-template-rows: auto 1fr; height: 100vh; min-height: 0; overflow: hidden; }
.workspace-header { padding: 16px 24px 6px; display: block; }
.workspace-header h2 { margin: 0; font-size: 22px; }
.workspace-header p { margin: 4px 0 0; color: var(--muted); }
.workspace-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.workspace-toolbar {
  margin: 0 24px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
}
.workspace-toolbar-inline {
  margin: 0;
  width: 100%;
}
.workspace-toolbar-top {
  justify-self: end;
  align-self: start;
  min-width: min(100%, 980px);
}
.workspace-toolbar-top .toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.workspace-toolbar-top .toolbar-label {
  white-space: nowrap;
}
.toolbar-group {
  display: grid;
  gap: 2px;
}
.toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar-actions .secondary {
  padding: 9px 12px;
}
.toolbar-label {
  font-size: 12px;
  color: var(--muted);
}
.toolbar-select {
  min-width: 210px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: none;
}
.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.operation-status {
  margin: 0 24px 8px;
  padding: 12px 14px;
  border: 1px solid #dbe2ff;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.operation-status.hidden { display: none; }
.operation-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.operation-status-row strong { font-size: 14px; }
.operation-status-row span { color: var(--muted); font-size: 12px; }
.operation-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(99,102,241,.14);
  overflow: hidden;
}
.operation-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .25s ease;
}

.workspace-main {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) minmax(116px, 150px);
  gap: 16px;
  padding: 18px 24px 24px;
  align-items: start;
  min-height: 0;
  overflow: hidden;
}
.rail-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(99,102,241,.12);
  background: rgba(255,255,255,.76);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}
.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.rail-head strong {
  font-size: 14px;
}
.rail-head span,
.rail-link {
  color: #6b7280;
  font-size: 12px;
}
.rail-link {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 800;
}
.side-category-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
  padding-right: 3px;
}
.side-category-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid rgba(99,102,241,.14);
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}
.side-category-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-category-item em {
  flex: 0 0 auto;
  font-style: normal;
  color: #94a3b8;
  font-size: 11px;
}
.side-category-item.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 28px -18px rgba(99,102,241,.65);
}
.side-category-item.active em {
  color: rgba(255,255,255,.82);
}
.history-rail-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  padding-right: 3px;
}
.history-rail-item {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(226,232,240,.95);
  background: #eef2ff;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.history-rail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.history-rail-empty {
  grid-column: 1 / -1;
  padding: 14px 10px;
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 8px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
  background: #f8faff;
}

@media (min-width: 421px) {
  .rail-panel {
    display: grid !important;
  }
  .insight-home-card > .preset-category-tabs {
    display: none;
  }
}
.message-stream-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: none;
}
.message-stream-head {
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.message-stream-head h3 {
  margin: 2px 0 0;
  font-size: 15px;
}
.message-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.message-list {
  padding: 0 0 8px;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
}
.message-list > .message-card:last-child {
  margin-bottom: 0;
}
.welcome-hint {
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.8;
}
.welcome-hint p {
  margin: 0 0 12px;
}
.welcome-hint strong {
  color: #4f46e5;
}
.welcome-hint a {
  color: #6366f1;
  text-decoration: none;
  font-weight: 600;
}
.welcome-hint a:hover {
  text-decoration: underline;
}
.home-gallery-shell {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}
.insight-home-card {
  min-height: 0;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  overflow: visible;
  background: #fff;
  border: 1px solid rgba(99,102,241,.12);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}
.home-gallery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 2px;
}
.home-gallery-head h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}
.home-gallery-head p {
  margin: 6px 0 0;
  color: #6b7280;
}
.home-gallery-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.home-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 16px;
}
.home-gallery-card {
  border: 1px solid rgba(226,232,240,.95);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto;
  text-align: left;
  box-shadow: 0 12px 26px -24px rgba(15,23,42,.28);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.home-gallery-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99,102,241,.34);
  box-shadow: 0 20px 34px -26px rgba(99,102,241,.42);
}
.home-gallery-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  color: #6366f1;
  font-weight: 900;
}
.home-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-gallery-title {
  padding: 10px 10px 2px;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 46px;
}
.home-gallery-meta {
  padding: 0 10px 10px;
  color: #6366f1;
  font-size: 11px;
  font-weight: 800;
}
.home-gallery-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: #6b7280;
  background: #f8faff;
}
.generation-result-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #fff;
}
.generation-result-card > button {
  width: 100%;
  padding: 0;
  border: 0;
  background: #f8faff;
  display: block;
}
.generation-result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}
.generation-result-card figcaption {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #6b7280;
  font-size: 12px;
}

.generation-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.generation-result-actions .secondary {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}
.floating-actions {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-fab,
.quick-generate-fab {
  min-width: 64px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,.28);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 900;
  box-shadow: 0 20px 42px -20px rgba(99,102,241,.75);
}
.quick-generate-fab {
  background: linear-gradient(135deg, #111827, #4f46e5);
}
.message-card { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow-soft); max-width: min(880px, 100%); transition: box-shadow .25s ease, border-color .25s ease, transform .25s ease; }
.message-card-highlight { border-color: rgba(99,102,241,.55); box-shadow: 0 0 0 4px rgba(99,102,241,.12), var(--shadow-soft); transform: translateY(-1px); }
.message-card.user { background: linear-gradient(135deg, #eef2ff, #f5f3ff); margin-left: auto; }
.message-role { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 700; letter-spacing: .02em; }
.message-content { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.message-progress {
  margin-top: 10px;
}
.message-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(99,102,241,.14);
}
.message-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #7c3aed);
  background-size: 200% 100%;
  animation: progress-slide 1.2s linear infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-35%); background-position: 0% 50%; }
  100% { transform: translateX(180%); background-position: 100% 50%; }
}
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.image-tile { border: 1px solid var(--border-soft); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow-soft); }
.image-tile img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; cursor: zoom-in; }
.image-actions { padding: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.image-actions .secondary { flex: 0 0 auto; }
.image-meta {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f8faff;
  border: 1px solid rgba(226,232,240,.9);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.composer-shell {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0 16px 16px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(20px);
  padding: 12px;
  box-shadow: 0 -8px 30px -18px rgba(15,23,42,.12), 0 12px 26px -24px rgba(15,23,42,.12);
  border-radius: 18px;
}
.composer-shell::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,.22), transparent);
}
.composer-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-height: 0;
}
.composer-top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
}
.role-top-field {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.field.role-top-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-top-field label {
  margin: 0;
  white-space: nowrap;
}
.role-top-field select {
  flex: 1;
}
.composer-shell-title .toolbar-label { display: none; }
.composer-shell-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}
.mode-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.mode-tabs-floating {
  align-self: center;
  padding: 3px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 24px -18px rgba(15,23,42,.18);
}
.mode-tab { border: 1px solid transparent; background: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 700; color: var(--muted); }
.mode-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: var(--primary); }
.composer-panel {
  display: none;
  gap: 8px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: none;
}
.composer-panel.active { display: grid; }
.composer-panel .field select,
.composer-panel .field input,
.composer-panel textarea {
  background: #fff;
}
.composer-panel-head.compact h3 { margin: 0; font-size: 15px; }
.composer-panel-head.compact p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.composer-grid {
  display: grid;
  gap: 10px;
  align-items: start;
}
.composer-grid-chat {
  grid-template-columns: 220px minmax(0, 1fr);
}
.composer-grid.single-column {
  grid-template-columns: 1fr;
}
.composer-grid-image {
  grid-template-columns: minmax(460px, 1fr) minmax(560px, 680px);
  align-items: end;
}
.composer-main-input {
  min-width: 0;
}
.composer-main-input textarea {
  width: 100%;
  min-height: 80px;
}
.composer-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.composer-status-inline {
  display: grid;
  gap: 2px;
}
.composer-status-inline strong {
  font-size: 13px;
  color: #1f2937;
}
.inline-hint { color: var(--muted); font-size: 12px; }
.image-controls { display: grid; grid-template-columns: 100px minmax(220px, 1fr) 220px; gap: 10px; align-items: end; }
.field { display: grid; gap: 8px; }
.field label { color: var(--muted); font-size: 12px; }
.reference-list { display: none; grid-template-columns: repeat(auto-fit, minmax(78px, 78px)); gap: 8px; }
.reference-list:not(:empty) { display: grid; margin-top: 0; padding: 0 2px 2px; }
.reference-thumb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 10px 20px -18px rgba(15,23,42,.2);
}
.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.reference-thumb-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(17,24,39,.78);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(0,0,0,.5);
  z-index: 2;
}
.reference-thumb-remove:hover {
  background: #ef4444;
}
.reference-thumb-name {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  padding: 3px 5px;
  border-radius: 10px;
  background: rgba(17,24,39,.62);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.insight-panel {
  position: sticky;
  top: 0;
  border: 1px solid rgba(99,102,241,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, #f8faff 100%);
  border-radius: 24px;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  min-height: 520px;
  max-height: calc(100vh - 220px);
  overflow: hidden;
}
.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  margin: 0 0 6px;
  line-height: 1.28;
}
.rich-content p {
  margin: 0 0 6px;
}
.rich-content p:last-child,
.rich-content ul:last-child,
.rich-content ol:last-child,
.rich-content blockquote:last-child,
.rich-content pre:last-child {
  margin-bottom: 0;
}
.rich-content ul,
.rich-content ol {
  margin: 0 0 6px 18px;
  padding: 0;
}
.rich-content pre {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0f172a;
  color: #e5eefc;
  overflow: auto;
}
.rich-content code {
  font-family: Consolas, "SFMono-Regular", monospace;
}
.rich-content :not(pre) > code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
}
.rich-content blockquote {
  margin: 6px 0;
  padding: 8px 10px;
  border-left: 3px solid #c7d2fe;
  background: #f8faff;
  border-radius: 0 12px 12px 0;
  color: #475569;
}
.rich-content .katex-display {
  margin: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.insight-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: auto;
  min-height: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.insight-panel-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.insight-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(99,102,241,.08);
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(99,102,241,.12);
}
.insight-panel-desc {
  display: none;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.idea-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(99,102,241,.14);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8faff 0%, #f3f5ff 100%);
}
.idea-progress.hidden { display: none; }
.idea-progress-text {
  font-size: 12px;
  color: #6366f1;
  font-weight: 700;
}
.idea-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(99,102,241,.14);
}
.idea-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #7c3aed);
  background-size: 200% 100%;
  animation: progress-slide 1.2s linear infinite;
}
.prompt-grid-side {
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  grid-template-columns: 1fr;
  align-content: start;
  grid-auto-rows: auto;
}
.prompt-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.prompt-panel-head strong {
  display: block;
  font-size: 14px;
}
.prompt-action-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border-color: rgba(99,102,241,.16);
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  color: #4f46e5;
  font-weight: 700;
  box-shadow: 0 10px 24px -20px rgba(99,102,241,.34);
}
.prompt-action-btn:hover {
  border-color: rgba(99,102,241,.28);
  background: linear-gradient(180deg, #eef2ff 0%, #f5f3ff 100%);
  color: #4338ca;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  max-height: 120px;
  overflow: auto;
  padding-right: 4px;
}
.prompt-grid.prompt-grid-side {
  height: 100%;
  max-height: none;
  grid-template-columns: 1fr;
  align-content: start;
  grid-auto-rows: auto;
}
.prompt-tag {
  text-align: left;
  padding: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
  border: 1px solid rgba(226,232,240,.95);
  color: #374151;
  line-height: 1.45;
  min-height: 0;
  font-size: 11px;
  transition: all .2s ease;
  box-shadow: 0 12px 24px -22px rgba(15,23,42,.18);
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 0;
  overflow: hidden;
  align-self: start;
}
.prompt-tag-preview {
  width: 100%;
  min-height: 0;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  display: grid;
  place-items: center;
  color: #6366f1;
  font-weight: 800;
}
.prompt-tag-preview img {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 5;
  object-fit: cover;
  display: block;
}
.prompt-tag-preview.is-error {
  color: #9ca3af;
  background: repeating-linear-gradient(45deg, #f8faff, #f8faff 8px, #eef2ff 8px, #eef2ff 16px);
  font-size: 12px;
}
.prompt-tag-preview.is-text {
  color: #6366f1;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #ede9fe 100%);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  box-sizing: border-box;
  line-height: 1.35;
}
.prompt-tag-preview.is-text .preview-text {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}
.prompt-tag-title {
  font-weight: 800;
  color: #1f2937;
  line-height: 1.35;
  padding: 9px 10px 2px;
}
.prompt-tag-desc {
  color: #6b7280;
  font-size: 11px;
  line-height: 1.42;
  padding: 2px 10px 8px;
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prompt-tag-meta {
  width: fit-content;
  max-width: calc(100% - 20px);
  margin: 0 10px 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #6366f1;
  font-size: 10px;
  font-weight: 700;
}
.prompt-tag-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 10px 8px;
  align-items: center;
}
.prompt-tag-author {
  font-size: 10px;
  color: #6b7280;
  font-weight: 600;
}
.prompt-tag-category {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  color: #6366f1;
  font-weight: 700;
  line-height: 1.3;
}
.prompt-tag:hover {
  border-color: rgba(99,102,241,.28);
  background: linear-gradient(180deg, #f8faff 0%, #f5f3ff 100%);
  color: #312e81;
  transform: translateY(-1px);
  box-shadow: 0 20px 32px -24px rgba(99,102,241,.24);
}
.case-empty-state {
  grid-column: 1 / -1;
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: #6b7280;
  background: #f8faff;
}

.message-card .rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 12px;
}
.message-card .rich-content th,
.message-card .rich-content td {
  border: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
}
.message-card .rich-content th {
  background: #f8faff;
}

#imagePrompt {
  min-height: 76px;
  max-height: 200px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
  resize: none;
  overflow-y: auto;
  field-sizing: content;
}

.composer-shell.image-mode {
  padding: 10px 12px;
  border-radius: 24px;
}
.composer-shell.image-mode .role-top-field {
  display: none;
}
.composer-shell.image-mode .composer-shell-head {
  position: static;
  margin: 0 0 8px;
  min-height: 0;
}
.composer-shell.image-mode .composer-top-controls {
  width: 100%;
  justify-content: flex-end;
}
.composer-shell.image-mode .mode-tabs-floating {
  margin-left: auto;
  box-shadow: none;
}
.composer-shell.image-mode .composer-panel-head.compact {
  display: none;
}
.composer-shell.image-mode #imageComposer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 16px 38px -30px rgba(15,23,42,.18);
}
.composer-shell.image-mode #referenceList {
  max-height: 92px;
  overflow: auto;
}
.composer-shell.image-mode .composer-status-inline {
  display: none;
}
.composer-shell.image-mode #sendImageBtn {
  min-width: 88px;
}

.composer-shell.image-mode .field-file input[type="file"] {
  height: 42px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-shell.image-mode #imagePrompt {
  min-height: 76px;
  max-height: 200px;
  border: 0;
  box-shadow: none;
  padding: 4px 4px 8px;
  border-radius: 0;
  resize: none;
  background: transparent;
}
.composer-shell.image-mode #imagePrompt:focus {
  border-color: transparent;
  box-shadow: none;
}
.composer-shell.image-mode .image-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(226,232,240,.72);
}
.composer-shell.image-mode .image-controls .field {
  gap: 4px;
}
.composer-shell.image-mode .image-controls .field:nth-child(1) {
  width: 104px;
}
.composer-shell.image-mode .image-controls .field:nth-child(2) {
  width: 190px;
}
.composer-shell.image-mode .image-controls .field-file {
  width: min(260px, 100%);
}
.composer-shell.image-mode .image-controls select,
.composer-shell.image-mode .image-controls input {
  height: 42px;
  border-radius: 999px;
  padding: 8px 14px;
}
.composer-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(226,232,240,.72);
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tool-pill,
.tool-select {
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
}
.tool-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.tool-pill:hover,
.tool-select:hover {
  border-color: #c7d2fe;
  color: var(--primary);
}
.tool-select {
  width: auto;
  min-width: 92px;
  max-width: 180px;
}
.tool-label {
  height: 36px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}
.tool-button {
  font-weight: 700;
}
.model-select {
  min-width: 170px;
  max-width: 230px;
}
.helper-model-select {
  max-width: 190px;
}
.size-select {
  min-width: 150px;
}
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.send-round {
  height: 36px;
  border-radius: 999px;
  padding: 0 18px;
  box-shadow: 0 14px 28px -18px rgba(99,102,241,.7);
}

#sendImageBtn {
  min-width: 140px;
}

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal.hidden { display: none; }
.prompt-detail-modal { z-index: 1010; }
.generate-modal { z-index: 1020; }
#authModal { z-index: 1120; }
.reference-compress-modal { z-index: 1125; }
.preview-modal { z-index: 1130; }
.modal-card, .preview-card { width: min(720px, 96vw); background: #fff; border-radius: 24px; border: 1px solid rgba(99,102,241,.12); box-shadow: 0 30px 80px -24px rgba(0,0,0,.32); padding: 24px; }
.reference-compress-card { max-width: 560px; display: grid; gap: 16px; }
.reference-compress-list { display: grid; gap: 8px; max-height: 180px; overflow: auto; padding: 10px; border-radius: 14px; background: #f8fafc; border: 1px solid rgba(148,163,184,.24); color: var(--muted); font-size: 13px; }
.reference-compress-item { display: flex; justify-content: space-between; gap: 12px; }
.reference-compress-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.reference-compress-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.auth-card { max-width: 560px; display: grid; gap: 14px; }
.auth-model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gallery-modal-card {
  width: min(1180px, 94vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 28px;
  border: 1px solid rgba(99,102,241,.12);
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.32);
  padding: 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 2px 4px 4px 0;
  align-content: start;
}
.gallery-item {
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: all .2s ease;
}
.gallery-item:hover {
  border-color: rgba(99,102,241,.35);
  transform: translateY(-2px);
  box-shadow: 0 20px 34px -24px rgba(99,102,241,.28);
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #eef2ff;
}

.gallery-item-pending {
  background: linear-gradient(180deg, rgba(11, 24, 48, .92), rgba(21, 45, 78, .88));
  border-color: rgba(96, 165, 250, .25);
  color: #eaf3ff;
}

.gallery-pending-stage {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, .24), transparent 56%),
    rgba(10, 24, 48, .88);
}

.gallery-item-pending .gallery-item-title {
  color: #edf6ff;
}

.gallery-item-pending .gallery-item-meta {
  color: #91c7ff;
}

.gallery-item-info {
  padding: 9px 10px 10px;
  display: grid;
  gap: 4px;
}
.gallery-item-title {
  font-size: 12px;
  font-weight: 800;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-item-meta {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-empty {
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 20px;
  padding: 28px;
  color: #6b7280;
  background: #f8faff;
}
.generate-card {
  width: min(1320px, 96vw);
  max-height: 92vh;
  background: #fff;
  border: 1px solid rgba(99,102,241,.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.32);
  padding: 20px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.generate-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, .95fr) minmax(0, 1.05fr);
  gap: 16px;
}
.generate-preview-panel,
.generate-form {
  min-height: 0;
  overflow: auto;
}
.generate-form {
  display: grid;
  gap: 12px;
  align-content: start;
}
.generate-form textarea {
  min-height: 180px;
}
.generate-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.generate-form label,
.generate-upload-label {
  display: grid;
  gap: 6px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}
.size-adjust-hint {
  min-height: 16px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.size-adjust-hint:empty {
  display: none;
}
.size-adjust-hint[data-type="success"] {
  color: #059669;
}
.size-adjust-hint[data-type="error"] {
  color: #dc2626;
}
.generate-reference-title {
  margin-bottom: 10px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 900;
}
.generate-reference-stage {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  min-height: 420px;
  max-height: 62vh;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #f8faff;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}
.generate-reference-stage img {
  width: 100%;
  height: 100%;
  max-height: 62vh;
  object-fit: contain;
  display: block;
}
.generate-reference-stage span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(17,24,39,.74);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.generate-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}
.generate-reference-grid.single {
  display: none;
}
.generate-reference-item {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #f8faff;
  text-align: left;
}
.generate-reference-item.active {
  border-color: #6366f1;
}
.generate-reference-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.generate-reference-item span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(17,24,39,.72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.generate-reference-empty {
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 8px;
  padding: 22px;
  color: #6b7280;
  background: #f8faff;
}
.generate-upload-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}
.generate-upload-card {
  position: relative;
  margin: 0;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  overflow: hidden;
  background: #f8faff;
}
.generate-upload-card.is-oversized {
  border-color: rgba(245,158,11,.52);
  background: #fffbeb;
}
.generate-upload-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.generate-upload-card figcaption {
  padding: 7px 8px;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.generate-upload-remove {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  padding: 0;
  background: rgba(17,24,39,.72);
  color: #fff;
  border: 1px solid rgba(255,255,255,.6);
  font-size: 16px;
  line-height: 1;
}
.generate-progress {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe2ff;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  border-radius: 8px;
}
.generate-progress-head,
.generate-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.generate-progress-head strong,
.generate-result-head strong {
  font-size: 14px;
}
.generate-progress-head span,
.generate-result-head span {
  color: #6b7280;
  font-size: 12px;
}
.generate-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(99,102,241,.14);
  overflow: hidden;
}
.generate-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .25s ease;
}
.generate-result-grid {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}
.generate-waiting-area {
  min-height: 220px;
  border: 1px dashed rgba(99,102,241,.28);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  outline: none;
}
.generate-waiting-area strong {
  font-size: 18px;
  color: #1f2937;
}
.generate-waiting-area span {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  color: #6366f1;
  font-size: 12px;
  font-weight: 900;
}
.generate-waiting-area p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}
.generate-result-images {
  display: grid;
  gap: 12px;
}
.generate-result-count-1 { grid-template-columns: minmax(0, min(520px, 100%)); }
.generate-result-count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.generate-result-count-3,
.generate-result-count-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.insight-modal-card {
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  max-width: none;
  max-height: none;
  background: #fff;
  border-radius: 28px;
  border: 1px solid rgba(99,102,241,.12);
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.32);
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
}
.preset-category-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  border-bottom: 1px solid rgba(99,102,241,.1);
}
.preset-category-tab {
  flex: 0 0 auto;
  border: 1px solid rgba(99,102,241,.16);
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  color: #4b5563;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 800;
  transition: all .2s ease;
  box-shadow: 0 10px 22px -20px rgba(99,102,241,.3);
}
.preset-category-tab:hover {
  border-color: rgba(99,102,241,.28);
  color: #4f46e5;
  transform: translateY(-1px);
}
.preset-category-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 14px 28px -18px rgba(99,102,241,.65);
}
.insight-modal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.case-library-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.case-search-field input {
  height: 44px;
  border-radius: 14px;
  background: #f8faff;
}
.case-result-stats {
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.prompt-grid-modal {
  max-height: none;
  min-height: 0;
  overflow: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  padding: 2px 4px 14px 0;
}
.prompt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 44px;
  padding: 8px 0 0;
  background: #fff;
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}
.prompt-pagination.hidden {
  display: none;
}
.pagination-btn {
  min-width: 88px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,.18);
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  color: #4f46e5;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 22px -20px rgba(99,102,241,.3);
}
.pagination-btn:hover:not(:disabled) {
  border-color: rgba(99,102,241,.32);
  transform: translateY(-1px);
}
.pagination-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.pagination-status {
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.prompt-detail-card {
  width: min(1180px, 96vw);
  max-height: 92vh;
  background: #fff;
  border: 1px solid rgba(99,102,241,.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.32);
  padding: 20px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.prompt-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.prompt-detail-kicker {
  color: #6366f1;
  font-size: 12px;
  font-weight: 900;
}
.prompt-detail-head h3 {
  margin: 4px 0 8px;
  font-size: 24px;
  line-height: 1.2;
}
.prompt-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}
.prompt-detail-meta a {
  color: #4f46e5;
  text-decoration: none;
}
.prompt-detail-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr);
  gap: 18px;
}
.prompt-detail-media,
.prompt-detail-copy {
  min-height: 0;
  overflow: auto;
}
.prompt-detail-image {
  width: 100%;
  min-height: 320px;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #f8faff;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0;
}
.prompt-detail-image img {
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
  display: block;
}
.prompt-detail-image.is-empty {
  color: #6b7280;
  font-weight: 800;
}
.prompt-detail-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.prompt-detail-thumbs button {
  height: 72px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: #f8faff;
}
.prompt-detail-thumbs button.active {
  border-color: #6366f1;
}
.prompt-detail-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.prompt-detail-desc {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 14px;
}
.prompt-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.prompt-detail-actions button:disabled {
  opacity: .58;
  cursor: not-allowed;
}
.prompt-detail-prompt {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #f8faff;
  color: #111827;
  padding: 14px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.58;
  min-height: 360px;
  resize: vertical;
}

.prompt-admin-card {
  width: min(1240px, 96vw);
  height: min(860px, 92vh);
  background: #fff;
  border: 1px solid rgba(99,102,241,.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.32);
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}
.prompt-admin-login {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.prompt-admin-login-status {
  grid-column: 1 / -1;
  min-height: 18px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
}
.prompt-admin-login-status[data-type="success"] {
  color: #059669;
}
.prompt-admin-login-status[data-type="error"] {
  color: #dc2626;
}
.prompt-admin-login.hidden,
.prompt-admin-workspace.hidden {
  display: none;
}
.prompt-admin-workspace {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}
.prompt-admin-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px auto auto auto;
  gap: 10px;
  align-items: center;
}
.prompt-admin-mirror-progress,
.prompt-admin-operation-progress {
  border: 1px solid rgba(99,102,241,.16);
  border-radius: 8px;
  background: #f8faff;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
.prompt-admin-operation-progress {
  background: #f9fafb;
}
.prompt-admin-mirror-progress.hidden,
.prompt-admin-operation-progress.hidden {
  display: none;
}
.prompt-admin-operation-progress[data-type="success"] {
  border-color: rgba(5,150,105,.22);
  background: #f0fdf4;
}
.prompt-admin-operation-progress[data-type="success"] .prompt-admin-progress-bar {
  background: linear-gradient(90deg, #059669, #22c55e);
}
.prompt-admin-operation-progress[data-type="error"] {
  border-color: rgba(220,38,38,.22);
  background: #fff7f7;
}
.prompt-admin-operation-progress[data-type="error"] .prompt-admin-progress-bar {
  background: linear-gradient(90deg, #dc2626, #f97316);
}
.prompt-admin-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}
.prompt-admin-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(99,102,241,.14);
}
.prompt-admin-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .25s ease;
}
.prompt-admin-progress-meta {
  color: #6b7280;
  font-size: 12px;
}
.prompt-admin-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}
.prompt-admin-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #f8faff;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 8px;
}
.prompt-admin-item {
  text-align: left;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}
.prompt-admin-item.active {
  border-color: #6366f1;
  box-shadow: 0 12px 26px -22px rgba(99,102,241,.7);
}
.prompt-admin-item strong {
  color: #111827;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-admin-item span,
.prompt-admin-empty {
  color: #6b7280;
  font-size: 12px;
}
.prompt-admin-item-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.prompt-admin-form {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.prompt-admin-form label {
  display: grid;
  gap: 6px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}
.prompt-admin-form textarea {
  min-height: 96px;
}
#promptAdminPrompt {
  min-height: 210px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}
.prompt-admin-editor-grid {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.prompt-admin-preview-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.prompt-admin-text-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.prompt-admin-panel-title {
  color: #4b5563;
  font-size: 12px;
  font-weight: 900;
}
.prompt-admin-form-row.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.prompt-admin-category-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.prompt-admin-inline-save {
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}
.prompt-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.prompt-admin-file-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 42px;
  cursor: pointer;
  color: #111827 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}
.prompt-admin-preview-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
}
.prompt-admin-preview-images button {
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: #f8faff;
  aspect-ratio: 4 / 3;
  min-height: 260px;
}
.prompt-admin-preview-images img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.prompt-admin-preview-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(99,102,241,.24);
  border-radius: 8px;
  padding: 12px;
  color: #6b7280;
  background: #f8faff;
  font-size: 12px;
}
.prompt-admin-import {
  border-top: 1px solid rgba(226,232,240,.95);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}
.prompt-admin-import textarea {
  min-height: 160px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}
.prompt-admin-import-result {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.prompt-admin-import-summary {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 800;
}
.prompt-admin-import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}
.prompt-admin-import-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-admin-import-row.new span { color: #059669; }
.prompt-admin-import-row.id-renamed span { color: #4f46e5; }
.prompt-admin-import-row.duplicate span { color: #b45309; }
.prompt-admin-import-row.invalid span { color: #dc2626; }
.danger-action {
  color: #dc2626;
  border-color: rgba(220,38,38,.24);
}
.prompt-admin-status {
  min-height: 20px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}
.prompt-admin-status[data-type="success"] { color: #059669; }
.prompt-admin-status[data-type="error"] { color: #dc2626; }

.insight-hover-preview {
  position: fixed;
  z-index: 9999;
  border: 2px solid #fff;
  border-radius: 8px;
  overflow: hidden;
  background: #f8faff;
  box-shadow: 0 20px 60px -18px rgba(0,0,0,.35);
  pointer-events: none;
}
.insight-hover-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-card {
  width: min(1280px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  padding: 16px;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.preview-tool-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  background: rgba(255,255,255,.96);
}
.preview-viewport {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: calc(92vh - 86px);
  overflow: auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  cursor: grab;
}
.preview-viewport:active {
  cursor: grabbing;
}
.preview-card img {
  max-width: min(1200px, 92vw);
  max-height: 86vh;
  display: block;
  border-radius: 16px;
  transform-origin: center center;
  transition: transform .16s ease;
  user-select: none;
  -webkit-user-drag: none;
  cursor: inherit;
}
.preview-close {
  background: rgba(255,255,255,.95);
}

.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96); background: rgba(255,255,255,.98); border: 1px solid rgba(99,102,241,.16); border-radius: 22px; padding: 18px 22px; display: flex; gap: 12px; align-items: center; min-width: min(86vw, 340px); max-width: min(92vw, 520px); box-shadow: 0 24px 60px -18px rgba(0,0,0,.24); z-index: 1200; }
.toast.hidden { display: none; }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #eef2ff; color: var(--primary); font-weight: 700; flex: 0 0 auto; }

@media (max-width: 420px) {
  .app-shell { grid-template-columns: 1fr; }
  .workspace-header { display: block; }
  .conversation-list { max-height: 220px; }
  .workspace-main { grid-template-columns: 1fr; }
  .rail-panel { display: none; }
  .insight-home-card > .preset-category-tabs {
    display: flex;
  }
  .message-stream-shell { min-height: 420px; }
  .prompt-grid-modal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prompt-detail-body { grid-template-columns: 1fr; }
  .generate-layout { grid-template-columns: 1fr; }
  .prompt-admin-body { grid-template-columns: 1fr; }
  .prompt-admin-list { max-height: 260px; }
}

@media (max-width: 420px) {
  .workspace-header { padding-left: 16px; padding-right: 16px; }
  .workspace-main { padding-left: 16px; padding-right: 16px; }
  .operation-status { margin-left: 16px; margin-right: 16px; }
  .workspace-toolbar { margin-left: 16px; margin-right: 16px; }
  .composer-shell { margin-left: 12px; margin-right: 12px; margin-bottom: 12px; }
  .image-controls, .modal-grid, .composer-grid-chat, .composer-grid-image { grid-template-columns: 1fr; }
  .composer-actions { flex-direction: column; align-items: stretch; }
  .composer-shell-head { flex-direction: column; align-items: stretch; }
  .workspace-toolbar-top .toolbar-group,
  .role-top-field { align-items: stretch; flex-direction: column; gap: 6px; }
  .composer-top-controls { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
  .toolbar-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .toolbar-select { min-width: 0; width: 100%; }
  .toolbar-divider { display: none; }
  .message-card { max-width: 100%; }
  .insight-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .insight-panel-desc {
    display: block;
    max-width: none;
    white-space: normal;
  }
  .prompt-action-btn {
    width: 100%;
  }
  .case-library-tools {
    grid-template-columns: 1fr;
  }
  .case-result-stats {
    white-space: normal;
  }
  .prompt-grid-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prompt-detail-card {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 14px;
  }
  .prompt-detail-head h3 {
    font-size: 20px;
  }
  .prompt-detail-image {
    min-height: 240px;
  }
  .generate-card {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 14px;
  }
  .generate-form-grid,
  .generation-result-count-2,
  .generate-result-count-2 {
    grid-template-columns: 1fr;
  }
  .generation-results-head {
    align-items: stretch;
    flex-direction: column;
  }
  .floating-actions {
    right: 14px;
    bottom: 14px;
  }
  .prompt-admin-card {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    padding: 14px;
  }
  .prompt-admin-login,
  .prompt-admin-toolbar,
  .prompt-admin-form-row.two,
  .prompt-admin-editor-grid {
    grid-template-columns: 1fr;
  }
  .prompt-admin-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .home-gallery-head {
    align-items: stretch;
    flex-direction: column;
  }
  .home-gallery-actions {
    justify-content: flex-start;
  }
  .home-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
    overscroll-behavior-y: contain;
  }

  .app-shell,
  .workspace {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    display: block;
  }

  .workspace-main {
    display: block;
    min-height: 100dvh;
    padding: 10px 10px calc(86px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  .rail-panel,
  .workspace-header {
    display: none !important;
  }

  .message-stream-shell,
  .message-list {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .home-gallery-shell {
    gap: 12px;
    max-width: none;
  }

  .insight-home-card {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 12px 10px 16px;
    box-shadow: none;
  }

  .home-gallery-head {
    gap: 12px;
    padding: 2px 0;
    align-items: stretch;
    flex-direction: column;
  }

  .home-gallery-head h2 {
    font-size: 24px;
    line-height: 1.2;
  }

  .home-gallery-head p {
    font-size: 12px;
  }

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

  .home-gallery-actions .secondary,
  .home-gallery-actions .prompt-action-btn {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 10px;
    text-align: center;
  }

  .preset-category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scrollbar-width: none;
  }

  .preset-category-tabs::-webkit-scrollbar {
    display: none;
  }

  .preset-category-tab {
    flex: 0 0 auto;
    min-height: 36px;
    white-space: nowrap;
  }

  .case-library-tools {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .case-search-field input {
    min-height: 42px;
    border-radius: 10px;
  }

  .case-result-stats {
    min-height: 18px;
    white-space: normal;
    font-size: 12px;
  }

  .prompt-grid,
  .prompt-grid-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .prompt-tag {
    border-radius: 8px;
    min-width: 0;
  }

  .prompt-tag-preview img {
    aspect-ratio: 4 / 3;
  }

  .prompt-tag-title {
    padding: 8px 8px 2px;
    font-size: 12px;
  }

  .prompt-tag-desc {
    padding: 2px 8px 7px;
    min-height: 39px;
    font-size: 10.5px;
  }

  .prompt-tag-info {
    padding: 0 8px 8px;
  }

  .prompt-pagination {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 12px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(10px);
  }

  .pagination-status {
    text-align: center;
  }

  .floating-actions {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 90;
  }

  .history-fab,
  .quick-generate-fab {
    min-width: 56px;
    height: 48px;
    border-radius: 999px;
    padding: 0 14px;
  }

  .modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .modal-head {
    gap: 10px;
    align-items: flex-start;
  }

  .modal-head h3 {
    font-size: 18px;
  }

  .modal-head p {
    font-size: 12px;
  }

  .modal-card,
  .auth-card,
  .gallery-modal-card,
  .prompt-detail-card,
  .generate-card,
  .prompt-admin-card,
  .preview-card {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: 0;
    padding: 14px;
  }

  .auth-card {
    align-self: stretch;
    overflow: auto;
  }

  .gallery-modal-card,
  .prompt-detail-card,
  .generate-card,
  .prompt-admin-card,
  .preview-card {
    overflow: auto;
  }

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

  .prompt-detail-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .prompt-detail-head {
    gap: 10px;
  }

  .prompt-detail-head h3 {
    font-size: 18px;
  }

  .prompt-detail-image {
    min-height: 0;
    aspect-ratio: 1 / 1;
  }

  .prompt-detail-copy {
    min-height: 0;
  }

  .prompt-detail-prompt {
    min-height: 180px;
    max-height: 34dvh;
  }

  .prompt-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .prompt-detail-actions .primary,
  .prompt-detail-actions .secondary,
  .prompt-detail-actions .detail-link {
    width: 100%;
    min-height: 40px;
    text-align: center;
  }

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

  .generate-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
  }

  .generate-preview-panel,
  .generate-form {
    overflow: visible;
  }

  .generate-reference-stage {
    position: static;
    min-height: 220px;
    max-height: none;
    aspect-ratio: 1 / 1;
  }

  .generate-reference-stage img {
    max-height: none;
  }

  .generate-reference-grid {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
  }

  .generate-reference-grid.single {
    display: none;
  }

  .generate-reference-item {
    flex: 0 0 82px;
  }

  .generate-form textarea {
    min-height: 150px;
  }

  .generate-form-grid,
  .generate-result-count-2,
  .generate-result-count-3,
  .generate-result-count-4 {
    grid-template-columns: 1fr;
  }

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

  .generate-progress-head,
  .generate-result-head {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .generate-waiting-area {
    min-height: 180px;
    padding: 20px 14px;
  }

  .generation-result-card img {
    max-height: 70dvh;
  }

  .prompt-admin-card {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .prompt-admin-login,
  .prompt-admin-toolbar,
  .prompt-admin-category-row,
  .prompt-admin-body,
  .prompt-admin-form-row.two,
  .prompt-admin-editor-grid {
    grid-template-columns: 1fr;
  }

  .prompt-admin-list {
    max-height: 220px;
  }

  .prompt-admin-preview-images button {
    min-height: 180px;
  }

  .prompt-admin-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .prompt-admin-import-row {
    grid-template-columns: 1fr;
  }

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

.preview-toolbar {
  justify-content: space-between;
}

.preview-action-btn {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 12px;
}

  .preview-tool-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 9px;
  }

  .preview-viewport {
    max-height: none;
    border-radius: 12px;
  }

  .preview-card img {
    max-width: 100%;
    max-height: calc(100dvh - 84px);
    border-radius: 10px;
  }

  .toast {
    top: auto;
    bottom: calc(76px + env(safe-area-inset-bottom));
    transform: translateX(-50%) scale(.98);
    border-radius: 16px;
    padding: 12px 14px;
  }
}

@media (max-width: 360px) {
  .home-gallery-actions,
  .prompt-detail-actions {
    grid-template-columns: 1fr;
  }

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

  .generate-upload-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dark gallery redesign inspired by the provided img.comet.com concept. */
:root {
  --bg: #020916;
  --panel: #081525;
  --border: rgba(95, 139, 205, .24);
  --border-soft: rgba(105, 148, 211, .16);
  --text: #eaf2ff;
  --muted: #8fa5c2;
  --primary: #2f6bff;
  --primary-2: #64a7ff;
  --shadow: 0 28px 80px -42px rgba(27, 122, 255, .5);
  --shadow-soft: 0 18px 44px -34px rgba(5, 16, 35, .75);
}

html,
body {
  background:
    linear-gradient(rgba(35, 85, 170, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 85, 170, .05) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(82, 154, 255, .22), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(123, 92, 246, .18), transparent 28%),
    linear-gradient(135deg, #020916 0%, #071529 48%, #020713 100%);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(174, 213, 255, .9) 0 1px, transparent 1.4px),
    linear-gradient(120deg, transparent 0 36%, rgba(70, 142, 255, .18) 36.3%, transparent 37% 68%, rgba(143, 89, 255, .13) 68.3%, transparent 69%);
  background-size: 180px 180px, 100% 100%;
  opacity: .42;
}

.app-shell {
  background: transparent;
  padding: 18px;
}

.workspace {
  height: calc(100vh - 36px);
  border: 1px solid rgba(133, 177, 255, .34);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(9, 23, 42, .9), rgba(4, 14, 28, .96));
  box-shadow: 0 0 0 3px rgba(217, 232, 255, .08), 0 30px 90px -26px rgba(29, 119, 255, .55);
}

.workspace-main {
  grid-template-columns: 246px minmax(0, 1fr) 220px;
  gap: 0;
  padding: 0;
  height: 100%;
}

.rail-panel,
.insight-home-card {
  border-radius: 0;
  box-shadow: none;
  background: rgba(4, 15, 30, .72);
  border-color: rgba(111, 151, 205, .18);
}

.rail-panel {
  padding: 22px 18px;
  border-width: 0 1px 0 0;
}

.history-rail {
  border-width: 0 0 0 1px;
}

.rail-head {
  align-items: center;
  padding-bottom: 8px;
}

.rail-head strong {
  color: #f4f8ff;
  font-size: 16px;
  letter-spacing: .01em;
}

.rail-head span,
.rail-link {
  color: var(--muted);
}

.side-category-list {
  gap: 4px;
  padding-right: 4px;
}

.side-category-item {
  border: 1px solid transparent;
  background: transparent;
  color: #c8d7ec;
  border-radius: 9px;
  padding: 9px 10px;
  font-weight: 750;
}

.side-category-item em {
  color: #6f86a9;
}

.side-category-item:hover {
  background: rgba(57, 105, 190, .13);
  border-color: rgba(107, 153, 229, .18);
}

.side-category-item.active {
  background: linear-gradient(90deg, rgba(45, 104, 255, .78), rgba(45, 104, 255, .24));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(126, 174, 255, .22), 0 12px 28px -22px rgba(64, 130, 255, .8);
}

.history-rail-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

.history-rail-item {
  aspect-ratio: auto;
  min-height: 58px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #dbe8ff;
  text-align: left;
}

.history-rail-item img {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  border: 1px solid rgba(112, 157, 222, .28);
  box-shadow: 0 10px 26px -18px rgba(58, 126, 255, .7);
}

.history-rail-thumb {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  border: 1px solid rgba(112, 157, 222, .28);
  display: grid;
  place-items: center;
  background: rgba(30, 57, 94, .72);
  box-shadow: 0 10px 26px -18px rgba(58, 126, 255, .7);
}

.history-rail-item-pending {
  opacity: .96;
}

.history-rail-thumb-pending {
  background:
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, .26), transparent 58%),
    rgba(13, 29, 55, .92);
}

.history-rail-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(155, 190, 244, .24);
  border-top-color: #7dd3fc;
  animation: history-spin .85s linear infinite;
}

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

.history-rail-item span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.history-rail-item strong,
.history-rail-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-rail-item strong {
  font-size: 12px;
  font-weight: 800;
}

.history-rail-item em {
  font-style: normal;
  color: #7489a9;
  font-size: 11px;
}

.history-rail-item-pending em {
  color: #8ec5ff;
}

.history-rail-empty,
.case-empty-state {
  color: #8fa5c2;
  background: rgba(12, 29, 54, .72);
  border-color: rgba(102, 149, 220, .24);
}

.message-list {
  padding: 0;
}

.home-gallery-shell {
  max-width: none;
  height: 100%;
  gap: 0;
}

.insight-home-card {
  display: grid;
  grid-template-rows: 86px auto auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.home-gallery-head {
  display: grid;
  grid-template-columns: 230px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(114, 154, 213, .18);
}

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

.home-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f6bff, #69b8ff);
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(69, 128, 255, .9);
}

.home-gallery-head h2 {
  font-size: 22px;
  color: #f7fbff;
  letter-spacing: 0;
  white-space: nowrap;
}

.home-gallery-actions {
  gap: 8px;
  flex-wrap: nowrap;
}

.home-gallery-actions .secondary,
.home-gallery-actions .prompt-action-btn {
  min-width: 84px;
  white-space: nowrap;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 12px;
}

.secondary,
.icon-btn,
input,
select,
textarea {
  background: rgba(8, 22, 42, .78);
  color: #dce9ff;
  border-color: rgba(110, 151, 214, .26);
}

input::placeholder,
textarea::placeholder {
  color: #6f83a4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(91, 154, 255, .8);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, .16);
}

.secondary:hover,
.icon-btn:hover {
  color: #fff;
  border-color: rgba(109, 173, 255, .55);
  background: rgba(30, 60, 105, .74);
}

.primary,
.quick-generate-fab {
  background: linear-gradient(135deg, #2f6bff, #4f9cff);
  box-shadow: 0 18px 42px -18px rgba(46, 111, 255, .95);
}

.case-library-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
}

.case-search-field input {
  min-height: 44px;
  border-radius: 9px;
  background: rgba(5, 17, 34, .72);
  border-color: rgba(105, 147, 210, .28);
  color: #e8f2ff;
  padding-left: 42px;
}

.case-search-field {
  position: relative;
}

.case-search-field::before {
  content: '⌕';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #a6b7cf;
  z-index: 1;
}

.case-result-stats {
  color: #7489a8;
  font-size: 12px;
  white-space: nowrap;
}

.home-gallery-subhead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 28px 12px;
}

.home-gallery-subhead strong {
  font-size: 18px;
  color: #f7fbff;
  margin-right: 10px;
}

.home-gallery-subhead span {
  color: #8fa5c2;
}

.home-sort-strip {
  display: flex;
  align-items: center;
  gap: 4px;
}

.home-sort-strip button {
  border: 0;
  border-left: 1px solid rgba(109, 151, 211, .2);
  background: transparent;
  color: #a8b8cf;
  padding: 6px 14px;
}

.home-sort-strip button:hover {
  color: #fff;
}

.home-sort-strip button.active {
  color: #fff;
  background: rgba(47, 107, 255, .18);
}

.prompt-grid-modal {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
  padding: 0 28px 18px;
  min-height: 0;
  overflow: auto;
}

.prompt-tag {
  border-color: rgba(105, 148, 211, .18);
  background: linear-gradient(180deg, rgba(13, 31, 56, .94), rgba(7, 20, 38, .96));
  color: #cfe0f6;
  border-radius: 8px;
  box-shadow: 0 18px 44px -34px rgba(1, 9, 20, .9);
}

.prompt-tag:hover {
  background: linear-gradient(180deg, rgba(17, 40, 72, .98), rgba(8, 24, 46, .98));
  border-color: rgba(102, 170, 255, .48);
  color: #f6fbff;
  transform: translateY(-3px);
  box-shadow: 0 24px 50px -32px rgba(65, 142, 255, .65);
}

.prompt-tag-preview {
  background: #08182e;
}

.prompt-tag-preview img {
  aspect-ratio: 4 / 3;
}

.prompt-tag-title {
  color: #f2f7ff;
  font-size: 14px;
  padding: 12px 12px 5px;
}

.prompt-tag-desc {
  color: #a8b8cf;
  padding: 4px 12px 10px;
  min-height: 48px;
}

.prompt-tag-info {
  padding: 0 12px 10px;
}

.prompt-tag-category,
.prompt-tag-meta,
.prompt-tag-stat {
  background: rgba(123, 146, 180, .14);
  color: #b8c8df;
  border-radius: 5px;
  font-size: 9px;
  padding: 1px 6px;
  font-weight: 700;
}

.prompt-tag-author {
  color: #7f93b2;
}

.prompt-pagination {
  background: rgba(4, 15, 30, .78);
  border-top: 1px solid rgba(105, 148, 211, .14);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  z-index: 8;
  backdrop-filter: blur(14px);
}

.preset-category-tabs {
  border-bottom-color: rgba(105, 148, 211, .14);
}

.preset-category-tab {
  background: rgba(10, 28, 54, .84);
  color: #c7d7ef;
  border-color: rgba(105, 148, 211, .24);
  box-shadow: none;
}

.preset-category-tab:hover {
  color: #fff;
  border-color: rgba(109, 173, 255, .55);
  background: rgba(30, 60, 105, .74);
}

.pagination-btn {
  color: #cfe0ff;
  background: rgba(10, 28, 54, .84);
  border-color: rgba(108, 151, 214, .24);
}

.pagination-status {
  color: #8fa5c2;
}

.floating-actions {
  right: 54px;
  bottom: 54px;
  gap: 14px;
}

.history-fab,
.quick-generate-fab {
  border-radius: 999px;
  min-width: 86px;
  height: 54px;
  color: #fff;
  border: 1px solid rgba(140, 184, 255, .34);
  backdrop-filter: blur(18px);
}

.history-fab {
  background: rgba(8, 22, 42, .74);
  color: #dbe8ff;
}

.quick-generate-fab::after {
  content: '✦';
  margin-left: 8px;
}

.modal {
  background: rgba(1, 6, 14, .62);
}

.modal-card,
.preview-card,
.gallery-modal-card,
.generate-card,
.prompt-admin-card,
.prompt-detail-card {
  color: #eaf2ff;
  background: linear-gradient(180deg, rgba(11, 29, 53, .96), rgba(5, 18, 36, .98));
  border-color: rgba(121, 180, 255, .35);
  box-shadow: 0 0 0 1px rgba(187, 220, 255, .08), 0 24px 90px -24px rgba(35, 133, 255, .58);
}

.prompt-detail-card {
  width: min(980px, 94vw);
  border-radius: 16px;
}

.prompt-detail-head h3,
.modal-head h3 {
  color: #f8fbff;
}

.prompt-detail-kicker,
.prompt-detail-meta,
.modal-head p,
.prompt-detail-desc {
  color: #9fb2ce;
}

.prompt-detail-image,
.prompt-detail-prompt,
.prompt-admin-mirror-progress,
.prompt-admin-operation-progress {
  background: rgba(4, 15, 30, .72);
  border-color: rgba(105, 148, 211, .22);
  color: #dce9ff;
}

.toast {
  background: rgba(8, 22, 42, .96);
  color: #eaf2ff;
  border-color: rgba(118, 166, 233, .34);
}

@media (max-width: 1180px) {
  .workspace-main {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .history-rail {
    display: none !important;
  }

  .home-gallery-head {
    grid-template-columns: 220px minmax(260px, 1fr);
  }

  .home-gallery-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .prompt-grid-modal {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    padding: 0;
  }

  .workspace {
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .workspace-main {
    display: block;
    overflow: auto;
    padding-bottom: 78px;
  }

  .rail-panel,
  .home-gallery-subhead .home-sort-strip {
    display: none !important;
  }

  .insight-home-card {
    min-height: 100dvh;
    display: block;
    overflow: visible;
  }

  .home-gallery-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 14px 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 17, 34, .92);
    backdrop-filter: blur(18px);
  }

  .home-brand h2 {
    font-size: 18px;
  }

  .case-library-tools {
    grid-template-columns: 1fr;
  }

  .case-result-stats {
    display: none;
  }

  .home-gallery-actions {
    display: none;
  }

  .home-gallery-subhead {
    padding: 12px 14px 8px;
  }

  .prompt-grid-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 10px 16px;
  }

  .prompt-pagination {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 10px 0;
    border: 1px solid rgba(105, 148, 211, .24);
    border-radius: 14px;
    background: rgba(7, 20, 38, .86);
  }

  .prompt-tag-title {
    font-size: 12px;
    padding: 9px 9px 3px;
  }

  .prompt-tag-desc {
    font-size: 10px;
    line-height: 1.35;
    padding: 2px 9px 8px;
    min-height: 40px;
  }

  .prompt-tag-info {
    padding: 0 9px 8px;
  }

  .floating-actions {
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: rgba(3, 12, 26, .9);
    border-top: 1px solid rgba(105, 148, 211, .2);
    backdrop-filter: blur(18px);
  }

  .history-fab,
  .quick-generate-fab {
    width: 100%;
    height: 46px;
    min-width: 0;
  }

  .prompt-detail-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .prompt-grid-modal {
    grid-template-columns: 1fr;
  }
}

.generate-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.generate-action-row #confirmGenerateBtn {
  width: auto;
  min-width: 132px;
  padding-left: 22px;
  padding-right: 22px;
  flex: 0 0 auto;
}
.generate-action-row #switchApiKeyBtn {
  width: auto;
  min-width: 122px;
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .generate-action-row #confirmGenerateBtn,
  .generate-action-row #switchApiKeyBtn {
    flex: 1 1 140px;
  }
}

#authBaseUrl {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
#authBaseUrlHistory option {
  color: #0f172a;
}
