:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: #111111;
  --bg-hover: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #777777;
  --accent: #ef4444;
  --accent-glow: rgba(239, 68, 68, 0.4);
  --accent-secondary: #ff5555;
  --border: #222222;
  --border-hover: #333333;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(239, 68, 68, 0.15);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
  --glass-bg: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(239,68,68,0.03) 0%, transparent 60%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  padding-left: 220px;
  animation: pageFadeIn 0.3s ease;
}

@keyframes pageFadeIn { from { opacity: 0; } to { opacity: 1; } }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent); text-decoration: none; }

/* ─── Left Sidebar ─── */
.left-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 220px;
  height: 100vh;
  background: rgba(8,8,8,0.95);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.left-sidebar-logo {
  display: flex;
  align-items: center;
  padding: 20px 20px 16px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.left-sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
}

.left-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-radius: 999px;
  position: relative;
}

.left-sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.left-sidebar-link.active {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.left-sidebar-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ─── Splash Screen ─── */
.splash-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.splash-screen.hidden { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 90%;
  max-width: 600px;
  opacity: 0;
  animation: splashPulse 2s infinite ease-in-out;
}
.splash-logo.tinted { opacity: 1; transition: opacity 0.3s ease; }
@keyframes splashPulse {
  0% { transform: scale(0.98); }
  50% { transform: scale(1.02); filter: brightness(1.2); }
  100% { transform: scale(0.98); }
}

/* ─── Hero Banner ─── */
.hero-banner-section {
  padding-top: 80px;
  padding-bottom: 8px;
  text-align: center;
}
.hero-banner-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.hero-banner-img {
  width: 100%;
  max-width: 620px;
  filter: hue-rotate(0deg) saturate(1.2) brightness(1);
  transition: filter 0.4s ease;
  user-select: none;
  pointer-events: none;
}
.hero-tagline {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent);
  opacity: 0.85;
  margin-top: -4px;
  text-transform: uppercase;
}

/* ─── Navbar ─── */
.navbar {
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 64px;
  gap: 24px;
  padding: 0 8px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  flex: 1;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active {
  color: #fff;
  background: var(--accent);
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 600;
}
#navUser { margin-left: auto; }

.settings-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  filter: grayscale(0.3);
  transition: var(--transition);
}
.settings-btn:hover {
  filter: grayscale(0);
  transform: rotate(60deg);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--accent-glow);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

/* ─── Character Grid ─── */
.characters-section { padding-bottom: 64px; }

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  animation: cardsStagger 0.4s ease;
}
@keyframes cardsStagger {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.character-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.character-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, transparent 60%, rgba(239,68,68,0.04) 100%);
  pointer-events: none;
}
.character-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px 4px var(--accent-glow), 0 8px 32px rgba(0,0,0,0.4);
}

.character-card .card-img {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  margin-bottom: 14px;
  object-fit: cover;
  object-position: top center;
  background: var(--bg-hover);
  display: block;
  transition: transform 0.4s ease;
}
.character-card:hover .card-img { transform: scale(1.02); }

.character-card .card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.card-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0;
  transition: var(--transition);
}
.character-card:hover .card-delete-btn { opacity: 1; }
.card-delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

.character-card .avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.character-card .card-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.character-card .card-info .creator {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.character-card .description {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.character-card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.08);
  transition: var(--transition);
}
.tag.popular {
  background: rgba(239,68,68,0.1);
  color: var(--accent);
  border-color: rgba(239,68,68,0.2);
}

