/* ===========================================================================
   HoroConsultant — Imperial White & Red Chinese FengShui Theme (style.css)
   Inspired by modern Chinese Metaphysics & BaZi FengShuiX aesthetic
   =========================================================================== */

:root {
  --bg-dark: #f8fafc;
  --bg-body: #ffffff;
  --bg-card: #ffffff;
  --bg-card-header: #fef2f2;
  --border-glass: #fee2e2;
  --border-subtle: #64748b;
  --border-glow: rgba(220, 38, 38, 0.4);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-gold: #b91c1c;
  --text-red: #dc2626;

  /* 5 Elements Palette (High Contrast on White) */
  --color-wood: #16a34a;   /* Forest / Jade Green */
  --color-fire: #dc2626;   /* Imperial Crimson Red */
  --color-earth: #d97706;  /* Golden Ochre Amber */
  --color-metal: #475569;  /* Noble Titanium Slate */
  --color-water: #2563eb;  /* Royal Ocean Blue */

  --gradient-gold: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  --gradient-red: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  --gradient-rose: linear-gradient(135deg, #ef4444 0%, #e11d48 100%);
  --gradient-purple: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  --gradient-header: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%);
  
  --radius-lg: 14px;
  --radius-md: 8px;
  --shadow-glow: 0 4px 20px -2px rgba(220, 38, 38, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(220, 38, 38, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', 'Outfit', 'Kanit', sans-serif;
}

svg, svg * {
  box-sizing: content-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.calculation-blocker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  z-index: 1000;
}

.calculation-blocker-card {
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  width: min(92vw, 520px);
  transform: translate(-50%, -50%);
  padding: 1.4rem;
  border: 2px solid #dc2626;
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.calculation-blocker-card h2 { color: #b91c1c; margin-bottom: 0.7rem; }
.calculation-blocker-card p { margin: 0.45rem 0; }
.calculation-blocker-critical { color: #b91c1c; font-weight: 700; }
.calculation-blocker-meta { color: #64748b; font-size: 0.78rem; word-break: break-word; }
.calculation-blocker-actions { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.calculation-blocker-actions a { text-decoration: none; }

.background-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  background: radial-gradient(circle at 20% 15%, rgba(220, 38, 38, 0.04) 0%, transparent 45%),
              radial-gradient(circle at 85% 85%, rgba(239, 68, 68, 0.03) 0%, transparent 45%),
              radial-gradient(circle at 50% 50%, rgba(217, 119, 6, 0.02) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.app-header {
  position: relative;
  z-index: 10;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 20px -10px rgba(220, 38, 38, 0.15);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 768px) {
  .app-header {
    padding: 0.85rem 1rem;
  }
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .spa-nav {
    width: 100%;
    justify-content: space-around;
  }
  .spa-nav-item {
    flex: 1;
    text-align: center;
  }
}

.spa-nav {
  display: flex;
  gap: 0.5rem;
  background: #f8fafc;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.spa-nav-item {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.spa-nav-item:hover, .spa-nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.lang-switcher {
  display: flex;
  gap: 4px;
  background: #f8fafc;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  align-items: center;
}

.lang-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: #b91c1c;
  background: #fee2e2;
}

.lang-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.sky-clock-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}

.sky-clock-icon {
  font-size: 1.1rem;
}

.sky-clock-text {
  display: flex;
  flex-direction: column;
}

.sky-clock-label {
  font-size: 0.68rem;
  color: #991b1b;
  font-weight: 600;
}

.sky-clock-pillars {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #dc2626;
  letter-spacing: 0.5px;
}

/* Timeline Scrubber & Aspect Cards */
.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #cbd5e1;
  outline: none;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc2626;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.timeline-aspects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.aspect-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.aspect-card.aspect-favorable {
  border-color: #86efac;
  background: #f0fdf4;
}

.aspect-card.aspect-caution {
  border-color: #fca5a5;
  background: #fef2f2;
}

.aspect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.aspect-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.aspect-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.aspect-badge.favorable {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.aspect-badge.caution {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.aspect-desc {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.4;
}

/* Voice Engine & Audio Player Styles */
.btn-voice-mic {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-voice-mic:hover {
  background: #fee2e2;
  color: #991b1b;
}

.btn-voice-mic.listening {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  animation: pulseMic 1.2s infinite alternate;
}

@keyframes pulseMic {
  from { box-shadow: 0 0 4px rgba(220, 38, 38, 0.4); }
  to { box-shadow: 0 0 14px rgba(220, 38, 38, 0.8); }
}

.btn-voice-listen {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-voice-listen:hover {
  background: #fee2e2;
  color: #7f1d1d;
}

.audio-player-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #fee2e2;
  box-shadow: 0 10px 30px -5px rgba(220, 38, 38, 0.25), 0 0 10px rgba(0, 0, 0, 0.05);
  border-radius: 30px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  z-index: 1000;
  max-width: 90vw;
  width: 520px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: #0f172a;
}

@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.audio-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.voice-status-text {
  font-size: 0.8rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.waveform-container {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.waveform-bar {
  width: 3px;
  height: 4px;
  background: #dc2626;
  border-radius: 2px;
}

.waveform-bar.animating {
  animation: soundWave 0.8s infinite ease-in-out alternate;
}

.waveform-bar:nth-child(1) { animation-delay: 0.1s; }
.waveform-bar:nth-child(2) { animation-delay: 0.3s; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { animation-delay: 0.4s; }
.waveform-bar:nth-child(5) { animation-delay: 0.25s; }

@keyframes soundWave {
  0% { height: 4px; }
  100% { height: 16px; }
}

.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-ctrl-btn {
  background: #f8fafc;
  border: 1px solid #64748b;
  color: #dc2626;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.voice-ctrl-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.voice-speed-selector {
  display: flex;
  gap: 2px;
  background: #64748b;
  padding: 2px;
  border-radius: 12px;
  border: 1px solid #64748b;
}

.voice-speed-selector .speed-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.voice-speed-selector .speed-btn.active {
  background: #dc2626;
  color: #ffffff;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
}

.app-header h1 span {
  background: linear-gradient(135deg, #dc2626, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #166534;
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.status-badge:hover {
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.2);
  transform: translateY(-1px);
}

.status-badge.health-badge {
  background: #f0f9ff;
  border: 1px solid #7dd3fc;
  color: #0369a1;
}

.status-badge.health-badge:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.status-badge.health-badge.amber-badge {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

.status-badge.health-badge.amber-badge:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.backend-status {
  min-height: 1.5rem;
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
}

.backend-status[data-state="waking"],
.backend-status[data-state="processing"] {
  color: #d97706;
}

.backend-status[data-state="unavailable"],
.backend-status[data-state="error"] {
  color: #dc2626;
}

.backend-status[data-state="complete"] {
  color: #16a34a;
}

.btn-retry {
  width: 100%;
  margin-top: 0.65rem;
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--color-wood);
  box-shadow: 0 0 8px var(--color-wood);
  animation: pulse 2s infinite;
}

.pulse-dot.cyan {
  background-color: #0284c7;
  box-shadow: 0 0 8px #0284c7;
  animation: pulse-cyan 2s infinite;
}

.pulse-dot.amber {
  background-color: #d97706;
  box-shadow: 0 0 8px #d97706;
  animation: pulse-amber 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@keyframes pulse-cyan {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(2, 132, 199, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

@keyframes pulse-amber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* Main Layout */
.main-container {
  position: relative;
  z-index: 5;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 2rem;
  width: 100%;
}

.main-container > * {
  min-width: 0;
  max-width: 100%;
}

.form-section, .results-section {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 0 0.75rem;
    margin: 1rem auto;
    gap: 1.25rem;
  }
}

/* Cards & Glassmorphism (White Card with Imperial Red Top Accent) */
.glass-card, .card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-top: 3px solid #dc2626;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .glass-card, .card {
    padding: 1.1rem;
    border-radius: var(--radius-md);
  }
}

.glass-card:hover, .card:hover {
  border-color: #fca5a5;
  box-shadow: 0 6px 24px -2px rgba(220, 38, 38, 0.12), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
}

.card-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.card-header h2, .card-header h3 {
  font-size: 1.25rem;
  color: #991b1b;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #334155;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #0f172a;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus {
  border-color: #dc2626;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-group select,
.form-group .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.95rem;
  outline: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select:focus {
  border-color: #dc2626;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-help {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.35;
}

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

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Switch Toggle */
.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.switch-label input {
  display: none;
}

.slider {
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  background-color: #cbd5e1;
  border-radius: 20px;
  position: relative;
  transition: 0.3s;
}

.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: #dc2626;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.label-text {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.4;
  word-break: break-word;
}

/* Buttons (FengShuiX Crimson CTA) */
.btn-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px -3px rgba(220, 38, 38, 0.4);
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  box-shadow: 0 6px 20px -3px rgba(220, 38, 38, 0.5);
}

.preset-buttons {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: #334155;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sm:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* Loading Spinner & Animations */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(220, 38, 38, 0.2);
  border-top-color: #dc2626;
  border-right-color: #dc2626;
  border-radius: 50%;
  animation: spin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

.spinner-gold {
  border: 2px solid rgba(220, 38, 38, 0.2);
  border-top-color: #dc2626;
  border-right-color: #dc2626;
}

.spinner-cyan {
  border: 2px solid rgba(2, 132, 199, 0.2);
  border-top-color: #0284c7;
  border-right-color: #0284c7;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.btn-primary:disabled,
.btn-sm:disabled {
  opacity: 0.75;
  cursor: wait;
  transform: none;
}

/* Loading Card Pulse Animation */
.loading-pulse {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

.loading-pulse .spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
  border: 3px solid rgba(220, 38, 38, 0.2);
  border-top-color: #dc2626;
  border-right-color: #b91c1c;
}

/* Global API Loader */
.global-api-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.global-api-loader-panel {
  padding: 1.25rem 1.75rem;
  border-radius: 14px;
  border: 1px solid #fecaca;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(220, 38, 38, 0.15);
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.global-api-loader .spinner {
  width: 24px;
  height: 24px;
  border-top-color: #dc2626;
  border-right-color: #dc2626;
}

/* Results Layout */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hidden {
  display: none !important;
}

/* 4 Pillars Grid */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pillar-col {
  background: #ffffff;
  border: 1px solid var(--border-glass);
  border-top: 3px solid #dc2626;
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.pillar-title {
  font-size: 0.8rem;
  color: #991b1b;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.char-box {
  padding: 0.75rem 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
}

.stem-box {
  background: #fef2f2;
  border-color: #fecaca;
}

.branch-box {
  background: #fff7ed;
  border-color: #ffedd5;
}

.cn-char {
  font-size: 1.85rem;
  font-weight: 800;
  display: block;
  color: #0f172a;
}

.th-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.element-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-top: 0.25rem;
  display: inline-block;
  font-weight: 600;
}

/* Element specific tags */
.tag-Wood  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.tag-Fire  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.tag-Earth { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.tag-Metal { background: #64748b; color: #334155; border: 1px solid #cbd5e1; }
.tag-Water { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

/* Hidden Stems List */
.hidden-stems-list {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.day-master-banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* 5 Elements Progress Bars */
.elements-bars {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.element-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.progress-track {
  height: 10px;
  background: #64748b;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #64748b;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-Wood  { background: var(--color-wood); }
.fill-Fire  { background: var(--color-fire); }
.fill-Earth { background: var(--color-earth); }
.fill-Metal { background: var(--color-metal); }
.fill-Water { background: var(--color-water); }

/* Tabs */
.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #fef2f2;
  color: #991b1b;
  border-bottom: 2px solid #dc2626;
}

.reading-body {
  line-height: 1.75;
  font-size: 0.95rem;
  color: #1e293b;
  white-space: pre-line;
  background: #ffffff;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
}

.validator-box {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  margin-top: 0.75rem;
}

.app-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-glass);
  margin-top: 3.5rem;
  background: #ffffff;
  text-align: center;
}

.footer-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 900px;
}

.btn-force-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
  user-select: none;
  touch-action: manipulation;
}

.btn-force-refresh:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.btn-force-refresh:active {
  transform: scale(0.97);
}

.btn-force-refresh:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

@media (max-width: 768px) {
  .footer-status-bar {
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
  }
  .footer-status-bar .status-badge,
  .btn-force-refresh {
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }
}

/* Flatpickr Custom Theme for White & Red */
.flatpickr-calendar {
  background: #ffffff !important;
  border: 1px solid #fee2e2 !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 12px 36px rgba(220, 38, 38, 0.15) !important;
  color: #0f172a !important;
  font-family: inherit !important;
}

.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after {
  border-bottom-color: #ffffff !important;
}

.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
  border-top-color: #ffffff !important;
}

.flatpickr-months {
  background: #fef2f2 !important;
  border-bottom: 1px solid #fee2e2 !important;
}

.flatpickr-months .flatpickr-month {
  color: #991b1b !important;
  fill: #991b1b !important;
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after {
  border-bottom-color: #dc2626 !important;
}

.flatpickr-current-month .numInputWrapper span.arrowDown:after {
  border-top-color: #dc2626 !important;
}

span.flatpickr-weekday {
  color: #dc2626 !important;
  font-weight: 700 !important;
}

.flatpickr-day {
  color: #334155 !important;
  border-radius: 6px !important;
}

.flatpickr-day:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #991b1b !important;
}

.flatpickr-day.today {
  border-color: #dc2626 !important;
  color: #dc2626 !important;
  font-weight: 700 !important;
}

.flatpickr-day.selected {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  font-weight: bold !important;
}

.flatpickr-time {
  border-top: 1px solid #fee2e2 !important;
  background: #f8fafc !important;
}

.flatpickr-time input {
  color: #dc2626 !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
}

.flatpickr-time .flatpickr-time-separator {
  color: #94a3b8 !important;
}

/* Bottom-Sheet Drum Wheel DateTime Picker (White & Red) */
.datetime-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  width: 100%;
  box-sizing: border-box;
}

.datetime-picker-wrapper:hover {
  border-color: #dc2626;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.12);
  background: #ffffff;
}

.datetime-picker-wrapper input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #dc2626 !important;
  font-family: inherit !important;
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  padding: 0.5rem 0.4rem !important;
  width: 100% !important;
  cursor: pointer !important;
}

.picker-icon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.65rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

/* Modal Backdrop */
.wheel-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wheel-picker-backdrop.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Bottom Sheet Container */
.wheel-picker-sheet {
  width: 100%;
  max-width: 600px;
  background: #ffffff !important;
  border: 1px solid #fee2e2 !important;
  border-bottom: none !important;
  border-radius: 24px 24px 0 0 !important;
  padding: 1.25rem 1rem 2rem 1rem !important;
  box-shadow: 0 -12px 48px rgba(220, 38, 38, 0.2) !important;
  animation: slideUpWheelSheet 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-sizing: border-box;
}

@keyframes slideUpWheelSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.wheel-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 0.75rem;
}

.wheel-picker-btn {
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.wheel-picker-btn:active {
  transform: scale(0.95);
}

.btn-cancel {
  background: transparent;
  color: #64748b;
  padding: 0.4rem 0.8rem;
  font-weight: 600;
}

.btn-confirm {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  padding: 0.45rem 1.3rem;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.35);
}

.wheel-picker-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title-main {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.title-sub {
  font-size: 0.82rem;
  color: #dc2626;
  font-family: monospace;
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.wheel-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  scrollbar-width: none;
}

.wheel-quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-pill {
  padding: 0.3rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.quick-pill:hover, .quick-pill:active {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.wheel-picker-body {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 220px;
  overflow: hidden;
  user-select: none;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

.wheel-selection-lens {
  position: absolute;
  top: 88px;
  left: 0;
  right: 0;
  height: 44px;
  background: rgba(220, 38, 38, 0.08);
  border-top: 1px solid #dc2626;
  border-bottom: 1px solid #dc2626;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.1);
}

.wheel-col-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  position: relative;
  z-index: 5;
}

.wheel-col-label {
  text-align: center;
  font-size: 0.68rem;
  color: #64748b;
  padding: 4px 0 2px 0;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
}

.wheel-col-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #dc2626;
  padding: 0 2px;
  padding-top: 20px;
  pointer-events: none;
}

.wheel-column {
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 88px 0;
  box-sizing: border-box;
  text-align: center;
}

.wheel-column::-webkit-scrollbar {
  display: none;
}

.wheel-item {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  font-size: 0.95rem;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease, font-weight 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

.wheel-item.active {
  color: #dc2626 !important;
  font-weight: 700 !important;
  font-size: 1.05rem !important;
  transform: scale(1.06);
}

/* FengShuiX Gender Segmented Control */
.block-label {
  display: block;
  font-size: 0.85rem;
  color: #334155;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.badge-hint {
  font-size: 0.72rem;
  color: #dc2626;
  font-weight: normal;
  margin-left: 4px;
}

.gender-segmented-control {
  display: flex;
  gap: 10px;
  width: 100%;
}

.gender-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  user-select: none;
}

.gender-option input {
  display: none;
}

.gender-option.active {
  background: #fef2f2;
  border: 1.5px solid #dc2626;
  color: #b91c1c;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.12);
}

.gender-option:hover {
  border-color: #fca5a5;
  color: #991b1b;
}

.gender-icon {
  font-size: 1.1rem;
}

.label-with-addon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.label-with-addon label {
  margin-bottom: 0;
}

.be-year-badge {
  font-size: 0.78rem;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}

.checkbox-row-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 0.5rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #475569;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.checkbox-inline input {
  accent-color: #dc2626;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Advanced Settings Accordion */
.advanced-accordion {
  margin: 0.8rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.advanced-accordion:hover {
  border-color: #fca5a5;
}

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: transparent;
  border: none;
  color: #334155;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.accordion-toggle:hover {
  background: #fef2f2;
  color: #991b1b;
}

.accordion-icon {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.75rem;
  color: #64748b;
}

.accordion-icon.open {
  transform: rotate(180deg);
  color: #dc2626;
}

.accordion-content {
  padding: 0.5rem 0.9rem 0.9rem 0.9rem;
  border-top: 1px solid var(--border-subtle);
  background: #ffffff;
}

/* 5 Elements Breakdown */
.element-balance-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  margin: 0.75rem 0;
  border: 1px solid #64748b;
  background: #64748b;
}

.element-bar-segment {
  height: 100%;
  transition: width 0.4s ease;
  position: relative;
}

.element-legend-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 0.6rem;
  text-align: center;
}

.element-legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.2rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.element-legend-item .el-name {
  font-weight: 700;
}

.element-legend-item .el-pct {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* Luck Pillars da-yun track */
.dayun-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
}

.dayun-card {
  flex: 0 0 72px;
  background: #ffffff;
  border: 1px solid var(--border-glass);
  border-top: 3px solid #dc2626;
  border-radius: 8px;
  padding: 0.5rem 0.3rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.dayun-card:hover {
  transform: translateY(-2px);
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.dayun-age {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 2px;
  font-weight: 500;
}

.dayun-stem-branch {
  font-size: 1rem;
  font-weight: 700;
  color: #dc2626;
}

/* 16 Disciplines Grid */
.disciplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin: 1rem 0;
}

.btn-discipline {
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-discipline:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-discipline.active {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* Tool Buttons & Tags */
.btn-tool {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  color: #334155;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.btn-tool.active {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-purple { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-green  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-amber  { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-red    { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Calendar View Styles */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #dc2626;
  padding: 4px 0;
}

.calendar-cell {
  background: #ffffff;
  border: 1px solid #64748b;
  border-radius: 8px;
  padding: 6px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  cursor: pointer;
}

.calendar-cell:hover {
  border-color: #dc2626;
  background: #fef2f2;
}

.calendar-cell.auspicious-day {
  background: #f0fdf4;
  border-color: #86efac;
}

.calendar-cell.inauspicious-day {
  background: #fef2f2;
  border-color: #fca5a5;
}

.cell-day-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.cell-badge {
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
}

/* LuoPan & Heatmap Styles */
.luopan-compass-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
}

.heatmap-grid-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.heatmap-sector-box {
  background: #ffffff;
  border: 1px solid #64748b;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.heatmap-sector-box:hover {
  transform: translateY(-2px);
  border-color: #dc2626;
}

.heatmap-sector-box.sector-wealth {
  border: 2px solid #16a34a;
  background: #f0fdf4;
}

.heatmap-sector-box.sector-calamity {
  border: 2px solid #dc2626;
  background: #fef2f2;
}

.sector-direction {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.sector-stars {
  font-size: 1rem;
  font-weight: 800;
  margin: 4px 0;
}

.sector-cure {
  font-size: 0.72rem;
  color: #0284c7;
  font-weight: 500;
}

/* Dream Decoder Styles */
.btn-dream-tag {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dream-tag:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.lucky-number-badge {
  display: inline-block;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 12px;
  margin-right: 4px;
}

/* Life Path Scenario Simulation Styles */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.sim-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.sim-card:hover {
  transform: translateY(-2px);
  border-color: #dc2626;
}

.sim-card.optimal-choice {
  border: 2px solid #16a34a;
  background: #f0fdf4;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.15);
}

.sim-badge-optimal {
  position: absolute;
  top: -10px;
  right: 12px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.metric-bar-wrapper {
  margin-bottom: 4px;
}

.metric-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #475569;
  font-weight: 600;
  margin-bottom: 2px;
}

.metric-bar-bg {
  height: 6px;
  background: #64748b;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #64748b;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ==========================================================================
   Consultation Report Print & PDF Export Styles
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm 15mm 15mm;
  }

  *, *::before, *::after {
    background: transparent !important;
    color: #0f172a !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  .background-glow,
  .app-header,
  .form-section,
  .app-footer,
  .tab-buttons,
  .btn-primary,
  .preset-buttons,
  .audio-player-bar,
  .global-api-loader,
  .btn-tool,
  .wheel-picker-backdrop,
  #version-update-toast {
    display: none !important;
  }

  .main-container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .results-section {
    display: block !important;
    width: 100% !important;
  }

  .glass-card, .card {
    border: 1px solid #64748b !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    page-break-inside: avoid;
  }

  .pillars-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
  }

  .pillar-col {
    border: 1px solid #cbd5e1 !important;
    padding: 8px !important;
  }

  .reading-body {
    color: #0f172a !important;
    font-size: 10.5pt !important;
  }

  .consultation-report-header {
    display: block !important;
    border-bottom: 2px solid #dc2626 !important;
    padding-bottom: 8px !important;
    margin-bottom: 16px !important;
  }
}

/* ==========================================================================
   14. METAPHYSICS AI LIVE CONSULTANT CHAT ASSISTANT
   ========================================================================== */
.chat-launcher-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.35);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.chat-launcher-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 26px rgba(220, 38, 38, 0.45);
}

.chat-launcher-icon {
  font-size: 1.2rem;
}

.chat-pulse-badge {
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulseLive 2s infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.95); }
}

/* Floating Slide-Out Drawer */
.floating-chat-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 48px);
  background: #ffffff;
  border: 1px solid #fee2e2;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(220, 38, 38, 0.15), 0 4px 16px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  animation: drawerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Fullscreen Mode */
.floating-chat-drawer.fullscreen {
  inset: 16px;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  border-radius: 20px;
}

/* Co-Pilot Split-Screen Mode */
.floating-chat-drawer.copilot {
  position: fixed;
  top: 70px;
  right: 16px;
  bottom: 16px;
  width: 460px;
  height: auto;
  max-height: none;
}

/* Drawer Header */
.chat-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fef2f2;
  border-bottom: 1px solid #fee2e2;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-logo {
  font-size: 1.4rem;
}

.chat-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.chat-header-sub {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-tool-btn {
  background: #ffffff;
  border: 1px solid #64748b;
  color: #475569;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-tool-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

.chat-close-btn {
  font-weight: 700;
  color: #64748b;
}

/* Context Bar */
.chat-context-bar {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #64748b;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ctx-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.ctx-pill.dm {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #b91c1c;
}

.ctx-pill.fav {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  color: #16a34a;
}

.ctx-pill.stars {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #2563eb;
}

/* Messages Container */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: fadeInMsg 0.2s ease;
}

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

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-msg.user .chat-msg-avatar {
  background: #eff6ff;
  border-color: #dbeafe;
}

.chat-msg-body {
  background: #f8fafc;
  border: 1px solid #64748b;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #0f172a;
}

.chat-msg.user .chat-msg-body {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border: none;
}

.chat-citation-card {
  margin-top: 10px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #fee2e2;
  border-left: 3px solid #dc2626;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #334155;
}

.chat-citation-title {
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 2px;
}

/* Dynamic Prompt Pills */
.chat-pills-section {
  padding: 8px 14px;
  background: #fef2f2;
  border-top: 1px solid #fee2e2;
  flex-shrink: 0;
}

.chat-pills-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 6px;
}

.chat-pills-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.prompt-pill {
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.prompt-pill:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Input Area */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #64748b;
  align-items: center;
  flex-shrink: 0;
}

.chat-input-field {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-field:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.chat-send-btn {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

/* Footer */
.chat-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #f8fafc;
  border-top: 1px solid #64748b;
  font-size: 0.7rem;
  color: #64748b;
  flex-shrink: 0;
}

.chat-export-group {
  display: flex;
  gap: 4px;
}

.chat-export-btn {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  cursor: pointer;
}

.chat-export-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ============================================================
   ACCORDION CARD SYSTEM — Collapsible Result Sections
   ============================================================ */

.accordion-card {
  overflow: hidden;
}

.accordion-card-header {
  width: 100%;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card-header);
  border: none;
  text-align: left;
  padding: 1rem 1.2rem;
  gap: 12px;
  border-bottom: 1px solid var(--border-glass);
  transition: background 0.2s ease;
  border-radius: 0;
}

.accordion-card-header:hover {
  background: rgba(220, 38, 38, 0.06);
}

.accordion-card-header .acc-header-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.acc-chevron {
  font-size: 0.75rem;
  color: #dc2626;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.1);
}

.accordion-card-header[aria-expanded="false"] .acc-chevron {
  transform: rotate(180deg);
}

.accordion-card-header[aria-expanded="false"] {
  border-bottom-color: transparent;
  border-radius: var(--radius-lg);
}

.accordion-card-body {
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  max-height: 5000px;
  opacity: 1;
}

.accordion-card-body.acc-collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

/* ============================================================
   TEXT COLOR CONTRAST FIXES — WCAG AA Compliance
   ============================================================ */

/* Dream result box — white bg needs dark text */
.dream-result-box {
  color: #1e293b !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  border-radius: 8px;
  padding: 12px;
}

/* General AI output content — ensure readable on white */
.reading-body,
.validator-body,
.rag-body {
  color: var(--text-primary);
}

/* Secondary/muted text — minimum 4.5:1 on white */
.text-muted-readable {
  color: #475569;
}

/* Pillar cell color fix */
.char-han {
  color: #0f172a;
}

/* ============================================================
   COMPREHENSIVE CONTRAST FIX — v2 (WCAG AA+ on White Theme)
   ============================================================ */

/* Discipline action buttons — colorful but readable on white card bg */
.btn-sm[style*="rgba(245, 158, 11"] { color: #92400e !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(168, 85, 247"] { color: #6b21a8 !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(59, 130, 246"] { color: #1d4ed8 !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(34, 197, 94"]  { color: #166534 !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(236, 72, 153"] { color: #9d174d !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(14, 165, 233"] { color: #0369a1 !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(234, 179, 8"]  { color: #78350f !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(20, 184, 166"] { color: #134e4a !important; font-weight: 600 !important; }
.btn-sm[style*="rgba(99, 102, 241"] { color: #312e81 !important; font-weight: 600 !important; }

/* Scenario checkboxes labels */
.scenario-label, label[style*="color: #cbd5e1"] {
  color: #334155 !important;
}

/* Timeline & age scrubber labels */
label[for="timeline-age-slider"] { color: #92400e !important; }
#timeline-slider-display { color: #0369a1 !important; }

/* Synastry title */
strong[data-i18n="synastry_mode_title"] { color: #9d174d !important; }

/* Loading text */
.global-api-loader-panel span { color: #1e293b !important; }

/* ============================================================
   STRICT MONOCHROME & WCAG AAA THEME CONTRAST RULES
   ============================================================ */

/* Simulation Cards & Optimal Choice (Light Green Card) */
.sim-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

.sim-card h4 {
  color: #475569 !important;
  font-weight: 700 !important;
}

.sim-card.optimal-choice {
  border: 2px solid #16a34a !important;
  background: #f0fdf4 !important;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.12) !important;
}

.sim-card.optimal-choice h4 {
  color: #475569 !important;
}

.sim-badge-optimal {
  background: linear-gradient(135deg, #15803d, #166534) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

.metric-bar-label {
  color: #334155 !important;
  font-weight: 600 !important;
}

/* Dream Result Container */
.dream-result-box h4 {
  color: #6b21a8 !important;
  font-weight: 700 !important;
}

.dream-result-box div,
.dream-result-box p {
  color: #0f172a !important;
}

/* Branch & Visualizer Result Body */
#branch-body {
  color: #0f172a !important;
}

#branch-body h4,
#branch-body h5 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

#branch-body p,
#branch-body div,
#branch-body span,
#branch-body td,
#branch-body th {
  color: #1e293b;
}

/* Form Controls High Contrast */
.form-group label {
  color: #0f172a !important;
  font-weight: 600 !important;
}

.form-help {
  color: #475569 !important;
}
