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

:root {
    --bg: #ffffff;
    --surface: #f5f5f5;
    --text: #1a1a1a;
    --text-muted: #666;
    --accent: #03B3FD;
    --border: #e0e0e0;
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --text: #fafafa;
    --text-muted: #888;
    --border: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

main {
    width: 100%;
    min-width: 320px;
    margin: 0 auto;
    padding: 1rem 1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);

    h1 {
        font-size: 1.125rem;
        font-weight: 600;
    }

    nav {
        display: none;
    }

    nav a {
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.875rem;

        &:hover {
            color: var(--text);
        }

        &.active {
            color: var(--text);
            font-weight: 600;
        }
    }
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1rem;
    z-index: 1001;
    position: relative;
    width: 44px;
    height: 44px;

    span {
        width: 18px;
        height: 2px;
        background: var(--text);
        transition: all 0.3s ease;
        border-radius: 2px;
        position: absolute;
    }

    span:nth-child(1) {
        top: 14px;
    }

    span:nth-child(2) {
        top: 21px;
    }

    span:nth-child(3) {
        top: 28px;
    }

    &.active span:nth-child(1) {
        top: 21px;
        transform: rotate(45deg);
    }

    &.active span:nth-child(2) {
        opacity: 0;
    }

    &.active span:nth-child(3) {
        top: 21px;
        transform: rotate(-45deg);
    }
}

nav.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;

    &.active {
        display: flex;
    }

    a {
        color: var(--text);
        text-decoration: none;
        font-size: 1.5rem;
        font-weight: 500;

        &:hover {
            color: var(--accent);
        }

        &.active {
            color: var(--accent);
            font-weight: 600;
        }
    }
}

@media (min-width: 481px) {
    .hero {
        h2 {
            font-size: 2.5rem;
        }

        .hero-intro {
            font-size: 1.25rem;
        }
    }

    section.milestone p {
        font-size: 1.75rem;
    }

    article.activity-card {
        padding: 2rem;

        .activity-name {
            font-size: 1.25rem;
        }

        .activity-stats {
            gap: 2.5rem;
        }
    }

    .stat .stat-value {
        font-size: 1.5rem;
    }

    .stat .stat-label {
        font-size: 0.75rem;
    }
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    color: var(--text-muted);

    &:hover {
        color: var(--text);
    }
}

.hero {
    text-align: center;
    padding: 1rem 0;
    max-width: 600px;
    margin: 0 auto;

    h2 {
        font-size: 1.875rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }

    .hero-intro {
        font-size: 1.35rem;
        color: var(--text);
        font-weight: 500;
        margin-bottom: 1rem;
        line-height: 1.4;
    }

    .tagline {
        font-size: 1.125rem;
        margin-bottom: 3rem;
    }

    .example-card {
        background: var(--surface);
        border-radius: 12px;
        padding: 2rem;
        margin: 3rem auto;
        max-width: 600px;
        border-left: 4px solid var(--accent);
    }

    .example-text {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }

    .how-it-works {
        margin: 3rem auto;

        h3 {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 2rem;
            text-align: center;
        }

        .steps {
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        article {
            h4 {
                font-size: 1rem;
                font-weight: 600;
                margin-bottom: 0.5rem;
            }

            p {
                color: var(--text-muted);
                margin: 0;
                line-height: 1.5;
            }

            .step-note {
                font-size: 0.875rem;
                margin-top: 0.25rem;
                opacity: 0.7;
            }
        }
    }

    aside.close {
        margin: 3rem auto 2rem;

        p {
            font-size: 1.125rem;
            color: var(--text-muted);
            line-height: 1.6;
            margin-bottom: 1.5rem;
        }

        .emphasis {
            font-weight: 500;
            color: var(--text);
        }
    }

    .faq {
        margin: 3rem auto 2rem;

        h3 {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 2rem;
            text-align: center;
        }

        .faq-items {
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        article {
            h4 {
                font-size: 1rem;
                font-weight: 600;
                margin-bottom: 0.5rem;
                color: var(--text);
            }

            p {
                color: var(--text-muted);
                margin: 0;
                line-height: 1.6;
            }
        }
    }
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;

    &:hover:not(:disabled) {
        background: #0299d9;
        transform: translateY(-1px);
    }

    &:active:not(:disabled) {
        transform: translateY(0);
    }

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

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

.type-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;

    a {
        padding: 0.5rem 1.5rem;
        border-radius: 100px;
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-muted);
        background: var(--surface);

        &:hover {
            color: var(--text);
        }

        &.active {
            background: var(--accent);
            color: white;
        }
    }
}

section.milestone {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--surface);
    border-radius: 12px;
    border-left: 4px solid var(--accent);

    p {
        font-size: 1.5rem;
        font-weight: 600;
        line-height: 1.4;
        color: var(--text);
    }
}

