/* ==========================================================
   Tax Procrastination Score - Styles
   Dark navy / charcoal theme with neon accents
   ========================================================== */

/* ---------- Design Tokens ---------- */
:root {
    --bg-primary: #0f1221;
    --bg-secondary: #161a2e;
    --bg-card: #1c2039;
    --bg-card-hover: #232845;

    --text-primary: #eef0f6;
    --text-secondary: #9399b2;
    --text-muted: #5d6382;

    --accent-cyan: #00e5ff;
    --accent-magenta: #e040fb;
    --accent-lime: #76ff03;
    --accent-orange: #ff9100;
    --accent-red: #ff1744;

    --gradient-primary: linear-gradient(135deg, #00e5ff 0%, #e040fb 100%);
    --gradient-warm: linear-gradient(135deg, #ff9100 0%, #ff1744 100%);
    --gradient-cool: linear-gradient(135deg, #00e5ff 0%, #76ff03 100%);

    --shadow-glow-cyan: 0 0 30px rgba(0, 229, 255, 0.25);
    --shadow-glow-magenta: 0 0 30px rgba(224, 64, 251, 0.25);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-med: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle gradient overlay on body */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(0, 229, 255, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(224, 64, 251, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- App Container ---------- */
#app {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ---------- Screens ---------- */
.screen {
    display: none;
    min-height: 100vh;
    padding: 24px 20px 40px;
    animation: fadeSlideIn 0.5s var(--transition-med) forwards;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-content {
    width: 100%;
}

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

/* ---------- Intro Screen ---------- */
.intro-icon {
    text-align: center;
    font-size: 64px;
    margin-bottom: 16px;
    animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.intro-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.2rem;
    line-height: 1.15;
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.intro-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.55;
    max-width: 340px;
    margin: 0 auto 28px;
}

.countdown-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 145, 0, 0.3);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-orange);
    margin: 0 auto 36px;
    width: fit-content;
    box-shadow: 0 0 20px rgba(255, 145, 0, 0.1);
}

.countdown-icon {
    font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #0f1221;
    box-shadow: var(--shadow-glow-cyan);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow-cyan), var(--shadow-glow-magenta);
    filter: brightness(1.1);
}

.btn-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.4;
    filter: blur(14px);
    transition: opacity var(--transition-fast);
}

.btn-glow:hover::after {
    opacity: 0.7;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.btn-arrow {
    font-size: 1.2rem;
    transition: transform var(--transition-fast);
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-arrow-left {
    font-size: 1.2rem;
    transition: transform var(--transition-fast);
}

.btn:hover .btn-arrow-left {
    transform: translateX(-4px);
}

.btn-icon {
    font-size: 1.15rem;
}

/* ---------- Quiz Screen ---------- */
.quiz-header {
    margin-bottom: 32px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width var(--transition-med);
}

.question-counter {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

.question-container {
    animation: fadeSlideIn 0.4s ease forwards;
}

.question-container.exit {
    animation: fadeSlideOut 0.3s ease forwards;
}

@keyframes fadeSlideOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.question-text {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.35rem;
    line-height: 1.35;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.08);
}

.answer-btn:active {
    transform: scale(0.98);
}

.answer-btn.selected {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.answer-btn.selected .answer-letter {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.answer-label {
    flex: 1;
}

/* ---------- Results Screen ---------- */
#screen-results .screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.results-card {
    width: 100%;
    text-align: center;
    padding: 20px 0 8px;
}

/* Score Ring */
.score-ring-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
}

.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 10;
}

.score-ring-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 534.07;
    stroke-dashoffset: 534.07;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-value-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.score-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 3.5rem;
    line-height: 1;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-percent {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.result-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 6px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-emoji {
    font-size: 2.6rem;
    margin-bottom: 14px;
}

.result-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 360px;
    margin: 0 auto 28px;
}

/* Countdown box */
.countdown-box {
    background: var(--bg-card);
    border: 1px solid rgba(255, 145, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 8px;
}

.countdown-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.countdown-number {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.4rem;
    color: var(--accent-orange);
    text-shadow: 0 0 20px rgba(255, 145, 0, 0.3);
}

.countdown-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Results actions */
.results-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

/* ---------- Leaderboard Screen ---------- */
#screen-leaderboard .screen-content {
    padding-top: 12px;
}

.leaderboard-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.leaderboard-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    animation: fadeSlideIn 0.4s ease forwards;
    opacity: 0;
}

.lb-row.gold {
    border-color: rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), var(--bg-card));
}

.lb-row.silver {
    border-color: rgba(192, 192, 192, 0.2);
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.06), var(--bg-card));
}

.lb-row.bronze {
    border-color: rgba(205, 127, 50, 0.2);
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.06), var(--bg-card));
}

.lb-rank {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.lb-row.gold .lb-rank { color: #ffd700; }
.lb-row.silver .lb-rank { color: #c0c0c0; }
.lb-row.bronze .lb-rank { color: #cd7f32; }

.lb-flag {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.lb-info {
    flex: 1;
    min-width: 0;
}

.lb-country {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-reason {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.lb-score {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.lb-bar-wrapper {
    flex: 1;
    max-width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

.lb-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Utility Animations ---------- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes confettiBurst {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

/* ---------- SVG Gradient (injected inline for stroke) ---------- */
/* We define this via JS since SVG <defs> must be in the SVG */

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
    .intro-title {
        font-size: 1.8rem;
    }

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

    .score-ring-wrapper {
        width: 170px;
        height: 170px;
    }

    .score-value {
        font-size: 2.8rem;
    }
}

@media (min-height: 800px) {
    .screen {
        padding-top: 40px;
    }
}

/* ---------- Safe area insets for notched devices ---------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .screen {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}
