/*!
 * ============================================================
 * StationHQ Embeddable Player — Stylesheet
 *
 *   Copyright (c) StationHQ / YesStreaming. All Rights Reserved.
 *
 *   This file, together with the companion HTML and JavaScript,
 *   is the proprietary work of StationHQ. It is licensed for use
 *   ONLY when (a) the file is loaded from the original StationHQ
 *   panel host that produced it, and (b) it is used to embed a
 *   stream owned by a paying StationHQ customer.
 *
 *   You may NOT:
 *     - Copy, mirror, repackage, rebrand, or rehost this file
 *       (in part or whole) on any server you do not control via
 *       a paid StationHQ subscription.
 *     - Strip, alter, or hide this notice.
 *     - Reverse-engineer the obfuscated companion JavaScript or
 *       circumvent the runtime origin / rehost guard contained
 *       therein.
 *     - Use these styles, layout, animations, or design system
 *       (including the "Vinyl" Style 2 visual identity) as the
 *       basis for any competing or derivative streaming player,
 *       SDK, or template — commercial or non-commercial.
 *
 *   Unauthorised use is a violation of copyright and the
 *   StationHQ Terms of Service and will be pursued.
 * ============================================================
 */

:root {
    --shq-bg:        #0f172a;
    --shq-surface:   rgba(255, 255, 255, 0.04);
    --shq-border:    rgba(255, 255, 255, 0.08);
    --shq-text:      #f8fafc;
    --shq-text-dim:  rgba(248, 250, 252, 0.65);
    --shq-accent:    #ff6b00;
    --shq-accent-2:  #ff9233;
    --shq-radius:    14px;
    --shq-font:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --shq-font-size-title:  1.05rem;
    --shq-font-size-artist: 0.875rem;
    --shq-art-size:  72px;
    --shq-pad:       14px;
}

/* Light theme override */
body[data-theme='light'] {
    --shq-bg:        #ffffff;
    --shq-surface:   rgba(0, 0, 0, 0.03);
    --shq-border:    rgba(0, 0, 0, 0.08);
    --shq-text:      #0f172a;
    --shq-text-dim:  rgba(15, 23, 42, 0.6);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    /* Body MUST carry the player's bg colour (not transparent). The
     * iframe element itself has a matching border-radius so its rounded
     * corners are clipped — but the antialiased edge of that clip is
     * sub-pixel partially transparent. If body is transparent the host
     * page bg (often white) bleeds through those partially-transparent
     * pixels and shows up as a thin white halo around the rounded
     * corners. Filling body with var(--shq-bg) makes the antialiased
     * pixels fade from card-colour → host-colour cleanly, with no
     * stray-colour leak into the corner. Users who genuinely want a
     * fully-transparent embed can pass bg=transparent (or any rgba with
     * alpha 0) on the URL — the JS still applies it via --shq-bg and
     * the body inherits that. */
    background: var(--shq-bg);
    color: var(--shq-text);
    font-family: var(--shq-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* ================== Card ================== */

.shq-card {
    width: 100%;
    height: 100%;
    min-height: 100px;
    padding: var(--shq-pad);
    display: flex;
    align-items: center;
    gap: var(--shq-pad);
    background: var(--shq-bg);
    color: var(--shq-text);
    /* The iframe element itself carries the corner-radius (set by the host
     * snippet from the `radius` slider). Repeating the same radius on the
     * card draws a second, slightly inset rounded rectangle whose sub-pixel
     * antialiasing exposes a thin band of body-bg between the iframe edge
     * and the card — visible as a "second background" frame around the
     * player. We drop the inner radius + border so the card fills the
     * iframe edge-to-edge and only one rounded rectangle is rendered. */
    border-radius: 0;
    border: 0;
    overflow: hidden;
    position: relative;
    transition: background 200ms ease;
}

/* Subtle gradient sheen behind the card */
.shq-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--shq-accent) 18%, transparent) 0%, transparent 60%),
        radial-gradient(120% 80% at 100% 100%, color-mix(in srgb, var(--shq-accent-2) 12%, transparent) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0.9;
}

