/* ═══════════════════════════════════════════
   LUMO — Amber Design System
   ═══════════════════════════════════════════ */

:root {
  --bg: #0A0804;
  --surface: #12100A;
  --card: #1C1810;
  --card-hover: #242018;
  --text: #F0E8DA;
  --t2: #A09478;
  --t3: #6E6248;
  --accent: #C49A4A;
  --accent2: #A07830;
  --accent3: #C45A5A;
  --green: #7AAA5A;
  --cyan: #6A9E8A;
  --rose: #B85A5A;
  --amber: #C49A4A;
  --border: rgba(196,154,74,0.12);
  --glass: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.06);
  --shadow: rgba(196,154,74,0.15);
  --gradient: linear-gradient(135deg, #C49A4A, #A07830);
  --gradient-soft: linear-gradient(135deg, rgba(196,154,74,0.1), rgba(160,120,48,0.05));
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --radius-full: 50px;
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Cream Theme ── */
[data-theme="cream"] {
  --bg: #FBF8F3;
  --surface: #F5F1EA;
  --card: #FFFFFF;
  --card-hover: #F8F5EE;
  --text: #1A1610;
  --t2: #8A7E6A;
  --t3: #B0A490;
  --accent: #C49A4A;
  --accent2: #A07830;
  --accent3: #C45A5A;
  --green: #6A9E5A;
  --cyan: #5A8E7A;
  --rose: #C45A5A;
  --amber: #C49A4A;
  --border: rgba(0,0,0,0.06);
  --glass: rgba(0,0,0,0.02);
  --glass-border: rgba(0,0,0,0.06);
  --shadow: rgba(0,0,0,0.06);
  --gradient: linear-gradient(135deg, #C49A4A, #A07830);
  --gradient-soft: linear-gradient(135deg, rgba(196,154,74,0.08), rgba(160,120,48,0.04));
}

/* ═══ RESET ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══ SCREENS ═══ */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
}
.screen.active { display: flex; flex-direction: column; }

/* ═══ BOTTOM NAV ═══ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(18,16,10,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--t3);
  transition: color 0.2s;
}
.nav-item.active { color: var(--accent); }
.nav-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.nav-item.active span { font-weight: 700; }

.nav-center {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  margin-top: -20px;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.15s;
}
.nav-center:active { transform: scale(0.92); }

/* ═══ TOPBAR ═══ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t2);
  transition: background 0.15s;
  flex-shrink: 0;
}
.topbar-btn:active { background: var(--card-hover); }
.topbar-btn svg { width: 18px; height: 18px; }

/* ═══ CARDS ═══ */
.card {
  background: var(--card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-glow {
  background: var(--gradient-soft);
  border: 1px solid var(--border);
}

/* ═══ BENTO GRID (Home) ═══ */
.bento-grid { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bento-row { display: grid; gap: 10px; }
.bento-row-2 { grid-template-columns: 1fr 1fr; }
.bento-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.bento-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--glass-border);
  animation: fadeUp 0.45s cubic-bezier(0.22,1,0.36,1) both;
}
.bento-card-accent {
  background: var(--gradient-soft);
  border-color: var(--border);
}
.bento-card-dark {
  background: linear-gradient(135deg, #0E0A04, #1A1408);
  border-color: rgba(255,255,255,0.04);
}
.bento-stat {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius);
}
.bento-stat-num {
  font-size: 22px;
  font-weight: 800;
}
.bento-stat-label {
  font-size: 10px;
  color: var(--t3);
  margin-top: 2px;
}
.bento-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: var(--accent);
}
.bento-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--bg);
  margin-top: 10px;
  overflow: hidden;
}
.bento-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient);
  transition: width 0.6s ease;
}

/* ═══ AVATAR / LOGO ═══ */
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

