/* ============================================
   Dark Theme - 深邃星空 + 现代科技融合
   Scoped under .dark-theme class
   ============================================ */

/* --- Variable overrides --- */
.dark-theme {
    --classical-primary: #d4af37;
    --classical-secondary: #8b7355;
    --classical-accent: #c41e3a;
    --classical-gold: #d4af37;
    --classical-bg: #141422;
    --classical-bg-secondary: #1e1e36;
    --classical-text-primary: rgba(212,175,55,1);
    --classical-text-secondary: rgba(212,175,55,0.7);
    --classical-text-light: rgba(212,175,55,0.5);
    --classical-card: rgba(30,30,54,0.85);
    --classical-card-end: rgba(20,20,40,0.92);
    --classical-border: rgba(212,175,55,0.22);
    --shadow-classical: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 24px rgba(212,175,55,0.15);
}

.dark-theme body,
body.dark-theme {
    background-color: #141422;
    color: rgba(212,175,55,1);
}

.dark-theme .bg-pattern {
    background-color: #141422;
    background-image: none;
    padding-bottom: 0;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #141422 0%, #1e1e36 50%, #141422 100%);
    overflow: hidden;
}

/* Hero 加载遮罩（已登录用户刷新时显示） */
.hero-loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 34, 0.92);
}

.hero-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: heroSpin 0.8s linear infinite;
}

.hero-loading-text {
    margin-top: 16px;
    color: rgba(212, 175, 55, 0.8);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

@keyframes heroSpin {
    to { transform: rotate(360deg); }
}

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particles-container canvas {
    pointer-events: none;
}

.hero-top-actions {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 2;
    display: flex;
    gap: 8px;
}

.hero-action-btn {
    font-size: 11px;
    color: rgba(212,175,55,0.6);
    padding: 4px 12px;
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.hero-action-btn:hover {
    color: #d4af37;
    border-color: rgba(212,175,55,0.3);
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

.hero-title-top {
    font-size: 12px;
    letter-spacing: 6px;
    color: rgba(212,175,55,0.7);
    margin-bottom: 12px;
    opacity: 0;
}

.hero-title-main {
    font-size: 28px;
    font-weight: 700;
    color: #d4af37;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(212,175,55,0.3);
    margin-bottom: 40px;
    font-family: var(--font-display);
    opacity: 0;
}

#baguaCanvas {
    cursor: pointer;
    display: block;
}

.hero-subtitle {
    font-size: 13px;
    color: rgba(212,175,55,0.6);
    letter-spacing: 2px;
    margin-top: 40px;
    opacity: 0;
}

.hero-footer-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    font-size: 10px;
    color: rgba(212,175,55,0.4);
    opacity: 0;
}

/* --- Form Modal Overlay --- */
.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(20,20,34,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.form-modal {
    width: 400px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(30,30,54,0.97) 0%, rgba(20,20,40,0.98) 100%);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 0 60px rgba(212,175,55,0.08);
    position: relative;
    z-index: 501;
}

.form-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 50%;
    background: transparent;
    color: rgba(212,175,55,0.6);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.form-modal-close:hover {
    background: rgba(212,175,55,0.1);
    color: #d4af37;
    border-color: rgba(212,175,55,0.4);
}

.form-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.form-modal-header .decor-line {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    margin: 0 auto 12px;
}

.form-modal-header h2 {
    font-size: 18px;
    color: #d4af37;
    letter-spacing: 3px;
    font-weight: 600;
    border: none;
    padding: 0;
    margin: 0;
}

.form-modal-header .form-subtitle {
    font-size: 11px;
    color: rgba(212,175,55,0.6);
    margin-top: 6px;
    letter-spacing: 1px;
}

.form-modal-header .decor-line-bottom {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    margin: 12px auto 0;
}

/* Calendar type toggle */
.calendar-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.calendar-toggle-btn {
    padding: 6px 20px;
    font-size: 12px;
    font-family: var(--font-serif);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(212,175,55,0.22);
    background: transparent;
    color: rgba(212,175,55,0.6);
}

.calendar-toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.calendar-toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.calendar-toggle-btn.active {
    background: rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.3);
    color: #d4af37;
}

