/* ============================================
   ADHD TEST — Authentic Design (not AI-template)
   Warm, imperfect, human. Like a friend made it.
   ============================================ */

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

:root {
    /* ARIA PALETTE — WCAG 2.1 AA compliant, ADHD-validated */
    --warm-bg: #F9F5F0;          /* warm cream, NOT pink */
    --paper: #FFFAF0;            /* creamy vanilla */
    --ink: #2A2A2A;              /* dark text — 13.8:1 on warm-bg */
    --ink-mid: #5A5250;          /* secondary text — 6.6:1 on warm-bg */
    --coral: #D9606A;            /* brand accent — headers, decorative */
    --teal: #5ABFBC;             /* calming — progress, checkmarks, success */
    --anchor: #3D3832;           /* trust — CTA buttons, prices */
    --peach: #FFDFBA;            /* dopamine — XP, badges, wins */

    /* Score bar category colors (ARIA-mapped) */
    --focus-color: #5ABFBC;      /* was --focus-blue */
    --energy-color: #FFDFBA;     /* was --energy-orange */
    --impulse-color: #D9606A;    /* was --impulse-red */

    --shadow-soft: 0 2px 20px rgba(80, 60, 40, 0.08);
    --radius: 16px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--warm-bg);
    min-height: 100vh;
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Grain texture overlay for anti-AI feel */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ---- SCREENS ---- */
.quiz-wrapper {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: screenIn 0.35s ease-out;
}

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

/* ============================================
   START SCREEN
   ============================================ */

.start-content {
    text-align: center;
    padding: 30px 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Hand-drawn doodle accents */
.doodle-accent {
    position: absolute;
    pointer-events: none;
    opacity: 0.8;
}

.doodle-top {
    top: 10px;
    right: 20px;
    animation: float 4s ease-in-out infinite;
}

.doodle-bottom {
    bottom: 80px;
    left: 10px;
    animation: float 5s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

.radar-preview {
    margin-bottom: 24px;
}

.radar-preview canvas {
    opacity: 0.35;
}

.start-content h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 8px;
}

.tagline {
    font-size: 1.1rem;
    color: var(--ink-mid);
    font-weight: 500;
    margin-bottom: 20px;
}

.start-desc {
    font-size: 0.95rem;
    color: var(--ink-mid);
    max-width: 400px;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* VALUE PROPS — start screen */
.value-props {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--paper);
    border: 1px solid rgba(61, 56, 50, 0.08);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 24px;
    text-align: left;
    max-width: 380px;
    width: 100%;
}

.value-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.875rem;
    color: var(--ink-mid);
    line-height: 1.4;
}

.value-item strong {
    color: var(--ink);
}

.value-check {
    flex-shrink: 0;
}

.start-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    background: var(--anchor);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 16px rgba(232, 105, 90, 0.3);
    letter-spacing: 0.01em;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232, 105, 90, 0.4);
}

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

.start-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #B8A5A0;
    font-family: 'Caveat', cursive;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ============================================
   QUIZ SCREEN
   ============================================ */

/* Progress bar */
.quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 4px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--warm-bg);
    border-radius: 3px;
    overflow: hidden;
}

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

.progress-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-mid);
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
}

/* Radar chart area */
.radar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.radar-container canvas {
    max-width: 200px;
    max-height: 200px;
}

.radar-status {
    font-size: 0.8rem;
    color: var(--ink-mid);
    margin-top: 6px;
    font-style: italic;
    transition: opacity 0.3s ease;
}

/* Question area */
.question-area {
    background: var(--paper);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
    min-height: 80px;
    /* Slight rotation for imperfect feel */
    transform: rotate(-0.3deg);
    /* Paper texture overlay */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='5' result='noise'/%3E%3CfeDiffuseLighting in='noise' lighting-color='%23F5EFE7' surfaceScale='1'%3E%3CfeDistantLight azimuth='45' elevation='60'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='0.3'/%3E%3C/svg%3E");
    background-blend-mode: multiply;
    /* Imperfect shadow (not perfectly symmetrical) */
    box-shadow:
        2px 4px 12px rgba(80, 60, 40, 0.06),
        -1px 2px 8px rgba(80, 60, 40, 0.04);
    position: relative;
    overflow: visible;
}

/* Tape mark effect (like paper stuck with tape) */
.question-area::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 30px;
    width: 50px;
    height: 20px;
    background: rgba(255, 250, 235, 0.6);
    border: 1px solid rgba(200, 190, 170, 0.3);
    transform: rotate(2deg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    pointer-events: none;
}

.question-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.55;
    color: var(--ink);
}

.question-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.category-focus {
    background: rgba(133, 199, 242, 0.20);
    color: #5BA3D9;
}

.category-energy {
    background: rgba(255, 179, 128, 0.20);
    color: #E89B4E;
}

.category-impulse {
    background: rgba(255, 154, 162, 0.20);
    color: #E8847A;
}