.shq-card > * { position: relative; z-index: 1; }

/* ================== Album Art ================== */

.shq-art {
    width: var(--shq-art-size);
    height: var(--shq-art-size);
    border-radius: calc(var(--shq-radius) - 6px);
    background: var(--shq-surface);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.shq-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 400ms ease;
    z-index: 1;
}

.shq-art img.is-visible { opacity: 1; }

.shq-art-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--shq-text-dim);
    background: var(--shq-surface);
}

body[data-show-art='false'] .shq-art { display: none; }

/* ================== Meta column ================== */

.shq-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.shq-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    min-height: 18px;
}

.shq-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    background: color-mix(in srgb, var(--shq-accent) 18%, transparent);
    color: var(--shq-accent);
    border: 1px solid color-mix(in srgb, var(--shq-accent) 35%, transparent);
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
}

.shq-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--shq-accent);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--shq-accent) 50%, transparent);
    animation: shq-pulse 1.6s infinite;
}

@keyframes shq-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--shq-accent) 60%, transparent); }
    70%  { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.shq-station {
    color: var(--shq-text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body[data-show-badge='false'] .shq-badge { display: none; }

.shq-dj-name {
    margin: 0 0 4px 0;
    padding: 0;
    color: var(--shq-accent);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shq-title {
    margin: 0;
    color: var(--shq-text);
    font-size: var(--shq-font-size-title);
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shq-artist {
    margin: 0;
    color: var(--shq-text-dim);
    font-size: var(--shq-font-size-artist);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================== Progress ================== */

.shq-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

body[data-show-progress='false'] .shq-progress-row { display: none; }

.shq-progress {
    flex: 1;
    height: 4px;
    background: color-mix(in srgb, var(--shq-text) 12%, transparent);
    border-radius: 4px;
    overflow: hidden;
    min-width: 40px;
}

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

.shq-time {
    color: var(--shq-text-dim);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ================== Request button ================== */

.shq-request-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--shq-accent), var(--shq-accent-2));
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--shq-accent) 40%, transparent);
}

.shq-request-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--shq-accent) 55%, transparent);
}

.shq-request-btn:active { transform: translateY(0); opacity: 0.9; }

/* Honour the embed's showRequest=0 toggle and the native [hidden] attribute.
   The base rule above sets display:inline-flex, which would otherwise win over
   the user-agent's [hidden]{display:none}. */
.shq-request-btn[hidden],
body[data-show-request='false'] .shq-request-btn { display: none !important; }

/* ================== Rating (thumbs up / down) ==================
   Sits inline with the title row. Two soft-pill buttons + a small "votes"
   counter. Hidden entirely when the embed has showRating=0 OR the station
   has ratings disabled (the JS toggles [hidden] in both cases). */
.shq-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--shq-text-dim);
    user-select: none;
    flex-wrap: wrap;
}

.shq-rate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--shq-surface);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, color 120ms ease;
}

.shq-rate-btn svg { width: 13px; height: 13px; }

.shq-rate-btn:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--shq-accent) 50%, var(--shq-border));
}

.shq-rate-btn:active { transform: translateY(0); opacity: 0.85; }

/* Active states — green for up, red for down. */
.shq-rate-up.is-active {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.6);
    color: #4ade80;
}
.shq-rate-down.is-active {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.6);
    color: #f87171;
}

.shq-rate-btn[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* Per-button vote counts are hidden — the running total in `.shq-rate-total`
   is the single source of truth shown to listeners (one vote count, not
   three). Kept in the DOM so legacy embeds and external CSS overrides keep
   working unchanged. */
.shq-rate-count { display: none; }

.shq-rate-total {
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.shq-rating[hidden],
body[data-show-rating='false'] .shq-rating { display: none !important; }

/* ================== Website dot ==================
   Tiny clickable indicator anchored to the top-right corner of the card.
   Visible only when the panel admin set a Website URL (rendered hidden
   otherwise via the [hidden] attribute). */
.shq-website-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--shq-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--shq-accent) 25%, transparent),
                0 2px 6px color-mix(in srgb, var(--shq-accent) 35%, transparent);
    cursor: pointer;
    text-decoration: none;
    z-index: 5;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
    opacity: 0.85;
}
.shq-website-dot:hover {
    transform: scale(1.25);
    opacity: 1;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--shq-accent) 35%, transparent),
                0 3px 10px color-mix(in srgb, var(--shq-accent) 55%, transparent);
}
.shq-website-dot:focus-visible {
    outline: 2px solid var(--shq-accent);
    outline-offset: 3px;
}
.shq-website-dot[hidden] { display: none !important; }

