:root {
    --purple: #7c24de;
    --purple-dark: #2c1054;
    --pink: #ff5eb8;
    --pink-soft: #ffb1d6;
    --cyan: #3fe0ff;
    --yellow: #ffe066;
    --cream: #fff7ea;
    --ink: #2a1145;
    --muted: #6b4c8a;
    --border: var(--ink);
    --shadow-hard: 4px 4px 0 var(--ink);
    --shadow-soft: 0 16px 34px rgba(44, 16, 84, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 48px 18px;
    display: flex;
    justify-content: center;
    color: var(--ink);
    font-family: "Comic Sans MS", "Chalkboard SE", "Trebuchet MS", Verdana, sans-serif;
    background-color: var(--purple-dark);
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.85) 1px, transparent 1.6px),
        radial-gradient(rgba(255, 224, 102, 0.7) 1px, transparent 1.6px),
        linear-gradient(135deg, rgba(124, 36, 222, 0.78) 0%, rgba(255, 94, 184, 0.6) 48%, rgba(63, 224, 255, 0.72) 100%),
        url("img/bg-cartes.jpeg");
    background-size: 28px 28px, 52px 52px, cover, cover;
    background-position: 0 0, 14px 20px, center, center;
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1.4px);
    background-size: 70px 70px;
    background-position: 35px 10px;
    animation: twinkle 3.5s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.75; }
}

.page {
    width: 100%;
    max-width: 430px;
    position: relative;
    z-index: 1;
}

.header {
    position: relative;
    text-align: center;
    margin-bottom: 24px;
    padding: 26px 22px;
    border: 3px solid var(--border);
    border-radius: 18px;
    background: var(--cream);
    box-shadow: var(--shadow-hard), var(--shadow-soft);
}

.header::before,
.header::after {
    content: "★";
    position: absolute;
    color: var(--yellow);
    text-shadow: 0 0 0 var(--ink), 1px 1px 0 var(--ink);
    font-size: 22px;
    animation: spin-star 6s linear infinite;
}

.header::before {
    top: -12px;
    left: -10px;
}

.header::after {
    bottom: -12px;
    right: -10px;
    animation-direction: reverse;
}

@keyframes spin-star {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cream);
    font-size: 30px;
    font-weight: 800;
    background: conic-gradient(from 180deg, var(--pink), var(--purple), var(--cyan), var(--yellow), var(--pink));
    border: 3px solid var(--ink);
    box-shadow: var(--shadow-hard);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.name {
    margin: 0 0 8px;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
    color: var(--purple);
    -webkit-text-stroke: 1px var(--ink);
    text-shadow: 2px 2px 0 var(--pink-soft);
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.music-widget {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 12px 15px;
    border: 3px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(90deg, var(--cyan) 0%, var(--cream) 45%);
    box-shadow: var(--shadow-hard), var(--shadow-soft);
}

.vinyl {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 50%;
    background: conic-gradient(var(--purple), var(--pink), var(--yellow), var(--cyan), var(--purple));
    border: 2px solid var(--ink);
    position: relative;
    box-shadow: 0 0 0 3px var(--cream), var(--shadow-hard);
}

.vinyl::after {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    border: 1px dashed rgba(42, 17, 69, 0.45);
}

.vinyl-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 9px;
    background: var(--cream);
    border: 2px solid var(--ink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.vinyl.spinning {
    animation: spin 2.2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.music-info {
    flex: 1;
    min-width: 0;
}

.music-title {
    margin: 0;
    color: var(--purple);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.music-track {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.play-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 2px solid var(--ink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    background: var(--yellow);
    box-shadow: var(--shadow-hard);
    cursor: pointer;
}

.play-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
}

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

.game-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 2px solid var(--ink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--ink);
    background: var(--cyan);
    box-shadow: var(--shadow-hard);
    cursor: pointer;
}

.game-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
}

.tetris-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 8, 40, 0.72);
    backdrop-filter: blur(4px);
}

