/* ═══════════════════════════════════════════════════════════════
   Eros AI Web App — Global Styles
   Design system from live_web/static/index.html
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0a0c;
  --bg-card: #111115;
  --bg-card-hover: #18181e;
  --border: #1e1e26;
  --border-accent: #2a2030;
  --text-primary: #f0eff4;
  --text-secondary: #8a8694;
  --text-muted: #5a5666;
  --accent-red: #dc2626;
  --accent-orange: #e85d1a;
  --accent-pink: #e6337a;
  --accent-purple: #9333ea;
  --gradient-main: linear-gradient(135deg, #e85d1a 0%, #dc2626 25%, #e6337a 50%, #9333ea 100%);
  --gradient-soft: linear-gradient(135deg, rgba(232,93,26,0.15) 0%, rgba(220,38,38,0.15) 25%, rgba(230,51,122,0.15) 50%, rgba(147,51,234,0.15) 100%);
  --shadow-glow: 0 0 20px rgba(220,38,38,0.15), 0 0 40px rgba(147,51,234,0.1);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  width: 100%;
}
a { color: var(--accent-pink); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
  overflow: hidden;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ─────────────────── Header ─────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
  min-height: 50px;
}
.header-left, .header-right { display: flex; align-items: center; gap: 8px; }
.logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-red);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.header-title {
  font-size: 16px; font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.balance-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--gradient-soft);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
}
.coin-icon { font-size: 14px; }
.balance-value { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px 6px;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--text-primary); }

/* ─────────────────── AUTH ─────────────────── */
.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 24px;
  overflow-y: auto;
}
.auth-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.logo-dot-large {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-red);
  animation: pulse-dot 2s ease-in-out infinite;
  margin-bottom: 4px;
}
.auth-title {
  font-size: 28px; font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-subtitle {
  font-size: 14px; color: var(--text-secondary);
}
.auth-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.form-input {
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent-purple); }
.form-input::placeholder { color: var(--text-muted); }
.form-error {
  font-size: 12px; color: var(--accent-red);
  min-height: 16px;
  display: none;
}
.form-error.show { display: block; }
.form-success {
  font-size: 12px; color: #22c55e;
  min-height: 16px;
  display: none;
}
.form-success.show { display: block; }

.btn-primary {
  padding: 12px 20px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  background: var(--gradient-main);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 18px;
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-accent); }

.btn-danger {
  padding: 10px 18px;
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: rgba(220,38,38,0.1);
  color: var(--accent-red);
  border: 1px solid rgba(220,38,38,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-danger:hover { background: rgba(220,38,38,0.2); }

.auth-links {
  display: flex; justify-content: center; gap: 16px;
  font-size: 13px;
}
.auth-disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 360px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.auth-disclaimer a { color: var(--text-secondary); text-decoration: underline; }

/* ─────────────────── TELEGRAM LINK (register) ─────────────────── */
.tg-link-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 2px 0;
  user-select: none;
}
.tg-link-checkbox input[type="checkbox"] {
  accent-color: #2AABEE;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  cursor: pointer;
}
.tg-bot-link {
  color: #2AABEE;
  text-decoration: none;
  font-weight: 500;
}
.tg-bot-link:hover { text-decoration: underline; }
.tg-id-group {
  animation: tg-slide-down 0.25s ease-out;
}
@keyframes tg-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tg-id-hint-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2AABEE;
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
  transition: opacity 0.2s;
}
.tg-id-hint-btn:hover { opacity: 0.8; }
.tg-id-benefit {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 2px;
}

/* Telegram ID help modal */
.tg-help-box {
  text-align: left;
  max-width: 360px;
}
.tg-help-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}
.tg-help-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.tg-help-body p {
  margin-bottom: 10px;
}
.tg-help-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.tg-help-body ol li {
  margin-bottom: 4px;
}
.tg-help-body a {
  color: #2AABEE;
  font-weight: 500;
}
.tg-help-note {
  color: var(--accent-orange);
  font-weight: 500;
  font-size: 13px;
}

