/* Annotation: Root CSS variables — warm parchment/gold/royal blue theme */
:root {
    --parchment: #f5f0e8;
    --parchment-dark: #e8dcc8;
    --gold: #c9a96e;
    --gold-dark: #a8863f;
    --royal-blue: #1a3a6b;
    --royal-blue-light: #2a5298;
    --dark: #1a1a2e;
    --dark-light: #2d2d44;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --white: #ffffff;
    --success: #2ea043;
    --danger: #da3633;
    --warning: #c9a96e;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s ease;
}

/* Annotation: Reset and base styles — mobile-first */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text);
    background-color: var(--parchment);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =============================================
   LANDING PAGE
   ============================================= */

/* Annotation: Full-screen hero section with centered content */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 50%, var(--royal-blue) 100%);
    color: var(--white);
}

.landing-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.landing h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.landing h1 .highlight {
    color: var(--gold);
}

.landing .subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    max-width: 500px;
    line-height: 1.7;
}

.landing .meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2.5rem;
}

/* Annotation: Main CTA button — gold, large, touch-friendly */
.btn-cta {
    display: inline-block;
    background: var(--gold);
    color: var(--dark);
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: 0 4px 15px rgba(201, 169, 110, 0.3);
}

.btn-cta:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 169, 110, 0.4);
}

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

.landing-footer {
    margin-top: 3rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Annotation: Mode toggle switch — Adult/Kids */
.mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mode-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all var(--transition);
    cursor: pointer;
}

.mode-label.mode-active {
    color: var(--gold);
    font-weight: 700;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    cursor: pointer;
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--gold);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(201, 169, 110, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Annotation: Kids mode — brighter colors, larger text, playful feel */
.kids-mode .landing {
    background: linear-gradient(135deg, #1a2a5e 0%, #2a4494 50%, #3a6ecf 100%);
}

.kids-mode .landing h1 {
    font-size: 2.3rem;
}

.kids-mode .btn-cta {
    font-size: 1.2rem;
    padding: 1.1rem 2.8rem;
    border-radius: 50px;
}

.kids-mode .question-text {
    font-size: 1.4rem;
}

.kids-mode .answer-btn {
    font-size: 1.1rem;
    padding: 1.1rem 1.5rem;
    border-radius: 16px;
}

.kids-mode .result-header {
    background: linear-gradient(135deg, #1a2a5e 0%, #3a6ecf 100%);
}

.kids-mode .result-name {
    font-size: 2.5rem;
}

@media (min-width: 480px) {
    .kids-mode .landing h1 {
        font-size: 2.8rem;
    }
}

/* =============================================
   QUIZ PAGE
   ============================================= */

/* Annotation: Fixed progress bar at top */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--dark);
    padding: 0;
}

.progress-bar-wrapper {
    height: 4px;
    background: var(--dark-light);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    transition: width 0.4s ease;
    width: 0%;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.progress-section-name {
    font-style: italic;
}

/* Annotation: Quiz body — full viewport, centered */
.quiz-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem 2rem;
    background: var(--parchment);
}

/* Annotation: Question card — centered, max-width for readability */
.question-card {
    max-width: 600px;
    width: 100%;
    text-align: center;
    position: relative;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Annotation: Answer buttons — large touch targets, vertical stack */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-btn {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--white);
    border: 2px solid var(--parchment-dark);
    border-radius: var(--radius-sm);
    font-family: Georgia, serif;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    line-height: 1.4;
}

.answer-btn:hover {
    border-color: var(--gold);
    background: rgba(201, 169, 110, 0.05);
    transform: translateX(4px);
}

.answer-btn.selected {
    border-color: var(--gold);
    background: rgba(201, 169, 110, 0.15);
    box-shadow: 0 0 0 1px var(--gold);
}

.answer-btn.selected::before {
    content: '✓ ';
    color: var(--gold-dark);
    font-weight: bold;
}

/* Annotation: Back button — subtle, bottom left */
.back-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    font-family: Georgia, serif;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 50;
}

.back-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.back-btn.hidden {
    display: none;
}

/* Annotation: CSS-only slide transitions for question changes */
.question-card.slide-out-left {
    animation: slideOutLeft 0.3s ease forwards;
}

.question-card.slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}

.question-card.slide-out-right {
    animation: slideOutRight 0.3s ease forwards;
}

.question-card.slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-60px); opacity: 0; }
}

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

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

@keyframes slideInLeft {
    from { transform: translateX(-60px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =============================================
   LOADING OVERLAY
   ============================================= */

/* Annotation: Full-screen loading overlay with spinner */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    color: var(--white);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1.5rem;
}

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

.loading-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

/* =============================================
   RESULT PAGE
   ============================================= */

/* Annotation: Result page container */
.result-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Annotation: Primary character card */
.result-header {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(135deg, var(--dark) 0%, var(--royal-blue) 100%);
    color: var(--white);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: 0 8px 30px var(--shadow-strong);
}

.result-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.result-name {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.result-match {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.result-match span {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.2rem;
}

.character-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    margin-bottom: 1rem;
    background: var(--dark-light);
}

/* Annotation: Result description section */
.result-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px var(--shadow);
}

.result-section h3 {
    font-size: 1.1rem;
    color: var(--royal-blue);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--parchment-dark);
}

.result-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
}

