@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg-dark: #11111b;
    --card-bg: rgba(30, 30, 46, 0.45);
    --border-color: rgba(255, 255, 255, 0.05);
    --text-main: #cdd6f4;
    --text-muted: #a6adc8;
    
    /* Catppuccin Colors for gradients */
    --c-mauve: #cba6f7;
    --c-pink: #f5c2e7;
    --c-lavender: #b4befe;
    --c-sapphire: #74c7ec;
    --c-green: #a6e3a1;
    --c-yellow: #f9e2af;
}

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

/* =========================================
   SKELETON LOADING
========================================= */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-load 1.5s infinite;
    color: transparent !important;
    border-radius: 4px;
}
.skeleton * {
    visibility: hidden;
}
@keyframes skeleton-load {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.hidden { display: none !important; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    height: 100vh; width: 100vw;
    overflow: hidden;
    user-select: none;
    cursor: none; /* Custom Cursor */
}

/* =========================================
   CUSTOM CURSOR
========================================= */
#cursor-dot {
    position: fixed; top: 0; left: 0;
    width: 6px; height: 6px;
    background: var(--c-sapphire);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--c-sapphire);
}
#cursor-ring {
    position: fixed; top: 0; left: 0;
    width: 30px; height: 30px;
    border: 2px solid rgba(116, 199, 236, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, border-color 0.2s;
}
/* When hovering over clickable things */
a:hover ~ #cursor-ring, button:hover ~ #cursor-ring, i:hover ~ #cursor-ring {
    width: 50px; height: 50px;
    border-color: var(--c-lavender);
    background: rgba(180, 190, 254, 0.1);
}

/* Hide custom cursor on touch devices */
@media (pointer: coarse) {
    body { cursor: auto; }
    #cursor-dot, #cursor-ring { display: none !important; }
}

/* =========================================
   BACKGROUND & EFFECTS
========================================= */
.bg-layer {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    filter: blur(4px) brightness(0.4);
    z-index: 1;
}

/* Scanline / Grid Overlay */
.grid-overlay {
    position: absolute; inset: 0; z-index: 2;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

/* Canvas Mouse Trail */
#mouse-canvas {
    position: absolute; inset: 0; z-index: 3;
    pointer-events: none;
}

/* Game / App Box */
.game-box {
    padding: 0;
}
.game-content {
    display: flex; gap: 15px; align-items: center;
}
.game-assets {
    position: relative;
    width: 60px; height: 60px;
    flex-shrink: 0;
}
.rp-large {
    width: 100%; height: 100%;
    border-radius: 12px;
    object-fit: cover;
}
.rp-small {
    position: absolute;
    bottom: -5px; right: -5px;
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 3px solid rgba(30,30,46, 0.8);
    background: #000;
}
.game-info {
    flex: 1;
    display: flex; flex-direction: column; justify-content: center;
    min-width: 0;
}
.time-elapsed {
    margin-top: 4px; font-variant-numeric: tabular-nums;
    font-size: 0.8rem; color: var(--text-muted);
}