.character-card .chat-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Categories ─── */
.category-pills {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.category-pill {
  padding: 8px 20px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.category-pill:hover,
.category-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Footer ─── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ─── Sync Status ─── */
.sync-status {
  display: inline-block;
  font-size: 0.7rem;
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}
.sync-syncing { color: var(--text-muted); background: rgba(255,255,255,0.05); }
.sync-ok { color: #4ade80; background: rgba(74,222,128,0.1); }
.sync-error { color: #f87171; background: rgba(248,113,113,0.1); }

/* ─── Chat Page ─── */
.chat-page {
  display: flex;
  height: 100vh;
  padding-top: 64px;
}

.chat-sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-sidebar-header h3 { font-size: 0.95rem; font-weight: 600; }
.chat-sidebar-header .new-chat-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.chat-sidebar-header .new-chat-btn:hover { filter: brightness(1.15); }

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.chat-history-item {
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  margin-bottom: 4px;
}
.chat-history-item:hover {
  background: var(--accent-glow);
  border-left: 2px solid var(--accent);
}

.chat-history-item .h-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  overflow: hidden;
}
.chat-history-item .h-info { flex: 1; min-width: 0; }
.chat-history-item .h-name { font-size: 0.85rem; font-weight: 500; }
.chat-history-item .h-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-delete-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
  flex-shrink: 0;
  color: var(--text-muted);
  line-height: 1;
}
.chat-delete-btn:hover {
  opacity: 1;
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.chat-header .ch-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  overflow: hidden;
}

.h-avatar-img, .msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.chat-header .ch-info h4 { font-size: 0.95rem; font-weight: 600; }
.chat-header .ch-info span { font-size: 0.75rem; color: var(--text-muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: msgSlide 0.25s ease;
}
@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; align-items: flex-end; }

.message .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
  overflow: hidden;
}

.msg-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.message.user .msg-label { color: var(--accent); }

.message .msg-bubble {
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.6;
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-color: transparent;
  color: #fff;
}
.message .msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.msg-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  transition: var(--transition);
  line-height: 1.2;
  font-family: inherit;
}
.msg-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.chat-input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
}
.chat-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px;
  transition: border-color var(--transition);
}
.chat-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.chat-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
}
.chat-input-wrapper textarea::placeholder { color: var(--text-muted); }
.chat-input-wrapper .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  margin: 4px;
  transition: var(--transition);
}
.chat-input-wrapper .send-btn:hover { background: var(--accent-secondary); }

/* ─── Characters Page ─── */
.chars-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
  gap: 0;
}

.characters-section {
  flex: 1;
  min-width: 0;
  padding: 0 0 0 24px;
}

.chars-tag-sidebar {
  width: 208px;
  flex-shrink: 0;
  max-width: 100%;
  padding: 16px;
  background: rgba(11,11,11,0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  height: 454px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  position: sticky;
  top: 84px;
}
.chars-tag-sidebar::-webkit-scrollbar { display: none; }

.chars-tag-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  color: var(--text-muted);
}

.chars-tag-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: none;
}
.chars-tag-list::-webkit-scrollbar { display: none; }

.chars-tag-item-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: var(--transition);
  border-radius: 6px;
  padding: 6px 8px;
}
.chars-tag-item-row:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.chars-tag-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #111;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.chars-tag-item-row.active .chars-tag-checkbox {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chars-tag-name { flex: 1; }
.chars-tag-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 8px;
}
.chars-tag-minus {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.chars-tag-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 12px;
  transition: var(--transition);
}
.chars-tag-search::placeholder { color: #555; }
.chars-tag-search:focus { border-color: var(--accent); }

/* ─── Filter Bar ─── */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tag-search-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 32px;
  position: relative;
}
.tag-search-input {
  width: 100%;
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.tag-search-input:focus { border-color: var(--accent); color: var(--text-primary); }

.tag-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}
.tag-search-results.active { display: block; }

.tag-search-result {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.tag-search-result:hover { background: var(--bg-hover); color: var(--accent); }

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text-secondary); }

/* ─── NSFW Warning Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { scale: 0.95; opacity: 0; } to { scale: 1; opacity: 1; } }
.modal h2 { font-size: 1.3rem; margin-bottom: 12px; }
.modal p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px; }
.modal .btn { width: 100%; justify-content: center; margin-bottom: 8px; }

/* ─── Typing Indicator ─── */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ─── User Avatar ─── */
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user-img {
  width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer;
  border: 2px solid var(--accent);
}
.nav-user-name { font-size: 0.85rem; color: var(--text-primary); }