/* ================== Floating mount/quality selector ================== */

.shq-quality {
    position: relative;
    flex-shrink: 0;
}

/* Compact, icon-only round button — same height/shape as the mute
 * button. The "active" mount label lives inside the popover (header
 * row + the selected radio item), so the chip itself stays minimal
 * and never overflows the controls row, regardless of label length
 * (e.g. "AAC 320k", "OGG 96k mono"). */
.shq-quality-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--shq-surface);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
    border-radius: 50%;
    font-family: inherit;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, color 120ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.shq-quality-chip:hover {
    background: color-mix(in srgb, var(--shq-accent) 18%, transparent);
    border-color: color-mix(in srgb, var(--shq-accent) 40%, transparent);
    color: var(--shq-accent);
    transform: translateY(-1px);
}

.shq-quality-chip[aria-expanded="true"] {
    background: color-mix(in srgb, var(--shq-accent) 24%, transparent);
    border-color: color-mix(in srgb, var(--shq-accent) 55%, transparent);
    color: var(--shq-accent);
}

.shq-quality-icon { display: block; }
.shq-quality-label[hidden] { display: none; }

/* Popover header — surfaces the currently selected mount so the user
 * can confirm the active stream without a chip label. */
.shq-quality-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid color-mix(in srgb, var(--shq-text) 10%, transparent);
    color: var(--shq-text-dim);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.shq-quality-pop {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    z-index: 25;
    min-width: 170px;
    max-width: 240px;
    padding: 6px;
    background: var(--shq-bg, #0f172a);
    color: var(--shq-text);
    border: 1px solid color-mix(in srgb, var(--shq-text) 16%, transparent);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: shq-quality-pop-in 140ms ease-out;
}

@keyframes shq-quality-pop-in {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.shq-quality-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 100ms ease;
    width: 100%;
}

.shq-quality-item:hover,
.shq-quality-item:focus-visible {
    background: color-mix(in srgb, var(--shq-text) 10%, transparent);
    outline: none;
}

.shq-quality-item[aria-selected="true"] {
    background: color-mix(in srgb, var(--shq-accent) 22%, transparent);
    color: var(--shq-text);
    font-weight: 700;
}

.shq-quality-item[aria-selected="true"]::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shq-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--shq-accent) 30%, transparent);
}

.shq-quality-item-meta {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.shq-quality-item-codec {
    font-weight: 700;
    line-height: 1;
}

.shq-quality-item-sub {
    font-size: 0.65rem;
    opacity: 0.65;
    line-height: 1;
    letter-spacing: 0.02em;
}

/* ================== Play / Stop button ================== */

.shq-play-btn {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--shq-accent), var(--shq-accent-2));
    box-shadow: 0 6px 18px color-mix(in srgb, var(--shq-accent) 45%, transparent);
    transition: transform 120ms ease, box-shadow 160ms ease, opacity 120ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 0;
}

.shq-play-btn:hover { transform: scale(1.04); }
.shq-play-btn:active { transform: scale(0.96); }
.shq-play-btn:focus-visible {
    outline: 2px solid var(--shq-accent);
    outline-offset: 3px;
}

.shq-play-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.shq-play-icon svg {
    position: absolute;
    inset: 0;
    margin: auto;
    transition: opacity 140ms ease, transform 140ms ease;
    opacity: 0;
    transform: scale(0.7);
}

/* Default state (stopped) → show play */
.shq-play-btn[data-state='stopped'] .shq-icon-play {
    opacity: 1;
    transform: scale(1) translateX(1px);
}

