/* ==========================================================================
   CSS Stylesheet for Thai Life Graph Web App (เว็บแอปพลิเคชันดูดวงกราฟชีวิต)
   Theme: Celestial Mystical Thai Astrology (ห้วงอวกาศดวงดาว ผสานลวดลายทองคำสวรรค์)
   Version: 1.2.0
   ========================================================================== */

:root {
  --bg-dark: #070B14;
  --bg-surface: #0E1626;
  --bg-card: rgba(18, 28, 48, 0.72);
  --bg-card-hover: rgba(26, 39, 65, 0.85);
  
  --gold-primary: #F59E0B;
  --gold-glow: rgba(245, 158, 11, 0.4);
  --gold-light: #FDE68A;
  --gold-gradient: linear-gradient(135deg, #F59E0B 0%, #FBBF24 50%, #D97706 100%);
  
  --tier-high: #10B981;
  --tier-high-bg: rgba(16, 185, 129, 0.12);
  --tier-good: #38BDF8;
  --tier-good-bg: rgba(56, 189, 248, 0.12);
  --tier-mod: #A855F7;
  --tier-mod-bg: rgba(168, 85, 247, 0.12);
  --tier-low: #F43F5E;
  --tier-low-bg: rgba(244, 63, 94, 0.12);

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.18);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(168, 85, 247, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(56, 189, 248, 0.07) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Update Banner (Toast) */
.update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.3);
  backdrop-filter: blur(12px);
  border-radius: 9999px;
  padding: 8px 18px;
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.update-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-main);
}
.update-icon {
  font-size: 1.1rem;
}
.btn-update {
  background: var(--gold-gradient);
  border: none;
  border-radius: 9999px;
  padding: 5px 14px;
  color: #1E1B18;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-update:hover {
  filter: brightness(1.15);
  transform: scale(1.04);
}
.btn-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
}
.btn-dismiss:hover {
  color: #FFFFFF;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Hero */
.app-header {
  padding: 32px 0 20px;
  text-align: center;
  position: relative;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  font-size: 0.85rem;
  color: var(--gold-light);
  margin-bottom: 14px;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

.brand-title {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FFFFFF 20%, #FDE68A 65%, #F59E0B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto 12px;
}

.quick-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  transform: translateY(-2px);
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease;
}
.glass-card:hover {
  border-color: rgba(245, 158, 11, 0.25);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(10, 16, 28, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: rgba(15, 23, 42, 0.95);
}

.form-select option {
  background: #0F172A;
  color: #F8FAFC;
}

/* Auto-calculated Box */
.auto-calc-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.auto-calc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.auto-calc-label {
  color: var(--text-dim);
}
.auto-calc-val {
  color: var(--gold-light);
  font-weight: 700;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.preset-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.btn-chip {
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-chip:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-primary {
  padding: 12px 28px;
  background: var(--gold-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #1E1B18;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
  filter: brightness(1.08);
}
.btn-primary:active {
  transform: translateY(0);
}

/* User Summary Ribbon */
.summary-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.user-badge-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-astral {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: #1E1B18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 15px var(--gold-glow);
}

.user-names h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}
.user-names p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.stats-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
}
.stat-pill-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}
.stat-pill-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
}

/* Navigation Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.tab-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

/* Chart Section */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 400px;
  margin-bottom: 16px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.4) 0%, rgba(10, 16, 28, 0.8) 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

canvas#lifeGraphCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Interactive Cycle Slider Box (รอบละ 12 ปี) */
.age-slider-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cycle-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.cycle-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cycle-badge-icon {
  font-size: 1.6rem;
}

.cycle-title-wrap h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-light);
}

.cycle-title-wrap p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.cycle-nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cycle-nav {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-cycle-nav:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}
.btn-cycle-nav.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--tier-high);
  color: #34D399;
}

.slider-wrapper {
  width: 100%;
}

.slider-input {
  width: 100%;
  accent-color: var(--gold-primary);
  cursor: pointer;
  height: 6px;
}

.slider-ticks-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-panel.active {
  display: block;
}

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

