* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    min-height: 100vh;
    /* Light, soft background so black moving text is clearly visible */
    background: radial-gradient(circle at top left, #f9fafb 0, #e5f3ff 45%, #e0f2fe 100%);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.bg-logo-layer {
    position: fixed;
    inset: -80px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.08;
    background-image: url('frugal-logo.png');
    background-size: 110px 110px;
    background-repeat: repeat;
    background-position: center;
    mix-blend-mode: screen;
}

.bg-frugal {
    position: fixed;
    inset: -120px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.12; /* a bit stronger but still background */
    filter: blur(0.5px);
}

.bg-frugal-row {
    position: absolute;
    white-space: nowrap;
    font-size: clamp(2.4rem, 4vw, 3.4rem);
    font-weight: 800;
    letter-spacing: 0.22em;
    color: rgba(37, 99, 235, 1); /* blue, semi-transparent for background */
    text-transform: uppercase;
    transform: rotate(-30deg);
    animation: frugal-scroll 32s linear infinite;
}

.bg-frugal-row span {
    margin-right: 2rem;
}

.bg-frugal-row.row1 {
    top: 10%;
    left: -40%;
}

.bg-frugal-row.row2 {
    top: 45%;
    left: -60%;
    animation-duration: 38s;
}

.bg-frugal-row.row3 {
    top: 80%;
    left: -50%;
    animation-duration: 26s;
}

@keyframes frugal-scroll {
    0% {
        transform: translateX(0) rotate(-30deg);
    }
    100% {
        transform: translateX(60%) rotate(-30deg);
    }
}

.app-container {
    max-width: 960px;
    width: 100%;
    margin: 20px;
    position: relative;
    z-index: 1;
}

.app-header {
    margin-bottom: 20px;
    color: #e5e7eb;
    display: flex;
    justify-content: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.65);
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 30% 20%, #22c55e, #14532d);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 24px 24px 28px;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(12px);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:not(.hidden):hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.6);
}

.card.hidden {
    display: none;
}

.card.active {
    display: block;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #111827;
}

.form-row select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-row select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.6);
    background: #ffffff;
}

.btn {
    padding: 9px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    margin-right: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.btn.primary {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #f9fafb;
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.35);
}

.btn.secondary {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ecfdf3;
    box-shadow: 0 12px 20px rgba(22, 163, 74, 0.35);
}

.btn.ghost {
    background: #f3f4f6;
    color: #111827;
    box-shadow: none;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.35);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.3);
}

.btn:disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
}

.timer.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.timer-label {
    opacity: 0.8;
}

.timer-value {
    font-weight: 700;
}

.progress-wrapper {
    margin: 8px 0 14px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #16a34a, #22c55e);
    transition: width 0.25s ease-out;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.options {
    margin-top: 4px;
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.option-row {
    position: relative;
}

.option-row input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-row label {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.option-row label:hover {
    border-color: #2563eb;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
    background: #ffffff;
}

.option-row input[type="radio"]:checked + label {
    border-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.quiz-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

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

.result-header h2 {
    margin-bottom: 2px;
}

.result-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
}

.badge-soft {
    background: #ecfdf3;
    color: #16a34a;
}

.result-summary {
    margin-bottom: 20px;
    font-size: 0.95rem;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
}

.result-summary p {
    margin-bottom: 4px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.chart-caption {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.result-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .app-container {
        margin: 10px;
    }

    .btn {
        width: 100%;
        margin-right: 0;
    }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .quiz-controls {
        justify-content: stretch;
    }
}
