/* ============================================================
   MAZDUR CLUB
   ============================================================ */

:root {
    --ink: #ffffff;
    --muted: rgba(255, 255, 255, 0.58);
    --faint: rgba(255, 255, 255, 0.14);
    --glass: rgba(14, 14, 17, 0.62);
    --live: #22c55e;

    --pad: 22px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;

    /* Phone browsers shrink the viewport as the address bar slides
       away; dvh follows that, so nothing jumps or gets clipped. */
    height: 100dvh;
}

body {
    background: #0b0b0d;
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    overscroll-behavior: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}


/* ============================================================
   BACKGROUND
   ============================================================ */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #14060a;
}

.backdrop-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Static and full size: the photo covers the whole screen, at 1:1
   with no zoom on top.

   Centred because the sign is centred in the picture. On a portrait
   phone cover crops the sides (the photo is 1.82:1), so centring is
   what keeps as much of "मज़दूर क्लब" in frame as a full-bleed
   background allows. */
.backdrop-img {
    object-fit: cover;
    object-position: center center;
}

/* There used to be a second, blurred copy behind this one to fill
   the gaps that `contain` left on tall screens. `cover` can't leave
   a gap, so it would never be visible — it's gone rather than
   costing every phone a needless full-screen blur. The colour on
   .backdrop is all that shows, and only while the image loads. */


/* Darkened top and bottom so the clock and player stay readable
   whatever the photo happens to be doing behind them. */
.backdrop-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0.5) 0%,
            rgba(0, 0, 0, 0.1) 26%,
            rgba(0, 0, 0, 0.14) 55%,
            rgba(0, 0, 0, 0.76) 100%);
}


/* ============================================================
   TOP BAR
   ============================================================ */

/* The background photo carries its own signage, so the clock and
   badges sit in the corners rather than across the middle of it. */
.top {
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    right: 0;

    padding: calc(var(--pad) + env(safe-area-inset-top)) var(--pad) 0;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
}


/* ---------- Clock ---------- */

.clock {
    line-height: 1;
}

.clock-time {
    font-size: clamp(34px, 5.4vw, 56px);
    font-weight: 200;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 26px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.clock-seconds {
    font-size: 0.36em;
    font-weight: 400;
    opacity: 0.5;
    margin-left: 4px;
}

.clock-meridiem {
    font-size: 0.26em;
    font-weight: 500;
    letter-spacing: 0.14em;
    opacity: 0.55;
    margin-left: 6px;
    text-transform: uppercase;
}

.clock-date {
    margin-top: 7px;
    font-size: 11.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}


/* ---------- Online count ---------- */

.live {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 7px 14px;
    border-radius: 999px;

    background: var(--glass);
    border: 1px solid var(--faint);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--live);
    animation: ping 2s ease-out infinite;
}

/* Dot goes grey when the socket drops */
.live.is-offline .live-dot {
    background: #9ca3af;
    animation: none;
}