.rp-buttons {
    display: flex; gap: 8px; margin-top: 12px; width: 100%;
}
.rp-buttons.hidden { display: none; }
.rp-button {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff; font-size: 0.75rem; font-weight: 600;
    text-align: center; cursor: pointer; text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rp-button:hover { background: rgba(255, 255, 255, 0.15); }

/* =========================================
   ENTRY SCREEN
========================================= */
.entry-screen {
    position: absolute; inset: 0; z-index: 9999;
    background: #000;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
.entry-screen.hidden {
    opacity: 0; visibility: hidden;
}

.entry-title {
    font-family: 'Space Mono', monospace;
    font-size: 2rem; font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 10px var(--c-lavender), 0 0 20px var(--c-sapphire);
    letter-spacing: 4px;
    margin-bottom: 20px;
    animation: glitch 3s infinite;
}

.entry-prompt {
    font-size: 0.9rem; color: var(--text-muted);
    letter-spacing: 1px;
    animation: blink 1.5s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* =========================================
   MAIN CONTENT & 3D TILT
========================================= */
.main-content {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column;
    overflow-y: auto; overflow-x: hidden;
    padding-bottom: 90px; /* Space for media player */
    opacity: 1; transition: opacity 1s ease;
}
.main-content.hidden { opacity: 0; pointer-events: none; }

.cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 30px;
    width: 100%;
    max-width: 1000px;
    margin: auto; /* Magic centering that prevents top cutoff */
    padding: 70px 20px 20px 20px; /* Top padding protects the overflowing avatar */
    transition: all 0.5s ease;
}

#activity-card-container {
    width: 320px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
#activity-card-container.hidden {
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
    position: absolute; /* Take it out of flow when hidden to auto-center main card */
}

.card-tilt {
    /* transition is handled by JS for smooth return */
}
#card { width: 380px; max-width: 100%; }
#activity-card-container { width: 320px; max-width: 100%; }

/* ANIMATED GRADIENT BORDER */
.card-border {
    position: relative;
    border-radius: 22px;
    box-shadow: 0 0 30px rgba(180, 190, 254, 0.3), 0 20px 50px rgba(0,0,0,0.8);
}
.card-border::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 22px;
    padding: 2px; /* border thickness */
    background: linear-gradient(45deg, var(--c-lavender), var(--c-sapphire), #89b4fa, var(--c-lavender));
    background-size: 300% 300%;
    animation: shimmerBorder 6s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes shimmerBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.card-inner {
    width: 100%;
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 20px 25px;
    position: relative;
    z-index: 2;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* For smooth lanyard updates */
.fade-transition {
    opacity: 0 !important;
}
.card-inner > div {
    transition: opacity 0.3s ease;
}

#activity-inner {
    align-items: stretch;
}

/* =========================================
   AVATAR (OVERLAPPING)
========================================= */
.avatar-wrapper {
    position: absolute;
    top: -50px; left: 50%;
    transform: translateX(-50%);
    width: 100px; height: 100px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(45deg, var(--c-lavender), var(--c-sapphire));
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 2;
    animation: float 4s ease-in-out infinite;
}
.avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%; object-fit: cover;
    background: #111;
}
.status-dot {
    position: absolute; bottom: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--text-muted); /* Offline default */
    border: 3px solid #2a2a3e; /* matches card dark area roughly */
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

/* =========================================
   USER INFO
========================================= */
.user-info {
    margin-top: 25px; /* space for avatar */
    text-align: center;
    width: 100%;
}
.display-name {
    font-family: 'Space Mono', monospace;
    font-size: 1.8rem; font-weight: 700;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.4);
    letter-spacing: -1px;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.verified-badge {
    font-size: 1.1rem; color: var(--c-sapphire);
    text-shadow: 0 0 10px var(--c-sapphire);
}
.scramble-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem; color: var(--c-lavender);
    margin-top: 6px; font-weight: 700;
    min-height: 20px; /* prevent layout shift */
    letter-spacing: 2px;
}
.user-note {
    font-size: 0.9rem;
    color: #fff;
    margin-top: 6px;
    font-weight: 500;
}
.member-since {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.badges {
    display: flex; justify-content: center; gap: 8px;
    margin: 8px 0;
}
.badges img { width: 22px; height: 22px; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4)); object-fit: contain; }


