/* ============================================================
   Flux Prompt Studio — Vanessa's Personal Theme
   Palette:  hot pink + soft pastels + plum
   Font:     DM Sans (warm, modern, friendly)
   Vibe:     fun, beautiful, modern, a touch playful
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Fraunces:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* ── Custom properties ──────────────────────────────────────── */
:root {
  /* ── Primary brand: vibrant pink ─────────────────────────── */
  --color-pink:          #EC4899;     /* primary brand */
  --color-pink-dark:     #DB2777;
  --color-pink-light:    #FCE7F3;     /* lightest tint */
  --color-pink-muted:    #F9A8D4;

  /* ── Secondary accents: pastels for variety ──────────────── */
  --color-purple:        #A855F7;     /* heading gradient partner */
  --color-purple-light:  #F3E8FF;
  --color-lavender:      #C4B5FD;     /* soft pastel pop */
  --color-mint:          #6EE7B7;     /* success / fresh */
  --color-peach:         #FDBA74;     /* warmth / highlights */

  /* ── Surface & background (pink-tinted creams) ──────────── */
  --color-cream:         #FFF7FA;     /* page bg, soft blush */
  --color-cream-card:    #FFFFFF;     /* card surface */
  --color-cream-dark:    #FBE9EF;     /* hover / alt surface */

  /* ── Text (warm near-black) ─────────────────────────────── */
  --color-ink:           #2A1F26;
  --color-ink-subtle:    #7C6770;

  /* ── Borders ────────────────────────────────────────────── */
  --color-border:        #F5D6E2;     /* gentle pink border */
  --color-border-light:  #FAE8EE;

  /* ── Legacy slots (kept so old class names resolve) ─────── */
  /* The original Salvia variable names map to the new palette */
  --color-sage:          var(--color-pink);
  --color-sage-dark:     var(--color-pink-dark);
  --color-sage-light:    var(--color-pink-muted);
  --color-sage-muted:    var(--color-pink-muted);
  --color-terracotta:    #F87171;     /* destructive */
  --color-terra-light:   #FCA5A5;
  --color-gold:          var(--color-peach);
  --color-gold-light:    #FED7AA;

  /* ── Sidebar (deep plum) ────────────────────────────────── */
  --sidebar-bg:          #2D1A2E;
  --sidebar-text:        #E8D9E1;
  --sidebar-accent:      #FFFFFF;
  --sidebar-hover:       rgba(255, 255, 255, 0.07);
  --sidebar-active-bg:   rgba(236, 72, 153, 0.20);
  --sidebar-width:       234px;

  /* ── Right panel ────────────────────────────────────────── */
  --panel-width:         360px;

  /* ── Typography ─────────────────────────────────────────── */
  --font-heading:        'DM Sans', system-ui, -apple-system, sans-serif;
  --font-body:           'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display:        'Fraunces', 'DM Sans', Georgia, serif;  /* fun italic for the H1 */

  /* ── Radii (more generous = more playful) ───────────────── */
  --radius-card:         16px;
  --radius-input:        12px;
  --radius-btn:          12px;
  --radius-pill:         999px;

  /* ── Shadows (soft pink tint, not pure gray) ────────────── */
  --shadow-card:         0 1px 2px rgba(236, 72, 153, 0.05),
                         0 4px 12px rgba(236, 72, 153, 0.04);
  --shadow-card-hover:   0 4px 14px rgba(236, 72, 153, 0.10),
                         0 8px 24px rgba(236, 72, 153, 0.06);
  --shadow-modal:        0 24px 64px rgba(45, 26, 46, 0.18),
                         0 8px 24px rgba(45, 26, 46, 0.10);

  /* ── Transitions ────────────────────────────────────────── */
  --ease:                cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--color-cream);
  color: var(--color-ink);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ── App shell ──────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--panel-width);
  grid-template-rows: 1fr;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-icon {
  font-size: 18px;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4),
              0 2px 4px rgba(168, 85, 247, 0.2);
}

.sidebar-logo .logo-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sidebar-accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
  display: block;
}