/* ─────────────────── CHARACTERS ─────────────────── */
.chars-title {
  padding: 16px 16px 8px;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.category-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.cat-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cat-tab:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.cat-tab:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.cat-tab:not(:last-child) { border-right: none; }
.cat-tab.active { background: var(--gradient-main); color: #fff; border-color: transparent; }
.cat-tab:hover:not(.active) { background: var(--bg-card-hover); color: var(--text-primary); }

.character-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
}
.character-grid::-webkit-scrollbar { width: 4px; }
.character-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.char-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.char-card-emoji { font-size: 32px; }
.char-card-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.char-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.char-card-type {
  font-size: 10px;
  color: #ffc107;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.char-card--vip {
  border-color: rgba(255, 193, 7, 0.3);
}
.char-card--vip:hover {
  border-color: rgba(255, 193, 7, 0.6);
  box-shadow: 0 0 16px rgba(255, 193, 7, 0.15);
}
.char-card--action {
  border-style: dashed;
  border-color: var(--border-accent);
  opacity: 0.85;
}
.char-card--action:hover {
  opacity: 1;
}
.chars-section-header {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0 0;
  text-align: center;
  letter-spacing: 0.3px;
}
.chars-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

/* ─────────────────── CHARACTER PREVIEW MODAL ─────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
}
.char-preview-box { text-align: center; }
.char-preview-emoji { font-size: 48px; margin-bottom: 8px; }
.char-preview-name {
  font-size: 20px; font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.char-preview-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  white-space: pre-line;
}
.char-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-new-dialog {
  border-color: rgba(255, 193, 7, 0.4);
  color: #ffc107;
}
.btn-new-dialog:hover {
  background: rgba(255, 193, 7, 0.1);
}

/* ─────────────────── CHAT ─────────────────── */
.chat-char-emoji { font-size: 20px; }
.chat-char-name {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-log::-webkit-scrollbar { width: 4px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: msg-in 0.25s ease-out;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(220,38,38,0.25) 0%, rgba(230,51,122,0.25) 100%);
  border: 1px solid rgba(230,51,122,0.3);
  border-bottom-right-radius: 4px;
}
.msg-bot {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(147,51,234,0.15) 0%, rgba(232,93,26,0.15) 100%);
  border: 1px solid rgba(147,51,234,0.2);
  border-bottom-left-radius: 4px;
}
.msg-bot .msg-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
}
.msg-error {
  align-self: center;
  background: rgba(220,38,38,0.15);
  border: 1px solid rgba(220,38,38,0.3);
  color: var(--accent-red);
  font-size: 12px;
  border-radius: 10px;
}
.msg-system {
  align-self: center;
  background: var(--gradient-soft);
  border: 1px solid var(--border-accent);
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 10px;
  text-align: center;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  align-self: flex-start;
}
.typing-indicator .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent-purple); }
.chat-input::placeholder { color: var(--text-muted); }

.btn-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-main);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-send:hover { opacity: 0.9; }
.btn-send:active { transform: scale(0.92); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─────────────────── SETTINGS ─────────────────── */
.settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.settings-scroll::-webkit-scrollbar { width: 4px; }
.settings-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-section-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  white-space: nowrap;
}
.settings-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}
.settings-account-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.seg-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.seg-btn {
  padding: 8px 14px;
  font-size: 12px; font-weight: 500; font-family: inherit;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.seg-btn:not(:last-child) { border-right: 1px solid var(--border); }
.seg-btn.active { background: var(--gradient-main); color: #fff; }
.seg-btn:hover:not(.active) { background: var(--bg-card-hover); color: var(--text-primary); }

/* ─────────────────── IMAGE MODAL ─────────────────── */
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 101;
}
.modal-image-full {
  max-width: 90%;
  max-height: 85vh;
  border-radius: 8px;
  object-fit: contain;
}

/* ─────────────────── UTILITIES ─────────────────── */
.hidden { display: none !important; }

/* Animations */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in { animation: fade-in 0.3s ease-out; }

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 480px) {
  .character-grid { grid-template-columns: repeat(2, 1fr); }
  .char-card { padding: 12px 8px; }
  .chat-char-name { max-width: 120px; }
}