/* =========================================
   SOCIALS
========================================= */
.social-row {
    display: flex; justify-content: center; gap: 15px;
    margin: 5px 0;
}
.social-icon {
    width: 45px; height: 45px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    display: flex; justify-content: center; align-items: center;
    color: var(--text-main); font-size: 1.4rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.social-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px) scale(1.1);
}
.social-icon.discord:hover { color: #5865F2; border-color: #5865F2; box-shadow: 0 10px 20px rgba(88, 101, 242, 0.3); }
.social-icon.spotify:hover { color: #1DB954; border-color: #1DB954; box-shadow: 0 10px 20px rgba(29, 185, 84, 0.3); }
.social-icon.github:hover { color: #ffffff; border-color: #ffffff; box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2); }
.social-icon.steam:hover { color: #66c0f4; border-color: #66c0f4; box-shadow: 0 10px 20px rgba(102, 192, 244, 0.3); }
.social-icon.riot:hover { color: #ff4655; border-color: #ff4655; box-shadow: 0 10px 20px rgba(255, 70, 85, 0.3); }

/* =========================================
   DISCORD PRESENCE / NOTES BOX
========================================= */
.activity-box {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
}
.discord-presence {
    display: flex; align-items: center; gap: 12px;
}
.presence-avatar {
    width: 45px; height: 45px; border-radius: 8px; object-fit: cover;
}
.presence-info { flex: 1; overflow: hidden; }
.presence-name {
    font-size: 0.85rem; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; justify-content: space-between; align-items: center;
}
.presence-status {
    font-size: 0.7rem; font-weight: 800; color: var(--c-yellow);
    background: rgba(249, 226, 175, 0.15);
    padding: 2px 6px; border-radius: 4px;
}
.presence-state {
    font-size: 0.8rem; color: var(--text-muted); margin-top: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =========================================
   SPOTIFY PLAYER (SPINNING DISC)
========================================= */
.music-box {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
}
.music-box.hidden { display: none; }
.music-header {
    font-size: 0.7rem; font-weight: 800; color: var(--c-green);
    margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
    letter-spacing: 1px;
}

.music-content {
    display: flex; align-items: center; gap: 15px;
}

/* The Vinyl */
.spinning-disc {
    position: relative;
    width: 50px; height: 50px;
    border-radius: 50%;
    animation: spin 4s linear infinite;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
#sp-art {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
}
.disc-hole {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 12px; height: 12px;
    background: var(--card-bg);
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.5);
}

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

.music-info { flex: 1; overflow: hidden; }
.song-title {
    font-size: 0.9rem; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-artist {
    font-size: 0.8rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 6px;
}
.music-progress { width: 100%; }
.progress-bar {
    width: 100%; height: 4px; background: rgba(255,255,255,0.1);
    border-radius: 2px; overflow: hidden;
}
.progress-fill {
    width: 45%; height: 100%; background: var(--c-green);
    border-radius: 2px;
    animation: progressAnim 2s infinite alternate;
}
@keyframes progressAnim { 0%{width:40%} 100%{width:60%} } /* fake visualizer */
.time-row {
    display: flex; justify-content: space-between;
    font-size: 0.65rem; color: var(--text-muted); margin-top: 4px;
}

/* =========================================
   FOOTER (VIEWS)
========================================= */
.footer-row {
    width: 100%; display: flex; justify-content: center;
}
.views {
    font-size: 0.8rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px; border-radius: 12px;
}

/* =========================================
   FLOATING BGM PLAYER
========================================= */
.bgm-player {
    position: absolute;
    bottom: 25px; left: 50%;
    z-index: 50;
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px 25px 12px 12px;
    display: flex; align-items: center; gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 1s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
    width: 380px; /* Match card width */
    max-width: 90vw;
    overflow: hidden; /* For visualizer */
}
.bgm-player.visible {
    opacity: 1; pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.bgm-player:hover { transform: translateX(-50%) scale(1.02); }

.bgm-cover {
    width: 45px; height: 45px;
    border-radius: 50%; position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    z-index: 2;
    flex-shrink: 0;
}
.bgm-spin {
    width: 100%; height: 100%;
    border-radius: 50%; object-fit: cover;
    animation: spin 4s linear infinite;
    animation-play-state: paused;
}
.bgm-player.playing .bgm-spin { animation-play-state: running; }
.bgm-hole {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 10px; height: 10px;
    background: #1e1e2e;
    border: 2px solid rgba(255,255,255,0.1);
}
.bgm-cover-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s;
    cursor: pointer; z-index: 4;
}
.bgm-cover-overlay i {
    color: #fff; font-size: 1.2rem;
}
.bgm-cover:hover .bgm-cover-overlay {
    opacity: 1;
}

.bgm-info { display: flex; flex-direction: column; justify-content: center; flex: 1; z-index: 2; min-width: 0; }
.bgm-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; min-width: 0; }
.marquee-container {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    min-width: 0;
}
.bgm-title {
    font-size: 0.8rem; font-weight: 700; color: #fff;
    display: inline-block;
    padding-left: 100%;
    animation: marquee 8s linear infinite;
}
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.bgm-controls {
    display: flex; gap: 12px; align-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
}
.bgm-controls i {
    font-size: 0.9rem; cursor: pointer; transition: color 0.2s;
}
.bgm-controls i:hover { color: var(--c-lavender); }

.volume-slider {
    -webkit-appearance: none;
    width: 60px; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none; cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%; background: var(--c-lavender);
}

.bgm-timeline { display: flex; align-items: center; gap: 8px; width: 100%; }
.bgm-time { font-size: 0.65rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline-slider {
    -webkit-appearance: none;
    flex: 1; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none; cursor: pointer;
    position: relative;
    z-index: 5;
}
.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 0; height: 0; /* Hidden thumb by default, only visible on hover */
    background: var(--c-lavender);
    border-radius: 50%;
    transition: width 0.1s, height 0.1s;
}
.timeline-slider:hover::-webkit-slider-thumb {
    width: 10px; height: 10px;
}

#audio-visualizer {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    opacity: 0.3;
    pointer-events: none;
}

/* =========================================
   TOAST NOTIFICATION & EMOJI
========================================= */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--c-lavender);
    color: var(--text-main);
    padding: 10px 22px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 15px rgba(180, 190, 254, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.custom-status-emoji {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
    object-fit: contain;
    margin-right: 4px;
}

#sp-progress-fill {
    animation: none;
    width: 0%;
    transition: width 0.3s linear;
}

/* =========================================
   REDUCED MOTION SUPPORT
========================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .avatar-wrapper { animation: none; }
    .spinning-disc { animation: none; }
    .bgm-spin { animation: none; }
}

