.sg-mosaic-section {
    width: 100%;
    background: #030303;
    color: #fff;
    padding: 80px 0 0;
    overflow: hidden;
}

.sg-mosaic-header {
    max-width: 1100px;
    margin: 0 auto 42px;
    padding: 0 24px;
    text-align: center;
}

.sg-tetris-wrap {
    position: relative;
    width: 100%;
}

.sg-tetris-grid {
    position: relative;
    z-index: 2;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-auto-flow: dense;
    gap: 18px;
    width: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(142,234,115,.12) 0 2px, transparent 3px),
        radial-gradient(circle at 70% 65%, rgba(118,214,255,.10) 0 2px, transparent 3px),
        linear-gradient(90deg, rgba(142,234,115,.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(142,234,115,.055) 1px, transparent 1px),
        #030303;
    background-size:
        180px 180px,
        260px 260px,
        80px 80px,
        80px 80px,
        auto;
}

.sg-tetris-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .28;
    background:
        linear-gradient(90deg, transparent 0 12%, rgba(142,234,115,.18) 12.2%, transparent 12.8%),
        linear-gradient(0deg, transparent 0 28%, rgba(118,214,255,.12) 28.2%, transparent 28.8%),
        linear-gradient(90deg, transparent 0 54%, rgba(255,222,115,.10) 54.2%, transparent 54.7%),
        linear-gradient(0deg, transparent 0 72%, rgba(142,234,115,.13) 72.1%, transparent 72.7%);
    background-size: 420px 420px, 520px 520px, 620px 620px, 760px 760px;
}

.sg-tetris-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle, rgba(142,234,115,.85) 0 2px, transparent 3px),
        radial-gradient(circle, rgba(118,214,255,.65) 0 2px, transparent 3px),
        radial-gradient(circle, rgba(255,222,115,.65) 0 2px, transparent 3px);
    background-size: 340px 340px, 510px 510px, 690px 690px;
    background-position: 20px 40px, 180px 140px, 420px 260px;
    animation: sgLedPulse 7s infinite ease-in-out;
    opacity: .22;
}

.sg-tetris-tile {
    position: relative;
    z-index: 3;
    display: block;
    overflow: hidden;
    background: #111;
    grid-column: span 1;
    grid-row: span 1;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,.22),
        0 0 18px rgba(0,0,0,.8);
}

.sg-tetris-tile.sg-large {
    grid-column: span 2;
    grid-row: span 1;
    aspect-ratio: 16 / 9;
}

.sg-tetris-tile.sg-vertical {
    grid-column: span 1;
    grid-row: span 2;
    aspect-ratio: 9 / 16;
}

.sg-tetris-tile.sg-square {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: 1 / 1;
}

.sg-tetris-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, filter .35s ease;
}

.sg-tetris-tile:hover img {
    transform: scale(1.06);
    filter: brightness(.75);
}

.sg-masonry-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,.7),
        rgba(0,0,0,.08) 45%,
        rgba(0,0,0,.78)
    );
    color: #fff;
    pointer-events: none;
}

.sg-tetris-tile .sg-masonry-overlay::after {
    content: "";
    position: absolute;
    left: -45%;
    bottom: 0;
    width: 45%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(142,234,115,.95),
        rgba(118,214,255,.95),
        transparent
    );
    opacity: 0;
    animation: sgSignalTravel 9s infinite linear;
    animation-delay: calc(var(--sg-delay, 0) * 1s);
    pointer-events: none;
}

.sg-tetris-tile:nth-child(5n) .sg-masonry-overlay::after { --sg-delay: 1; }
.sg-tetris-tile:nth-child(7n) .sg-masonry-overlay::after { --sg-delay: 3; }
.sg-tetris-tile:nth-child(11n) .sg-masonry-overlay::after { --sg-delay: 5; }

.sg-title {
    display: block;
    max-width: 90%;
    text-transform: uppercase;
    line-height: 1.05;
    text-shadow: 0 2px 10px rgba(0,0,0,.9);
}

.sg-artist {
    display: block;
    color: #fff !important;
    font-weight: 900;
    font-size: clamp(.58rem, .65vw, .9rem);
    margin-bottom: 3px;
}

.sg-tutorial {
    display: block;
    font-weight: 800;
    font-size: clamp(.55rem, .6vw, .8rem);
}

.sg-colour-1 { color: #8EEA73 !important; }
.sg-colour-2 { color: #76D6FF !important; }
.sg-colour-3 { color: #FFDE73 !important; }
.sg-colour-4 { color: #FF8FD6 !important; }
.sg-colour-5 { color: #BFA2FF !important; }

.sg-play {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.9);
    display: grid;
    place-items: center;
    font-size: 10px;
    align-self: flex-start;
    background: rgba(0,0,0,.25);
}

/* side connector nodes only */
.sg-tetris-tile::before,
.sg-tetris-tile::after {
    content: "";
    position: absolute;
    z-index: 5;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    pointer-events: none;
}

.sg-tetris-tile::before {
    right: -3px;
    top: 50%;
    background: #8EEA73;
    box-shadow: 0 0 12px rgba(142,234,115,.95);
}

.sg-tetris-tile::after {
    left: -3px;
    top: 50%;
    background: #76D6FF;
    box-shadow: 0 0 12px rgba(118,214,255,.95);
}

/* SVG cable layer */
.sg-cable-layer {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 6 !important;
    pointer-events: none !important;
    overflow: visible;
}

.sg-cable {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .82;
}

.sg-cable-glow {
    fill: none;
    stroke-width: 13;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .32;
    filter: blur(6px);
}

.sg-cable-port {
    display: none;
}

.sg-cable-pulse {
    opacity: .95;
    filter: drop-shadow(0 0 8px currentColor);
}

.sg-video-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0,0,0,.9);
}

.sg-video-modal.is-open {
    display: flex;
}

.sg-video-box {
    width: min(1100px, 94vw);
    aspect-ratio: 16 / 9;
    background: #000;
}

.sg-video-frame {
    width: 100%;
    height: 100%;
    display: block;
}

.sg-video-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 1000000;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 999px;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

@keyframes sgLedPulse {
    0%, 72%, 100% {
        opacity: .16;
        filter: brightness(.7);
    }

    76% {
        opacity: .55;
        filter: brightness(1.45);
    }

    82% {
        opacity: .22;
        filter: brightness(.9);
    }

    88% {
        opacity: .46;
        filter: brightness(1.25);
    }
}

@keyframes sgSignalTravel {
    0%, 68% {
        transform: translateX(0);
        opacity: 0;
    }

    72% {
        opacity: .8;
    }

    86% {
        transform: translateX(360%);
        opacity: .8;
    }

    92%, 100% {
        transform: translateX(420%);
        opacity: 0;
    }
}

@media (max-width: 1500px) {
    .sg-tetris-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1000px) {
    .sg-tetris-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .sg-tetris-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sg-tetris-tile.sg-large,
    .sg-tetris-tile.sg-vertical,
    .sg-tetris-tile.sg-square {
        grid-column: span 1;
        grid-row: span 1;
        aspect-ratio: 16 / 9;
    }

    .sg-cable-layer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sg-tetris-grid::after,
    .sg-tetris-tile .sg-masonry-overlay::after,
    .sg-cable-pulse {
        animation: none;
    }
}