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

html,
body {
    width: 100%;
    min-height: 100%;
    background: #0a0a0a;
    font-family: 'Roboto Mono', monospace;
    overflow-x: hidden;
}

body {
    overflow-y: auto;
}

:root {
    --surface-bg: linear-gradient(145deg, rgba(24, 24, 24, 0.9), rgba(14, 14, 14, 0.86));
    --surface-bg-hover: linear-gradient(145deg, rgba(28, 28, 28, 0.93), rgba(16, 16, 16, 0.9));
    --surface-border: rgba(255, 255, 255, 0.16);
    --surface-border-hover: rgba(255, 255, 255, 0.26);
    --surface-shadow: 0 18px 40px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --surface-blur: 14px;
    --surface-radius: 14px;
    --text-muted: #888;
    --text-subtle: #666;
}

.surface-card {
    border: 1px solid var(--surface-border);
    border-radius: var(--surface-radius);
    background: var(--surface-bg);
    backdrop-filter: blur(var(--surface-blur));
    -webkit-backdrop-filter: blur(var(--surface-blur));
    box-shadow: var(--surface-shadow);
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.surface-card:hover {
    border-color: var(--surface-border-hover);
    background: var(--surface-bg-hover);
}

canvas#bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    color: #e0e0e0;
}

/* Top bar */
.topbar {
    position: relative;
    z-index: 1200;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding-top: 24px;
    padding-bottom: 24px;
    padding-left: 36px;
    padding-right: max(0px, calc(36px - (100vw - 100%)));
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 0;
    animation: fadeIn 1.2s ease forwards 0.2s;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: #d0d0d0;
    text-decoration: none;
}

.topbar-sep {
    color: rgba(255, 255, 255, 0.2);
    font-size: 18px;
    font-weight: 300;
    user-select: none;
}

.nav-link {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    font-size: 13px;
    color: #888;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    transition: color 0.3s, border-color 0.3s;
}

.nav-link:hover {
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-link.active {
    color: #d6d6d6;
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.06);
}

.login-label-btn {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    font-size: 12px;
    color: #8d8d8d;
    text-decoration: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-label-btn:hover {
    color: #d2d2d2;
    border-color: rgba(255, 255, 255, 0.32);
}

.avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, background 0.3s;
    text-decoration: none;
}

.avatar-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.avatar-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-nav {
    display: none;
    position: relative;
    z-index: 1250;
}

.mobile-nav-trigger {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    font-size: 11.5px;
    color: #d0d0d0;
    background: linear-gradient(145deg, rgba(28, 28, 28, 0.92), rgba(14, 14, 14, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    min-height: 36px;
    min-width: 0;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    touch-action: manipulation;
}

.mobile-nav-trigger:hover {
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.34);
}

.mobile-nav-trigger:disabled {
    opacity: 0.75;
    cursor: default;
}

.mobile-nav.open .mobile-nav-trigger {
    border-color: rgba(255, 255, 255, 0.34);
    background: linear-gradient(145deg, rgba(34, 34, 34, 0.95), rgba(18, 18, 18, 0.9));
}

.mobile-nav-current {
    max-width: 92px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-nav-arrow {
    font-size: 10px;
    color: #9a9a9a;
    line-height: 1;
    transform: translateY(0);
    transition: transform 0.2s ease;
}

.mobile-nav.open .mobile-nav-arrow {
    transform: rotate(180deg);
}

.mobile-nav-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 150px;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, rgba(26, 26, 26, 0.98), rgba(14, 14, 14, 0.95));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 22px 38px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 3000;
}

.mobile-nav.open .mobile-nav-menu {
    display: flex;
}

.mobile-nav-item {
    font-family: 'Roboto Mono', monospace;
    font-size: 11.5px;
    color: #c2c2c2;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    min-height: 36px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    touch-action: manipulation;
}

.mobile-nav-item:hover {
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* Footer */
.footer {
    padding: 24px 0;
    text-align: center;
    opacity: 0;
    animation: fadeIn 1.2s ease forwards 1.3s;
}

.footer-text {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    font-size: 12px;
    color: #555;
    letter-spacing: 0.5px;
}

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

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

/* Scrollable content area */
.scrollable {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

@media (max-width: 900px) {
    .topbar {
        padding-top: 16px;
        padding-bottom: 16px;
        padding-left: 18px;
        padding-right: 18px;
    }

    .topbar-left {
        gap: 12px;
        flex-wrap: wrap;
    }

    .footer {
        padding: 18px 12px;
    }
}

@media (max-width: 620px) {
    .topbar {
        align-items: center;
        flex-wrap: nowrap;
        column-gap: 10px;
    }

    .topbar-right {
        justify-content: flex-end;
        margin-left: auto;
        gap: 8px;
        width: auto;
    }

    .logo-text {
        font-size: 14px;
    }

    .topbar-left {
        gap: 8px;
        flex-wrap: nowrap;
    }

    .topbar-sep {
        display: none;
    }

    .topbar-left .nav-link {
        display: none;
    }

    .mobile-nav {
        display: inline-flex;
    }

    .topbar.mobile-single-nav .mobile-nav {
        display: none;
    }

    .topbar.mobile-single-nav .topbar-left .nav-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
        border-radius: 999px;
        padding: 6px 12px;
        color: #d0d0d0;
        border-color: rgba(255, 255, 255, 0.24);
        background: linear-gradient(145deg, rgba(28, 28, 28, 0.92), rgba(14, 14, 14, 0.88));
    }

    .nav-link,
    .login-label-btn {
        font-size: 12px;
        padding: 6px 9px;
    }

    .login-label-btn {
        max-width: 130px;
    }

    .avatar-btn {
        width: 34px;
        height: 34px;
    }

    .avatar-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 420px) {
    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .topbar-left {
        gap: 8px;
    }
}