/* Loading / buffering → show spinner */
.shq-play-btn[data-state='loading'] .shq-icon-load {
    opacity: 1;
    transform: scale(1);
    animation: shq-spin 900ms linear infinite;
}
.shq-play-btn[data-state='loading'] {
    cursor: progress;
}

/* Playing → show pause/stop bars */
.shq-play-btn[data-state='playing'] .shq-icon-pause {
    opacity: 1;
    transform: scale(1);
}
/* "Playing" state highlight.
 *
 * The original drop-shadow (0 18px 40px) extended ~40px OUTSIDE the card.
 * Because the card fills 100% of the iframe and the iframe itself has
 * `border-radius` + `overflow: hidden`, the iframe's rectangular bounding
 * box clipped that outside shadow at hard right-angles — producing a
 * visible "square halo" around the rounded card on every embed. The user
 * (correctly) reported this as "I see a square behind the rounded corners".
 *
 * Fix: keep all visual emphasis INSIDE the card. We use a 1px accent ring
 * via outline (which never adds layout) for both Style 1 and Style 2. The
 * outline draws *on* the card edge, so it can't bleed past the iframe.
 */
body[data-playing='true'] .shq-card {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shq-accent) 30%, transparent),
                inset 0 0 24px color-mix(in srgb, var(--shq-accent) 14%, transparent);
}

@keyframes shq-spin {
    to { transform: rotate(360deg); }
}

body[data-show-play='false'] .shq-play-btn { display: none; }

/* ================== Volume ================== */

.shq-controls {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.shq-volume {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--shq-surface);
    border: 1px solid var(--shq-border);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    height: 36px;
}

.shq-mute-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--shq-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.shq-mute-btn .shq-icon-mute { display: none; }
body[data-muted='true'] .shq-mute-btn .shq-icon-vol  { display: none; }
body[data-muted='true'] .shq-mute-btn .shq-icon-mute { display: inline-block; }

.shq-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: color-mix(in srgb, var(--shq-text) 18%, transparent);
    border-radius: 4px;
    outline: none;
    margin: 0;
    cursor: pointer;
    accent-color: var(--shq-accent);
}

.shq-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--shq-accent);
    border: 2px solid var(--shq-bg);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.shq-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--shq-accent);
    border: 2px solid var(--shq-bg);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

body[data-show-volume='false'] .shq-volume { display: none; }

/* ---------- Mobile browsers: drop the volume slider, widen the text ----------
 * On phones/tablets the hardware buttons own the output level, so the on-screen
 * slider is removed and the freed horizontal space is handed back to the track
 * title/artist so long names stay readable instead of truncating early. */