/* Dark form fields */
.form-modal .form-group label {
    font-size: 11px;
    color: rgba(212,175,55,0.7);
    font-weight: 400;
}

.form-modal .form-group select,
.form-modal .form-group input {
    padding: 8px 12px;
    background: rgba(212,175,55,0.05);
    border: 1px solid rgba(212,175,55,0.15);
    border-radius: 8px;
    font-size: 13px;
    color: rgba(212,175,55,0.85);
    font-family: var(--font-serif);
}

.form-modal .form-group select:focus,
.form-modal .form-group input:focus {
    border-color: rgba(212,175,55,0.5);
    box-shadow: 0 0 0 2px rgba(212,175,55,0.1);
    outline: none;
}

.form-modal .form-group select option {
    background: #1e1e36;
    color: rgba(212,175,55,0.9);
}

/* Gender toggle */
.gender-toggle {
    display: flex;
}

.gender-toggle-btn {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    font-family: var(--font-serif);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(212,175,55,0.2);
    background: transparent;
    color: rgba(212,175,55,0.6);
}

.gender-toggle-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.gender-toggle-btn:last-child {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.gender-toggle-btn.active {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.25);
    color: #d4af37;
}

/* Submit button */
.btn-submit-dark {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, rgba(212,175,55,0.2) 0%, rgba(212,175,55,0.1) 100%);
    border: 1px solid rgba(212,175,55,0.4);
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    color: #d4af37;
    letter-spacing: 3px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-weight: 600;
    box-shadow: 0 0 20px rgba(212,175,55,0.1);
    transition: all 0.3s ease;
}

.btn-submit-dark:hover {
    background: linear-gradient(135deg, rgba(212,175,55,0.3) 0%, rgba(212,175,55,0.15) 100%);
    box-shadow: 0 0 30px rgba(212,175,55,0.15);
}

.btn-submit-dark:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-modal-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 10px;
    color: rgba(212,175,55,0.4);
    letter-spacing: 4px;
}

/* --- Transition Screen --- */
.transition-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #141422 0%, #1e1e36 50%, #141422 100%);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.transition-pillars {
    display: flex;
    gap: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.transition-pillar {
    text-align: center;
    opacity: 0;
    color: #d4af37;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(212,175,55,0.5);
}

.transition-pillar .pillar-label {
    font-size: 10px;
    color: rgba(212,175,55,0.6);
    margin-top: 4px;
}

.transition-status-text {
    position: absolute;
    bottom: 60px;
    color: rgba(212,175,55,0.6);
    font-size: 13px;
    letter-spacing: 2px;
}

/* --- Result Page Dark Theme --- */
.dark-theme .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(212,175,55,0.1);
    background: rgba(20,20,34,0.95);
    position: sticky;
    top: 0;
    z-index: 200;
}

.dark-theme .result-brand {
    font-size: 14px;
    color: #d4af37;
    letter-spacing: 2px;
    font-family: var(--font-display);
}

.dark-theme .result-header-actions {
    display: flex;
    gap: 8px;
}

