:root {
  --bg-deep: #0d0d1a;
  --bg-card: #161628;
  --bg-card-hover: #1e1e38;
  --accent-gold: #f0c040;
  --accent-blue: #4a9eff;
  --accent-green: #3ddc84;
  --accent-pink: #ff6eb4;
  --accent-red: #ff4757;
  --accent-purple: #a855f7;
  --accent-cyan: #22d3ee;
  --text-primary: #e8e6f0;
  --text-muted: #8888aa;
  --border-subtle: rgba(255,255,255,0.06);
}

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

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
}

@keyframes floatUp {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.7; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(240,192,64,0.3); }
  50% { box-shadow: 0 0 40px rgba(240,192,64,0.6); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(60px) rotate(720deg); opacity: 0; }
}

@keyframes statChange {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.animate-fadeInUp {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slideInRight {
  animation: slideInRight 0.4s ease forwards;
}

.animate-shake {
  animation: shake 0.5s ease;
}

.animate-pulse-glow {
  animation: pulseGlow 2s infinite;
}

.animate-stat {
  animation: statChange 0.4s ease;
}

.floating-emoji {
  position: absolute;
  font-size: 24px;
  animation: floatUp linear infinite;
  pointer-events: none;
  z-index: 0;
}

.stat-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
  transition: all 0.2s ease;
}

.card:hover {
  background: var(--bg-card-hover);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #e6a800);
  color: #1a1a2e;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Bricolage Grotesque', sans-serif;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(240,192,64,0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Bricolage Grotesque', sans-serif;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.nav-btn .emoji {
  font-size: 20px;
}

input, select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Bricolage Grotesque', sans-serif;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  border-color: var(--accent-gold);
}

select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 20px 20px 0 0;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 70vh;
  overflow-y: auto;
  animation: fadeInUp 0.3s ease;
}

.event-card {
  border-left: 3px solid var(--accent-purple);
  margin-bottom: 12px;
}

.event-card.positive { border-left-color: var(--accent-green); }
.event-card.negative { border-left-color: var(--accent-red); }
.event-card.neutral { border-left-color: var(--accent-blue); }
.event-card.romantic { border-left-color: var(--accent-pink); }
.event-card.golden { border-left-color: var(--accent-gold); }

.scrollbar-thin::-webkit-scrollbar { width: 4px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.family-tier-card {
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}
.family-tier-card:hover {
  transform: translateY(-2px);
}
.family-tier-card.selected {
  border-color: var(--accent-gold);
  background: rgba(240,192,64,0.1);
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 1.5s ease forwards;
  pointer-events: none;
  z-index: 200;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s;
}
.footer-link:hover {
  color: var(--accent-gold);
}

.event-card.historical {
  border-left-color: var(--accent-gold);
  background: rgba(240,192,64,0.03);
}

.ai-event {
  border-left-color: var(--accent-cyan);
}

@keyframes aiPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ai-loading {
  animation: aiPulse 1.5s infinite;
}

.rel-card-description {
  border-left: 2px solid rgba(255,255,255,0.08);
  padding-left: 8px;
  margin-top: 6px;
}

textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Bricolage Grotesque', sans-serif;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent-gold);
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* 18+ Toggle Switch */
.nsfw-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.nsfw-toggle-wrapper:hover {
  background: rgba(255,255,255,0.04);
}

.nsfw-toggle-wrapper.active {
  background: rgba(255, 71, 87, 0.1);
  border-color: rgba(255, 71, 87, 0.3);
}

.nsfw-toggle-label {
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  transition: color 0.3s;
}

.nsfw-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.nsfw-toggle-track.active {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  box-shadow: 0 0 12px rgba(255, 71, 87, 0.4);
}

.nsfw-toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.nsfw-toggle-thumb.active {
  left: 18px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(255, 71, 87, 0.5);
}

@keyframes nsfwPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 71, 87, 0.2); }
  50% { box-shadow: 0 0 16px rgba(255, 71, 87, 0.5); }
}

.nsfw-active-badge {
  animation: nsfwPulse 2s infinite;
}

/* Relationship card styles */
.rel-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.event-card .text-sm {
  white-space: pre-line;
}

.milestone-event {
  border-left-color: var(--accent-gold) !important;
  background: rgba(240, 192, 64, 0.03);
}

.milestone-event .text-sm {
  line-height: 1.7;
}

@keyframes milestoneGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(240, 192, 64, 0.1); }
  50% { box-shadow: 0 0 16px rgba(240, 192, 64, 0.25); }
}

.milestone-event {
  animation: milestoneGlow 3s infinite;
}