/* ═══ CHAT ═══ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
}
.msg-row {
  display: flex;
  margin-bottom: 8px;
  animation: msgIn 0.35s cubic-bezier(0.22,1,0.36,1) both;
}
.msg-row-user { justify-content: flex-end; }
.msg-row-ai { gap: 8px; }

.msg-bubble {
  max-width: 82%;
  padding: 12px 14px 6px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}
.msg-user {
  background: var(--gradient);
  border-radius: 20px 20px 4px 20px;
  color: #fff;
  box-shadow: 0 3px 12px rgba(196,154,74,0.2);
}
.msg-ai {
  background: var(--card);
  border: 1px solid var(--glass-border);
  border-radius: 20px 20px 20px 4px;
  color: var(--text);
}
.msg-time {
  font-size: 10px;
  text-align: right;
  margin-top: 4px;
  opacity: 0.5;
}
/* typing dots */
.typing-dots { display: flex; gap: 5px; padding: 14px 16px; }
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* quick replies */
.quick-replies { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding: 0 2px; }
.quick-reply {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s;
}
.quick-reply:active { background: var(--card-hover); transform: scale(0.95); }
.quick-reply svg { width: 14px; height: 14px; }


/* composer */
.composer {
  padding: 8px 12px 12px;
  flex-shrink: 0;
}
.composer-inner {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 24px;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--glass-border);
  transition: border-color 0.25s;
}
.composer-inner:focus-within {
  border-color: rgba(196,154,74,0.35);
}
.composer-inner.focused {
  border-color: rgba(196,154,74,0.35);
}
.composer-attach {
  color: var(--t3);
  cursor: pointer;
  margin-right: 8px;
  display: flex;
}
.composer-attach svg { width: 22px; height: 22px; }
.composer-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  min-width: 0;
}
.composer-input::placeholder { color: var(--t3); }
.composer-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  transition: all 0.2s;
  flex-shrink: 0;
}
.composer-send.has-text {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 12px var(--shadow);
}
.composer-send svg { width: 18px; height: 18px; }

/* welcome */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}
.chat-welcome-title { font-size: 20px; font-weight: 700; }
.chat-welcome-sub { font-size: 14px; color: var(--t2); text-align: center; }
.chat-suggestions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 12px; }
.chat-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: background 0.15s;
}
.chat-suggestion:active { background: var(--card-hover); transform: scale(0.98); }
.chat-suggestion { transition: background 0.15s, transform 0.15s, border-color 0.2s; }
.chat-suggestion-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-suggestion-text { font-size: 14px; color: var(--t2); }

/* ═══ IMAGES SCREEN ═══ */
.img-canvas {
  margin: 12px;
  height: 200px;
  border-radius: var(--radius-lg);
  background: var(--gradient-soft);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.img-canvas-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(196,154,74,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.img-canvas-icon svg { width: 28px; height: 28px; }
.img-styles { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 8px; }
.img-style-card {
  min-width: 80px;
  padding: 14px 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 2px solid transparent;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.img-style-card.active { border-color: var(--accent); background: var(--gradient-soft); }
.img-style-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-style-icon svg { width: 24px; height: 24px; }
.img-style-name { font-size: 11px; font-weight: 600; color: var(--t2); }
.img-style-card.active .img-style-name { color: var(--accent); }

/* ═══ LIST ITEMS ═══ */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.list-item:active { background: rgba(255,255,255,0.02); }
.list-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-icon svg { width: 22px; height: 22px; }
.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 500; }
.list-sub { font-size: 12px; color: var(--t3); margin-top: 2px; }
.list-chevron { color: var(--t3); flex-shrink: 0; }
.list-chevron svg { width: 18px; height: 18px; }
.list-detail { font-size: 13px; font-weight: 600; margin-right: 8px; }

/* ═══ SETTINGS ═══ */
.settings-group {
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 16px 16px;
  border: 1px solid var(--glass-border);
}
.settings-item {
  display: flex;
  align-items: center;
  padding: 15px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
}
.settings-item:last-child { border-bottom: none; }
.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  flex-shrink: 0;
}
.settings-icon svg { width: 18px; height: 18px; }

/* profile card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  margin: 8px 16px 16px;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(196,154,74,0.1);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ═══ PRICING ═══ */
.plan-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
  background: var(--card);
  border: 2px solid transparent;
}
.plan-card.selected { border-color: var(--accent); background: var(--gradient-soft); }
.plan-card-gradient {
  padding: 2px;
  border-radius: 22px;
  background: var(--gradient);
  margin-bottom: 10px;
}
.plan-card-gradient .plan-card-inner {
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
}
.plan-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.plan-icon { font-size: 22px; }
.plan-name { font-size: 18px; font-weight: 700; }
.plan-price { margin-left: auto; font-size: 20px; font-weight: 700; }
.plan-period { font-size: 12px; font-weight: 400; color: var(--t2); }
.plan-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--t2);
  margin-bottom: 4px;
}
.plan-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══ USAGE ═══ */
.usage-plan-card {
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin: 8px 16px 24px;
}
.usage-plan-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--gradient);
  opacity: 0.06;
  filter: blur(30px);
}
.usage-plan-label { font-size: 13px; color: var(--t2); }
.usage-plan-name {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.usage-plan-timer { font-size: 12px; color: var(--t3); margin-top: 6px; }

.usage-item { margin-bottom: 20px; padding: 0 16px; }
.usage-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.usage-item-left { display: flex; align-items: center; gap: 8px; }
.usage-item-left svg { width: 16px; height: 16px; }
.usage-item-label { font-size: 15px; font-weight: 500; }
.usage-item-count { font-size: 13px; color: var(--t2); }
.usage-bar { height: 6px; border-radius: 3px; background: var(--card); overflow: hidden; }
.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1);
}