.sidebar-logo .logo-sub {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-pink-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  margin: 2px 10px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--sidebar-text);
  border: none;
  background: none;
  width: calc(100% - 20px);
  text-align: left;
  position: relative;
  font-family: var(--font-body);
  letter-spacing: -0.005em;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-accent);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 50%;
  background: var(--color-pink);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.5);
}

.nav-item .nav-icon { font-size: 15px; flex-shrink: 0; opacity: 0.95; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.64rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-item.active .nav-badge {
  background: rgba(236, 72, 153, 0.3);
  color: white;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.usage-bar-label {
  font-size: 0.7rem;
  color: rgba(212,232,216,0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-bar-label span { color: var(--sidebar-text); }

.usage-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-sage-light), var(--color-gold));
  border-radius: var(--radius-pill);
  transition: width 0.5s var(--ease);
}

.usage-note {
  font-size: 0.67rem;
  color: rgba(212,232,216,0.4);
  margin-top: 5px;
}

/* ── Main area ───────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--color-cream);
}

/* Main header */
.main-header {
  padding: 20px 28px 0;
  flex-shrink: 0;
}

.main-header h1 {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.main-header h1 em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(115deg, var(--color-pink) 0%, var(--color-purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 4px;  /* italic glyph cropping fix */
}

.main-header .header-sub {
  font-size: 0.8rem;
  color: var(--color-ink-subtle);
  margin-top: 6px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Main scroll area */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--color-cream-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-pink-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon { font-size: 14px; }

/* Helpful note shown under a card title */
.card-helper {
  font-size:    0.78rem;
  line-height:  1.5;
  color:        var(--color-ink-subtle);
  margin:       -6px 0 14px 0;
  padding:      10px 12px;
  background:   rgba(236, 72, 153, 0.05);
  border-left:  3px solid var(--color-pink-muted);
  border-radius: 0 8px 8px 0;
}

.card-helper strong {
  color:       var(--color-pink-dark);
  font-weight: 600;
}

/* ── Prompt area ─────────────────────────────────────────────── */
.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.prompt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

textarea#prompt-input {
  width: 100%;
  height: 160px;
  padding: 14px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-cream);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  outline: none;
}

textarea#prompt-input:focus {
  border-color: var(--color-pink);
  background: white;
  box-shadow: 0 0 0 4px var(--color-pink-light);
}

textarea#prompt-input::placeholder { color: var(--color-ink-subtle); opacity: 0.6; }

.prompt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.char-count {
  font-size: 0.72rem;
  color: var(--color-ink-subtle);
}

.char-count.warning { color: var(--color-terracotta); }

/* ── Style pills ─────────────────────────────────────────────── */
.style-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.style-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-cream-card);
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--color-ink);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.style-pill:hover {
  border-color: var(--color-pink-muted);
  color: var(--color-pink-dark);
  background: var(--color-pink-light);
  transform: translateY(-1px);
}

.style-pill.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.35),
              0 1px 2px rgba(168, 85, 247, 0.2);
  transform: translateY(-1px);
}

.style-pill .pill-emoji { font-size: 13px; }

/* ── Controls row ────────────────────────────────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* Toggle switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-ink);
  user-select: none;
}

.toggle-input { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 0.2s var(--ease);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(16px);
}

.toggle-text { font-weight: 400; }

/* Size selector */
.size-select {
  padding: 7px 28px 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-cream);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-ink);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23585858' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.size-select:focus { border-color: var(--color-pink); box-shadow: 0 0 0 4px var(--color-pink-light); }

.controls-divider {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* ── Generate button ─────────────────────────────────────────── */
.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.4),
              0 2px 4px rgba(168, 85, 247, 0.2);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 55%);
  pointer-events: none;
}