/* Numerology Table (ตาราง 4 ฐาน) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(10, 16, 28, 0.7);
}

.numerology-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.92rem;
}

.numerology-table th, .numerology-table td {
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.numerology-table th {
  background: rgba(245, 158, 11, 0.1);
  color: var(--gold-light);
  font-weight: 700;
  white-space: nowrap;
}
.numerology-table th.header-row-name {
  text-align: left;
  min-width: 130px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-main);
}

.numerology-table td.cell-header {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.5);
}

.numerology-table tr.row-score {
  background: rgba(245, 158, 11, 0.08);
}
.numerology-table tr.row-score td {
  font-weight: 800;
  font-size: 1.15rem;
}

/* 12 Houses Cards Grid */
.houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.house-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.house-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.house-card.active {
  border-color: var(--gold-primary);
  background: rgba(26, 39, 65, 0.9);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.house-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.house-badge-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.house-badge-name h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}
.house-pali {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1rem;
  color: #FFFFFF;
}

.house-tier-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.house-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 6px;
  line-height: 1.4;
}

.house-card-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail Modal / Slide-in */
.house-detail-view {
  background: rgba(12, 19, 34, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 14px;
  animation: fadeIn 0.3s ease;
}

.spotlight-tag-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-light);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 6px;
  padding: 3px 10px;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.badge-base-chart {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #93C5FD;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 9999px;
  padding: 4px 14px;
  margin-bottom: 6px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-title-group h3 {
  font-size: 1.35rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-pali {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.detail-body {
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 18px;
}

.detail-advice-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--gold-primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--gold-light);
}

/* Compatibility Section */
.couple-score-banner {
  text-align: center;
  padding: 28px 20px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.match-percentage {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #F43F5E, #EC4899, #F59E0B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.match-verdict {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.match-desc {
  max-width: 650px;
  margin: 0 auto;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.aspect-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.aspect-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.aspect-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #F43F5E, #F59E0B);
  transition: width 0.8s ease;
}

/* Lucky Elements Section */
.lucky-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.lucky-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.lucky-card h4 {
  font-size: 1.05rem;
  color: var(--gold-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lucky-list {
  list-style: none;
}
.lucky-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
}
.lucky-list li:last-child {
  border-bottom: none;
}

.lucky-key {
  color: var(--text-muted);
}
.lucky-val {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}

/* Footer with Version Control */
.app-footer {
  text-align: center;
  padding: 32px 0 40px;
  color: var(--text-dim);
  font-size: 0.86rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}

.disclaimer-box {
  max-width: 700px;
  margin: 12px auto 16px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #64748B;
}

.footer-credits {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-credits a {
  color: var(--gold-light);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}
.footer-credits a:hover {
  color: #FFFFFF;
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
.footer-separator {
  color: rgba(255, 255, 255, 0.2);
}

.version-badge-footer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.version-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

/* Subpage Navigation Bar & Back Button */
.subpage-back-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 20px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
}

.btn-back-to-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(245, 158, 11, 0.1) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  color: var(--gold-light);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-back-to-main:hover {
  background: var(--gold-primary);
  color: #070B14;
  transform: translateX(-3px);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
}
.btn-back-to-main .back-icon {
  font-size: 1.15rem;
  transition: transform 0.2s ease;
}
.btn-back-to-main:hover .back-icon {
  transform: translateX(-4px);
}

.subpage-badge {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

.subpage-bottom-bar {
  display: flex;
  justify-content: center;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

/* Mobile & Quick Feature Navigation Menu (หน้าหลัก: กราฟชีวิต) */
.mobile-feature-menu {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
}

.feature-menu-header {
  margin-bottom: 18px;
  text-align: center;
}

.feature-menu-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-light);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 9999px;
  padding: 3px 14px;
  margin-bottom: 6px;
}

.feature-menu-header h4 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 4px;
  font-weight: 700;
}

.feature-menu-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.feature-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.feature-menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 14px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  color: var(--text-main);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  position: relative;
  overflow: hidden;
}

.feature-menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.feature-menu-card:hover {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.03) 100%);
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.16), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.feature-menu-card:hover::before {
  opacity: 1;
}

.feature-menu-card:active {
  transform: translateY(-1px) scale(0.99);
}