/* Annotation: Strengths and growth lists */
.result-list {
    list-style: none;
    padding: 0;
}

.result-list li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    line-height: 1.5;
}

.result-list.strengths li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--gold);
}

.result-list.growth li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--royal-blue-light);
}

/* Annotation: Radar chart container */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 1rem auto;
}

/* Annotation: Axes bars (alternative to radar chart for simple display) */
.axis-bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.axis-label {
    width: 80px;
    text-align: right;
    padding-right: 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.axis-track {
    flex: 1;
    height: 8px;
    background: var(--parchment-dark);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.axis-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--royal-blue-light), var(--gold));
    border-radius: 4px;
    transition: width 0.6s ease;
}

.axis-value {
    width: 30px;
    text-align: center;
    padding-left: 0.5rem;
    font-weight: 700;
    color: var(--text);
    font-size: 0.85rem;
}

.axis-poles {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Annotation: Psychological profile badges */
.psych-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.psych-badge {
    background: var(--parchment);
    border: 1px solid var(--parchment-dark);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    text-align: center;
}

.psych-badge-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.psych-badge-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--royal-blue);
}

.psych-badge-desc {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

@media (min-width: 480px) {
    .psych-badges {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
}

/* Annotation: Secondary character (smaller card) */
.secondary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--parchment);
    border-radius: var(--radius-sm);
    border: 1px solid var(--parchment-dark);
}

.secondary-card .secondary-name {
    font-weight: 700;
    color: var(--royal-blue);
}

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

/* Annotation: Shadow profile (expandable) */
.shadow-section {
    cursor: pointer;
}

.shadow-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-weight: 600;
    color: var(--text);
}

.shadow-toggle .arrow {
    transition: transform var(--transition);
    font-size: 0.8rem;
}

.shadow-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.shadow-content.expanded {
    max-height: 300px;
}

.shadow-content p {
    padding: 0.5rem 0 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
}

/* Annotation: Verse highlight box */
.verse-box {
    background: linear-gradient(135deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    border-left: 4px solid var(--gold);
    padding: 1.25rem 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text);
    line-height: 1.6;
}

/* Annotation: Action buttons row */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.btn {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: Georgia, serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-gold {
    background: var(--gold);
    color: var(--dark);
    font-weight: 700;
}

.btn-gold:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 169, 110, 0.4);
}

.btn-email {
    background: var(--royal-blue);
    color: var(--white);
}

.btn-email:hover {
    background: var(--royal-blue-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 58, 107, 0.4);
}

.btn-redo {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--parchment-dark);
}

.btn-redo:hover {
    border-color: var(--gold);
    background: rgba(201, 169, 110, 0.08);
    transform: translateY(-2px);
}

/* Annotation: Share buttons — branded colors, larger icons */
.share-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.btn-share {
    flex: 1;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-share svg {
    flex-shrink: 0;
}

.btn-whatsapp {
    background: #25D366;
    color: #ffffff;
}

.btn-whatsapp:hover {
    background: #1da851;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.btn-facebook {
    background: #1877F2;
    color: #ffffff;
}

.btn-facebook:hover {
    background: #0d65d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.btn-copy {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--parchment-dark);
}

.btn-copy:hover {
    border-color: var(--gold);
    background: rgba(201, 169, 110, 0.08);
    transform: translateY(-2px);
}

/* =============================================
   EMAIL MODAL
   ============================================= */

/* Annotation: Modal overlay and dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    padding: 1rem;
}

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

.modal-dialog {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px var(--shadow-strong);
}

.modal-dialog h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.modal-dialog input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--parchment-dark);
    border-radius: var(--radius-sm);
    font-family: Georgia, serif;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}

.modal-dialog input[type="email"]:focus {
    outline: none;
    border-color: var(--gold);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn {
    flex: 1;
}

#emailStatus {
    font-size: 0.85rem;
    margin-top: 0.75rem;
    min-height: 1.2rem;
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-gold {
    color: var(--gold);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (min-width: 480px) {
    .landing h1 {
        font-size: 2.5rem;
    }

    .question-text {
        font-size: 1.35rem;
    }

    .result-name {
        font-size: 2.5rem;
    }
}

@media (min-width: 768px) {
    .landing h1 {
        font-size: 3rem;
    }

    .landing .subtitle {
        font-size: 1.2rem;
    }

    .result-header {
        padding: 3rem 2rem;
    }

    .result-section {
        padding: 2rem;
    }

    .actions-row {
        flex-wrap: nowrap;
    }
}

/* =============================================
   PRINT STYLES
   ============================================= */

@media print {
    .progress-container,
    .back-btn,
    .actions-row,
    .share-row,
    .modal-overlay,
    .loading-overlay {
        display: none !important;
    }

    .result-page {
        padding: 0;
    }

    .result-header {
        color: #000;
        background: #f0f0f0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