.login-btn {
  padding: 8px 18px;
  border-radius: 50px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.login-btn:hover { background: var(--accent-secondary); }

.user-dropdown { position: relative; display: inline-block; }
.user-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 42px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  z-index: 300;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a,
.user-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover { background: var(--bg-hover); color: var(--accent); }

/* ─── Login Page ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
.login-page::before {
  content: '';
  position: fixed;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(239,68,68,0.1) 0%, transparent 70%);
  top: -100px; left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  animation: blobPulse 6s ease-in-out infinite;
}
@keyframes blobPulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-card .login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-card h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 6px; }
.login-card .login-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; }

/* ─── Terms & Conditions Overlay ─── */
.terms-overlay { text-align: left; margin-bottom: 0; }
.terms-overlay .terms-header {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 12px;
  color: var(--accent); text-align: center;
  padding-bottom: 10px; border-bottom: 2px solid var(--accent);
}
.terms-overlay .terms-scroll {
  max-height: 340px; overflow-y: auto;
  padding-right: 6px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.terms-overlay .terms-scroll::-webkit-scrollbar { width: 4px; }
.terms-overlay .terms-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
.terms-overlay .terms-body { font-size: 0.78rem; line-height: 1.6; color: var(--text-secondary); }
.terms-overlay .terms-body p { margin-bottom: 8px; }
.terms-overlay .terms-body strong { color: var(--text-primary); }
.terms-overlay .terms-body ul { margin: 4px 0 12px; padding-left: 20px; }
.terms-overlay .terms-body ul li { margin-bottom: 4px; }
.terms-overlay .terms-agree-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 14px;
}
.terms-overlay .terms-checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--text-secondary);
  cursor: pointer; flex: 1; min-width: 200px;
}
.terms-overlay .terms-checkbox-label input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}

/* ─── Google Button ─── */
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  border-radius: 50px;
  background: #fff;
  color: #333;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.google-btn:hover { background: #f0f0f0; transform: translateY(-1px); }
.google-btn:disabled { opacity: 0.6; cursor: default; }
.google-btn img { width: 20px; height: 20px; }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-muted); font-size: 0.8rem;
}
.login-divider::before,
.login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.login-card .guest-btn {
  display: block; width: 100%; padding: 12px;
  border-radius: 50px; background: transparent;
  border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 0.9rem; cursor: pointer; transition: var(--transition);
}
.login-card .guest-btn:hover { border-color: var(--accent); color: var(--accent); }
.login-card .login-footer { margin-top: 20px; font-size: 0.75rem; color: var(--text-muted); }

/* ─── Settings Modal ─── */
.settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.settings-modal.active { display: flex; }

.settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.settings-panel h2 { font-size: 1.3rem; margin-bottom: 4px; color: var(--accent); }
.settings-panel .settings-sub { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px; }

.settings-group {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.settings-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-group label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.95rem; font-weight: 500; cursor: pointer;
}
.settings-group label span:first-child { color: var(--text-primary); }

