:root {
    /* Light Theme */
    --primary-hue: 355;
    /* Holiness Red */
    /* Secondary can be a neutral gray or kept blue-ish but let's make it match */
    --secondary-hue: 0;

    --color-primary: hsl(var(--primary-hue), 75%, 50%);
    /* A bit darker/richer red */
    --color-primary-dark: hsl(var(--primary-hue), 75%, 40%);
    --color-secondary: hsl(var(--secondary-hue), 0%, 90%);

    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-body: #f0f2f5;

    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --card-border: 1px solid rgba(255, 255, 255, 0.5);

    --text-main: #2d3436;
    --text-muted: #636e72;
    --text-light: #ffffff;

    --success: #00b894;
    --warning: #fdcb6e;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #1e1e2f 0%, #2d2d44 100%);
    --bg-body: #121212;

    --card-bg: rgba(30, 30, 46, 0.95);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --card-border: 1px solid rgba(255, 255, 255, 0.05);

    --text-main: #dfe6e9;
    --text-muted: #b2bec3;

    --color-primary: hsl(var(--primary-hue), 70%, 65%);
    --color-primary-dark: hsl(var(--primary-hue), 70%, 55%);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    /* Standardized margin */
    flex-wrap: wrap;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    /* Reduced from 50px */
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Main Content Views */
main {
    flex: 1;
    position: relative;
}

.view {
    /* transition for switching views could be added here */
    animation: fadeIn 0.4s ease-out;
}

.view.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero / Intro */
.hero-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    text-align: center;
}

.hero-card h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--color-primary);
}

.hero-text {
    font-size: 1.1rem;
    margin-bottom: 32px;
    color: var(--text-muted);
}

.verse-ref {
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 600;
}

.instructions {
    text-align: left;
    background: rgba(var(--primary-hue), 100, 100, 0.05);
    background: var(--bg-body);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 32px;
}

.instructions h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    font-family: var(--font-heading);
}

.instructions ul {
    list-style: none;
}

.instructions li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.instructions li i {
    color: var(--color-primary);
    width: 20px;
}

/* Buttons */
.btn {
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
    width: 100%;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 12px 24px;
}

.btn-secondary:hover {
    background: rgba(100, 100, 255, 0.05);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
}

.btn-text:hover:not(:disabled) {
    color: var(--text-main);
}

.btn-text:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* Quiz View */
.progress-container {
    margin-bottom: 24px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-bar-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

[data-theme="dark"] .progress-bar-track {
    background: rgba(255, 255, 255, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 4px;
}

.question-card {
    background: var(--card-bg);
    padding: 32px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.question-content h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 32px;
    color: var(--text-main);
    line-height: 1.4;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rating-buttons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.rating-btn {
    flex: 1;
    aspect-ratio: 1;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-heading);
}

[data-theme="dark"] .rating-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

.rating-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.rating-btn.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rating-hint {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-primary);
    font-weight: 500;
    min-height: 20px;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 20px;
}

/* Results View */
.results-header {
    text-align: center;
    margin-bottom: 32px;
}

.results-header h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-primary);
}

.top-gifts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 32px;
}

@media (min-width: 600px) {
    .top-gifts-container {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Make the first one span full width on small screens or centered better? 
       Actually let's highlight the #1 differently */
}

.gift-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    text-align: center;
    position: relative;
    transition: transform 0.3s;
}

.gift-card.top-1 {
    border: 2px solid var(--color-primary);
    transform: scale(1.02);
}

.gift-rank {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.gift-card h3.gift-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gift-help-btn-inline,
.gift-help-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
}

.gift-help-btn-inline:hover {
    color: var(--color-primary);
}

.gift-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.results-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 24px;
    /* Increased gap */
    flex-wrap: wrap;
    margin-top: 20px;
}

.results-actions #download-btn {
    padding-left: 40px;
    padding-right: 40px;
}

.all-gifts-list {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: var(--card-border);
    margin-bottom: 32px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.list-item:last-child {
    border-bottom: none;
}

[data-theme="dark"] .list-item {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.list-item-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-item-score {
    font-weight: 700;
    color: var(--color-primary);
}

.restart-area {
    text-align: center;
    margin-bottom: 40px;
}

.cancel {
    color: var(--text-muted);
    text-decoration: underline;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--card-bg);
    width: 90%;
    max-width: 500px;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    border: var(--card-border);
}

[data-theme="dark"] .modal {
    background: #2d2d44;
}

.close-modal-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal h3 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.modal p {
    color: var(--text-main);
    margin-bottom: 16px;
    line-height: 1.6;
}

.biblical-refs {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.03);
    padding: 12px;
    border-radius: var(--radius-sm);
}

[data-theme="dark"] .biblical-refs {
    background: rgba(255, 255, 255, 0.03);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

.credits {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* User Inputs */
.user-inputs {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.input-group input {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

[data-theme="dark"] .input-group input {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-hue), 80%, 60%, 0.1);
}

/* Rating Instruction */
.rating-instruction {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .main-header {
        padding: 10px 0;
        justify-content: center;
        gap: 10px;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
    }

    .logo-img {
        height: 26px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .question-card {
        padding: 20px 15px;
        min-height: auto;
    }

    .question-content h3 {
        font-size: 1.15rem;
        margin-bottom: 24px;
    }

    .rating-buttons {
        gap: 4px;
    }

    .rating-btn {
        height: 44px;
        font-size: 1.1rem;
        border-radius: 8px;
    }
}