.menu-card-icon {
  font-size: 2.2rem;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.08);
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  margin-bottom: 14px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.feature-menu-card:hover .menu-card-icon {
  transform: scale(1.1);
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--gold-light);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.menu-card-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu-card-body h5 {
  font-size: 1.05rem;
  color: var(--gold-light);
  margin: 0 0 6px 0;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.feature-menu-card:hover .menu-card-body h5 {
  color: #FDE68A;
}

.menu-card-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .brand-title {
    font-size: 1.8rem;
  }
  .canvas-container {
    height: 410px;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
  .cycle-slider-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* บน Mobile เมื่ออยู่ในหน้าเฉพาะ ให้ซ่อนฟอร์มและแท็บเพื่อโฟกัสกับเนื้อหาเฉพาะด้าน */
  body.in-subpage .glass-card:has(#horoForm),
  body.in-subpage .ribbon-summary {
    display: none;
  }
  body.in-subpage .tabs-nav {
    display: none;
  }

  .subpage-back-bar {
    position: sticky;
    top: 8px;
    z-index: 40;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(11, 16, 28, 0.95);
    border-color: var(--border-gold);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  }

  .subpage-badge {
    display: none;
  }

  .feature-menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .feature-menu-card {
    padding: 16px 10px 14px;
  }

  .menu-card-icon {
    width: 48px;
    height: 48px;
    font-size: 1.7rem;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .menu-card-body h5 {
    font-size: 0.94rem;
    margin-bottom: 4px;
  }

  .menu-card-body p {
    font-size: 0.75rem;
    line-height: 1.35;
  }
}

@media (max-width: 360px) {
  .feature-menu-grid {
    grid-template-columns: 1fr;
  }
}

/* Floating Toast Notification (แจ้งเตือนคัดลอกลงคลิปบอร์ด / แจ้งเตือนสถานะ) */
.app-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(11, 16, 28, 0.96);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  padding: 10px 24px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 16px rgba(245, 158, 11, 0.25);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Google AdSense Containers */
.ad-container {
  width: 100%;
  margin: 18px 0;
  text-align: center;
  overflow: hidden;
  clear: both;
}

.ad-container ins.adsbygoogle {
  margin: 0 auto;
}

.ad-display {
  margin: 16px 0 20px 0;
}

.ad-in-article {
  margin: 22px 0;
  padding: 8px 0;
}

.ad-multiplex {
  margin: 28px 0 16px 0;
}

/* Print Stylesheet */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 14mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #FFFFFF !important;
    color: #0F172A !important;
    font-size: 10pt;
  }

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

  /* ซ่อนส่วนประกอบ UI ที่ไม่จำเป็นสำหรับการพิมพ์ */
  .ad-container,
  .adsbygoogle,
  .app-header, 
  .tabs-nav, 
  .form-actions, 
  .quick-bar, 
  .age-slider-box, 
  .update-banner,
  .btn-chip,
  .mobile-feature-menu,
  .subpage-back-bar,
  .subpage-bottom-bar,
  .tab-panel:not(.active) {
    display: none !important;
  }

  /* การ์ดข้อมูล (หน้า 1) */
  .glass-card {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    padding: 14px 18px !important;
    margin-bottom: 12px !important;
    color: #0F172A !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .form-title {
    color: #0F172A !important;
    font-size: 1.05rem !important;
    margin-bottom: 10px !important;
  }

  .form-grid {
    gap: 10px !important;
  }

  .form-label {
    color: #475569 !important;
    font-size: 0.82rem !important;
  }

  .form-input, 
  .form-select {
    background: #F8FAFC !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
    font-size: 0.88rem !important;
    padding: 5px 8px !important;
  }

  .auto-calc-box {
    background: #F1F5F9 !important;
    border: 1px solid #E2E8F0 !important;
    padding: 8px 12px !important;
    margin-top: 8px !important;
    border-radius: 6px !important;
  }

  .auto-calc-label {
    color: #64748B !important;
    font-size: 0.8rem !important;
  }

  .auto-calc-val {
    color: #B45309 !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
  }

  /* Ribbon สรุปดวงชะตา (หน้า 1) */
  .ribbon-summary {
    margin-bottom: 0 !important;
  }

  .ribbon-card {
    background: #FFFBEB !important;
    border: 1px solid #FCD34D !important;
    border-radius: 8px !important;
    padding: 14px 18px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .ribbon-title {
    color: #92400E !important;
    font-size: 1.15rem !important;
  }

  .ribbon-subtitle {
    color: #78350F !important;
    font-size: 0.85rem !important;
  }

  .ribbon-stats {
    gap: 12px !important;
  }

  .stat-item {
    border-color: #FDE68A !important;
    padding: 0 10px !important;
  }

  .stat-label {
    color: #64748B !important;
    font-size: 0.72rem !important;
  }

  .stat-val {
    font-size: 1.15rem !important;
  }

  /* หน้า 2: ตัดส่วนกราฟ 12 ภพชะตาชีวิตไปเริ่มที่หน้า 2 ทั้งหมด */
  #tab-chart,
  #tab-chart > .glass-card {
    display: block !important;
    break-before: page !important;
    page-break-before: always !important;
    margin-top: 0 !important;
    padding: 14px 18px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .chart-controls {
    margin-bottom: 8px !important;
  }

  .chart-controls h3 {
    color: #B45309 !important;
    font-size: 1.1rem !important;
    margin-bottom: 2px !important;
  }

  .chart-controls p {
    color: #64748B !important;
    font-size: 0.8rem !important;
  }

  .chart-legend {
    margin-top: 4px !important;
    gap: 8px !important;
  }

  .legend-item {
    color: #475569 !important;
    font-size: 0.75rem !important;
  }

  /* ตัวกราฟ Canvas */
  .canvas-container {
    height: 340px !important;
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 8px !important;
    margin-bottom: 12px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* กล่องคำพยากรณ์ Spotlight ประจำภพและอายุ (รวมอยู่ในหน้า 2) - ปรับเป็นพื้นสว่าง ชัดเจน อ่านง่าย */
  #annualSpotlight,
  .house-detail-view,
  .annual-spotlight {
    background: #F8FAFC !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 8px !important;
    padding: 14px 18px !important;
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    box-shadow: none !important;
  }

  .detail-header {
    margin-bottom: 8px !important;
  }

  .detail-title-group h3,
  #spotlightTitle,
  #houseDetailTitle {
    color: #0F172A !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
  }

  .detail-pali,
  #spotlightPali,
  #houseDetailPali {
    color: #475569 !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
  }

  .score-badge,
  #spotlightBadge {
    box-shadow: none !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    font-weight: 700 !important;
    color: #FFFFFF !important;
  }

  .detail-body,
  #spotlightDesc,
  #houseDetailDesc {
    color: #1E293B !important;
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
    margin: 8px 0 10px !important;
  }

  .detail-body strong {
    color: #0F172A !important;
  }

  .detail-advice-box,
  #spotlightAdvice,
  #houseDetailAdvice {
    background: #FFFBEB !important;
    border-left: 4px solid #F59E0B !important;
    border-top: 1px solid #FEF3C7 !important;
    border-right: 1px solid #FEF3C7 !important;
    border-bottom: 1px solid #FEF3C7 !important;
    border-radius: 6px !important;
    color: #92400E !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    padding: 8px 12px !important;
  }

  .detail-advice-box strong,
  #spotlightAdvice strong {
    color: #78350F !important;
  }

  /* ส่วนท้ายกระดาษ (Footer) */
  .app-footer {
    border-top: 1px solid #E2E8F0 !important;
    padding-top: 8px !important;
    margin-top: 6px !important;
    color: #64748B !important;
    font-size: 0.72rem !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .app-footer p {
    color: #64748B !important;
    margin-bottom: 4px !important;
  }

  .footer-credits {
    margin: 4px 0 !important;
    font-size: 0.76rem !important;
    color: #475569 !important;
  }

  .footer-credits a {
    color: #B45309 !important;
    text-decoration: underline !important;
  }

  .disclaimer-box {
    color: #94A3B8 !important;
    font-size: 0.68rem !important;
    margin: 4px auto !important;
    line-height: 1.35 !important;
  }

  .version-badge-footer {
    padding: 2px 8px !important;
    font-size: 0.68rem !important;
    border: 1px solid #E2E8F0 !important;
    background: #F8FAFC !important;
    color: #64748B !important;
  }
}