.btn-generate:hover:not(:disabled) {
  box-shadow: 0 10px 28px rgba(236, 72, 153, 0.5),
              0 4px 8px rgba(168, 85, 247, 0.3);
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-generate:active:not(:disabled) { transform: translateY(0); filter: brightness(0.97); }

.btn-generate:disabled {
  background: var(--color-cream-dark);
  color: var(--color-ink-subtle);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-generate .btn-icon { font-size: 18px; }

/* ── Loading state ───────────────────────────────────────────── */
.loading-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.loading-state.visible { display: flex; }

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-sage-muted);
  border-top-color: var(--color-sage);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.85rem;
  color: var(--color-ink-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

.loading-timer {
  font-weight: 500;
  color: var(--color-sage);
  min-width: 3ch;
  text-align: right;
}

/* ── Error message ───────────────────────────────────────────── */
.error-message {
  display: none;
  padding: 12px 14px;
  background: rgba(194, 123, 90, 0.08);
  border: 1px solid rgba(194, 123, 90, 0.3);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  color: var(--color-terracotta);
  line-height: 1.5;
}

.error-message.visible { display: block; }

/* ── Buttons (secondary) ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border);
  background: var(--color-cream-card);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-ink);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
  letter-spacing: -0.005em;
}

.btn:hover {
  border-color: var(--color-pink-muted);
  color: var(--color-pink-dark);
  background: var(--color-pink-light);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.05);
  color: white;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--color-gold);
  color: white;
  border-color: var(--color-gold);
}

.btn-gold:hover {
  background: #b8933d;
  border-color: #b8933d;
  color: white;
}

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

/* ── Right panel — image preview ─────────────────────────────── */
.right-panel {
  background: var(--color-cream-card);
  border-left: 1px solid var(--color-border-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-header {
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.panel-header h2 {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-pink-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Image display area */
.image-frame {
  aspect-ratio: 1 / 1;
  background: var(--color-cream-dark);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.image-frame img.visible { display: block; }

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--color-border);
  text-align: center;
  padding: 20px;
}

.image-placeholder .placeholder-icon { font-size: 36px; opacity: 0.4; }
.image-placeholder p { font-size: 0.78rem; color: var(--color-ink-subtle); opacity: 0.6; }

.image-frame.loading .image-placeholder {
  display: none;
}

.image-loading-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.image-frame.loading .image-loading-overlay { display: flex; }

/* Image actions */
.image-actions {
  display: flex;
  gap: 8px;
}

.image-actions .btn { flex: 1; justify-content: center; }

/* Image metadata */
.image-meta {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.image-meta.visible { display: flex; }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  padding: 5px 0;
  border-bottom: 1px solid var(--color-border-light);
}

.meta-row:last-child { border-bottom: none; }
.meta-label { color: var(--color-ink-subtle); }
.meta-value { font-weight: 500; color: var(--color-ink); }
.meta-value.positive { color: var(--color-sage); }
.meta-value.warning { color: var(--color-terracotta); }

/* ── Library modal ───────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,30,30,0.45);
  backdrop-filter: blur(3px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.visible { display: flex; }

.modal {
  background: var(--color-cream-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.015em;
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-ink-subtle);
  font-size: 20px;
  border-radius: 6px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.modal-close:hover { background: var(--color-cream-dark); color: var(--color-ink); }

.modal-controls {
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.modal-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--color-cream);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.modal-search:focus { border-color: var(--color-sage); }

.category-filter {
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-cream);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-ink);
  cursor: pointer;
  outline: none;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Prompt cards in library modal */
.prompt-card {
  padding: 14px 16px;
  background: var(--color-cream);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

/* Custom (user-saved) prompts get a subtle pink hint */
.prompt-card.custom {
  border-color: var(--color-pink-muted);
  background: linear-gradient(180deg, rgba(252, 231, 243, 0.35) 0%, var(--color-cream) 100%);
}

/* Pencil edit button shown only for custom prompts (on hover) */
.prompt-card-edit-btn {
  position:        absolute;
  top:             10px;
  right:           10px;
  width:           28px;
  height:          28px;
  border-radius:   8px;
  border:          1px solid transparent;
  background:      rgba(255, 255, 255, 0.7);
  color:           var(--color-pink-dark);
  cursor:          pointer;
  font-size:       0.85rem;
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  transition:      all 0.15s var(--ease);
}

.prompt-card.custom:hover .prompt-card-edit-btn {
  opacity: 1;
}

.prompt-card-edit-btn:hover {
  background:   var(--color-pink);
  color:        white;
  border-color: var(--color-pink);
}

.prompt-card:hover {
  border-color: var(--color-sage-muted);
  background: rgba(74,120,80,0.03);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.prompt-card-name {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--color-ink);
}

.prompt-card-desc {
  font-size: 0.78rem;
  color: var(--color-ink-subtle);
  line-height: 1.4;
}

.prompt-card-preview {
  font-size: 0.72rem;
  color: var(--color-ink-subtle);
  opacity: 0.65;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.prompt-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-cream-dark);
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  color: var(--color-ink-subtle);
}

.prompt-card-category {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-sage);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.modal-empty {
  text-align: center;
  padding: 32px;
  color: var(--color-ink-subtle);
  font-size: 0.85rem;
}

/* ── Settings modal ──────────────────────────────────────────── */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.settings-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-ink);
}

.settings-group input[type="text"],
.settings-group input[type="url"] {
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--color-cream);
  color: var(--color-ink);
  outline: none;
  width: 100%;
  transition: border-color 0.2s var(--ease);
}

.settings-group input:focus { border-color: var(--color-sage); }

.settings-hint {
  font-size: 0.73rem;
  color: var(--color-ink-subtle);
  line-height: 1.5;
}

.settings-hint a {
  color: var(--color-sage);
  text-decoration: none;
}

.settings-hint a:hover { text-decoration: underline; }

.settings-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.connection-status {
  display: none;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-input);
  margin-top: 8px;
}

.connection-status.ok {
  display: block;
  background: rgba(74,120,80,0.1);
  color: var(--color-sage-dark);
  border: 1px solid rgba(74,120,80,0.2);
}

.connection-status.error {
  display: block;
  background: rgba(194,123,90,0.08);
  color: var(--color-terracotta);
  border: 1px solid rgba(194,123,90,0.25);
}

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-sage-muted); }

