:root {
    --bg: #0a0a0f;
    --card-bg: rgba(15, 15, 25, 0.55);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(99, 102, 241, 0.3);
    --text: #f0f0f5;
    --text-dim: #7a7a90;
    --text-muted: #4a4a60;
    --accent: #6366f1;
    --accent-light: #a78bfa;
    --spotify: #1db954;
    --youtube: #ff0000;
    --discord: #5865f2;
    --github: #f0f0f5;
    --green: #10b981;
    --yellow: #eab308;
    --red: #ef4444;
    --radius: 20px;
}

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

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

::selection { background: var(--accent); color: #fff; }

/* Background */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
    filter: saturate(0.5) brightness(0.7);
}

.bg-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(10, 10, 15, 0.3) 0%, rgba(10, 10, 15, 0.88) 70%);
}

.noise {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 128px;
}

/* Visualizer Canvas */
.visualizer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.7;
}

/* Particles */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: pFloat linear infinite;
}

@keyframes pFloat {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    8% { opacity: 0.5; }
    92% { opacity: 0.5; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* Page */
.page {
    position: relative;
    z-index: 3;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
}

/* Main Card */
.card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    padding: 32px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    overflow: hidden;
    transition: box-shadow 0.4s, border-color 0.4s;
}

@keyframes cardIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.4), transparent);
}

.card-glow {
    position: absolute;
    top: -80px; left: 50%;
    transform: translateX(-50%);
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
    pointer-events: none;
}

.card.phonk-active {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow:
        0 0 30px rgba(99, 102, 241, 0.15),
        0 0 60px rgba(139, 92, 246, 0.08),
        inset 0 0 30px rgba(99, 102, 241, 0.03);
}

/* Avatar */
.avatar-wrapper {
    position: relative;
    width: 100px; height: 100px;
}

.avatar-ring {
    position: absolute;
    inset: -5px;
}

.ring-svg { width: 100%; height: 100%; }

.ring-rotate {
    animation: ringSpin 6s linear infinite;
    transform-origin: center;
}

@keyframes ringSpin {
    to { stroke-dashoffset: -326.7; }
}

.avatar-img {
    width: 100px; height: 100px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    border: 3px solid rgba(10, 10, 15, 0.8);
    background: #1a1a2e;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card.phonk-active .avatar-img {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
}

.status-dot {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 3px solid var(--bg);
    z-index: 2;
    background: var(--green);
    transition: background 0.3s;
}

.status-dot.idle { background: var(--yellow); }
.status-dot.dnd { background: var(--red); }
.status-dot.offline { background: #555; }

/* Username */
.username {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #c4c4d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    line-height: 1.2;
}

/* Bio */
.bio {
    font-size: 0.82rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: -4px;
}

/* Badges */
.badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid;
}

.badge-dev {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
    border-color: rgba(99, 102, 241, 0.2);
}

.badge-nitro {
    background: rgba(234, 179, 8, 0.12);
    color: var(--yellow);
    border-color: rgba(234, 179, 8, 0.2);
}

/* Socials */
.socials {
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

.social-btn {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-btn:hover {
    transform: translateY(-3px) scale(1.08);
    color: #fff;
}

.social-btn.github:hover {
    background: var(--github);
    color: #000;
    border-color: var(--github);
    box-shadow: 0 4px 20px rgba(240, 240, 245, 0.2);
}

.social-btn.spotify:hover {
    background: var(--spotify);
    border-color: var(--spotify);
    box-shadow: 0 4px 20px rgba(29, 185, 84, 0.3);
}

.social-btn.spotify-artist:hover {
    background: linear-gradient(135deg, #1db954, #1ed760);
    border-color: var(--spotify);
    box-shadow: 0 4px 20px rgba(29, 185, 84, 0.3);
}

.social-btn.youtube:hover {
    background: var(--youtube);
    border-color: var(--youtube);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.3);
}

.social-btn.discord:hover {
    background: var(--discord);
    border-color: var(--discord);
    box-shadow: 0 4px 20px rgba(88, 101, 242, 0.3);
}

/* Spotify Now Playing */
.spotify-now {
    width: 100%;
    background: rgba(29, 185, 84, 0.06);
    border: 1px solid rgba(29, 185, 84, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 2px;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--spotify);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.np-dot {
    width: 6px; height: 6px;
    background: var(--spotify);
    border-radius: 50%;
    animation: npPulse 1.5s ease-in-out infinite;
}

@keyframes npPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.track-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-img {
    width: 38px; height: 38px;
    border-radius: 6px;
    object-fit: cover;
}

.track-text { flex: 1; min-width: 0; }

.track-name {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Music Control */
.music-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-top: 2px;
}

.play-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.play-btn:hover {
    background: var(--accent-light);
    transform: scale(1.1);
}

.play-btn i { margin-left: 1px; }

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    transition: width 0.1s linear;
}

.time-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    min-width: 32px;
    text-align: center;
}

.volume-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.volume-wrap i {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.vol-slider {
    width: 50px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.vol-slider::-moz-range-thumb {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

/* Views */
.views {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Bottom Card */
.bottom-card {
    width: 100%;
    max-width: 400px;
    animation: cardIn 0.7s 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.96);
}

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

.github-mini:hover {
    border-color: var(--card-border-hover);
}

.github-mini.phonk-active {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.mini-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 10px;
    color: var(--text);
}

.mini-stats {
    display: flex;
    justify-content: space-around;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ms-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.05rem;
}

.ms-lbl {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 10px 18px;
    background: rgba(15, 15, 25, 0.9);
    border: 1px solid var(--green);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    z-index: 999;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast i { color: var(--green); }

/* Responsive */
@media (max-width: 480px) {
    .card { padding: 24px 18px 18px; max-width: 95%; }
    .avatar-wrapper { width: 86px; height: 86px; }
    .avatar-img { width: 86px; height: 86px; }
    .username { font-size: 1.3rem; }
    .social-btn { width: 38px; height: 38px; font-size: 0.95rem; }
    .bottom-card { max-width: 95%; }
    .vol-slider { width: 35px; }
}

@media (max-height: 700px) {
    .card { padding: 22px 20px 16px; gap: 8px; }
    .avatar-wrapper { width: 76px; height: 76px; }
    .avatar-img { width: 76px; height: 76px; }
    .username { font-size: 1.25rem; }
    .bottom-card { display: none; }
}