.tetris-overlay[hidden] {
    display: none;
}

.tetris-panel {
    position: relative;
    width: 100%;
    max-width: 360px;
    padding: 20px;
    border: 3px solid var(--ink);
    border-radius: 18px;
    background: var(--cream);
    box-shadow: var(--shadow-hard), var(--shadow-soft);
}

.tetris-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.tetris-title {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--purple);
}

.tetris-close {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--pink);
    color: var(--cream);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink);
}

.tetris-body {
    display: flex;
    gap: 14px;
    justify-content: center;
}

#tetrisCanvas {
    border: 3px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-hard);
    background: var(--cream);
}

.tetris-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 84px;
}

.tetris-label {
    margin: 6px 0 0;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.tetris-score {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--purple);
}

.tetris-target {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
}

#tetrisNext {
    border: 2px solid var(--ink);
    border-radius: 8px;
    background: var(--cream);
}

.tetris-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.tetris-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--ink);
    border-radius: 10px;
    background: var(--yellow);
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    cursor: pointer;
}

.tetris-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
}

.tetris-win {
    position: absolute;
    inset: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
    text-align: center;
    border-radius: 14px;
    background: rgba(255, 247, 234, 0.97);
    border: 3px solid var(--ink);
}

.tetris-win[hidden] {
    display: none;
}

.tetris-win p {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--purple);
}

.play-btn-like {
    padding: 10px 18px;
    border: 2px solid var(--ink);
    border-radius: 10px;
    background: var(--cyan);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--ink);
    box-shadow: var(--shadow-hard);
    cursor: pointer;
}

.play-btn-like:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
}

.links {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.links-card {
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    border: 3px solid var(--border);
    border-radius: 16px;
    color: var(--cream);
    text-decoration: none;
    background: var(--cream);
    box-shadow: var(--shadow-hard), var(--shadow-soft);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.links-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 7px 7px 0 var(--ink), var(--shadow-soft);
}

.links-image {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    background: var(--cream);
    overflow: hidden;
    border-bottom: 3px solid var(--ink);
}

.links-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    filter: saturate(1.3) contrast(1.05) brightness(1.02);
}

.links-label {
    min-height: 104px;
    padding: 22px 24px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--cream);
    text-shadow:
        1.5px 1.5px 0 var(--ink),
        -1.5px -1.5px 0 var(--ink),
        1.5px -1.5px 0 var(--ink),
        -1.5px 1.5px 0 var(--ink),
        0 3px 6px rgba(0, 0, 0, 0.55);
}

.links-label {
    background-image:
        linear-gradient(rgba(20, 8, 40, 0.62), rgba(20, 8, 40, 0.62)),
        linear-gradient(135deg, var(--overlay-a, rgba(255, 94, 184, 0.72)), var(--overlay-b, rgba(255, 177, 153, 0.55)) 60%),
        url("img/bg-suit.jpeg");
    background-size: cover;
    background-position: center;
}

.instagram .links-label {
    --overlay-a: rgba(255, 94, 184, 0.72);
    --overlay-b: rgba(255, 177, 153, 0.5);
}

.bluesky .links-label {
    --overlay-a: rgba(63, 224, 255, 0.72);
    --overlay-b: rgba(56, 189, 248, 0.55);
}

.spacehey .links-label {
    --overlay-a: rgba(124, 36, 222, 0.78);
    --overlay-b: rgba(91, 23, 168, 0.6);
}

.signature {
    margin: 20px 0 0;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--cream);
    text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
}

@media (max-width: 520px) {
    body {
        padding: 24px 14px;
        background-attachment: scroll;
    }

    .header {
        padding: 22px 18px;
        margin-bottom: 18px;
    }

    .name {
        font-size: 22px;
    }

    .tagline {
        font-size: 12px;
    }

    .tetris-panel {
        padding: 16px;
        max-width: 320px;
    }

    .tetris-body {
        gap: 10px;
    }

    .tetris-side {
        min-width: 72px;
    }
}