.dark-theme .result-header-btn {
    font-size: 11px;
    color: rgba(212,175,55,0.6);
    padding: 4px 10px;
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.dark-theme .result-header-btn:hover {
    color: #d4af37;
    border-color: rgba(212,175,55,0.3);
}

/* Result Summary Area */
.result-summary {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 24px 20px;
}

.result-summary-bagua {
    flex-shrink: 0;
}

.result-summary-bagua canvas {
    display: block;
}

/* Four Pillars in result */
.result-pillars {
    display: flex;
    gap: 10px;
}

.result-pillar {
    text-align: center;
    padding: 10px 14px;
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 8px;
    background: rgba(212,175,55,0.05);
    min-width: 56px;
    opacity: 0;
    transform: translateY(20px);
}

.result-pillar.day-pillar {
    border-color: rgba(212,175,55,0.35);
    background: rgba(212,175,55,0.08);
    box-shadow: 0 0 15px rgba(212,175,55,0.08);
}

.result-pillar .pillar-name {
    font-size: 9px;
    color: rgba(212,175,55,0.6);
    margin-bottom: 6px;
}

.result-pillar .pillar-tg {
    font-size: 18px;
    color: #d4af37;
    font-weight: 700;
}

.result-pillar .pillar-divider {
    width: 20px;
    height: 1px;
    background: rgba(212,175,55,0.2);
    margin: 4px auto;
}

.result-pillar .pillar-dz {
    font-size: 18px;
    color: #d4af37;
}

.result-pillar .pillar-gz {
    font-size: 9px;
    color: rgba(212,175,55,0.5);
    margin-top: 4px;
}

/* Radar chart area */
.result-radar {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
}

.result-radar canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Birth info inline (inside result-summary) */
.birth-info-inline {
    width: 100%;
    text-align: center;
    padding: 0 0 4px;
    font-size: 12px;
    color: rgba(212,175,55,0.55);
    letter-spacing: 0.5px;
}

.birth-info-inline .birth-val {
    color: rgba(212,175,55,0.8);
}

.birth-info-inline .birth-dot {
    margin: 0 6px;
    color: rgba(212,175,55,0.25);
}

/* Divider */
.result-divider {
    width: 80%;
    max-width: 800px;
    margin: 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.15), transparent);
}

/* --- Dark theme overrides for existing components --- */

/* Old header hidden */
.dark-theme .app-header {
    display: none;
}

/* Old input section hidden (moved to modal) */
.dark-theme #birthInfoSection {
    display: none !important;
}

/* Module nav dark */
.dark-theme .module-nav {
    background: rgba(30,30,54,0.85);
    border: 1px solid rgba(212,175,55,0.1);
    border-radius: 12px;
}

.dark-theme .module-nav.sticky {
    background: rgba(20,20,34,0.95);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(212,175,55,0.1);
}

.dark-theme .module-nav-item {
    color: rgba(212,175,55,0.7);
}

.dark-theme .module-nav-item:hover {
    background: rgba(212,175,55,0.08);
    color: rgba(212,175,55,0.85);
}

.dark-theme .module-nav-item.active {
    background: rgba(212,175,55,0.12);
    color: #d4af37;
    border: 1px solid rgba(212,175,55,0.3);
}

.dark-theme .module-nav-toggle {
    border-color: rgba(212,175,55,0.22);
    color: rgba(212,175,55,0.6);
}

.dark-theme .module-nav-toggle:hover {
    background: rgba(212,175,55,0.08);
    color: #d4af37;
    border-color: rgba(212,175,55,0.3);
}

/* 导航分隔符 dark */
.dark-theme .nav-separator {
    color: rgba(212,175,55,0.2);
}

/* 阶段分组标题 dark */
.dark-theme .phase-group-label {
    color: #d4af37;
}

.dark-theme .phase-group-desc {
    color: rgba(212,175,55,0.5);
}

.dark-theme .phase-analyze-btn {
    border-color: rgba(212,175,55,0.4);
    color: rgba(212,175,55,0.8);
    background: transparent;
}

.dark-theme .phase-analyze-btn:hover:not(:disabled) {
    background: rgba(212,175,55,0.15);
    color: #d4af37;
    border-color: #d4af37;
}

.dark-theme .phase-analyze-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dark-theme .phase-analyze-btn.phase-btn-locked {
    opacity: 0.35;
    border-style: dashed;
    border-color: rgba(212,175,55,0.2);
    color: rgba(212,175,55,0.45);
}

.dark-theme .phase-analyze-btn.phase-btn-done {
    opacity: 0.6;
    border-color: rgba(76, 175, 80, 0.4);
    color: rgba(76, 175, 80, 0.7);
}

/* Result cards dark */
.dark-theme .card,
.dark-theme .result-card {
    background: linear-gradient(145deg, rgba(30,30,54,0.85) 0%, rgba(20,20,40,0.92) 100%);
    border: 1px solid rgba(212,175,55,0.22);
    border-radius: 12px;
    box-shadow: none;
}

.dark-theme .section-title {
    color: #d4af37;
    border-bottom-color: rgba(212,175,55,0.2);
    font-size: 15px;
    position: relative;
    padding-left: 16px;
}

