:root {
    --primary: #4f8ef7;
    --primary-hover: #3a6ec7;
    --dark: #1a1a2e;
    --text: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(to bottom right, #f0f2f5, #e0e5ec);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    background: var(--dark);
    color: white;
    padding: 1rem clamp(1rem, 2.5vw, 2rem);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem clamp(0.75rem, 1.8vw, 1.25rem);
    max-width: min(1680px, calc(100vw - 3rem));
    margin: 0 auto;
}

.nav-greeting {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    max-width: 100%;
    margin: 0;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-greeting strong {
    color: #fff;
}

nav {
    display: flex;
    gap: clamp(0.35rem, 0.8vw, 0.8rem);
    justify-content: center;
    align-items: center;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
}

nav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.58rem clamp(0.75rem, 1vw, 1.1rem);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.96rem;
    line-height: 1.15;
    transition: var(--transition);
    white-space: nowrap;
}

nav a:hover,
nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

nav a.active {
    color: white;
}

nav a.nav-logout {
    color: #feb2b2;
}

@media (max-width: 1180px) {
    header {
        padding-block: 0.8rem;
    }

    .header-inner.has-greeting {
        grid-template-columns: 1fr;
    }

    .header-inner.has-greeting .nav-greeting {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
    }

    .header-inner.has-greeting nav {
        grid-column: 1;
        grid-row: 2;
    }

    nav {
        row-gap: 0.45rem;
    }
}

@media (max-width: 900px) {
    .header-inner {
        grid-template-columns: 1fr;
        max-width: none;
    }

    nav {
        grid-column: 1;
        grid-row: 1;
        justify-content: center;
    }

    .header-inner.has-greeting nav {
        grid-row: 2;
    }
}

.container {
    flex: 1;
    padding: 2.5rem clamp(1rem, 3vw, 3rem);
    max-width: 1760px;
    width: 100%;
    margin: 0 auto;
}

section {
    width: 100%;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h1 span {
    color: var(--primary);
}

p {
    font-size: 1.1rem;
    color: var(--text-light);
}

footer {
    background: var(--dark);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
}

:focus-visible {
    outline: 3px solid rgba(79, 142, 247, 0.35);
    outline-offset: 3px;
}

@media (max-width: 720px) {
    html {
        scroll-padding-top: 4.5rem;
    }

    header {
        padding: 0.65rem max(0.75rem, env(safe-area-inset-left)) 0.7rem max(0.75rem, env(safe-area-inset-right));
    }

    .header-inner {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        max-width: none;
    }

    .nav-greeting {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        max-width: 100%;
        padding: 0.35rem 0.65rem;
        font-size: 0.85rem;
    }

    nav {
        grid-column: 1;
        grid-row: 1;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 0.15rem 0.1rem 0.25rem;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .header-inner.has-greeting nav {
        grid-row: 2;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    nav a {
        flex: 0 0 auto;
        scroll-snap-align: start;
        min-height: 42px;
        padding: 0.6rem 0.85rem;
        font-size: 0.92rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.04);
    }

    nav a.active {
        background: rgba(255, 255, 255, 0.16);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    }

    .container {
        padding: 1.15rem 0.9rem 1.75rem;
    }

    h1 {
        font-size: 1.9rem;
        line-height: 1.08;
        margin-bottom: 0.65rem;
    }

    p {
        font-size: 1rem;
    }

}