.toggle-switch {
  position: relative; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 24px; cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px; background: #fff;
  border-radius: 50%; transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.settings-group .setting-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.color-options { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; transition: var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

.color-picker-row {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
}
.color-picker-row input[type="color"] {
  width: 40px; height: 40px; border: none;
  border-radius: 50%; cursor: pointer; background: none; padding: 0;
}
.color-picker-row span { font-size: 0.85rem; color: var(--text-secondary); }

.settings-close-btn {
  display: block; width: 100%; padding: 12px; margin-top: 16px;
  border-radius: 50px; background: var(--accent); color: #fff;
  font-size: 0.9rem; font-weight: 600; border: none; cursor: pointer; transition: var(--transition);
}
.settings-close-btn:hover { background: var(--accent-secondary); }

/* ─── Create Character Page ─── */
.create-page {
  padding: 100px 24px 64px;
  max-width: 800px;
  margin: 0 auto;
}
.create-page h1 { font-size: 1.8rem; margin-bottom: 4px; color: var(--accent); }
.create-page .create-sub { color: var(--text-secondary); margin-bottom: 32px; font-size: 0.9rem; }

.create-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.create-form { display: flex; flex-direction: column; gap: 20px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.form-group label .req { color: var(--accent); }

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.form-group select { cursor: pointer; }
.form-group select option { background: var(--bg-card); color: var(--text-primary); }

.form-image-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.form-inline-group {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.form-scenarios {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scenario-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.scenario-row-full { grid-column: 1 / -1; }
.scenario-remove-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 0.8rem; padding: 4px 8px;
  border-radius: 6px; transition: var(--transition); font-family: inherit;
}
.scenario-remove-btn:hover { background: rgba(239,68,68,0.1); }

.file-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sm {
  padding: 6px 14px !important;
  font-size: 0.8rem !important;
}

.tag-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-option {
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 0.8rem;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.tag-option:hover { border-color: var(--accent); color: var(--accent); }
.tag-option.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

.selected-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 50px;
  background: var(--accent); color: #fff; font-size: 0.75rem; white-space: nowrap;
}
.tag-chip-remove {
  background: none; border: none; color: rgba(255,255,255,0.7);
  cursor: pointer; font-size: 0.7rem; padding: 0; line-height: 1;
}
.tag-chip-remove:hover { color: #fff; }

.image-preview-area {
  display: flex; gap: 16px; align-items: flex-start;
}
.image-preview-area input { flex: 1; }
.image-preview {
  width: 100px; height: 100px; border-radius: var(--radius);
  border: 2px dashed var(--border); display: flex;
  align-items: center; justify-content: center; font-size: 2rem;
  color: var(--text-muted); flex-shrink: 0; overflow: hidden; background: var(--bg-card);
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview.has-image { border-style: solid; border-color: var(--accent); }

.create-actions { display: flex; gap: 12px; margin-top: 8px; }
.create-actions .btn { flex: 1; justify-content: center; }

/* ─── Scenario Selector ─── */
.scenario-bar {
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}
.scenario-bar .scenario-chip {
  padding: 5px 14px; border-radius: 20px; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 0.78rem; cursor: pointer; white-space: nowrap;
  transition: var(--transition); font-family: inherit;
}
.scenario-bar .scenario-chip:hover,
.scenario-bar .scenario-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.scenario-bar .scenario-label {
  font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0;
}

/* ─── Chat Character Info Bar ─── */
.chat-char-info {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-secondary);
}
.chat-char-info .cci-img {
  width: 56px; height: 56px; border-radius: 12px;
  object-fit: cover; flex-shrink: 0; background: var(--bg-hover);
}
.chat-char-info .cci-text { flex: 1; min-width: 0; }
.chat-char-info .cci-text h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; }
.chat-char-info .cci-text p {
  font-size: 0.8rem; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ─── Characters Header Bar ─── */
.characters-header-bar {
  display: flex; gap: 12px; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 0 24px 8px; flex-wrap: wrap;
}
.characters-header-bar h1 { font-size: 1.6rem; color: var(--accent); flex-shrink: 0; }
.characters-header-bar .search-input {
  flex: 1; min-width: 200px; padding: 10px 16px;
  border-radius: 50px; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-primary);
  font-size: 0.9rem; outline: none; transition: var(--transition);
}
.characters-header-bar .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── Chat Tag Sidebar ─── */
.chat-page .chars-tag-sidebar {
  position: static;
  align-self: stretch;
  max-height: none;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

/* ─── Premium ─── */
.owner-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 10px; border-radius: 20px;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000; font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; margin-right: 6px; vertical-align: middle;
}
.premium-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: auto; margin-right: 4px; vertical-align: middle;
}
.upgrade-btn {
  display: block; width: 100%; padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  border: none; border-radius: 6px; color: #000; font-size: 0.8rem;
  font-weight: 600; cursor: pointer; font-family: inherit;
  margin-bottom: 4px; transition: var(--transition);
}
.upgrade-btn:hover { filter: brightness(1.2); }

/* ─── Chat Tab Bar ─── */
.chat-tab-bar {
  width: 48px;
  min-width: 48px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex-shrink: 0;
}
.chat-tab-btn {
  width: 36px; height: 36px; background: transparent;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-secondary); font-size: 1.1rem; cursor: pointer;
  transition: var(--transition); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-tab-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.chat-tab-text-btn {
  width: 72px; min-height: 38px; padding: 6px 8px;
  font-size: 0.72rem; font-weight: 700; line-height: 1.1; text-align: center;
  height: auto;
}
.chat-tab-persona-img {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
}

/* ─── Download Hero Button ─── */
.download-hero-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 10px 24px; border-radius: 50px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: #fff; font-size: 0.9rem; font-weight: 600; text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
}
.download-hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(239,68,68,0.6);
}

/* ─── Persona Don't Ask ─── */
.persona-dont-ask {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px 16px; font-size: 0.8rem;
  color: var(--text-muted); cursor: pointer; user-select: none;
}
.persona-dont-ask input[type=checkbox] { accent-color: var(--accent); }

/* ─── Personas Page ─── */
.personas-page {
  max-width: 700px; margin: 0 auto; padding: 40px 20px;
}
.personas-page h1 { font-size: 2rem; margin-bottom: 4px; }
.personas-sub { color: var(--text-muted); margin-bottom: 32px; }

.persona-form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 32px;
}
.persona-form-card h3 { margin-bottom: 16px; }
.persona-form-actions { margin-top: 16px; }

