* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

button, a, [role="button"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.nav-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 20px;
    border-radius: 16px;
}

.nav-container {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #333;
}

.nav-logo-icon {
    font-size: 24px;
}

.nav-logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    position: relative;
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-link-external {
    padding-right: 24px;
    color: #6f4ab0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(118, 75, 162, 0.2);
}

.nav-link-external:hover {
    color: #5e3a9c;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.14) 0%, rgba(118, 75, 162, 0.14) 100%);
}

.nav-link-tip {
    position: absolute;
    top: -7px;
    right: -8px;
    padding: 2px 5px;
    border-radius: 999px;
    background: #f0f1f5;
    color: #777;
    border: 1px solid rgba(120, 120, 120, 0.16);
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.nav-login-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    color: #667eea;
}

.nav-user-info {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.nav-user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.nav-user-avatar-placeholder {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.nav-user-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.nav-user-toggle {
    border: none;
    background: transparent;
    color: #666;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    line-height: 0;
    cursor: pointer;
    padding: 0;
    border-radius: 999px;
    transition: all 0.2s;
}

.nav-user-toggle-icon {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.nav-user-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    display: none;
    min-width: 86px;
    padding: 6px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(102, 126, 234, 0.16);
    box-shadow: 0 12px 28px rgba(36, 42, 80, 0.16);
}

.nav-user-info-open .nav-user-dropdown {
    display: block;
}

.nav-user-logout {
    width: 100%;
    border: none;
    background: transparent;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
}

.nav-user-logout:hover {
    color: #d64545;
    background: rgba(214, 69, 69, 0.08);
}

.nav-link:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-link.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    margin-top: 30px;
}

.login-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(23, 23, 35, 0.58);
    backdrop-filter: blur(6px);
}

.login-modal-overlay.show {
    display: flex;
}

.login-modal {
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(27, 31, 59, 0.35);
    animation: loginModalIn 0.22s ease-out;
}

@keyframes loginModalIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 14px;
}

.login-modal-title {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
}

.login-modal-close {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #f3f4f8;
    color: #777;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: all 0.2s;
}

.login-modal-close:hover {
    background: #eceef8;
    color: #333;
}

.login-modal-body {
    padding: 0 28px 28px;
    text-align: center;
}

.login-modal-desc {
    margin: 0 auto 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.75;
}

.login-qrcode-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 224px;
    height: 224px;
    margin: 0 auto 18px;
    border: 1px solid rgba(102, 126, 234, 0.16);
    border-radius: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    box-shadow: inset 0 0 0 8px rgba(102, 126, 234, 0.04);
}

.login-qrcode-card img {
    display: none;
    width: 186px;
    height: 186px;
    object-fit: contain;
}

.login-qrcode-card.has-image img {
    display: block;
}

.login-qrcode-loading,
.login-qrcode-error {
    padding: 0 18px;
    color: #777;
    font-size: 13px;
    line-height: 1.6;
}

.login-qrcode-error {
    color: #d64545;
}

.login-modal-status {
    min-height: 22px;
    margin-bottom: 14px;
    color: #667eea;
    font-size: 13px;
}

.login-modal-actions {
    display: flex;
    justify-content: center;
}

.login-refresh-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.28);
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(102, 126, 234, 0.38);
}

@media (max-width: 768px) {
    .nav-header {
        padding: 10px 15px;
        border-radius: 12px;
    }
    
    .nav-logo-text {
        display: none;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 12px;
    }

    .nav-link-external {
        padding-right: 18px;
    }

    .nav-link-tip {
        top: -6px;
        right: -6px;
        padding: 1px 4px;
        font-size: 9px;
    }

    .nav-user-info {
        padding: 4px 8px;
        gap: 6px;
    }

    .nav-user-profile {
        gap: 6px;
    }

    .nav-user-avatar {
        width: 24px;
        height: 24px;
    }

    .nav-user-name {
        max-width: 70px;
        font-size: 12px;
    }

    .nav-user-toggle {
        width: 20px;
        height: 20px;
    }

    .nav-user-toggle-icon {
        width: 6px;
        height: 6px;
    }

    .nav-user-dropdown {
        top: calc(100% + 6px);
        min-width: 76px;
    }

    .nav-user-logout {
        font-size: 12px;
        padding: 7px 10px;
    }

    .login-modal {
        max-width: 360px;
        border-radius: 18px;
    }

    .login-modal-body {
        padding: 0 20px 24px;
    }

    .login-qrcode-card {
        width: 204px;
        height: 204px;
    }

    .login-qrcode-card img {
        width: 170px;
        height: 170px;
    }
    
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        border-radius: 15px;
    }
}