/* ── Utility ─────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .sidebar {
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-logo { padding: 12px 16px; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; }
  .nav-item { padding: 12px 14px; }
  .nav-item .nav-badge, .sidebar-footer { display: none; }
  .sidebar-logo .logo-sub { display: none; }

  .right-panel {
    border-left: none;
    border-top: 1px solid var(--color-border-light);
    height: auto;
  }

  :root { --panel-width: 100%; }
}

/* ── Custom style pills ─────────────────────────────────────── */
.style-pill.custom {
  position: relative;
  border-color: var(--color-gold-light);
  padding-right: 30px;  /* space for the edit icon */
}

.style-pill.custom.active {
  border-color: var(--color-sage);
}

.pill-edit-btn {
  position:        absolute;
  right:           6px;
  top:             50%;
  transform:       translateY(-50%);
  width:           20px;
  height:          20px;
  border-radius:   50%;
  background:      rgba(255, 255, 255, 0.7);
  color:           var(--color-ink-subtle);
  font-size:       0.7rem;
  display:         flex;
  align-items:     center;
  justify-content: center;
  cursor:          pointer;
  opacity:         0.6;
  transition:      all 0.15s var(--ease);
}

.style-pill.custom:hover .pill-edit-btn {
  opacity: 1;
}

.pill-edit-btn:hover {
  background: var(--color-sage);
  color:      white;
  transform:  translateY(-50%) scale(1.1);
}

.style-pill.add-custom-pill {
  border-style: dashed;
  border-color: var(--color-border);
  color:        var(--color-ink-subtle);
  background:   transparent;
}

.style-pill.add-custom-pill:hover {
  border-color: var(--color-sage);
  border-style: solid;
  color:        var(--color-sage-dark);
  background:   rgba(74, 120, 80, 0.04);
}

.style-pill.add-custom-pill .pill-emoji {
  font-weight: 600;
  font-size:   1rem;
  color:       var(--color-sage);
}

/* ── Model selector ─────────────────────────────────────────── */
.model-row {
  display:        flex;
  align-items:    center;
  gap:            12px;
  margin-bottom:  14px;
  flex-wrap:      wrap;
}