.persona-list { display: flex; flex-direction: column; gap: 12px; }
.empty-personas { color: var(--text-muted); text-align: center; padding: 40px; }

.persona-card {
  display: flex; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; gap: 14px;
  transition: var(--transition);
}
.persona-card:hover { border-color: var(--border-hover); }
.persona-card.active { border-color: var(--accent); }

.persona-card-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0; overflow: hidden;
}
.persona-card-info { flex: 1; min-width: 0; }
.persona-card-name { font-weight: 600; font-size: 1rem; }
.persona-card-desc {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-card-actions { display: flex; gap: 8px; align-items: center; }
.persona-use-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--accent); padding: 6px 14px;
  font-size: 0.8rem; cursor: pointer; transition: var(--transition); font-family: inherit;
}
.persona-use-btn:hover { background: var(--accent); color: #fff; }
.persona-del-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); font-size: 0.75rem;
  cursor: pointer; padding: 4px 6px; transition: var(--transition); font-family: inherit;
}
.persona-del-btn:hover { color: #ef4444; border-color: #ef4444; }

.persona-picker-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; width: 380px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
}
.persona-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
}
.persona-picker-header h3 { margin: 0; font-size: 1.1rem; }
.persona-picker-close {
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted); font-size: 0.78rem;
  cursor: pointer; padding: 4px 10px; min-height: 32px; transition: var(--transition);
}
.persona-picker-close:hover { border-color: var(--accent); color: var(--accent); }
.persona-picker-list { padding: 0 12px 12px; }

.persona-pick-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 10px; cursor: pointer; transition: var(--transition);
}
.persona-pick-item:hover { background: var(--bg-hover); }
.persona-pick-item.active { background: var(--bg-hover); border: 1px solid var(--accent); margin: -1px; }

