/* ============================================
   CosmosDiary - Cosmic Design System
   ============================================ */

:root {
  --bg-primary: #07071a;
  --bg-secondary: #0d0d24;
  --bg-card: #11112b;
  --bg-card-hover: #161640;
  --bg-input: #0a0a22;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #7c3aed;
  --gold: #c9a96e;
  --gold-light: #e8c98a;
  --teal: #06b6d4;
  --rose: #f43f5e;
  --emerald: #10b981;

  --border: rgba(139, 92, 246, 0.2);
  --border-hover: rgba(139, 92, 246, 0.5);
  --border-gold: rgba(201, 169, 110, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
  --shadow-glow-gold: 0 0 20px rgba(201, 169, 110, 0.2);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans KR', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Cosmic Background ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(201, 169, 110, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

a {
  color: var(--purple-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--gold-light); }

/* ─── Header / Navbar ─── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: rgba(7, 7, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand .brand-icon {
  font-size: 1.5rem;
}

.brand-text {
  background: linear-gradient(135deg, var(--gold-light), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.1);
}

.nav-link.active {
  color: var(--purple-light);
}

.btn-nav-login {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-nav-login:hover {
  border-color: var(--purple);
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-light);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-card);
  display: none;
}

.user-menu-wrap {
  position: relative;
}

.user-menu-wrap:hover .user-dropdown,
.user-menu-wrap.open .user-dropdown {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
}

/* ─── Page Wrapper ─── */
.page-wrapper {
  min-height: 100vh;
  padding-top: 64px;
  position: relative;
  z-index: 1;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-gold {
  background: linear-gradient(135deg, #b8852a, var(--gold));
  color: #1a0e00;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(201, 169, 110, 0.3);
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201, 169, 110, 0.45);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  transform: translateY(-2px);
}

.card-glass {
  background: rgba(17, 17, 43, 0.7);
  backdrop-filter: blur(20px);
}

/* ─── Forms ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label span.required {
  color: var(--rose);
  margin-left: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-select option { background: var(--bg-secondary); }

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

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

.form-error {
  font-size: 0.8rem;
  color: var(--rose);
}

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

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-glow);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

/* ─── Hero Section ─── */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  border: 1px solid var(--border-gold);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 20px;
  line-height: 1.15;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--gold-light), var(--purple-light), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 36px;
}

/* ─── Section ─── */
.section {
  padding: 40px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.section-header {
  margin-bottom: 32px;
}

/* ─── Category Filter Tabs ─── */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-tab {
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-tab:hover {
  border-color: var(--purple);
  color: var(--purple-light);
}

.filter-tab.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}

/* ─── Fortune System Cards Grid ─── */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.system-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.system-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color, var(--purple));
  opacity: 0;
  transition: opacity var(--transition);
}

.system-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), 0 0 30px rgba(139, 92, 246, 0.12);
}

.system-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--border);
}

.card-title-wrap {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.card-category {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-light);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: inline-block;
  margin-top: 4px;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars {
  display: flex;
  gap: 2px;
  color: var(--gold);
  font-size: 0.85rem;
}

.rating-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}

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

.comment-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.card-action {
  margin-top: 4px;
}

/* ─── Access Modal Options ─── */
.access-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 12px;
}

.access-option:hover {
  border-color: var(--purple);
  background: rgba(139, 92, 246, 0.06);
}

.access-option-icon {
  font-size: 1.8rem;
  width: 48px;
  text-align: center;
}

.access-option-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.access-option-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.access-option.recommended {
  border-color: var(--border-gold);
  background: rgba(201, 169, 110, 0.04);
}

.access-option.recommended:hover {
  border-color: var(--gold);
  background: rgba(201, 169, 110, 0.08);
}

/* ─── Auth Page ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 40px;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.auth-logo {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 6px;
}

.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.tab-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}

.tab-btn {
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-divider {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 4px 0;
  position: relative;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.auth-footer a {
  color: var(--purple-light);
}

/* ─── Info Input Form (Fortune Entry) ─── */
.info-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 520px;
  width: 100%;
}

.time-unknown-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  cursor: pointer;
}

.time-unknown-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
  cursor: pointer;
}

.time-unknown-check span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── Fortune Chat Page ─── */
.fortune-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 64px);
}

.fortune-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-system {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-system-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.sidebar-system-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.sidebar-subject {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.sidebar-subject-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.subject-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.subject-info-row:last-child { margin-bottom: 0; }

.subject-info-label {
  color: var(--text-muted);
  min-width: 60px;
  font-size: 0.8rem;
}

.subject-info-value {
  color: var(--text-primary);
  font-weight: 500;
}

.sidebar-categories {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.sidebar-cat-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  margin: 3px 3px 3px 0;
}

.category-pill:hover,
.category-pill.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--border);
  color: var(--purple-light);
}