article.activity-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    border: 1px solid var(--border);

    .activity-name {
        font-size: 1.125rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: var(--text);
    }

    .activity-date {
        font-size: 0.875rem;
        color: var(--text-muted);
        margin-bottom: 2rem;
    }

    .activity-stats {
        display: flex;
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

.run-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;

    .stat {
        text-align: center;
    }

    .stat-value {
        display: block;
        font-size: 1.5rem;
        font-weight: 700;
    }

    .stat-label {
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}

.milestones {
    display: grid;
    gap: 1rem;
}

.milestone-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent);

    .milestone-headline {
        font-size: 1rem;
        color: var(--text-muted);
        margin-bottom: 0.5rem;
    }

    .milestone-date {
        font-size: 2rem;
        font-weight: 700;
        color: var(--accent);
    }
}

.no-milestone {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: 12px;
}

.empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.waiting {
    text-align: center;
    padding: 4rem 2rem;

    p {
        font-size: 1.25rem;
        color: var(--text-muted);
        margin-bottom: 0.5rem;
    }

    .subtext {
        font-size: 0.875rem;
        color: var(--text-muted);
        opacity: 0.7;
    }
}

.stat {
    text-align: center;

    .stat-value {
        display: block;
        font-size: 1.125rem;
        font-weight: 700;
    }

    .stat-label {
        font-size: 0.6875rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}

.share-actions {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
}

.settings-page {
    max-width: 400px;
    margin: 0 auto;

    .account-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 3rem;
        border-bottom: 1px solid var(--border);
        text-decoration: none;
        color: inherit;
        transition: all 0.2s ease;
        border-radius: 8px;
        padding: 1rem 1rem 2rem;
        margin-left: -1rem;
        margin-right: -1rem;

        &:hover {
            background: var(--surface);

            .muted-text {
                color: var(--accent);
            }
        }

        .profile-picture {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            object-fit: cover;
        }

        h2 {
            margin: 0;
            font-size: 1.5rem;
        }

        .muted-text {
            font-size: 0.875rem;
            color: var(--text-muted);
            margin: 0;
            transition: color 0.2s ease;
        }
    }

    h2 {
        margin-bottom: 2rem;
    }

    form {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    fieldset {
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1rem;

        legend {
            padding: 0 0.5rem;
            font-weight: 600;
        }
    }

    .checkbox-label,
    .radio-label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0;
        cursor: pointer;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 1.25rem;
        height: 1.25rem;
        accent-color: var(--accent);
    }

    section.logout-section {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid var(--border);
        text-align: center;

        .logout-link {
            color: var(--text-muted);
            text-decoration: none;
            font-size: 0.875rem;
            transition: color 0.2s ease;

            &:hover {
                color: var(--text);
            }
        }
    }

    section.danger-zone {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid var(--border);

        h3 {
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: #dc2626;
        }

        p {
            font-size: 0.875rem;
            color: var(--text-muted);
            margin-bottom: 1rem;
        }
    }
}

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

    &:hover:not(:disabled) {
        background: var(--border);
        transform: translateY(-1px);
    }
}

.btn-danger {
    background: #dc2626;

    &:hover:not(:disabled) {
        background: #b91c1c;
    }
}

@media (min-width: 769px) {
    main {
        padding: 3rem 2rem;

        &.dashboard {
            max-width: 600px;
        }
    }


    header {
        padding: 1rem 2rem;

        h1 {
            font-size: 1.5rem;
        }

        nav {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
    }

    .hamburger {
        display: none;
    }

    .hero {
        max-width: 1200px;
    }

    .hero .how-it-works .steps {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
        text-align: center;
    }

    .hero .faq .faq-items {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 3rem;
        text-align: left;
    }
}