body.shq-mobile .shq-volume { display: none; }
body.shq-mobile .shq-meta {
    flex: 1 1 auto;
    min-width: 0;
}
body.shq-mobile .shq-title,
body.shq-mobile .shq-artist {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
body.shq-mobile .shq-artist { -webkit-line-clamp: 1; }

/* ================== Responsive layout ==================
 * The player is always rendered inside a fixed-size iframe, so the
 * iframe's internal viewport == the embed's width × height. That means
 * @media queries inside this stylesheet behave like container queries:
 * resizing the embed (or viewing it on a phone where the iframe is set
 * to 100% width) triggers the rules below directly.
 *
 * Layout decision tree (top wins):
 *   1. width ≤ 480 AND height ≥ 260 → MOBILE PORTRAIT (stacked card)
 *   2. width ≤ 480 AND height <  260 → COMPACT HORIZONTAL (tight row)
 *   3. width ≤ 280                   → ULTRA TINY (hide volume)
 *   else                             → DEFAULT (desktop horizontal)
 */

/* ---------- 1. Mobile portrait — stacked vertical card ----------
 * Triggers on real phones (iframe set to width=100%) and on tall
 * embeds (e.g. 320×320). Album art on top, title/artist centre
 * under it, big play button below, volume + request on the
 * bottom row. Sized to fit a 260px-tall iframe; if the embedder
 * gave us 360+ height, the second @media block scales everything
 * up for a more impressive look.                                */
@media (max-width: 480px) and (min-height: 260px) {
    .shq-card {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        padding: 12px;
        gap: 8px;
        text-align: center;
    }

    .shq-art {
        order: 1;
        align-self: center;
        width: min(35%, 110px, 25vh);
        height: auto;
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        border-radius: 12px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    }

    .shq-meta {
        order: 2;
        align-items: center;
        gap: 3px;
        width: 100%;
        flex-shrink: 0;
    }
    .shq-row-top { justify-content: center; min-height: 16px; }
    .shq-title {
        white-space: normal;
        line-height: 1.2;
        max-height: 2.4em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        text-overflow: ellipsis;
    }
    .shq-artist { white-space: normal; }
    .shq-progress-row { width: 100%; margin-top: 4px; }

    .shq-play-btn {
        order: 3;
        width: 52px;
        height: 52px;
        align-self: center;
        flex-shrink: 0;
    }
    .shq-play-btn .shq-play-icon,
    .shq-play-btn svg { width: 24px; height: 24px; }

    .shq-controls {
        order: 4;
        width: 100%;
        justify-content: space-between;
        gap: 10px;
        flex-shrink: 0;
    }
    .shq-volume {
        flex: 1;
        min-width: 0;
        height: 36px;
        padding: 4px 12px 4px 4px;
    }
    .shq-mute-btn { width: 30px; height: 30px; }
    .shq-volume-slider { width: 100%; flex: 1; }
    .shq-volume-slider::-webkit-slider-thumb { width: 16px; height: 16px; }
    .shq-volume-slider::-moz-range-thumb     { width: 16px; height: 16px; }
    .shq-request-btn {
        padding: 9px 14px;
        font-size: 0.8rem;
    }
    .shq-request-btn span { display: inline; }

    .shq-website-dot { top: 10px; right: 10px; width: 12px; height: 12px; }
}

/* ---------- 1b. Mobile portrait, taller embeds (≥ 380 high) ----
 * When the operator picks a tall embed (e.g. 360×400, 400×480),
 * upscale the album art and play button so the player feels
 * "full-screen mobile" instead of a small banner. We scale the
 * art with `vh` so the meta column always has enough vertical
 * room (badge + 2-line title + artist + progress = ~80px). */
@media (max-width: 480px) and (min-height: 380px) {
    .shq-card { padding: 14px; gap: 12px; }
    .shq-art  { width: min(50%, 160px, 28vh); border-radius: 14px; }
    .shq-meta { gap: 5px; }
    .shq-play-btn { width: 58px; height: 58px; }
    .shq-play-btn .shq-play-icon,
    .shq-play-btn svg { width: 26px; height: 26px; }
    .shq-volume { height: 38px; }
}

/* ---------- 1c. Mobile portrait, generous embeds (≥ 500 high) - */
@media (max-width: 480px) and (min-height: 500px) {
    .shq-card { padding: 18px; gap: 16px; }
    .shq-art  { width: min(60%, 220px, 32vh); border-radius: 16px; }
    .shq-play-btn { width: 64px; height: 64px; }
    .shq-play-btn .shq-play-icon,
    .shq-play-btn svg { width: 28px; height: 28px; }
}

/* ---------- 2. Compact horizontal — tight inline row ----------
 * Triggers on the "Compact" preset (300×110) and on the default
 * "Medium" preset (380×180) when the embedder did not increase the
 * height. Same shape as the desktop card, just smaller.            */
@media (max-width: 480px) and (max-height: 259px) {
    .shq-card { padding: 12px; gap: 12px; }
    .shq-art  { width: 56px; height: 56px; }
    .shq-play-btn { width: 46px; height: 46px; }
    .shq-volume-slider { width: 60px; }
    .shq-request-btn span { display: none; }
    .shq-request-btn { padding: 8px; }
}

/* Phone-sized "short" embeds (≤ 380 wide, short height): wrap the
 * controls beneath the meta so the title/artist still get full width.
 * The .shq-controls row is full-width and right-aligned; we cap the
 * volume slider to a small fixed width so the box never extrudes
 * past the card padding. */
@media (max-width: 380px) and (max-height: 259px) {
    .shq-card {
        flex-wrap: wrap;
        align-content: center;
        row-gap: 8px;
        padding: 10px;
    }
    .shq-meta { flex-basis: calc(100% - 56px - 46px - 24px); }
    .shq-controls {
        flex-basis: 100%;
        max-width: 100%;
        justify-content: flex-end;
        order: 4;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .shq-volume {
        padding: 3px 8px 3px 3px;
        height: 30px;
        min-width: 0;
        max-width: 100%;
    }
    .shq-mute-btn { width: 24px; height: 24px; }
    .shq-volume-slider { width: 70px; flex: 0 1 70px; }
    .shq-progress-row { margin-top: 4px; }
    .shq-title { font-size: calc(var(--shq-font-size-title) * 0.95); }
}

/* ---------- 3. Ultra-tiny embeds: hide volume entirely ---------- */
@media (max-width: 280px) {
    .shq-volume { display: none; }
    .shq-art { width: 44px; height: 44px; }
    .shq-play-btn { width: 40px; height: 40px; }
}

/* ---------- Touch tweaks (any layout) ----------
 * On real touch devices, give all interactive controls bigger hit
 * targets and disable hover-only :hover transforms that feel sticky
 * on mobile (since hover state can latch after a tap).             */
@media (hover: none) and (pointer: coarse) {
    .shq-play-btn:hover,
    .shq-request-btn:hover { transform: none; }
    .shq-play-btn:active   { transform: scale(0.94); }
    .shq-request-btn:active{ transform: scale(0.97); opacity: 0.92; }
    .shq-mute-btn          { width: 32px; height: 32px; }
}

/* ================== Connection error overlay ================== */

.shq-card[data-state='error']::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent 0 8px,
        color-mix(in srgb, var(--shq-text) 6%, transparent) 8px 16px
    );
    pointer-events: none;
    opacity: 0.4;
}