/* ═══ BUTTONS ═══ */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--gradient);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: none;
  font-family: inherit;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.15s;
}
.btn-primary:active { transform: scale(0.97); }

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
  padding: 0 12px;
}

/* ═══ BOTTOM SHEETS ═══ */
#sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  z-index: 210;
  max-height: 75vh;
  overflow-y: auto;
  display: none;
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--t3);
  margin: 0 auto 16px;
}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.85) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* stagger delays */
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }
.delay-5 { animation-delay: 0.30s; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 0; }

/* ═══ UTILITY ═══ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.mt-auto { margin-top: auto; }
.text-accent { color: var(--accent); }
.text-t2 { color: var(--t2); }
.text-t3 { color: var(--t3); }
.fw-700 { font-weight: 700; }
.fs-15 { font-size: 15px; }
/* ═══ FIXES ═══ */

/* Fix: bento grid max width and overflow */
.bento-grid { max-width: 100%; overflow-x: hidden; }
.bento-card { overflow: hidden; min-width: 0; }

/* Fix: bento icon SVG sizing */
.bento-icon svg { width: 28px; height: 28px; }

/* Fix: profile card layout */
.profile-card { display: flex; align-items: center; gap: 14px; }

/* Fix: nav center not clipped by #app overflow */
#bottom-nav { overflow: visible; }

/* Fix: gallery empty icon sizing */
.gallery-empty-icon svg { width: 48px; height: 48px; opacity: 0.3; }

/* Fix: image styles hide scrollbar */
.img-styles { -ms-overflow-style: none; scrollbar-width: none; }
.img-styles::-webkit-scrollbar { display: none; }

/* Fix: chat screen takes full height, composer doesn't go under nav */
#screen-chat { overflow: hidden !important; padding-bottom: 0 !important; }
#chat-composer-wrap {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  z-index: 100;
  background: var(--bg);
  padding: 8px 12px 8px !important;
  display: none;
}
#chat-messages { padding-bottom: 70px !important; }

/* Fix: settings scroll padding */
#screen-settings, #screen-pricing, #screen-usage { padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px) !important; }

/* Fix: quick replies horizontal scroll without wrap */
.quick-replies { overflow-x: auto; flex-wrap: nowrap; -ms-overflow-style: none; scrollbar-width: none; padding-bottom: 4px; }
.quick-replies::-webkit-scrollbar { display: none; }

/* Fix: prevent text overflow in list items */
.list-title, .list-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fix: image prompt input full width */
#img-prompt { width: 100%; padding: 0; }

/* Fix: plan cards overflow text */
.plan-name, .plan-price { white-space: nowrap; }

/* Fix: usage bar container */
.usage-bar { min-width: 0; }

