/* ============================================================
   ADHD Focus Task Breaker — Styles
   Warm, calming dark mode — rounded, soft, toy-like
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #FF9F43;
    --primary-light: #FECA57;
    --primary-dark: #E17B20;
    --secondary: #54A0FF;
    --secondary-light: #74B9FF;
    --accent: #5F27CD;
    --accent-light: #A29BFE;
    --bg: #1A1A2E;
    --bg-elevated: #222240;
    --bg-surface: #2A2A48;
    --bg-card: #30305A;
    --bg-hover: #383870;
    --text-primary: #F8F8FF;
    --text-secondary: #B0B0D0;
    --text-muted: #6C6C90;
    --border: #3A3A60;
    --success: #00D2A0;
    --success-light: #55EFC4;
    --danger: #FF6B6B;
    --warning: #FDCB6E;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --radius-pill: 50px;
    --shadow: 0 4px 20px rgba(0, 0, 0, .3);
    --shadow-glow: 0 0 24px rgba(255, 159, 67, .15);
    --transition: 250ms cubic-bezier(.4, 0, .2, 1);
    --spring: 300ms cubic-bezier(.68, -.55, .265, 1.55);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Layout --- */
.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 100px;
}

/* --- Header --- */
.header {
    text-align: center;
    padding: 32px 0 24px;
}

.header-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: 4px;
}

/* --- Energy Selector --- */
.energy-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.energy-btn {
    padding: 8px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

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

.energy-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.energy-btn .emoji {
    margin-right: 4px;
}

/* --- Task Input --- */
.task-input-area {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.task-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    padding: 14px 16px;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
}

.task-textarea:focus {
    border-color: var(--primary);
}

.task-textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 159, 67, .3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(255, 159, 67, .4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00B894);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: .8rem;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

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

/* --- Timer Section --- */
.timer-section {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.timer-label {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.timer-display {
    font-size: 4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    line-height: 1;
    margin: 12px 0;
    text-shadow: 0 0 40px rgba(255, 159, 67, .2);
}

.timer-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    margin: 16px 0;
    overflow: hidden;
}

.timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 1s linear;
}

.timer-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.hyperfocus-alert {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(253, 203, 110, .1);
    border: 1px solid rgba(253, 203, 110, .3);
    border-radius: var(--radius-sm);
    color: var(--warning);
    font-size: .85rem;
    margin-top: 12px;
}

.hyperfocus-alert.show {
    display: flex;
}

/* --- Steps List --- */
.steps-section {
    margin-bottom: 20px;
}

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

.section-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-count {
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

.step-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.step-item.completed {
    opacity: .5;
    border-color: var(--success);
}

.step-item.completed .step-text {
    text-decoration: line-through;
}

.step-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--spring);
    font-size: .8rem;
}

.step-item.completed .step-checkbox {
    background: var(--success);
    border-color: var(--success);
    animation: popIn var(--spring) forwards;
}

@keyframes popIn {
    0% {
        transform: scale(.5);
    }

    60% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.step-text {
    flex: 1;
    font-size: .95rem;
}

.step-size {
    font-size: .7rem;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

/* --- Nudge Banner --- */
.nudge-banner {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--accent), #7C4DFF);
    border-radius: var(--radius);
    margin-bottom: 20px;
    color: #fff;
    font-weight: 600;
    animation: slideIn .4s ease;
}

.nudge-banner.show {
    display: flex;
}

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

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

.nudge-dismiss {
    margin-left: auto;
    background: rgba(255, 255, 255, .2);
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    font-size: .8rem;
}

/* --- Parking Lot --- */
.parking-lot {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

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

.parking-input-row {
    display: flex;
    gap: 8px;
}

.parking-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    padding: 8px 12px;
    outline: none;
}

.parking-input:focus {
    border-color: var(--secondary);
}

.parked-tasks {
    list-style: none;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.parked-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--text-secondary);
}

.parked-item .remove-parked {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.parked-item .remove-parked:hover {
    color: var(--danger);
}

/* --- Daily Wins --- */
.daily-wins {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.streak-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.streak-label {
    font-size: .85rem;
    color: var(--text-secondary);
}

.streak-fire {
    font-size: 1.5rem;
}

.wins-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.win-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: .85rem;
}

.win-date {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Sound Bar --- */
.sound-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.sound-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: .8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.sound-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.sound-btn.active {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

/* --- Confetti Canvas --- */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: .85rem;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Export Bar --- */
.export-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px 0;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .app {
        padding: 16px 12px 100px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .timer-display {
        font-size: 3rem;
    }

    .energy-bar {
        flex-wrap: wrap;
    }

    .input-actions {
        flex-direction: column;
    }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}