/* ================== Modal ================== */

.shq-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.shq-modal[hidden] { display: none; }

.shq-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.shq-modal-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 28px);
    background: var(--shq-bg);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.shq-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--shq-border);
}

.shq-modal-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.shq-modal-close {
    background: transparent;
    border: 0;
    color: var(--shq-text-dim);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    transition: background 120ms ease, color 120ms ease;
}

.shq-modal-close:hover { color: var(--shq-text); background: var(--shq-surface); }

.shq-modal-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--shq-border);
}

.shq-modal-search input {
    width: 100%;
    padding: 9px 12px;
    background: var(--shq-surface);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.shq-modal-search input:focus {
    border-color: var(--shq-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--shq-accent) 25%, transparent);
}

.shq-modal-results {
    flex: 1;
    min-height: 140px;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 8px;
}

.shq-modal-empty {
    margin: 28px 16px;
    text-align: center;
    color: var(--shq-text-dim);
    font-size: 0.85rem;
}

.shq-modal-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 120ms ease;
}

.shq-modal-result:hover,
.shq-modal-result[aria-selected='true'] {
    background: var(--shq-surface);
}

.shq-modal-result[aria-selected='true'] {
    outline: 1px solid color-mix(in srgb, var(--shq-accent) 50%, transparent);
}

.shq-modal-result-meta {
    flex: 1;
    min-width: 0;
}

.shq-modal-result-title {
    color: var(--shq-text);
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shq-modal-result-artist {
    color: var(--shq-text-dim);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shq-modal-result-check {
    color: var(--shq-accent);
    opacity: 0;
    transition: opacity 120ms ease;
}

.shq-modal-result[aria-selected='true'] .shq-modal-result-check { opacity: 1; }

/* Per-row instant-request button */
.shq-modal-result-req-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid color-mix(in srgb, var(--shq-accent) 60%, transparent);
    border-radius: 20px;
    background: transparent;
    color: var(--shq-accent);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    white-space: nowrap;
}
.shq-modal-result-req-btn:hover {
    background: var(--shq-accent);
    color: #fff;
    border-color: var(--shq-accent);
}

/* Prevent text selection on the player card (source-copy friction) */
.shq-card, .shq-modal-card {
    -webkit-user-select: none;
    user-select: none;
}

.shq-modal-message {
    padding: 12px 16px;
    border-top: 1px solid var(--shq-border);
}

.shq-modal-message label {
    display: block;
    color: var(--shq-text-dim);
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.shq-modal-message-hint { opacity: 0.6; }

.shq-modal-message textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--shq-surface);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    outline: none;
}