.persona-pick-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0; overflow: hidden;
}
.persona-pick-info { flex: 1; min-width: 0; }
.persona-pick-name { font-weight: 600; font-size: 0.95rem; }
.persona-pick-desc {
  font-size: 0.8rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-pick-check { color: var(--accent); font-weight: 700; font-size: 1.1rem; }

.persona-picker-manage {
  display: block; text-align: center; padding: 12px;
  border-top: 1px solid var(--border); color: var(--accent);
  text-decoration: none; font-size: 0.85rem; font-weight: 500;
}
.persona-picker-manage:hover { text-decoration: underline; background: rgba(255,255,255,0.02); }

/* ─── Persona Image ─── */
.persona-image-group { flex: 1 1 180px; }
.persona-image-upload {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-secondary); cursor: pointer;
}
.persona-image-upload:hover { border-color: var(--accent); }
.persona-image-preview {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-hover); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; overflow: hidden; flex-shrink: 0;
}
.persona-image-preview img,
.persona-avatar-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.persona-image-copy {
  color: var(--text-secondary); font-size: 0.82rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#personaImageInput { display: none; }
.persona-avatar-image-wrap { background: var(--bg-hover); overflow: hidden; padding: 0; }

/* ─── My Bots Page ─── */
.my-bots-page {
  max-width: 1100px; margin: 0 auto; padding: 100px 32px 60px;
}
.my-bots-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 36px; flex-wrap: wrap;
}
.my-bots-title {
  font-size: 2rem; font-weight: 800; color: var(--text-primary);
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 6px;
}
.my-bots-sub { font-size: 0.95rem; color: var(--text-muted); }
.my-bots-create-btn { flex-shrink: 0; padding: 10px 22px; font-size: 0.95rem; }

.my-bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.my-bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.my-bot-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.my-bot-card-media {
  position: relative; height: 200px; overflow: hidden; background: #0d0d0d;
}
.my-bot-card-img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: top center; display: block;
  transition: transform 0.4s ease;
}
.my-bot-card:hover .my-bot-card-img { transform: scale(1.03); }
.my-bot-card-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; font-weight: 800; color: rgba(255,255,255,0.9);
}
.my-bot-card-color-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
}

.my-bot-card-body {
  padding: 16px 16px 10px; flex: 1;
  display: flex; flex-direction: column; gap: 6px;
}
.my-bot-card-name {
  font-size: 1.05rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.my-bot-card-desc {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.my-bot-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.my-bot-tag {
  display: inline-block; padding: 2px 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 20px; font-size: 0.72rem; color: var(--text-muted); text-transform: lowercase;
}

.my-bot-card-actions {
  display: flex; gap: 8px; padding: 10px 16px 16px;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.my-bot-action-btn {
  flex: 1; text-align: center; padding: 8px 6px;
  font-size: 0.82rem; border-radius: 8px;
}
.my-bot-delete-btn {
  flex-shrink: 0; padding: 8px 12px; font-size: 0.82rem;
  background: transparent; border: 1px solid #444;
  color: var(--text-muted); border-radius: 8px;
  cursor: pointer; transition: var(--transition);
}
.my-bot-delete-btn:hover { background: crimson; border-color: crimson; color: #fff; }

.my-bots-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 24px; text-align: center; gap: 12px;
}
.my-bots-empty-icon {
  font-size: 4rem; margin-bottom: 8px; filter: grayscale(0.4);
}
.my-bots-empty h2 { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.my-bots-empty p { color: var(--text-muted); font-size: 0.95rem; max-width: 340px; }

/* ─── Language Dropdown ─── */
.lang-dropdown { position: relative; display: inline-block; }
.lang-btn {
  background: transparent; border: none; color: var(--text-primary);
  font-size: 1.5rem; cursor: pointer; padding: 5px;
  border-radius: 50%; transition: var(--transition); line-height: 1;
}
.lang-btn:hover { background: var(--bg-hover); }
.lang-dropdown-menu {
  display: none; position: absolute; right: 0; top: 45px; width: 220px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); z-index: 1000; overflow: hidden;
}
.lang-dropdown-menu.show { display: flex; flex-direction: column; }
#langSearch {
  width: 100%; border: none; border-bottom: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary);
  padding: 12px; outline: none; font-size: 0.95rem; font-family: inherit;
}
.lang-list { max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; }
.lang-list button {
  background: transparent; border: none; color: var(--text-secondary);
  text-align: left; padding: 12px 15px; cursor: pointer;
  font-size: 0.95rem; transition: background 0.2s; font-family: inherit;
}
.lang-list button:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── Download Page ─── */
.download-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}
.download-page::before,
.download-page::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.download-page::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(239,68,68,0.18) 0%, transparent 70%);
  top: -100px; left: 50%;
  transform: translateX(-50%);
  animation: blobPulse 6s ease-in-out infinite;
}
.download-page::after {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  bottom: 0; right: 0;
  animation: blobPulse 8s ease-in-out infinite reverse;
}