.model-row-label {
  color:          var(--color-ink-subtle);
  font-size:      0.8rem;
  font-weight:    500;
  letter-spacing: 0.02em;
}

.model-pills {
  display: flex;
  gap:     8px;
  flex:    1;
  flex-wrap: wrap;
}

.model-pill {
  display:         flex;
  flex-direction:  column;
  align-items:     flex-start;
  gap:             2px;
  padding:         8px 14px;
  background:      var(--color-cream-card);
  border:          1.5px solid var(--color-border-light);
  border-radius:   var(--radius-input);
  font-family:     var(--font-body);
  font-size:       0.82rem;
  color:           var(--color-ink);
  cursor:          pointer;
  transition:      all 0.18s var(--ease);
  text-align:      left;
  min-width:       150px;
}

.model-pill:hover {
  border-color: var(--color-sage-muted);
  background:   white;
}

.model-pill.active {
  background:   rgba(74, 120, 80, 0.08);
  border-color: var(--color-sage);
  color:        var(--color-sage-dark);
}

.model-pill-icon {
  font-size: 1rem;
  margin-right: 4px;
}

.model-pill-name {
  font-weight: 500;
  display:     flex;
  align-items: center;
  gap:         4px;
}

.model-pill-tag {
  font-size: 0.65rem;
  color:     var(--color-ink-subtle);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity:   0.8;
}

.model-pill.active .model-pill-tag {
  color:   var(--color-sage);
  opacity: 1;
}

/* Disabled size options when klein is selected */
.size-select option:disabled {
  color: var(--color-ink-subtle);
  opacity: 0.5;
}

/* ── Workspace pill (sidebar) ───────────────────────────────── */
.workspace-pill {
  display:        flex;
  align-items:    center;
  gap:            8px;
  margin:         8px 14px 12px;
  padding:        9px 12px;
  background:     rgba(255, 255, 255, 0.05);
  border:         1px solid rgba(255, 255, 255, 0.08);
  border-radius:  10px;
  cursor:         pointer;
  font-family:    var(--font-body);
  color:          var(--sidebar-text);
  transition:     all 0.18s var(--ease);
  text-align:     left;
  width:          calc(100% - 28px);
}

.workspace-pill:hover {
  background:    rgba(236, 72, 153, 0.15);
  border-color:  rgba(236, 72, 153, 0.35);
}

.workspace-pill-label {
  font-size:      0.6rem;
  font-weight:    700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color:          var(--color-pink-muted);
  display:        block;
}

.workspace-pill-name {
  font-size:    0.85rem;
  font-weight:  600;
  color:        white;
  margin-top:   1px;
  display:      block;
  white-space:  nowrap;
  overflow:     hidden;
  text-overflow: ellipsis;
  max-width:    140px;
  flex:         1;
}

.workspace-pill-chevron {
  font-size:    0.85rem;
  color:        var(--color-pink-muted);
  margin-left:  auto;
  opacity:      0.7;
  transform:    rotate(180deg);
}

/* The label and name are stacked, so override flex for them */
.workspace-pill {
  flex-wrap: wrap;
}
.workspace-pill > .workspace-pill-label,
.workspace-pill > .workspace-pill-name {
  flex-basis: 100%;
}
.workspace-pill > .workspace-pill-chevron {
  position: absolute;
}
.workspace-pill {
  position: relative;
  padding-right: 28px;
}

/* ── Mobile workspace bar (hidden on desktop, shown on small screens) ─── */
.mobile-workspace-bar {
  display:        none;   /* hidden by default; shown in the 640px breakpoint */
}