.shq-modal-message textarea:focus {
    border-color: var(--shq-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--shq-accent) 25%, transparent);
}

.shq-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--shq-border);
}

.shq-modal-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 120ms ease, transform 120ms ease;
}

.shq-modal-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.shq-modal-btn-ghost {
    background: var(--shq-surface);
    color: var(--shq-text);
    border: 1px solid var(--shq-border);
}

.shq-modal-btn-primary {
    background: linear-gradient(135deg, var(--shq-accent), var(--shq-accent-2));
    color: #fff;
}

.shq-modal-btn-primary:not(:disabled):hover { transform: translateY(-1px); }

.shq-modal-toast {
    margin: 0;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--shq-accent) 15%, transparent);
    color: var(--shq-text);
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid var(--shq-border);
}

.shq-modal-toast[data-tone='error'] {
    background: rgba(220, 38, 38, 0.15);
    color: #fecaca;
}

.shq-modal-toast[data-tone='success'] {
    background: rgba(34, 197, 94, 0.15);
    color: #bbf7d0;
}

/* ==========================================================================
 * STYLE 2 — "Vinyl Glow"
 * ==========================================================================
 * A more visually distinctive layout: the album art is rendered as a
 * spinning vinyl record (with a centred accent label and grooved
 * background), the card uses a stronger glassmorphism + radial gradient,
 * the play button sits to the side with a soft accent halo, and the
 * volume / progress controls are slimmed down for a "premium" feel.
 *
 * Activated by adding `shq-style-2` to the body class (the player JS
 * sets this automatically from the ?style=2 URL parameter).
 * All Style 1 rules above remain the defaults; Style 2 only overrides
 * what needs to change, so future styles can layer on top the same way.
 * ========================================================================== */

body.shq-style-2 {
    --shq-art-size: 96px;
}

/* Style 2's card carries its OWN full gradient background, so the body
 * underneath must be transparent — otherwise the body's solid var(--shq-bg)
 * paints a flat-colour rectangle that shows through where the card's rounded
 * corners curve in, producing the visible "halo / flute" around the card.
 * The card and the iframe share the same border-radius, so making the body
 * transparent lets the gradient card's rounded edge be the only visible
 * boundary on the host page. html:has() also clears the html element so
 * Safari/Chrome don't re-paint a default page background. */
html:has(body.shq-style-2),
body.shq-style-2 {
    background: transparent;
}

body.shq-style-2 .shq-card {
    background:
        radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--shq-accent) 32%, transparent) 0%, transparent 48%),
        radial-gradient(circle at 90% 110%, color-mix(in srgb, var(--shq-accent-2) 24%, transparent) 0%, transparent 60%),
        linear-gradient(135deg, color-mix(in srgb, var(--shq-bg) 92%, black) 0%, var(--shq-bg) 100%);
    border: 1px solid color-mix(in srgb, var(--shq-text) 8%, transparent);
}

body.shq-style-2 .shq-card::before {
    background:
        radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--shq-accent) 10%, transparent) 0%, transparent 70%);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    opacity: 1;
}