/* Fix: settings icon flex alignment */
.settings-item { display: flex; align-items: center; }

/* Fix: general touch targets minimum size */
.topbar-btn, .nav-item, .nav-center, .quick-reply, .chat-suggestion, .settings-item, .img-style-card {
  -webkit-tap-highlight-color: transparent;
}

/* Fix: iOS rubber band overscroll color */
html { background: var(--bg); }

/* Fix: safe area on iPhone */
@supports (padding: max(0px)) {
  #bottom-nav {
    padding-bottom: max(var(--safe-bottom), 8px);
  }
  #chat-composer-wrap {
    bottom: calc(max(var(--safe-bottom), 8px) + var(--nav-height));
  }
}

/* ═══ Screen transitions ═══ */
.screen.active { animation: screenIn 0.25s ease both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ Markdown in chat ═══ */
.msg-ai pre { margin: 6px 0; }
.msg-ai code { font-family: "SF Mono", "Fira Code", monospace; }
.msg-ai b { font-weight: 600; }
.msg-bubble { cursor: pointer; transition: outline 0.2s; outline: 2px solid transparent; }


/* ═══ Persona chip ═══ */
.persona-chip { transition: transform 0.15s, background 0.2s; }
.persona-chip:active { transform: scale(0.93) !important; }

/* ═══ Quick action items ═══ */
#newchat-sheet > div:not(.sheet-handle) { transition: background 0.15s, transform 0.15s; }
#newchat-sheet > div:not(.sheet-handle):active { transform: scale(0.98); background: var(--card-hover); }

/* ═══ Settings items hover ═══ */
.settings-item:active { background: var(--card-hover); }

/* ═══ Persona page cards ═══ */
#personas-list > div { transition: transform 0.15s, border-color 0.2s; }
#personas-list > div:active { transform: scale(0.98); }

/* ═══ Sub-screen scroll padding ═══ */
#screen-personas, #screen-pricing, #screen-usage {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px) !important;
}

/* ═══ Usage items spacing ═══ */
.usage-item { padding: 14px 16px; }

/* ═══ FINAL VISUAL FIXES ═══ */

/* Fix: settings-group items get cut off by overflow:hidden */
.settings-group { overflow: visible; }

/* Fix: settings icon color inheritance */
.settings-icon svg { width: 18px; height: 18px; }

/* Fix: bento cards touch feedback */
.bento-card { cursor: pointer; transition: transform 0.15s; }
.bento-card:active { transform: scale(0.97); }

/* Fix: home greeting card no touch effect */
.bento-card:first-child { cursor: default; }
.bento-card:first-child:active { transform: none; }

/* Fix: plan-card touch feedback */
.plan-card { transition: border-color 0.2s, transform 0.15s; }
.plan-card:active { transform: scale(0.98); }

/* Fix: personas page back button alignment */
#screen-personas .topbar { gap: 12px; }

/* Fix: icon containers in inline styles need proper display */
div[style*="display:inline-flex"] svg { width: 100%; height: 100%; }

/* Fix: chat messages scroll area padding for fixed composer */
#chat-messages {
  padding-bottom: 80px !important;
  -webkit-overflow-scrolling: touch;
}

/* Fix: image result close button tap target */
#img-result-close { min-width: 36px; min-height: 36px; }

/* Fix: error card in images */
#img-error { border-radius: 14px; }

/* Fix: gallery list items tap feedback */
#gal-list > div { transition: background 0.15s; border-radius: 8px; padding-left: 4px; padding-right: 4px; }
#gal-list > div:active { background: var(--card); }

/* Fix: persona chips scrollbar hidden */
#chat-persona-chips { -ms-overflow-style: none; scrollbar-width: none; }
#chat-persona-chips::-webkit-scrollbar { display: none; }

/* Fix: welcome content tighter */
#chat-welcome .chat-suggestion { gap: 10px; }
#chat-welcome .chat-suggestion-icon { flex-shrink: 0; }