@keyframes ping {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.live-count {
    font-weight: 600;
}

.live-label {
    color: var(--muted);
}

/* Little bump whenever the number changes */
.live-count.bump {
    animation: bump 0.4s var(--ease);
}

@keyframes bump {
    0%   { transform: translateY(0); }
    40%  { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}


/* ============================================================
   SOUNDBOARD
   Stuck on the wall above the player at odd angles, like the
   notices on the board behind them.
   ============================================================ */

.board {
    position: fixed;
    z-index: 15;
    left: 50%;
    bottom: calc(152px + env(safe-area-inset-bottom));
    transform: translateX(-50%);

    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;

    max-width: calc(100vw - 20px);
    padding: 6px 10px 10px;

    /* Too many buttons for a narrow screen? Swipe them. */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;

    /* Fades the buttons out at the edges instead of slicing one
       in half, which reads as "there's more this way". */
    -webkit-mask-image: linear-gradient(to right,
        transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(to right,
        transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}

.chip {
    scroll-snap-align: center;
}

.board::-webkit-scrollbar {
    display: none;
}


.chip {
    position: relative;
    flex: none;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;

    padding: 9px 12px 8px;
    border-radius: 14px;

    /* Heavier than the rest of the glass on purpose — this strip
       sits over the busiest part of the photo and has to hold its
       own against it. */
    background: rgba(10, 10, 13, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);

    color: rgba(255, 255, 255, 0.72);

    transform: rotate(var(--tilt, 0deg));

    transition: transform 0.32s var(--ease),
                color 0.24s var(--ease),
                border-color 0.24s var(--ease),
                background 0.24s var(--ease);
}

/* Straightens up and jumps when you go near it */
.chip:hover {
    color: var(--ink);
    background: rgba(26, 26, 31, 0.9);
    border-color: rgba(255, 255, 255, 0.36);
    transform: rotate(0deg) translateY(-7px) scale(1.06);
}

.chip:active {
    transform: rotate(0deg) translateY(-2px) scale(0.97);
}

.chip:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}

.chip-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.32s var(--ease);
}

.chip:hover .chip-icon {
    transform: scale(1.18) rotate(-8deg);
}

.chip-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* Glow ring that pulses out while the clip plays */
.chip-ring {
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    pointer-events: none;
    opacity: 0;
}

.chip.is-playing {
    color: var(--ink);
    background: rgba(28, 28, 33, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(0deg) translateY(-5px) scale(1.05);
}

.chip.is-playing .chip-ring {
    opacity: 1;
    animation: ring 1.5s ease-out infinite;
}

@keyframes ring {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
    70%  { box-shadow: 0 0 0 13px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.chip.is-playing .chip-icon {
    animation: wiggle 0.55s var(--ease) infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-11deg) scale(1.12); }
    50%      { transform: rotate(11deg) scale(1.12); }
}


/* ============================================================
   BANNER
   ============================================================ */

.banner {
    position: fixed;
    z-index: 40;
    top: 38%;
    left: 50%;

    display: flex;
    align-items: center;
    gap: 14px;

    max-width: calc(100vw - 32px);

    padding: 18px 30px;
    border-radius: 20px;

    background: rgba(10, 10, 12, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);

    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.9);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.banner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* On a landscape phone the middle of the screen is where the
   soundboard lives, so the banner moves up out of its way. */
@media (max-height: 520px) {

    .banner {
        top: 74px;
        padding: 11px 20px;
        gap: 10px;
    }

    .banner-icon { font-size: 23px; }
    .banner-text { font-size: 15px; }
}

.banner-icon {
    font-size: 34px;
    line-height: 1;
}

.banner-text {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.01em;
}


/* ============================================================
   PLAYER
   ============================================================ */

.player {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%);

    width: min(430px, calc(100vw - 28px));

    padding: 14px 16px 13px;
    border-radius: 22px;

    background: var(--glass);
    border: 1px solid var(--faint);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.player-main {
    display: flex;
    align-items: center;
    gap: 13px;
}


/* ---------- Spinning disc ---------- */

.disc {
    position: relative;
    flex: none;

    width: 54px;
    height: 54px;
    border-radius: 50%;

    overflow: hidden;
    background: #1a1a1e;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);

    /* Runs always, paused when the music is paused. Keeping the
       animation alive rather than removing it means the disc
       resumes from where it stopped instead of snapping to 0. */
    animation: spin 7s linear infinite;
    animation-play-state: paused;
}

.disc.spinning {
    animation-play-state: running;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.disc-art {
    width: 100%;
    height: 100%;

    /* YouTube thumbs are 16:9 with letterboxing; scaling up and
       cropping the middle gives a clean square for the circle. */
    object-fit: cover;
    transform: scale(1.42);

    display: block;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}

.disc-art.ready {
    opacity: 1;
}

/* Vinyl centre */
.disc-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 13px;
    height: 13px;
    margin: -6.5px 0 0 -6.5px;
    border-radius: 50%;
    background: #0b0b0d;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.disc-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.16),
        inset 0 0 22px rgba(0, 0, 0, 0.55);
}


/* ---------- Track text ---------- */

.track {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--muted);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ---------- Buttons: pause + next only ---------- */

.buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}

.btn {
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.btn:active {
    transform: scale(0.9);
}

.btn-play {
    width: 40px;
    height: 40px;
    background: #fff;
    color: #101013;
}

.btn-play:hover {
    transform: scale(1.07);
}

.btn-side {
    width: 40px;
    height: 40px;
    opacity: 0.7;
}

.btn-side:hover {
    opacity: 1;
}

.icon {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.btn-side .icon {
    width: 16px;
    height: 16px;
}

/* Swap play/pause glyphs off one class on <body> */
.icon-pause { display: none; }

body.is-playing .icon-play  { display: none; }
body.is-playing .icon-pause { display: block; }

/* Buttons are dead until the YouTube player is ready */
body:not(.is-ready) .btn {
    opacity: 0.35;
    pointer-events: none;
}


/* ---------- Progress ---------- */

.bar {
    height: 3px;
    margin: 12px 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.bar-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #fff;
    transition: width 0.3s linear;
}


/* ---------- Meta row ---------- */

.meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    font-size: 10.5px;
    color: var(--muted);
}

.time {
    font-variant-numeric: tabular-nums;
    flex: none;
}

.yt-link {
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.2s var(--ease);

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.yt-link:hover {
    opacity: 1;
    text-decoration: underline;
}


/* ============================================================
   START OVERLAY
   ============================================================ */

.start {
    position: fixed;
    inset: 0;
    z-index: 60;

    display: grid;
    place-items: center;

    background: rgba(6, 6, 8, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    animation: fade 0.45s var(--ease);
}

.start[hidden] {
    display: none;
}

@keyframes fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 13px;

    padding: 15px 26px;
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    font-size: 14.5px;
    font-weight: 500;

    transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.start-btn:hover {
    background: rgba(255, 255, 255, 0.17);
    transform: scale(1.04);
}

.start-icon {
    font-size: 12px;
}


/* ============================================================
   HIDDEN YOUTUBE PLAYER
   We only want the audio. It stays in the layout (rather than
   display:none, which some browsers treat as "not playing")
   but sits off-screen behind everything.
   ============================================================ */

.yt-host {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 320px;
    height: 180px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}


/* ============================================================
   SMALL SCREENS
   ============================================================ */

@media (max-width: 600px) {

    :root {
        --pad: 14px;
    }

    .clock-time {
        font-size: 30px;
    }

    .clock-date {
        font-size: 9.5px;
        letter-spacing: 0.12em;
    }

    /* The board packs in tighter and scrolls sideways rather than
       shrinking the buttons past the point of being tappable. */
    .board {
        bottom: calc(142px + env(safe-area-inset-bottom));
        gap: 8px;
        justify-content: flex-start;
    }

    .chip {
        padding: 9px 11px 8px;
        border-radius: 14px;
    }

    .chip-icon {
        font-size: 22px;
    }

    .chip-label {
        font-size: 9.5px;
    }

    .player {
        bottom: calc(14px + env(safe-area-inset-bottom));
        padding: 12px 13px 11px;
        border-radius: 19px;
    }

    .disc {
        width: 48px;
        height: 48px;
    }

    .banner {
        padding: 15px 22px;
        gap: 11px;
    }

    .banner-icon { font-size: 27px; }
    .banner-text { font-size: 17px; }
}

/* Very short screens (landscape phones) — drop the seconds and
   date so the clock doesn't collide with the player. */
@media (max-height: 460px) {

    .clock-date,
    .clock-seconds {
        display: none;
    }

    .clock-time {
        font-size: 38px;
    }
}


@media (prefers-reduced-motion: reduce) {

    .backdrop-img,
    .disc,
    .live-dot,
    .chip.is-playing .chip-icon,
    .chip.is-playing .chip-ring {
        animation: none !important;
    }

    .chip {
        transform: none;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}