/* ----- Vinyl record ----- */
body.shq-style-2 .shq-art {
    border-radius: 50%;
    background:
        /* centre label */
        radial-gradient(circle at center,
            color-mix(in srgb, var(--shq-accent) 95%, black) 0%,
            color-mix(in srgb, var(--shq-accent) 95%, black) 14%,
            transparent 14.5%),
        /* concentric grooves */
        repeating-radial-gradient(circle at center,
            #1a1a1a 0px,
            #1a1a1a 1.5px,
            #2a2a2a 2.5px,
            #1a1a1a 4px),
        #111;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.55),
        0 0 0 2px rgba(0, 0, 0, 0.4) inset,
        0 0 0 1px color-mix(in srgb, var(--shq-accent) 30%, transparent);
    transition: transform 240ms ease;
    overflow: visible;
}

/* Album art image becomes a circular sticker on top of the vinyl, with a
 * tiny centre hole punched through (mask-image), so the vinyl groove is
 * visible at the edge and the centre looks like a real spindle hole.   */
body.shq-style-2 .shq-art img {
    border-radius: 50%;
    -webkit-mask-image: radial-gradient(circle at center,
        transparent 0,
        transparent 7%,
        black 8%,
        black 92%,
        transparent 95%);
            mask-image: radial-gradient(circle at center,
        transparent 0,
        transparent 7%,
        black 8%,
        black 92%,
        transparent 95%);
}

/* Hide the music-note placeholder on Style 2; the vinyl grooves are
 * the placeholder. */
body.shq-style-2 .shq-art-fallback { display: none; }

/* Spin while playing. We use a long duration so it's a slow, classy
 * rotation, not a fidget-spinner. */
body.shq-style-2[data-playing='true'] .shq-art {
    animation: shq-vinyl-spin 9s linear infinite;
}

@keyframes shq-vinyl-spin {
    to { transform: rotate(360deg); }
}

/* ----- Play button (with accent halo) ----- */
body.shq-style-2 .shq-play-btn {
    width: 56px;
    height: 56px;
    box-shadow:
        0 0 0 6px color-mix(in srgb, var(--shq-accent) 14%, transparent),
        0 8px 22px color-mix(in srgb, var(--shq-accent) 50%, transparent);
}

/* ----- Typography ----- */
body.shq-style-2 .shq-title {
    font-weight: 800;
    letter-spacing: -0.01em;
}
body.shq-style-2 .shq-artist {
    opacity: 0.78;
    font-weight: 500;
}
body.shq-style-2 .shq-station {
    color: color-mix(in srgb, var(--shq-accent) 90%, var(--shq-text));
    font-weight: 700;
}

/* ----- Badge: pill with soft accent ring ----- */
body.shq-style-2 .shq-badge {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid color-mix(in srgb, var(--shq-accent) 45%, transparent);
    color: var(--shq-accent);
}

/* ----- Slim, glowing progress bar ----- */
body.shq-style-2 .shq-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}
body.shq-style-2 .shq-progress-fill {
    background: var(--shq-accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--shq-accent) 70%, transparent);
}

/* ----- Volume: minimal, no pill background ----- */
body.shq-style-2 .shq-volume {
    background: transparent;
    border: 0;
    padding: 0;
    height: 32px;
    gap: 6px;
}
body.shq-style-2 .shq-volume-slider {
    width: 70px;
    background: rgba(255, 255, 255, 0.12);
}
body.shq-style-2 .shq-mute-btn {
    color: var(--shq-text-dim);
}
body.shq-style-2 .shq-mute-btn:hover {
    color: var(--shq-accent);
}

/* ----- Request button: outline / ghost in Style 2 ----- */
body.shq-style-2 .shq-request-btn {
    background: transparent;
    color: var(--shq-accent);
    border: 1px solid color-mix(in srgb, var(--shq-accent) 55%, transparent);
    box-shadow: none;
}
body.shq-style-2 .shq-request-btn:hover {
    background: color-mix(in srgb, var(--shq-accent) 14%, transparent);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--shq-accent) 35%, transparent);
}

/* ----- On the mobile-portrait Style-2 layout, scale the vinyl up
        and centre everything more tightly ----- */
@media (max-width: 480px) and (min-height: 260px) {
    body.shq-style-2 .shq-art {
        border-radius: 50%;
        width: min(40%, 130px, 28vh);
    }
}
@media (max-width: 480px) and (min-height: 380px) {
    body.shq-style-2 .shq-art {
        width: min(55%, 200px, 32vh);
    }
}