.sidebar-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── Chat Area ─── */
.chat-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  height: 100%;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
}

.chat-header-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

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

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

/* Message bubbles */
.message {
  display: flex;
  gap: 12px;
  max-width: 100%;
}

.message.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-top: 2px;
}

.message.user-message .message-avatar {
  background: linear-gradient(135deg, var(--purple), var(--teal));
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
}

.message.ai-message .message-avatar {
  background: linear-gradient(135deg, var(--gold), #a0522d);
  font-size: 1rem;
}

.message-bubble {
  max-width: calc(100% - 60px);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.7;
}

.message.user-message .message-bubble {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  color: white;
  border-bottom-right-radius: 4px;
}

.message.ai-message .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

/* AI message markdown styles */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
  color: var(--gold-light);
}

.message-bubble h2:first-child, .message-bubble h3:first-child {
  margin-top: 0;
}

.message-bubble strong {
  color: var(--gold-light);
  font-weight: 600;
}

.message-bubble p {
  margin-bottom: 10px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul, .message-bubble ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

.message.ai-message .message-time {
  text-align: left;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Suggested questions */
.suggested-questions {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.suggested-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.suggested-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggested-btn {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
  line-height: 1.4;
}

.suggested-btn:hover {
  border-color: var(--purple);
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.08);
}

/* Chat input */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.chat-input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.93rem;
  font-family: inherit;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  line-height: 1.5;
  outline: none;
  transition: border-color var(--transition);
  overflow-y: auto;
}

.chat-input:focus {
  border-color: var(--purple);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── History Page ─── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.history-item:hover {
  border-color: var(--border-hover);
  transform: translateX(3px);
}

.history-icon {
  font-size: 1.8rem;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

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

.history-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Profile Page ─── */
.profile-layout {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
}

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

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.profile-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--gold-light);
}

/* ─── Compatibility Page ─── */
.compat-layout {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px;
}

.compat-persons {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 32px;
}

.compat-vs {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
}

.compat-person-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.compat-person-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compat-result {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
}

.compat-score {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

/* ─── Comments Section ─── */
.comments-section {
  margin-top: 40px;
}

.comments-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.comment-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.comment-form-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.resonance-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.resonance-btn {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.resonance-btn:hover { border-color: var(--purple); color: var(--purple-light); }
.resonance-btn.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--purple);
  color: var(--purple-light);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comment-author {
  font-size: 0.9rem;
  font-weight: 600;
}

.comment-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
}

.comment-resonance-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-light);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.comment-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Star Rating Input ─── */
.star-input {
  display: flex;
  gap: 4px;
}

.star-input-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  padding: 2px;
  line-height: 1;
}

.star-input-btn.active,
.star-input-btn:hover {
  color: var(--gold);
  transform: scale(1.1);
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-size: 0.9rem;
  color: var(--text-primary);
  max-width: 320px;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(244, 63, 94, 0.4); }
.toast.info { border-color: rgba(139, 92, 246, 0.4); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Loading State ─── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 60px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-text {
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ─── Share Banner ─── */
.share-banner {
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.share-link {
  flex: 1;
  word-break: break-all;
  color: var(--gold);
  font-size: 0.82rem;
}

/* ─── Badge ─── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple-light);
}

.badge-gold {
  background: rgba(201, 169, 110, 0.15);
  color: var(--gold-light);
}

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

/* ─── Misc Utils ─── */
.text-center { text-align: center; }
.text-gold { color: var(--gold-light); }
.text-purple { color: var(--purple-light); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--emerald); }
.text-danger { color: var(--rose); }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.prose strong { color: var(--gold-light); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .fortune-layout {
    grid-template-columns: 260px 1fr;
  }
}

@media (max-width: 768px) {
  .fortune-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 64px);
  }

  .fortune-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 12px;
  }

  .sidebar-system {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding-bottom: 0;
    border-bottom: none;
  }

  .sidebar-system-icon { font-size: 2rem; margin-bottom: 0; }

  .sidebar-categories { display: none; }
  .sidebar-actions { display: none; }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .compat-persons {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .modal {
    padding: 24px;
  }

  .section {
    padding: 24px 16px 40px;
  }

  .hero {
    padding: 40px 16px 40px;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0 16px;
  }

  .nav-link { display: none; }

  .systems-grid {
    grid-template-columns: 1fr;
  }
}