.dark-theme .section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: #d4af37;
    border-radius: 2px;
}

/* Analysis content dark */
.dark-theme .analysis-content {
    color: rgba(212,175,55,0.75);
}

.dark-theme .analysis-content h3 {
    color: #d4af37;
}

.dark-theme .analysis-content h4 {
    color: rgba(212,175,55,0.85);
}

.dark-theme .analysis-content strong {
    color: #d4af37;
}

.dark-theme .analysis-content blockquote {
    border-left-color: rgba(212,175,55,0.4);
    color: rgba(212,175,55,0.6);
}

.dark-theme .analysis-content table {
    border-collapse: collapse;
}

.dark-theme .analysis-content th {
    background-color: rgba(212,175,55,0.08);
    color: #d4af37;
    border-color: rgba(212,175,55,0.15);
}

.dark-theme .analysis-content td {
    background-color: transparent;
    border-color: rgba(212,175,55,0.15);
    color: rgba(212,175,55,0.75);
}

.dark-theme .analysis-loading {
    color: rgba(212,175,55,0.5);
}

.dark-theme .analysis-section {
    background-color: rgba(212,175,55,0.03);
    border-left-color: rgba(212,175,55,0.3);
}

.dark-theme .analysis-section-title {
    color: #d4af37;
}

.dark-theme .analysis-text {
    color: rgba(212,175,55,0.75);
}

.dark-theme .json-summary {
    background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(212,175,55,0.02));
    border-left: none;
    color: rgba(212,175,55,0.85);
}

.dark-theme .json-content-text {
    color: rgba(212,175,55,0.75);
}

.dark-theme .json-explanation {
    background: rgba(78,203,113,0.04);
    border-left: none;
}

.dark-theme .json-explanation h4 {
    color: #6ddb8a;
}

.dark-theme .json-explanation-text {
    color: rgba(212,175,55,0.7);
}

.dark-theme .json-content-text h2 {
    color: #d4af37;
    border-bottom-color: rgba(212,175,55,0.3);
}

.dark-theme .json-content-text h3,
.dark-theme .json-content-text h4 {
    color: rgba(212,175,55,0.85);
}

.dark-theme .json-content-text hr {
    border-top-color: rgba(212,175,55,0.15);
}