/* ── Workspace list (in Settings modal) ─────────────────────── */
.settings-section-title {
  font-size:      0.78rem;
  font-weight:    700;
  color:          var(--color-pink-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom:  12px;
  display:        flex;
  align-items:    baseline;
  gap:            8px;
  flex-wrap:      wrap;
}

.settings-section-hint {
  font-size:      0.7rem;
  font-weight:    400;
  color:          var(--color-ink-subtle);
  text-transform: none;
  letter-spacing: 0;
}

.workspace-list {
  display:        flex;
  flex-direction: column;
  gap:            8px;
  margin-bottom:  14px;
}

.workspace-item {
  display:        flex;
  align-items:    center;
  gap:            12px;
  padding:        12px 14px;
  background:     var(--color-cream);
  border:         1.5px solid var(--color-border-light);
  border-radius:  var(--radius-card);
  cursor:         pointer;
  transition:     all 0.18s var(--ease);
}

.workspace-item:hover {
  border-color: var(--color-pink-muted);
  background:   var(--color-pink-light);
}

.workspace-item.active {
  border-color: var(--color-pink);
  background:   linear-gradient(135deg, rgba(236, 72, 153, 0.08) 0%, rgba(168, 85, 247, 0.06) 100%);
  box-shadow:   0 2px 8px rgba(236, 72, 153, 0.12);
}

.workspace-radio {
  width:           18px;
  height:          18px;
  border-radius:   50%;
  border:          2px solid var(--color-border);
  flex-shrink:     0;
  transition:      all 0.18s var(--ease);
  position:        relative;
}

.workspace-item.active .workspace-radio {
  border-color: var(--color-pink);
  background:   linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
}

.workspace-item.active .workspace-radio::after {
  content:    '';
  position:   absolute;
  inset:      3px;
  background: white;
  border-radius: 50%;
}

.workspace-info {
  flex: 1;
  min-width: 0;
}

.workspace-name {
  font-size:    0.92rem;
  font-weight:  600;
  color:        var(--color-ink);
  margin-bottom: 2px;
  display:      flex;
  align-items:  center;
  gap:          6px;
}

.workspace-active-badge {
  font-size:     0.6rem;
  font-weight:   700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color:         white;
  background:    linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
  padding:       1px 7px;
  border-radius: var(--radius-pill);
}

.workspace-url {
  font-size:     0.74rem;
  color:         var(--color-ink-subtle);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  font-family:   ui-monospace, 'SF Mono', monospace;
}

.workspace-edit-btn {
  width:           30px;
  height:          30px;
  border-radius:   8px;
  border:          1px solid transparent;
  background:      transparent;
  color:           var(--color-ink-subtle);
  cursor:          pointer;
  font-size:       0.85rem;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      all 0.15s var(--ease);
  flex-shrink:     0;
}

.workspace-edit-btn:hover {
  background:   white;
  border-color: var(--color-border);
  color:        var(--color-pink-dark);
}

.btn-add-workspace {
  width:        100%;
  padding:      11px;
  border-style: dashed !important;
  justify-content: center;
  color:        var(--color-pink-dark) !important;
  border-color: var(--color-pink-muted) !important;
}

.btn-add-workspace:hover {
  background:   var(--color-pink-light) !important;
  border-style: solid !important;
}

.workspace-empty {
  text-align: center;
  padding:    20px 16px;
  color:      var(--color-ink-subtle);
  font-size:  0.85rem;
  background: var(--color-cream);
  border:     1.5px dashed var(--color-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
}

.settings-help {
  margin-top: 14px;
  font-size:  0.82rem;
  color:      var(--color-ink-subtle);
}

.settings-help summary {
  cursor: pointer;
  padding: 6px 0;
  color: var(--color-pink-dark);
  font-weight: 500;
}

.settings-help summary:hover { color: var(--color-pink); }

/* ── History modal ──────────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 4px 4px 16px;
}

.history-card {
  background:    var(--color-cream-card);
  border:        1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  overflow:      hidden;
  cursor:        pointer;
  transition:    transform 0.18s var(--ease),
                 box-shadow 0.18s var(--ease),
                 border-color 0.18s var(--ease);
  display:       flex;
  flex-direction: column;
}

.history-card:hover {
  transform:    translateY(-2px);
  border-color: var(--color-sage-muted);
  box-shadow:   var(--shadow-card-hover);
}

.history-thumb {
  aspect-ratio:        1 / 1;
  background-size:     cover;
  background-position: center;
  background-color:    var(--color-cream-dark);
  position:            relative;
  border-bottom:       1px solid var(--color-border-light);
}

.history-card-actions {
  position:   absolute;
  top:        8px;
  right:      8px;
  display:    flex;
  gap:        6px;
  opacity:    0;
  transition: opacity 0.15s var(--ease);
}

.history-card:hover .history-card-actions,
.history-card:focus-within .history-card-actions {
  opacity: 1;
}

.history-action-btn {
  width:           30px;
  height:          30px;
  border-radius:   50%;
  border:          none;
  background:      rgba(255, 255, 255, 0.94);
  color:           var(--color-ink);
  font-size:       0.95rem;
  font-family:     var(--font-body);
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  box-shadow:      0 2px 6px rgba(0, 0, 0, 0.18);
  transition:      background 0.15s var(--ease),
                   color 0.15s var(--ease),
                   transform 0.15s var(--ease);
}

.history-action-btn:hover {
  background: var(--color-sage);
  color:      white;
  transform:  scale(1.08);
}

.history-action-btn[data-action="delete"]:hover {
  background: var(--color-terracotta);
  color:      white;
}

.history-card-body {
  padding:        10px 12px 12px;
  display:        flex;
  flex-direction: column;
  gap:            6px;
  flex:           1;
}

.history-card-meta {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  gap:             8px;
  font-size:       0.7rem;
}

.history-style-badge {
  background:     rgba(74, 120, 80, 0.10);
  color:          var(--color-sage-dark);
  padding:        2px 9px;
  border-radius:  var(--radius-pill);
  font-weight:    500;
  letter-spacing: 0.02em;
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
  max-width:      60%;
}

.history-date {
  color:       var(--color-ink-subtle);
  font-size:   0.68rem;
  white-space: nowrap;
  opacity:     0.8;
}

.history-card-prompt {
  font-size:           0.78rem;
  line-height:         1.45;
  color:               var(--color-ink);
  display:             -webkit-box;
  -webkit-line-clamp:  3;
  -webkit-box-orient:  vertical;
  overflow:            hidden;
}

.history-card-tech {
  display:         flex;
  justify-content: space-between;
  margin-top:      auto;
  padding-top:     6px;
  font-size:       0.66rem;
  color:           var(--color-ink-subtle);
  letter-spacing:  0.04em;
  text-transform:  uppercase;
  opacity:         0.75;
  border-top:      1px dashed var(--color-border-light);
}

/* Export and Clear buttons in history controls */
#export-history-btn {
  margin-left: auto;
  color:       var(--color-sage-dark);
  border-color: rgba(74, 120, 80, 0.25);
}

#export-history-btn:hover {
  background:   rgba(74, 120, 80, 0.08);
  border-color: var(--color-sage);
}

