:root {
  --bg: #0a0a0b;
  --bg-elevated: #131315;
  --bg-panel: #18181b;
  --border: #29292d;
  --text: #f5f5f6;
  --text-muted: #96969c;
  --accent: #ff5a1f;
  --accent-hover: #e64a12;
  --accent-soft: rgba(255, 90, 31, 0.15);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: 250px;
}

:root[data-theme="light"] {
  --bg: #f5f5f6;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-muted: #6b6b72;
  --accent: #ff5a1f;
  --accent-hover: #e64a12;
  --accent-soft: rgba(255, 90, 31, 0.1);
  --success: #0d9668;
  --success-soft: rgba(13, 150, 104, 0.1);
  --error: #dc2626;
  --error-soft: rgba(220, 38, 38, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a {
  color: var(--accent);
}

h1, h2, h3 {
  margin: 0 0 1rem 0;
  font-weight: 600;
}

/* ---------------- Topbar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.logo-mark {
  color: var(--accent);
  font-size: 1.3rem;
}

.accent {
  color: var(--accent);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-user {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-block {
  width: 100%;
}

.btn-small {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text);
}

.btn-small:hover {
  border-color: var(--accent);
}

.btn-danger {
  color: var(--error);
}

.btn-danger:hover {
  border-color: var(--error);
}

/* ---------------- Flash messages ---------------- */

.flash-container {
  max-width: 1200px;
  margin: 1rem auto 0 auto;
  padding: 0 2rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.flash-error {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.flash-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* ---------------- Layout ---------------- */

.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ---------------- Auth ---------------- */

.auth-body .topbar {
  display: none;
}

.auth-body .page-main {
  max-width: 420px;
  display: flex;
  align-items: center;
  min-height: 90vh;
}

.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.auth-logo h1 {
  font-size: 1.3rem;
  margin: 0;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

.auth-form button {
  margin-top: 1.5rem;
}

/* ---------------- Form elements ---------------- */

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

.field-group {
  margin-bottom: 1.1rem;
}

.field-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.checkbox-label input {
  width: auto;
}

/* ---------------- Imagine-Seite ---------------- */

.imagine-page {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Composer - drei Zeilen wie im Referenzdesign:
   1) Modus-Tabs (groß)  2) Prompt-Zeile  3) Werkzeugleiste + Erstellen-Button */

.composer-wrapper {
  position: relative;
}

.composer-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem 1.45rem 1.2rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.mode-switch {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-elevated);
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-bottom: 1.1rem;
  width: fit-content;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow:
    0 0 16px rgba(255, 90, 31, 0.55),
    0 0 32px rgba(255, 90, 31, 0.28);
}

.mode-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.composer-prompt {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.3rem 0;
  resize: none;
  max-height: 160px;
}

.composer-prompt:focus {
  outline: none;
}

.composer-prompt::placeholder {
  color: var(--text-muted);
}

.prompt-counter {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 0.4rem;
}

.composer-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.composer-tools {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.15;
}

.tool-btn:hover {
  border-color: var(--accent);
}

.tool-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-chevron {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-tool-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.upload-tool-btn.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.upload-tool-btn.has-image {
  padding: 0;
}

.upload-tool-icon-wrap {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-tool-btn.has-image .upload-tool-icon-wrap {
  width: 100%;
  height: 100%;
}

.upload-tool-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-tool-label {
  display: none;
}

.upload-cloud-icon {
  width: 18px;
  height: 18px;
}

.more-options-dropdown {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 220px;
}

.more-options-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.more-options-label:first-child {
  margin-top: 0;
}

.more-options-dropdown select {
  font-size: 0.82rem;
  padding: 0.5rem 0.6rem;
}

.btn-generate {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.8rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 0 18px rgba(255, 90, 31, 0.45),
    0 0 36px rgba(255, 90, 31, 0.2);
}

.btn-generate:hover {
  background: var(--accent-hover);
  box-shadow:
    0 0 22px rgba(255, 90, 31, 0.6),
    0 0 44px rgba(255, 90, 31, 0.28);
}

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

.loading-indicator {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(3px);
  border-radius: var(--radius);
}

:root[data-theme="light"] .loading-indicator {
  background: rgba(245, 245, 246, 0.9);
}

.loading-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.spinner {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

/* Skeleton (wie bei Grok Imagine): platzhalter mit Shimmer-Animation in der Ziel-Ratio,
   während im Hintergrund live von der xAI-API gepollt wird. */

.skeleton-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    var(--bg-elevated) 30%,
    var(--border) 50%,
    var(--bg-elevated) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.progress-bar-wrap {
  width: 100%;
  max-width: 420px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.error-box {
  background: var(--error-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

/* Galerie */

.gallery-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem 1rem;
}

.ref-gallery-grid {
  max-width: 980px;
}

@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.gallery-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  content-visibility: auto;
  contain-intrinsic-size: 220px 280px;
}

.gallery-stack {
  position: relative;
  aspect-ratio: 3 / 4;
}

.gallery-stack-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.gallery-stack-layer.layer-1 {
  transform: translate(6px, 6px) rotate(2deg);
}

.gallery-stack-layer.layer-2 {
  transform: translate(11px, 11px) rotate(4deg);
}

.gallery-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform 0.15s ease;
}

.gallery-card:hover .gallery-thumb {
  transform: translateY(-2px);
}

.gallery-count-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.gallery-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lightbox-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.lightbox-media {
  max-width: 100%;
  max-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media-el {
  max-width: 100%;
  max-height: 62vh;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
}

.lightbox-nav {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.75rem;
}

.lightbox-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox-info {
  text-align: center;
}

.lightbox-prompt {
  font-size: 0.95rem;
  margin: 0 0 0.25rem 0;
}

.lightbox-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.lightbox-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.continue-hint {
  margin: 0.6rem 0 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.extend-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.trim-row {
  display: grid;
  grid-template-columns: 70px 1fr 56px;
  align-items: center;
  gap: 0.6rem;
}

.trim-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.trim-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.extend-panel .field-group {
  margin-bottom: 0;
}

.extend-prompt-hint {
  margin: 0 0 0.45rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

#extend-prompt {
  min-height: 5.5rem;
}

.extend-duration-group input {
  max-width: 100px;
}

.lightbox-filmstrip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  justify-content: center;
}

.filmstrip-item {
  position: relative;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: var(--bg-elevated);
}

.filmstrip-item img,
.filmstrip-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filmstrip-item.active {
  border-color: var(--accent);
}

.filmstrip-video-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.25);
}

/* ---------------- Admin ---------------- */

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stat-success .stat-value {
  color: var(--success);
}

.stat-error .stat-value {
  color: var(--error);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

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

.kv-table th, .kv-table td {
  text-align: left;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.kv-table th {
  color: var(--text-muted);
  font-weight: 500;
  width: 45%;
}

.kv-table tr:last-child th,
.kv-table tr:last-child td {
  border-bottom: none;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  white-space: nowrap;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.prompt-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 0;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-error {
  background: var(--error-soft);
  color: var(--error);
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form {
  display: inline-block;
}

.inline-create-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.8rem;
}

.inline-create-form input[type="text"],
.inline-create-form input[type="password"] {
  width: auto;
  min-width: 180px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .composer-toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-generate {
    width: 100%;
    justify-content: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .page-main {
    padding: 1.2rem;
  }

  .topbar {
    padding: 1rem;
  }
}

/* =====================================================================
   App-Shell mit Sidebar (Erstellen / Entdecken / Meine Werke / Stile /
   Modelle / Community)
   ===================================================================== */

.app-body {
  margin: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 1.2rem 0.5rem;
}

.sidebar-brand .logo-mark {
  color: var(--accent);
  font-size: 1.4rem;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.sidebar-brand-tagline {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--bg-panel);
  color: var(--text);
}

.nav-item.active {
  background: rgba(255, 90, 31, 0.18);
  color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(255, 90, 31, 0.35),
    0 0 18px rgba(255, 90, 31, 0.45),
    0 0 36px rgba(255, 90, 31, 0.22);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(255, 90, 31, 0.85));
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-promo {
  margin-top: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.promo-text {
  font-size: 1rem;
  line-height: 1.3;
  margin: 0 0 0.5rem 0;
}

.promo-text strong {
  color: var(--accent);
}

.promo-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.credits-widget {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.credits-ring {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.credits-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.credits-ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}

.credits-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.credits-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.credits-value {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Main-Bereich */

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-v2 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  padding: 1.1rem 2rem;
  background: transparent;
  position: relative;
  z-index: 20;
}

.topbar-search {
  position: relative;
  width: 340px;
  max-width: 100%;
  margin-right: auto;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 2.3rem;
  color: var(--text);
  font-size: 0.82rem;
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.icon-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg);
}

.theme-icon, .bell-icon, .chevron-icon, .lang-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 34px;
  padding: 0 0.65rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lang-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.lang-dropdown {
  min-width: 160px;
}

.dropdown-link-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.notif-inline {
  padding: 0 0.4rem 0.4rem;
}

.dropdown-wrapper {
  position: relative;
  flex-shrink: 0;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  padding: 0.5rem;
  z-index: 30;
}

.dropdown-panel-right {
  right: 0;
}

.dropdown-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.5rem;
  margin: 0;
}

.dropdown-link {
  display: block;
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.dropdown-link:hover {
  background: var(--bg-elevated);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0.2rem 0.3rem;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-chip-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.page-content {
  padding: 0.85rem 2rem 2rem;
  width: 100%;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.3rem 0;
  font-size: 1.6rem;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* Hero (Erstellen-Seite) – Foto rechts, Text links, Composer direkt darunter */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  /* Natürliche Banner-Höhe — cover, nicht strecken */
  min-height: 300px;
  height: clamp(300px, 28vw, 380px);
  margin: 0 -2rem 1.5rem -2rem;
  padding: 0 2.25rem;
  overflow: hidden;
}

.hero-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: right center;
  background-color: var(--bg);
}


.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    var(--bg) 12%,
    rgba(10, 10, 11, 0.55) 32%,
    transparent 55%
  );
  pointer-events: none;
}

:root[data-theme="light"] .hero-photo::after {
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    var(--bg) 12%,
    rgba(245, 245, 246, 0.7) 32%,
    transparent 55%
  );
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 460px;
  padding: 1.8rem 0;
}

.hero-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(2.5rem, 4.2vw, 3.6rem);
  line-height: 1.02;
  margin: 0 0 0.9rem 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

:root[data-theme="light"] .hero-title {
  color: var(--text);
}

.hero-title .accent {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 360px;
  line-height: 1.45;
}

.hero-note {
  position: absolute;
  top: 1.6rem;
  right: 2.2rem;
  z-index: 2;
  font-family: "Caveat", cursive;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.12;
  color: #fff;
  text-align: right;
  transform: rotate(-5deg);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.hero-note-underline {
  width: 90px;
  height: 14px;
  display: block;
  margin: 2px 0 0 auto;
  stroke: var(--accent);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

@media (max-width: 900px) {
  .hero {
    aspect-ratio: auto;
    max-height: none;
    min-height: 220px;
  }

  .hero-note {
    display: none;
  }
}

/* Tool-Dropdowns (Stil / Charaktere / Kamera / Szenen / Weitere Optionen) */

.tool-dropdown {
  left: 0;
  right: auto;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
}

.scene-dropdown {
  min-width: 300px;
  max-width: min(420px, 92vw);
  max-height: 380px;
}

.dropdown-group-label {
  margin: 0.55rem 0 0.25rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dropdown-group-label:first-child {
  margin-top: 0.15rem;
}

.scene-option-label {
  display: block;
  line-height: 1.35;
}

.dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
}

.dropdown-option:hover {
  background: var(--bg-elevated);
}

.dropdown-option-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.character-option-name {
  flex: 1;
}

.character-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem;
}

.character-delete-btn:hover {
  color: var(--error);
}

.character-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid var(--border);
  margin-top: 0.4rem;
  padding-top: 0.6rem;
}

.character-form input {
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
}

/* Vorschläge-Chips */

.suggestions-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  flex-wrap: nowrap;
}

.suggestions-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.suggestions-chips {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.suggestion-chip {
  flex-shrink: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

:root[data-theme="light"] .suggestion-chip {
  background: var(--bg-elevated);
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.shuffle-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
}

.shuffle-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.shuffle-btn.spinning .tool-icon {
  animation: spin 0.6s linear;
}

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

/* Galerie-Header mit Tabs */

.gallery-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.gallery-header h2 {
  margin: 0;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.gallery-tabs {
  display: flex;
  gap: 1.2rem;
  flex: 1;
}

.gallery-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.gallery-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.gallery-view-all {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}

.gallery-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.gallery-fav-btn,
.gallery-share-btn {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: background 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(2px);
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.gallery-fav-btn {
  top: 0.55rem;
  right: 0.55rem;
}

.gallery-share-btn {
  right: 0.55rem;
  bottom: 0.55rem;
}

.gallery-fav-btn:hover,
.gallery-share-btn:hover {
  background: rgba(0, 0, 0, 0.55);
  transform: scale(1.05);
}

.gallery-fav-btn.active,
.gallery-share-btn.active {
  color: #fff;
  background: var(--accent);
}

.gallery-action-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-fav-btn.active .gallery-action-icon {
  fill: currentColor;
}

.lightbox-actions .btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Content-Grids (Entdecken / Stile / Community) */

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}

.content-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: block;
  cursor: pointer;
}

.content-card:hover {
  border-color: var(--accent);
}

.content-card-static {
  cursor: default;
}

.content-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
}

.content-card-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent);
  background: var(--bg-elevated);
}

.content-card-body {
  padding: 0.9rem 1rem;
}

.content-card-body h3 {
  margin: 0 0 0.3rem 0;
  font-size: 0.92rem;
}

.content-card-body p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.content-card-meta {
  margin-top: 0.4rem !important;
  font-size: 0.72rem !important;
  -webkit-line-clamp: 1 !important;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

/* Modelle-Seite */

.models-section {
  margin-bottom: 2rem;
}

.models-section h2 {
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
}

.model-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.model-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.model-card h3 {
  margin: 0 0 0.4rem 0;
  font-size: 0.9rem;
  font-family: monospace;
  color: var(--accent);
}

.model-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Admin-Ergänzungen */

.credits-form {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.credits-input {
  width: 56px;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
}

.admin-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
}

/* Responsive: Sidebar */

@media (max-width: 1000px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sidebar-brand {
    padding: 0.4rem 0.5rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 0;
  }

  .sidebar-promo,
  .credits-widget {
    display: none;
  }

  .topbar-v2 {
    padding: 1rem;
    flex-wrap: wrap;
  }

  .page-content {
    padding: 1.2rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }
}


/* -------- Verbesserungen: Fokus, Light-Theme, Mobile, Chips, Kosten -------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-generate:focus-visible,
.tool-btn:focus-visible,
.nav-item:focus-visible,
.mode-btn:focus-visible,
.suggestion-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-generate {
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.15;
  padding: 0.65rem 1.6rem;
}

.btn-generate-label {
  display: block;
}

.btn-generate-cost {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.02em;
}

.scene-tool-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.suggestion-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  max-width: 240px;
  padding: 0.45rem 0.95rem;
}

.suggestion-chip-cat {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-chip-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.error-box {
  border-left: 3px solid var(--error);
  background: var(--error-soft);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* Light-Theme Feinschliff */
:root[data-theme="light"] .composer-card {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .nav-item.active {
  background: rgba(255, 90, 31, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 90, 31, 0.28),
    0 0 14px rgba(255, 90, 31, 0.22);
}

:root[data-theme="light"] .mode-btn.active,
:root[data-theme="light"] .btn-generate {
  box-shadow:
    0 0 14px rgba(255, 90, 31, 0.35),
    0 4px 14px rgba(255, 90, 31, 0.18);
}

:root[data-theme="light"] .suggestion-chip {
  background: #fff;
  border-color: var(--border);
}

:root[data-theme="light"] .hero-note {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] .text-muted,
:root[data-theme="light"] .hero-subtitle,
:root[data-theme="light"] .hero-eyebrow,
:root[data-theme="light"] .credits-label,
:root[data-theme="light"] .suggestions-label {
  color: #5c5c66;
}

/* Mobile Sidebar Drawer */
.mobile-menu-btn,
.sidebar-close-btn {
  display: none;
}

.menu-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

@media (max-width: 1000px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100vh;
    z-index: 80;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-y: auto;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
    margin-bottom: 1rem;
  }

  .sidebar-promo,
  .credits-widget {
    display: flex;
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.45);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .gallery-grid,
  .ref-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .hero {
    margin: 0 -1.2rem 1.1rem -1.2rem;
    padding: 0 1.2rem;
    height: 220px;
    min-height: 200px;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .composer-tools {
    gap: 0.45rem;
  }

  .tool-btn span[data-i18n="tool.more"],
  .tool-btn .tool-chevron {
    /* keep more options readable */
  }
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .btn-generate {
    width: 100%;
  }

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

  .topbar-search {
    width: 100%;
    order: 3;
    margin-right: 0;
  }
}


/* Video Startframe / Reference / Endframe */
.video-frames-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.video-frame-slot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.video-frame-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.video-frame-hint {
  margin: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.video-frame-btn {
  align-self: flex-start;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.video-frame-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.video-frame-preview {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.video-frame-preview.is-empty {
  border-style: dashed;
}

.video-frame-preview img,
.video-frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-frame-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.video-frame-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-frame-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

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