.dark-theme .json-section h4 {
    color: rgba(212,175,55,0.9);
    border-bottom: none;
}
.dark-theme .json-section h4::before {
    background: linear-gradient(180deg, #d4af37, rgba(212,175,55,0.3));
}

.dark-theme .json-keypoints li,
.dark-theme .json-suggestions li {
    background: rgba(212,175,55,0.04);
    color: rgba(212,175,55,0.75);
}

.dark-theme .json-keypoints li::before {
    color: #d4af37;
}

.dark-theme .json-suggestions li::before {
    color: #d4af37;
}

.dark-theme .json-table {
    background: rgba(212,175,55,0.02);
    border-color: rgba(212,175,55,0.12);
}

.dark-theme .json-table th {
    background: linear-gradient(135deg, rgba(212,175,55,0.1), rgba(212,175,55,0.05));
    color: #d4af37;
    border-bottom-color: rgba(212,175,55,0.12);
}

.dark-theme .json-table td {
    border-bottom-color: rgba(212,175,55,0.05);
    color: rgba(212,175,55,0.75);
}

.dark-theme .json-table tr:nth-child(even) {
    background: rgba(212,175,55,0.02);
}

.dark-theme .json-table tr:hover {
    background: rgba(212,175,55,0.05);
}

/* Tags */
.dark-theme .tag-yongshen {
    background: rgba(212,175,55,0.1);
    color: #d4af37;
    border-color: rgba(212,175,55,0.25);
}

.dark-theme .tag-jishen {
    background: rgba(196,30,58,0.1);
    color: #c41e3a;
    border-color: rgba(196,30,58,0.25);
}

/* Sidebar dark */
.dark-theme .sidebar {
    background: linear-gradient(180deg, #1e1e36 0%, #151528 100%);
    border-right-color: rgba(212,175,55,0.1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}

.dark-theme .sidebar-header {
    border-bottom-color: rgba(212,175,55,0.1);
}

.dark-theme .sidebar-header h3 {
    color: #d4af37;
}

.dark-theme .sidebar-close {
    color: rgba(212,175,55,0.6);
}

.dark-theme .sidebar-close:hover {
    color: #d4af37;
}

.dark-theme .history-empty {
    color: rgba(212,175,55,0.5);
}

.dark-theme .history-item {
    background: rgba(212,175,55,0.03);
    border-color: rgba(212,175,55,0.1);
}

.dark-theme .history-item:hover {
    background: rgba(212,175,55,0.06);
}

.dark-theme .history-item.active {
    border-color: rgba(212,175,55,0.3);
    background: rgba(212,175,55,0.08);
}

.dark-theme .history-item-date {
    color: rgba(212,175,55,0.85);
}

.dark-theme .history-item-gender,
.dark-theme .history-item-meta {
    color: rgba(212,175,55,0.6);
}

.dark-theme .history-dropdown {
    background: #1e1e36;
    border-color: rgba(212,175,55,0.15);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.dark-theme .history-dropdown-item {
    color: rgba(212,175,55,0.75);
}

.dark-theme .history-dropdown-item:hover {
    background: rgba(212,175,55,0.08);
}

/* Buttons dark */
.dark-theme .btn-primary {
    background: linear-gradient(135deg, rgba(212,175,55,0.2) 0%, rgba(212,175,55,0.1) 100%);
    border-color: rgba(212,175,55,0.4);
    color: #d4af37;
}

.dark-theme .btn-primary:hover {
    background: linear-gradient(135deg, rgba(212,175,55,0.3) 0%, rgba(212,175,55,0.15) 100%);
    box-shadow: 0 0 20px rgba(212,175,55,0.15);
}

.dark-theme .btn-outline {
    color: #d4af37;
    border-color: rgba(212,175,55,0.3);
}

.dark-theme .btn-outline:hover {
    background: rgba(212,175,55,0.15);
    color: #d4af37;
}

.dark-theme .btn-secondary {
    background: rgba(212,175,55,0.06);
    color: rgba(212,175,55,0.75);
    border-color: rgba(212,175,55,0.22);
}

.dark-theme .btn-secondary:hover {
    background: rgba(212,175,55,0.1);
}

/* Modals dark */
.dark-theme .modal {
    background: rgba(20,20,34,0.8);
}

.dark-theme .modal-content {
    background: linear-gradient(145deg, rgba(30,30,54,0.97) 0%, rgba(20,20,40,0.98) 100%);
    border: 1px solid rgba(212,175,55,0.2);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.dark-theme .login-prompt-title {
    color: #d4af37;
}

.dark-theme .login-prompt-text {
    color: rgba(212,175,55,0.7);
}

.dark-theme .login-prompt-icon {
    filter: grayscale(0.5) brightness(1.2);
}

/* Loading overlay dark */
.dark-theme .loading-overlay {
    background: rgba(20,20,34,0.85);
}

.dark-theme .loading-spinner {
    border-color: rgba(212,175,55,0.2);
    border-top-color: #d4af37;
}

.dark-theme .loading-content {
    color: #d4af37;
}

.dark-theme .loading-tip {
    color: rgba(212,175,55,0.6);
}

/* Error */
.dark-theme .analysis-error {
    background: rgba(196,30,58,0.08);
    border-color: rgba(196,30,58,0.2);
}

.dark-theme .error-message {
    background: rgba(196,30,58,0.08);
    color: rgba(196,30,58,0.8);
}

/* Locked modules — disabled button with lock icon */
.dark-theme .analyze-btn-locked {
    opacity: 0.45;
    cursor: not-allowed !important;
    background: linear-gradient(135deg, rgba(212,175,55,0.08) 0%, rgba(212,175,55,0.04) 100%) !important;
    border-color: rgba(212,175,55,0.2) !important;
    color: rgba(212,175,55,0.5) !important;
    box-shadow: none !important;
}

.dark-theme .locked-hint {
    color: rgba(212,175,55,0.4);
}

.dark-theme .analyze-btn-locked:hover {
    transform: none !important;
    box-shadow: none !important;
    background: linear-gradient(135deg, rgba(212,175,55,0.1) 0%, rgba(212,175,55,0.05) 100%) !important;
}

.dark-theme .analyze-btn-dep-locked {
    opacity: 0.35;
    cursor: not-allowed !important;
    background: linear-gradient(135deg, rgba(212,175,55,0.05) 0%, rgba(212,175,55,0.02) 100%) !important;
    border-color: rgba(212,175,55,0.15) !important;
    color: rgba(212,175,55,0.4) !important;
}

/* User status */
.dark-theme .user-status {
    background: rgba(212,175,55,0.05);
    border-color: rgba(212,175,55,0.15);
    color: rgba(212,175,55,0.5);
}

/* Info rows */
.dark-theme .info-row {
    border-bottom-color: rgba(212,175,55,0.08);
    color: rgba(212,175,55,0.5);
}

.dark-theme .info-row .value {
    color: rgba(212,175,55,0.7);
}

/* Stat bars */
.dark-theme .stat-bar {
    background-color: rgba(212,175,55,0.08);
}

.dark-theme .stat-bar-fill.good {
    background: linear-gradient(90deg, #d4af37, #8b7355);
}

/* Bazi pillars in result (old style) */
.dark-theme .bazi-pillar {
    background: linear-gradient(135deg, rgba(26,26,46,0.6) 0%, rgba(15,15,30,0.7) 100%);
    border-color: rgba(212,175,55,0.3);
    color: #d4af37;
}

.dark-theme .bazi-pillar .tiangan {
    color: #d4af37;
}

.dark-theme .bazi-pillar .dizhi {
    color: rgba(212,175,55,0.7);
}

.dark-theme .bazi-info {
    background-color: rgba(212,175,55,0.03);
}

/* Footer dark */
.dark-theme .app-footer {
    color: rgba(212,175,55,0.2);
}

/* Form actions in modal */
.dark-theme .form-modal .form-actions {
    margin-top: 20px;
}

/* Analysis content pre/code */
.dark-theme .analysis-text pre {
    background-color: rgba(212,175,55,0.03);
    border-color: rgba(212,175,55,0.1);
    color: rgba(212,175,55,0.6);
}

/* Result wrapper */
.result-wrapper {
    background-color: #141422;
    min-height: 100vh;
}

/* Main container in dark mode */
.dark-theme .main-container {
    max-width: 900px;
}

/* Config modal */
.dark-theme #configModal .modal-content {
    background: linear-gradient(145deg, rgba(26,26,46,0.95) 0%, rgba(15,15,30,0.98) 100%);
}

.dark-theme #configModal label {
    color: rgba(212,175,55,0.5);
}

.dark-theme #configModal input,
.dark-theme #configModal select {
    background: rgba(212,175,55,0.05);
    border-color: rgba(212,175,55,0.15);
    color: rgba(212,175,55,0.7);
}

/* Scroll animations */
.dark-theme .result-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.dark-theme .result-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .hero-section,
    .transition-screen,
    .form-overlay,
    .form-modal,
    .result-pillar,
    .result-card {
        animation: none !important;
        transition: none !important;
    }

    .hero-title-top,
    .hero-title-main,
    .hero-subtitle,
    .hero-footer-text {
        opacity: 1 !important;
    }

    .result-card {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title-main {
        font-size: 22px;
        letter-spacing: 2px;
    }

    .result-summary {
        flex-direction: column;
        gap: 16px;
    }

    .result-pillars {
        gap: 6px;
    }

    .result-pillar {
        padding: 8px 10px;
        min-width: 48px;
    }

    .result-pillar .pillar-tg,
    .result-pillar .pillar-dz {
        font-size: 16px;
    }

    .birth-info-inline {
        font-size: 11px;
    }

    .birth-info-inline .birth-dot {
        margin: 0 4px;
    }

    .form-modal {
        padding: 24px 20px;
    }

    .result-info-tags {
        gap: 6px;
    }

    .hero-footer-text {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .hero-title-main {
        font-size: 20px;
    }

    .result-header {
        padding: 10px 12px;
    }

    .result-brand {
        font-size: 12px;
    }
}

/* ─── 贴条（Badge）通用样式 ─── */
.btn-badge-wrapper {
    position: relative;
    overflow: visible;
    display: inline-block;
}

/* phase-group-header 作为贴条容器时保持 flex 布局 */
.phase-group-header.btn-badge-wrapper {
    display: flex;
}

.btn-badge {
    position: absolute;
    top: -18px;
    right: -10px;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px 4px 4px 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    display: none;
}

.btn-badge--free {
    background: #2a7a3a;
    color: #fff;
}

.btn-badge--gold {
    background: rgba(212,175,55,0.9);
    color: #1a1a2e;
}

.btn-badge--gray {
    background: rgba(120,120,120,0.8);
    color: #fff;
}

.btn-badge--pulse {
    animation: badgePulse 2s ease-in-out infinite;
}

.btn-badge--clickable {
    pointer-events: auto;
    cursor: pointer;
}

@keyframes badgePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 按钮置灰（免费用完） */
.phase-btn-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* 按钮半透明（深度用完，可点击跳转兑换） */
.phase-btn-dimmed {
    opacity: 0.5;
    cursor: pointer;
}

/* ─── Quota Toast ─── */
.quota-toast {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 34, 0.9);
    color: #d4af37;
    font-size: 13px;
    padding: 8px 20px;
    border-radius: 8px;
    z-index: 800;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
}

.quota-toast-show {
    animation: toastSlideDown 0.3s ease forwards;
}

.quota-toast-hide {
    animation: toastFadeOut 0.5s ease forwards;
}

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* ─── 首屏引导文案 ─── */
.hero-guide-text {
    font-size: 12px;
    color: rgba(212, 175, 55, 0.5);
    text-align: center;
    margin-top: 8px;
}

/* ─── 通用自定义弹窗 ─── */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-modal-box {
    background: rgba(20,16,28,0.98);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 14px;
    padding: 28px 24px;
    max-width: 300px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}

.custom-modal-title {
    font-size: 16px;
    color: rgba(212,175,55,0.85);
    margin-bottom: 8px;
    font-family: var(--font-serif);
}

.custom-modal-message {
    font-size: 13px;
    color: rgba(212,175,55,0.5);
    margin-bottom: 24px;
    line-height: 1.6;
}

.custom-modal-buttons {
    display: flex;
    gap: 12px;
}

.custom-modal-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 8px;
    color: rgba(212,175,55,0.6);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.custom-modal-btn:hover {
    border-color: rgba(212,175,55,0.4);
    color: rgba(212,175,55,0.8);
}

.custom-modal-btn-primary {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.35);
    color: rgba(212,175,55,0.85);
}

.custom-modal-btn-primary:hover {
    background: rgba(212,175,55,0.18);
}

.custom-modal-btn-danger {
    background: rgba(220,60,80,0.18);
    border: 1px solid rgba(220,60,80,0.45);
    color: #e05565;
}

.custom-modal-btn-danger:hover {
    background: rgba(220,60,80,0.28);
    color: #e8606f;
}

/* ─── 设置下拉菜单 ─── */
.settings-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: rgba(20,16,28,0.95);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    padding: 16px;
    z-index: 100;
}

.settings-account-label {
    font-size: 10px;
    color: rgba(212,175,55,0.4);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.settings-phone-display {
    font-size: 14px;
    color: rgba(212,175,55,0.8);
    font-family: var(--font-serif);
}

.settings-depth-row {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.settings-depth-row:hover {
    background: rgba(212,175,55,0.08);
}

.settings-depth-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.settings-depth-count {
    font-size: 12px;
    color: rgba(212,175,55,0.8);
    margin-left: 8px;
}

.settings-depth-arrow {
    margin-left: auto;
    font-size: 14px;
    color: rgba(212,175,55,0.4);
}

.settings-divider {
    height: 1px;
    background: rgba(212,175,55,0.15);
    margin: 12px 0;
}

.settings-logout-btn {
    width: 100%;
    padding: 8px 0;
    background: rgba(220,60,80,0.12);
    border: 1px solid rgba(220,60,80,0.35);
    border-radius: 6px;
    color: #e05565;
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.settings-logout-btn:hover {
    background: rgba(220,60,80,0.22);
    color: #e8606f;
}

.settings-changepwd-btn {
    width: 100%;
    padding: 8px 0;
    background: rgba(212,175,55,0.08);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 6px;
    color: rgba(212,175,55,0.7);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.settings-changepwd-btn:hover {
    background: rgba(212,175,55,0.15);
    color: #d4af37;
}

.changepwd-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.changepwd-modal-overlay.active {
    display: flex;
}

.changepwd-modal {
    background: rgba(20,16,28,0.97);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 380px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.changepwd-modal h3 {
    color: rgba(212,175,55,0.85);
    font-size: 16px;
    font-family: var(--font-serif);
    margin: 0 0 20px;
    text-align: center;
}

.changepwd-field {
    margin-bottom: 14px;
}

.changepwd-field label {
    display: block;
    font-size: 11px;
    color: rgba(212,175,55,0.5);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.changepwd-field input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.changepwd-field input:focus {
    border-color: rgba(212,175,55,0.5);
}

.changepwd-error {
    font-size: 11px;
    color: #e05565;
    margin-top: 4px;
    min-height: 16px;
}

.changepwd-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.changepwd-buttons button {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s ease;
}

.changepwd-cancel-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
}

.changepwd-cancel-btn:hover {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
}

.changepwd-submit-btn {
    background: rgba(212,175,55,0.15);
    border: 1px solid rgba(212,175,55,0.35);
    color: #d4af37;
}

.changepwd-submit-btn:hover {
    background: rgba(212,175,55,0.25);
}

.changepwd-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   程序表格区升级样式（RENDER_MODE=program）
   ============================================================ */

/* --- 程序表格区：表格（继承基础深色样式，仅添加 nowrap） --- */
.dark-theme .program-tables-zone .json-table th,
.dark-theme .program-tables-zone .json-table td {
    white-space: nowrap;
}

/* 动画继承自亮色主题的 @keyframes programTableFadeIn */

/* 日主高亮 */
.dark-theme .program-tables-zone .json-table .cell-highlight {
    color: #d4af37;
    font-weight: 600;
}

/* 用神第一行高亮 */
.dark-theme .program-tables-zone .json-table .row-primary td {
    color: #d4af37 !important;
    font-weight: 600;
    background: rgba(212,175,55,0.05) !important;
}

/* 忌神行 */
.dark-theme .program-tables-zone .json-table .row-ji td {
    color: #ff8a8a !important;
}

/* 程序表格区小标题继承基础 .dark-theme .json-section h4 样式 */

/* --- 程序表格区：摘要 tag pills --- */
.dark-theme .program-tables-zone .program-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0;
    margin: 18px 0;
    background: none;
    border: none;
    border-left: none;
    border-radius: 0;
    font-size: 12px;
    font-weight: normal;
    line-height: normal;
}

.dark-theme .program-tables-zone .program-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 12px;
    background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(212,175,55,0.04));
    color: rgba(212,175,55,0.9);
}

.dark-theme .program-tables-zone .program-tag-label {
    color: rgba(212,175,55,0.5);
    font-size: 11px;
}

/* --- 五行彩色标签 --- */
.dark-theme .wx-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.dark-theme .wx-water { background: rgba(74,158,255,0.2); color: #6cb4ff; }
.dark-theme .wx-metal { background: rgba(212,175,55,0.15); color: #e0c755; }
.dark-theme .wx-fire  { background: rgba(255,120,120,0.15); color: #ff9a9a; }
.dark-theme .wx-wood  { background: rgba(78,203,113,0.15); color: #6ddb8a; }
.dark-theme .wx-earth { background: rgba(160,150,140,0.12); color: #b0a090; }

/* --- 分隔线 --- */
.dark-theme .program-tables-zone .program-divider {
    height: 1px;
    margin: 12px 0;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.12), transparent);
}

/* --- AI 解读区 --- */
/* AI 解读区 - 继承基础深色样式，仅设置间距 */
.dark-theme .ai-interpretation-zone {
    margin-top: 24px;
}