.apk-download-section {
  margin: 60px auto 80px;
  max-width: 900px;
  padding: 0 24px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.apk-download-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239,68,68,0.06) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px 48px;
  position: relative;
  overflow: hidden;
}
.apk-download-inner::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(239,68,68,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.apk-download-left {
  display: flex; align-items: flex-start; gap: 24px; flex: 1;
}
.apk-icon {
  font-size: 3.5rem; line-height: 1; flex-shrink: 0;
  filter: drop-shadow(0 0 16px rgba(239,68,68,0.5));
}
.apk-download-text { display: flex; flex-direction: column; gap: 8px; }
.apk-title { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.apk-sub { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; margin: 0; }
.apk-features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.apk-feature {
  font-size: 0.82rem; color: var(--accent);
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 999px; padding: 4px 12px; font-weight: 500;
}

.apk-download-right {
  display: flex; flex-direction: column; align-items: center; gap: 10px; flex-shrink: 0;
}
.apk-download-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 14px; padding: 16px 32px;
  font-size: 1.05rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
  white-space: nowrap;
}
.apk-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(239,68,68,0.55);
  filter: brightness(1.1);
}
.apk-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; }

.apk-steps-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 16px;
  padding: 28px 28px 20px;
  margin-bottom: 0;
  text-align: left;
}
.apk-steps-title {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 20px; letter-spacing: 0.2px;
}
.apk-steps-list {
  list-style: none; padding: 0; margin: 0 0 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.apk-steps-list li { display: flex; align-items: flex-start; gap: 14px; }
.apk-step-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.apk-steps-list li div strong { display: block; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 3px; }
.apk-steps-list li div p { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
.apk-steps-list li div code {
  background: rgba(255,255,255,0.08); border-radius: 4px;
  padding: 1px 6px; font-size: 0.82rem; color: var(--accent);
}

.android-update-notice {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 18px; padding: 12px 14px;
  border: 1px solid rgba(239,68,68,0.35); border-radius: 12px;
  background: rgba(239,68,68,0.12); color: var(--text-primary); text-align: left;
}
.android-update-notice strong { color: var(--accent); font-size: 0.95rem; }
.android-update-notice span { color: var(--text-secondary); font-size: 0.82rem; line-height: 1.4; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  body { padding-left: 0 !important; }

  .left-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 500;
    width: 240px;
  }
  .left-sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); z-index: 499;
  }
  .sidebar-overlay.active { display: block; }

  .mobile-sidebar-close {
    display: flex; align-items: center; justify-content: center;
    margin: 12px 12px 0; min-height: 42px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-card); color: var(--text-primary);
    font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  }
  .mobile-sidebar-close:hover,
  .mobile-sidebar-close:focus-visible {
    border-color: var(--accent); background: var(--bg-hover); outline: none;
  }

  .navbar { left: 0 !important; padding: 0 16px; }
  .nav-inner { justify-content: space-between; padding: 0; }

  .hamburger-btn {
    background: none; border: none; color: var(--text-primary);
    font-size: 1.5rem; cursor: pointer; padding: 6px;
    border-radius: 8px; display: flex; align-items: center; line-height: 1;
  }
  .hamburger-btn:hover { background: var(--bg-hover); }

  .hero-banner-section { padding-top: 80px; }
  .hero-banner-inner { padding: 24px 16px 16px; }

  .category-tabs { padding: 0 12px; gap: 6px; }
  .category-tab { padding: 7px 14px; font-size: 0.8rem; }

  .chars-layout { flex-direction: column !important; padding: 0 12px 40px; gap: 0; }
  .chars-tag-sidebar {
    width: 100% !important; height: auto !important;
    max-height: 180px;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
  }
  .characters-section { padding: 0 !important; }

  #searchInput {
    position: sticky; top: 72px; z-index: 90; display: block;
    width: 100% !important; margin: 0 0 12px !important;
    background: #0b0b0b; border-color: #303030;
    box-shadow: 0 10px 18px rgba(0,0,0,0.55);
  }

  .character-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .character-card { border-radius: 12px; }
  .card-img { height: 160px !important; }

  .chat-page { flex-direction: column; }
  .chat-sidebar {
    width: 100% !important; height: 56px;
    flex-direction: row; align-items: center;
    overflow: hidden; border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; padding: 0 12px; gap: 10px;
    cursor: pointer; position: relative; z-index: 10;
  }
  .chat-sidebar.expanded { height: auto; flex-direction: column; align-items: stretch; }
  .chat-main { flex: 1; min-height: 0; }
  .chat-messages { padding: 12px !important; }
  .message { max-width: 92% !important; }
  .chat-input-area { padding: 10px 12px !important; }

  .my-bots-grid { grid-template-columns: 1fr !important; padding: 0 12px !important; }
  .my-bots-header { flex-direction: column !important; align-items: flex-start !important; gap: 12px; padding: 80px 16px 16px !important; }

  .create-page,
  .create-form-wrap { padding: 80px 16px 40px !important; }

  .personas-page { padding: 80px 16px 40px !important; }
  .personas-grid { grid-template-columns: 1fr !important; }

  .settings-panel { width: 95vw !important; padding: 24px 20px !important; max-height: 90vh; overflow-y: auto; }

  .lang-dropdown-menu { right: -40px; width: 200px; }

  .chat-page { padding-bottom: 58px; }

  .chat-tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100% !important; height: 58px;
    flex-direction: row; justify-content: center;
    border-left: none; border-top: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.96); z-index: 120;
    padding: 8px 12px;
  }
  .chat-tab-btn,
  .chat-tab-text-btn {
    width: min(42vw, 160px); min-height: 42px; font-size: 0.82rem;
  }

  .form-row { flex-direction: column; }
  .persona-card { align-items: flex-start; }
  .persona-card-actions { flex-direction: column; align-items: stretch; }
  .persona-image-group { flex: 0 0 auto !important; }

  .nav-links li:not(:last-child) { display: none; }

  .apk-download-inner { flex-direction: column; padding: 28px 24px; text-align: center; }
  .apk-download-left { flex-direction: column; align-items: center; }
  .apk-features { justify-content: center; }

  .download-card { padding: 20px 16px 18px !important; border-radius: 16px !important; }
  .download-features { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .download-title { font-size: 1.25rem !important; }
  .apk-steps-box { padding: 14px 12px !important; border-radius: 12px !important; }
  .apk-steps-title { font-size: 0.85rem !important; margin-bottom: 10px !important; }
  .apk-steps-list { gap: 9px !important; margin-bottom: 12px !important; }
  .apk-steps-list li { gap: 9px !important; }
  .apk-step-num { width: 22px !important; height: 22px !important; font-size: 0.7rem !important; }
  .apk-steps-list li div strong { font-size: 0.8rem !important; }
  .apk-steps-list li div p { font-size: 0.72rem !important; }

  .nav-user-img { width: 32px !important; height: 32px !important; }
}

@media (max-width: 400px) {
  .character-grid { grid-template-columns: 1fr !important; }
  .card-img { height: 200px !important; }
}