/* Answer options */
.options-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Add subtle rotation variety to options (imperfect alignment) */
.option-btn:nth-child(1) { transform: rotate(0.2deg); }
.option-btn:nth-child(2) { transform: rotate(-0.1deg); }
.option-btn:nth-child(3) { transform: rotate(0.15deg); }
.option-btn:nth-child(4) { transform: rotate(-0.2deg); }
.option-btn:nth-child(5) { transform: rotate(0.1deg); }

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--paper);
    border: 2px solid var(--warm-bg);
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--ink);
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    border-color: var(--teal);
    background: rgba(90, 191, 188, 0.12);
}

/* Preserve rotation on hover for each option */
.option-btn:nth-child(1):hover { transform: rotate(0.2deg) translateX(3px); }
.option-btn:nth-child(2):hover { transform: rotate(-0.1deg) translateX(3px); }
.option-btn:nth-child(3):hover { transform: rotate(0.15deg) translateX(3px); }
.option-btn:nth-child(4):hover { transform: rotate(-0.2deg) translateX(3px); }
.option-btn:nth-child(5):hover { transform: rotate(0.1deg) translateX(3px); }

.option-btn:active {
    transform: translateX(1px) scale(0.99);
}

.option-btn.selected {
    border-color: var(--teal);
    background: rgba(90, 191, 188, 0.12);
    font-weight: 600;
    color: var(--anchor);
}

/* Keyboard hint */
.option-btn .key-hint {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #9E8E8A;
    font-weight: 600;
    background: #F5F0EB;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Back button */
.back-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--ink-mid);
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 0 0;
    align-self: flex-start;
    transition: color 0.15s ease;
}

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

/* ============================================
   EMAIL SCREEN
   ============================================ */

.email-content {
    text-align: center;
    padding: 20px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Sticker-style accent */
.sticker-accent {
    position: absolute;
    top: 40px;
    right: 20px;
    animation: stickerPulse 3s ease-in-out infinite;
}

@keyframes stickerPulse {
    0%, 100% { transform: scale(1) rotate(-8deg); }
    50% { transform: scale(1.05) rotate(-6deg); }
}

.radar-blurred {
    position: relative;
}

.blur-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 30%, var(--warm-bg) 70%);
    pointer-events: none;
}

.email-content h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.email-desc {
    color: var(--ink-mid);
    font-size: 1rem;
    margin-bottom: 24px;
}

#emailForm {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#userEmail {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    padding: 14px 18px;
    border: 2px solid var(--warm-bg);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    transition: border-color 0.15s ease;
    text-align: center;
}

#userEmail:focus {
    outline: none;
    border-color: var(--teal);
}

#userEmail::placeholder {
    color: #D4ABA5;
}

.submit-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--anchor);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 16px rgba(232, 105, 90, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232, 105, 90, 0.4);
}

.privacy-note {
    font-size: 0.78rem;
    color: #B8A5A0;
    margin-top: 14px;
    line-height: 1.5;
    max-width: 340px;
}

/* ============================================
   LOADING SCREEN
   ============================================ */

.loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 60px;
}

.radar-pulse canvas {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(1.04); opacity: 1; }
}

.loading-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink-mid);
    margin-top: 16px;
    animation: textFade 2s ease-in-out infinite;
}

@keyframes textFade {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ============================================
   DISCLAIMER
   ============================================ */

.disclaimer {
    font-size: 0.72rem;
    color: #B8A5A0;
    text-align: center;
    padding: 20px 10px;
    line-height: 1.5;
    margin-top: auto;
}

/* ============================================
   MOBILE
   ============================================ */

@media (max-width: 480px) {
    .quiz-wrapper {
        padding: 12px 12px 30px;
    }

    .start-content h1 {
        font-size: 1.7rem;
    }

    .question-area {
        padding: 20px 16px;
    }

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

    .option-btn {
        padding: 13px 16px;
        font-size: 0.9rem;
    }

    .option-btn .key-hint {
        display: none;
    }

    .radar-container canvas {
        max-width: 160px;
        max-height: 160px;
    }
}

@media (min-width: 768px) {
    .quiz-wrapper {
        padding: 40px 20px;
    }

    .start-content h1 {
        font-size: 2.3rem;
    }

    .question-area {
        padding: 28px 24px;
    }
}


/* ---- EMAIL CAPTURE SCREEN ---- */
.email-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 16px;
    text-align: center;
    padding: 20px 0;
}

.email-title {
    font-family: 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--ink);
    margin-top: 8px;
}

.email-subtitle {
    font-size: 17px;
    color: var(--ink-mid);
}

.email-form-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

.email-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    border: 2px solid var(--warm-bg);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s;
}

.email-input:focus {
    border-color: var(--teal);
}

.email-submit {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    background: var(--anchor);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}

.email-submit:hover {
    background: #5A5450;
    transform: translateY(-1px);
}

.email-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.email-note {
    font-size: 13px;
    color: var(--ink-mid);
    opacity: 0.8;
}

.email-skip {
    background: none;
    border: none;
    color: var(--ink-mid);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
    opacity: 0.6;
}

.email-skip:hover {
    opacity: 1;
}

.emoji-bubble { width: 100px; height: 100px; object-fit: contain; vertical-align: middle; }
.emoji-bubble-lg { width: 160px; height: 160px; object-fit: contain; }
.emoji-bubble-sm { width: 64px; height: 64px; object-fit: contain; vertical-align: middle; }
.bubble-slot { display: none; }