/* ═══ LUMO AVATAR ═══ */
.lumo-ava {
  background: url('/static/img/lumo-avatar.png') center/cover;
  border-radius: 50%;
  flex-shrink: 0;
}
.lumo-ava-sm { width: 28px; height: 28px; }
.lumo-ava-md { width: 32px; height: 32px; }
.lumo-ava-lg { width: 48px; height: 48px; }

/* ═══ ANIMATED LUMO (welcome) ═══ */
@keyframes lumoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes lumoBlink { 0%, 43%, 45%, 100% { transform: scaleY(1); } 44% { transform: scaleY(0.05); } }
@keyframes lumoGlow { 0%, 100% { box-shadow: 0 0 6px rgba(80,210,200,0.3); } 50% { box-shadow: 0 0 14px rgba(80,210,200,0.6); } }
@keyframes lumoLed { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.lumo-char {
  width: 120px; height: 130px;
  position: relative;
  animation: lumoFloat 4s ease-in-out infinite;
}
.lumo-head {
  width: 100%; height: 110px;
  border-radius: 55px 55px 44px 44px;
  background: linear-gradient(165deg, #ece8e2, #ccc8c0 55%, #bbb7ae);
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.lumo-visor {
  position: absolute; top: 32px; left: 50%; transform: translateX(-50%);
  width: 80px; height: 52px; border-radius: 26px;
  background: linear-gradient(175deg, #1e1a26, #0a080e);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding-top: 4px;
}
.lumo-eye {
  width: 22px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 48% 45%, #0e0c14, #080610);
  position: relative;
  animation: lumoGlow 3s ease-in-out infinite;
}
.lumo-eye::after {
  content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 10px; border-radius: 50%;
  background: radial-gradient(ellipse, #50d2c8, rgba(32,136,128,0));
  opacity: 0.55;
}
.lumo-eye-wrap { animation: lumoBlink 5.5s ease-in-out infinite; transform-origin: center; }
.lumo-eye-wrap:nth-child(2) { animation-delay: 0.08s; }
.lumo-antenna {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 14px;
  background: linear-gradient(90deg, #b0aca4, #c8c4bc);
  border-radius: 3px;
}
.lumo-antenna::after {
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #ddd9d2, #c0bcb4);
}
.lumo-led {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: #50d2c8;
  animation: lumoLed 2.5s ease-in-out infinite;
  z-index: 1;
}
.lumo-phone {
  position: absolute; top: 42px; width: 18px; height: 24px;
  border-radius: 8px;
  background: linear-gradient(160deg, #706c64, #4a4642);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}
.lumo-phone-l { left: -6px; }
.lumo-phone-r { right: -6px; }

/* ═══ Create tabs ═══ */
.create-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--t3);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.create-tab.active {
  background: var(--gradient);
  color: #fff;
}

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 60px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
  pointer-events: none;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; } }

/* ═══ Scroll to bottom ═══ */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t2);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ═══ TTS button on AI messages ═══ */
.msg-tts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  margin-top: 6px;
  border-radius: 20px;
  background: rgba(196,154,74,0.08);
  color: var(--t2);
  font-size: 11px;
  cursor: pointer;
}
.msg-tts:active { background: rgba(196,154,74,0.15); }

/* ═══ Gallery preview overlay ═══ */
.gallery-preview {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.gallery-preview img, .gallery-preview video {
  max-width: 90%;
  max-height: 70vh;
  border-radius: 16px;
}
.gallery-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ═══ Logo image ═══ */
.logo-img {
  background: url('/static/logo-transparent.png') center/contain no-repeat;
  flex-shrink: 0;
}
.logo-img-sm { width: 32px; height: 32px; }
.logo-img-md { width: 36px; height: 36px; }
.logo-img-lg { width: 56px; height: 56px; }
.logo-img-xl { width: 80px; height: 80px; }

/* ═══ Skeleton loading ═══ */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, #242018 50%, var(--card) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}

/* ═══ iOS keyboard fix ═══ */
body.keyboard-open .screen {
  padding-bottom: 0 !important;
}
body.keyboard-open #bottom-nav {
  display: none !important;
}
body.keyboard-open #chat-composer-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  z-index: 100;
  padding: 8px 12px !important;
  border-top: 1px solid var(--border);
}

/* Mic recording pulse */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Remove default focus outline on all inputs */
input:focus, textarea:focus { outline: none !important; -webkit-tap-highlight-color: transparent; }
.composer-inner *:focus { outline: none !important; }

/* Cream theme overrides for hardcoded colors */
[data-theme="cream"] .bottom-nav { background: #fff; border-top-color: rgba(0,0,0,0.06); box-shadow: 0 -2px 8px rgba(0,0,0,0.03); }
[data-theme="cream"] .msg-bubble.msg-ai { background: #fff; border-color: rgba(0,0,0,0.06); }
[data-theme="cream"] .bento-card { box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
[data-theme="cream"] .plan-card { background: #fff; border-color: rgba(0,0,0,0.06); }
[data-theme="cream"] .plan-card.selected { border-color: var(--accent); }
[data-theme="cream"] .topbar-btn { background: #F5F1EA; }
[data-theme="cream"] .persona-chip { background: #F5F1EA; border-color: rgba(0,0,0,0.04); }
[data-theme="cream"] .persona-chip.active { background: rgba(196,154,74,0.08); border-color: rgba(196,154,74,0.18); }
[data-theme="cream"] .sheet-overlay { background: rgba(0,0,0,0.3); }
[data-theme="cream"] .bottom-sheet { background: #fff; }
[data-theme="cream"] .logo-img { filter: none; }
[data-theme="cream"] code, [data-theme="cream"] pre { background: #F5F1EA !important; color: #1A1610 !important; }
[data-theme="cream"] .typing-dot { background: var(--accent); }

/* Cream theme: skeleton & persona fixes */
[data-theme="cream"] .skeleton { background: linear-gradient(90deg, #F5F1EA 25%, #EDE8DF 50%, #F5F1EA 75%); background-size: 400px 100%; }
[data-theme="cream"] .settings-group { background: #fff; }
[data-theme="cream"] .settings-item { border-bottom-color: rgba(0,0,0,0.04); }
[data-theme="cream"] .bento-card, [data-theme="cream"] .plan-card, [data-theme="cream"] .usage-item { background: #fff; }
[data-theme="cream"] .msg-time { color: rgba(0,0,0,0.3); }
[data-theme="cream"] .chat-suggestion { background: #fff; border-color: rgba(0,0,0,0.06); }
[data-theme="cream"] .research-cat { background: #fff; border-color: rgba(0,0,0,0.06); }
[data-theme="cream"] input, [data-theme="cream"] textarea { color: #1A1610; }
[data-theme="cream"] input::placeholder, [data-theme="cream"] textarea::placeholder { color: #B0A490; }
[data-theme="cream"] .sheet-handle { background: rgba(0,0,0,0.15); }
[data-theme="cream"] .composer-inner { background: #fff; border-color: rgba(0,0,0,0.06); box-shadow: 0 1px 4px rgba(0,0,0,0.04); }

[data-theme="cream"] .bento-card-dark { background: linear-gradient(135deg, #F0EBE2, #E8E2D8); border-color: rgba(0,0,0,0.06); }


/* ═══ PERFORMANCE & SMOOTHNESS ═══ */

/* GPU acceleration for animated elements */
.screen, .msg-row, .bento-card, .bottom-sheet, .toast, .nav-center, .composer-send {
  will-change: transform, opacity;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Smoother screen transitions */
.screen.active { animation: screenIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Smoother bottom sheet */
.bottom-sheet {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

#sheet-overlay {
  transition: opacity 0.3s ease;
}

/* Smooth scroll everywhere */
.chat-messages, .screen, .bottom-sheet {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* Better tap feedback */
.nav-item, .bento-card, .settings-item, .list-item, .plan-card,
.quick-reply, .chat-suggestion, .img-style-card, .create-tab {
  transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), 
              background 0.15s ease,
              border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Composer input smooth grow */
.composer-inner {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.composer-inner:focus-within {
  border-color: rgba(196,154,74,0.35);
  box-shadow: 0 0 0 3px rgba(196,154,74,0.08);
}

/* Send button pulse when has text */
@keyframes sendPulse {
  0%, 100% { box-shadow: 0 2px 12px var(--shadow); }
  50% { box-shadow: 0 4px 20px rgba(196,154,74,0.35); }
}
.composer-send.has-text {
  animation: sendPulse 2s ease-in-out infinite;
}
.composer-send.has-text:active { animation: none; transform: scale(0.9); }

/* Nav item active indicator dot */
.nav-item.active::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 1px;
}

/* Smooth typing dots */

/* Better message animations */
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-row { animation: msgSlideIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Loading skeleton pulse */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

/* Image result fade in */
@keyframes imgReveal {
  from { opacity: 0; transform: scale(0.95); filter: blur(8px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
#img-result img, #img-result video {
  animation: imgReveal 0.5s ease both;
}

/* Toast improvements */
.toast {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

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


/* ═══ UI POLISH ═══ */

/* Smooth nav item transition */
.nav-item { transition: color 0.2s, transform 0.15s; }
.nav-item:active { transform: scale(0.9); }

/* Bento card hover/press */
.bento-card { transition: transform 0.2s cubic-bezier(0.22,1,0.36,1), border-color 0.2s; }
.bento-card:active { transform: scale(0.97); }

/* Chat bubble entrance */
.msg-row-user .msg-bubble { animation: msgUserIn 0.3s cubic-bezier(0.22,1,0.36,1) both; }
.msg-row-ai .msg-bubble { animation: msgAiIn 0.3s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes msgUserIn { from { opacity:0; transform: translateX(20px) scale(0.95); } to { opacity:1; transform: none; } }
@keyframes msgAiIn { from { opacity:0; transform: translateX(-20px) scale(0.95); } to { opacity:1; transform: none; } }

/* Quick reply hover */
.quick-reply { transition: all 0.15s cubic-bezier(0.22,1,0.36,1); }
.quick-reply:active { transform: scale(0.93); background: var(--card-hover); }

/* Create tab pills */
.create-tab { transition: all 0.2s ease; }
.create-tab:active { transform: scale(0.95); }
.create-tab.active { box-shadow: 0 2px 12px var(--shadow); }

/* Settings items */
.settings-item { transition: background 0.15s; border-radius: 14px; }
.settings-item:active { background: var(--card-hover); }

/* Bottom sheet smooth */
.bottom-sheet { transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), opacity 0.3s; }

/* Plan card glow */
.plan-card { transition: transform 0.2s, box-shadow 0.2s; }
.plan-card:active { transform: scale(0.98); }
.plan-card.current { box-shadow: 0 0 0 2px var(--accent), 0 4px 20px var(--shadow); }

/* Image result reveal */
@keyframes imgReveal {
  from { opacity:0; transform: scale(0.92); filter: blur(12px); }
  50% { opacity:1; filter: blur(4px); }
  to { opacity:1; transform: scale(1); filter: blur(0); }
}

/* Topbar glassmorphism enhance */
.topbar { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* Composer mic button pulse when recording */
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(184,90,90,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(184,90,90,0); }
}
.recording .composer-send { animation: micPulse 1.5s ease infinite; background: var(--rose) !important; }

/* Persona chip animation */
.persona-chip { transition: all 0.15s; }
.persona-chip:active { transform: scale(0.93); }
.persona-chip.active { box-shadow: 0 0 0 2px var(--accent); }

/* Gallery item hover */
[data-gal-idx] { transition: background 0.15s; border-radius: 14px; padding-left: 4px; padding-right: 4px; }
[data-gal-idx]:active { background: var(--card-hover); }

/* Progress bar shimmer */
@keyframes progressShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
#gen-progress {
  background: linear-gradient(90deg, var(--accent) 0%, #E0C080 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
}

/* Screen fade in */
.screen.active { animation: screenIn 0.25s ease both; }
@keyframes screenIn { from { opacity:0; } to { opacity:1; } }

/* Button primary press */
.btn-primary:active { transform: scale(0.96); }

/* Smooth focus for all inputs */
input, textarea { transition: border-color 0.25s, box-shadow 0.25s; }
input:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(196,154,74,0.08); }
