:root {
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --card-bg: rgba(30, 30, 30, 0.9);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --accent-color: #2A7AFF;
    --accent-light: #2A7AFF;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --security-green: #28a745;
    --error-red: #dc3545;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

a, a:link, a:visited, a:hover, a:active, a:focus {
    text-decoration: none;
    color: inherit;
}

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    transition: background-color 0.3s ease, color 0.1s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    flex: 1;
}

header {
    text-align: center;
    padding: 70px 0 30px;
    width: 100%;
}

.avatar-container {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 25px;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 8px var(--shadow-color), 
                0 0 0 2px var(--accent-light);
    border: 2px solid transparent;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 8px var(--shadow-color), 
                    0 0 0 2px var(--accent-light);
    }
    50% {
        box-shadow: 0 4px 12px var(--shadow-color), 
                    0 0 0 3px var(--accent-light);
    }
    100% {
        box-shadow: 0 4px 8px var(--shadow-color), 
                    0 0 0 2px var(--accent-light);
    }
}

.avatar:hover {
    animation: rotateOnce 0.8s ease forwards;
}

@keyframes rotateOnce {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    transition: color 0.1s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    transition: color 0.1s ease;
}

.links-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    width: 100%;
    margin: 20px 0;
}

.link-card {
    background: var(--card-bg);
    border-radius: 50px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 16px var(--shadow-color), 
                0 0 0 1px var(--accent-light);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
    border-top: 3px solid var(--accent-color);
    -webkit-backdrop-filter: blur(10px);
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px var(--shadow-color), 
                0 0 0 1px var(--accent-light);
}

.link-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    transition: color 0.1s ease;
}

.link-title {
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 600;
    transition: color 0.1s ease;
}

.link-desc {
    font-size: 0.95rem;
    opacity: 0.8;
    transition: color 0.1s ease;
}

footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
    width: 100%;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: color 0.1s ease;
}

.copyright {
    white-space: nowrap;
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.copyright a:hover {
    text-decoration: none;
}

.runtime-info {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.runtime-number {
    color: var(--accent-color);
    font-weight: bold;
}

.icp-info {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.icp-link, .gongan-link {
    color: var(--accent-color);
    transition: opacity 0.2s ease;
}

.icp-link:hover, .gongan-link:hover {
    opacity: 0.9;
    text-decoration: none;
}

.security-badge {
    display: inline-block;
    background: rgba(40, 167, 69, 0.1);
    color: var(--security-green);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 1rem;
    border: 1px solid var(--security-green);
}

.browser-prompt {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    color: white;
}

.browser-prompt h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

.browser-prompt p {
    max-width: 500px;
    margin-bottom: 25px;
    line-height: 1.6;
}

.browser-prompt .url-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    word-break: break-all;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
}

.copy-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
    transition: background 0.3s;
}

.copy-btn:hover {
    background: #1a68e6;
}

.gongan-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
}

@media (min-width: 601px) {
    .links-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 50px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 30px 15px;
        justify-content: flex-start;
    }
    
    .links-container {
        grid-template-columns: 1fr;
        gap: 60px;
        width: 71.11%;
        margin: 0 auto;
    }
    
    .link-card {
        padding: 12px 15px;
        display: block;
        text-align: left;
        width: 100%;
        margin: 0 auto;
        border-radius: 25px;
        height: auto;
        min-height: 50px;
        box-shadow: 0 8px 16px var(--shadow-color), 
                    0 0 0 0.5px var(--accent-light);
        border-top: 0.5px solid var(--accent-color);
    }
    
    .link-card:nth-child(1) {
        margin-top: 35px;
        margin-bottom: -30px;
    }
    
    .link-card:nth-child(2) {
        margin-top: 0;
        margin-bottom: -30px;
    }
    
    .link-card:nth-child(3) {
        margin-top: 0;
        margin-bottom: 30px;
    }
    
    .link-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 24px var(--shadow-color), 
                    0 0 0 0.5px var(--accent-light);
    }
    
    .link-icon {
        display: none;
    }
    
    .link-content {
        display: block;
        text-align: left;
    }
    
    .link-title {
        display: inline;
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0;
        padding: 0;
    }
    
    .link-title::after {
        content: "";
        margin: 0;
    }
    
    .link-desc {
        display: inline;
        font-size: 0.95rem;
        opacity: 0.8;
        margin: 0;
        padding: 0;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .avatar-container {
        width: 80px;
        height: 80px;
    }
    
    header {
        padding: 40px 0 15px;
    }
    
    footer {
        margin-top: 0px;
    }
    
    .copyright {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8rem;
        margin-top: 5px;
        margin-bottom: 8px;
    }
    
    .icp-info, .runtime-info {
        font-size: 0.7rem;
    }
    
    footer {
        margin-top: 0px;
    }
    
    .security-badge {
        margin-top: 0.8rem;
    }
    
    .avatar {
        box-shadow: 0 3px 6px var(--shadow-color), 
                    0 0 0 1.5px var(--accent-light);
    }
    
    @keyframes pulse {
        0% {
            box-shadow: 0 3px 6px var(--shadow-color), 
                        0 0 0 1.5px var(--accent-light);
        }
        50% {
            box-shadow: 0 3px 8px var(--shadow-color), 
                        0 0 0 2px var(--accent-light);
        }
        100% {
            box-shadow: 0 3px 6px var(--shadow-color), 
                        0 0 0 1.5px var(--accent-light);
        }
    }
}

@media (max-width: 400px) {
    .browser-prompt {
        padding: 15px;
    }
    
    .browser-prompt h2 {
        font-size: 1.5rem;
    }
    
    .browser-prompt p {
        font-size: 0.9rem;
    }
    
    .links-container {
        width: 71.11%;
    }
}

@media (prefers-contrast: high) {
    .link-card {
        box-shadow: 0 0 0 2px var(--accent-color) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .avatar {
        animation: none !important;
    }
    
    .avatar:hover {
        animation: none !important;
    }
}