#clear-history-btn {
  color:       var(--color-terracotta);
  border-color: rgba(194, 123, 90, 0.3);
}

#clear-history-btn:hover {
  background:   rgba(194, 123, 90, 0.08);
  border-color: var(--color-terracotta);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE OPTIMISATION  (max-width: 640px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Prevent horizontal overflow on the whole page */
  body, .app { overflow-x: hidden; }

  /* ── App shell ── */
  /* On mobile the preview panel is moved ABOVE the main column so the
     generated image is the first thing visible, at full screen width.
     Order: sidebar · workspace-bar · preview · main  */
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;  /* iOS Safari: excludes the address-bar area so content isn't cut off */
  }
  .app > .sidebar              { grid-row: 1; }
  .app > .mobile-workspace-bar { grid-row: 2; }
  .app > .right-panel          { grid-row: 3; }  /* preview ABOVE the prompt */
  .app > .main                 { grid-row: 4; }

  /* ── Sidebar → horizontal tab bar at top ── */
  .sidebar {
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-logo    { display: none; }
  .sidebar-footer  { display: none; }
  .workspace-pill  { display: none; }

  /* Mobile workspace bar — appears below the nav tab bar */
  .mobile-workspace-bar {
    display:         flex;
    align-items:     center;
    gap:             10px;
    padding:         9px 14px;
    background:      var(--color-pink-light);
    border-bottom:   1px solid var(--color-pink-muted);
    position:        sticky;
    top:             0;
    z-index:         50;
  }
  .mobile-workspace-label {
    font-size:       0.72rem;
    font-weight:     600;
    color:           var(--color-pink-dark);
    white-space:     nowrap;
    letter-spacing:  0.04em;
  }
  .mobile-workspace-select {
    flex:            1 1 0;
    min-width:       0;
    font-size:       0.82rem;
    font-family:     var(--font-body);
    color:           var(--color-ink);
    background:      white;
    border:          1px solid var(--color-pink-muted);
    border-radius:   8px;
    padding:         7px 10px;
    appearance:      auto;
    cursor:          pointer;
  }
  .mobile-workspace-settings-btn {
    background:      transparent;
    border:          none;
    cursor:          pointer;
    font-size:       1.1rem;
    padding:         4px 6px;
    border-radius:   8px;
    line-height:     1;
  }
  .mobile-workspace-settings-btn:active {
    background:      var(--color-pink-muted);
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    padding: 0;
    width: 100%;
  }
  .nav-item {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.72rem;
    text-align: center;
    flex-direction: column;
    gap: 3px;
    min-height: 56px;
  }
  .nav-icon { font-size: 18px; }
  .nav-item .nav-badge { display: none; }

  /* ── Main scroll area ── */
  /* Bottom padding clears the Generate button from iOS Safari's bottom
     address bar. env(safe-area-inset-bottom) handles the iPhone home-indicator
     area; the extra 80px keeps the button comfortably above the URL bar. */
  .main-scroll {
    padding: 12px 12px calc(150px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
    overflow-y: auto;
    height: auto;
  }

  /* ── Cards ── */
  .card { padding: 14px 12px; }

  /* ── Prompt header: stack title + buttons vertically ── */
  .prompt-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }
  .prompt-actions {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .prompt-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.78rem;
    padding: 8px 10px;
    min-height: 40px;
    justify-content: center;
    white-space: nowrap;
  }

  /* ── Textarea ── */
  /* font-size MUST be ≥16px on iOS to stop Safari auto-zooming on focus.
     When it auto-zooms, the sticky workspace bar gets shoved off-screen
     and is hard to recover without a precise pinch-out. */
  textarea#prompt-input {
    height: 120px;
    font-size: 16px;
  }

  /* Same rule for every other form control inside the app — any of them
     dipping under 16px would trigger the same iOS auto-zoom. */
  input[type="text"],
  input[type="url"],
  input[type="search"],
  input[type="email"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }

  /* ── Model pills: wrap if needed ── */
  .model-pills {
    flex-wrap: wrap;
    gap: 6px;
  }
  .model-pill {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    min-height: 44px;
  }

  /* ── Style pills: smaller on mobile ── */
  .style-pill {
    font-size: 0.74rem;
    padding: 6px 10px;
    min-height: 36px;
  }

  /* ── Generate button: full width ── */
  .btn-generate {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 0.95rem;
  }

  /* ── Right panel (preview): full width, sits ABOVE the prompt ── */
  .right-panel {
    border-left: none;
    border-bottom: 1px solid var(--color-border-light);
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  :root { --panel-width: 100%; }

  .panel-scroll {
    padding: 10px 12px 14px;
    overflow: visible;
  }

  /* Image fills the phone's width and stays square */
  .image-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
  }
  .image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* When no image yet (no visible img, not loading), keep the
     placeholder short so the prompt stays reachable without a long scroll.
     Once an image is generated, img.visible restores the square frame. */
  .image-frame:not(.loading):not(:has(img.visible)) {
    aspect-ratio: auto;
    min-height: 120px;
  }

  /* Generation-info meta block is noise on a small screen */
  .image-meta { font-size: 0.78rem; }

  /* ── Image actions: stack if too narrow ── */
  .image-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .image-actions .btn {
    flex: 1 1 120px;
    min-height: 44px;
    justify-content: center;
  }

  /* ── Modals: full screen on mobile ── */
  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .modal-overlay {
    align-items: flex-end;
  }

  /* ── Usage bar text ── */
  .usage-bar-label { font-size: 0.7rem; }
}
