html,
body,
.public-shell {
    max-width: 100%;
    overflow-x: clip;
}

.auto-detect-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.auto-detect-row .secondary-button {
    flex: 0 0 auto;
}

.auto-detect-row .secondary-button.is-on {
    color: var(--acid);
    border-color: #d8ff4248;
    background: #d8ff420a;
}

.auto-detect-row span {
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.5;
}

.request-message {
    margin: 8px 0;
    padding: 13px 76px 13px 12px;
    border: 1px solid #ffffff0d;
    border-radius: 10px;
    background: #ffffff03;
}

.request-message p strong,
.request-message p em {
    display: block;
}

.request-message p em {
    margin-top: 3px;
    color: var(--muted);
    font-size: .68rem;
    font-style: normal;
}

.request-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    color: #ffac45;
    font-size: .56rem;
    letter-spacing: .12em;
}

.request-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.request-message[data-status="Accepted"] .request-status,
.studio-request[data-status="Accepted"] small {
    color: var(--acid);
}

.request-message[data-status="Rejected"] .request-status,
.studio-request[data-status="Rejected"] small {
    color: var(--danger);
}

.studio-request[data-status="Pending"] small {
    color: #ffac45;
}

.spotify-controller {
    margin-top: 16px;
    padding: 17px;
    border: 1px solid #1ed76035;
    border-radius: 12px;
    background: linear-gradient(135deg, #1ed7600b, #080b09);
}

.spotify-controller-heading,
.spotify-controller-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.spotify-button {
    padding: 10px 15px;
    border: 1px solid #1ed76055;
    border-radius: 999px;
    background: #1ed760;
    color: #061008;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .08em;
    cursor: pointer;
}

.spotify-button.is-connected {
    background: #1ed76012;
    color: #74ee9d;
}

.spotify-button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.spotify-controller-tools {
    align-items: end;
    margin-top: 14px;
}

.spotify-controller-tools > label:first-child {
    flex: 1;
    color: var(--muted);
    font-size: .68rem;
}

.spotify-controller select {
    display: block;
    width: 100%;
    margin-top: 7px;
    padding: 10px 12px;
    border: 1px solid #ffffff16;
    border-radius: 9px;
    background: #09090d;
    color: var(--text);
}

.spotify-auto-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    color: #b8bdba;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .07em;
}

.spotify-auto-row input {
    accent-color: #1ed760;
}

.spotify-status {
    min-height: 1.2em;
    margin: 12px 0 0;
    color: #8b938e;
    font-size: .68rem;
}

.spotify-status.error {
    color: var(--danger);
}

#visualizer {
    width: 92%;
    height: 42%;
    opacity: .8;
}

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
    .public-header,
    .public-footer,
    .radio-stage,
    .social-grid,
    .history-section {
        width: 100%;
    }

    .radio-stage {
        min-height: auto;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        align-items: stretch;
        gap: 0;
        padding-top: 42px;
        padding-bottom: 52px;
    }

    .stage-copy {
        grid-row: 1;
        align-self: auto;
        max-width: 100%;
    }

    .player-orbit {
        position: relative;
        grid-row: 2;
        width: min(78vw, 540px);
        right: auto;
        top: auto;
        justify-self: center;
        margin: -34px auto -28px;
    }

    .now-card {
        grid-row: 3;
        width: min(100%, 760px);
        max-width: none;
        margin: 0;
        justify-self: center;
        align-self: auto;
    }

    .social-grid {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 18px;
    }

    .side-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .public-header {
        min-height: 72px;
        height: auto;
        padding: max(15px, env(safe-area-inset-top)) 16px 14px;
    }

    .wordmark {
        gap: 8px;
        font-size: .68rem;
        letter-spacing: .12em;
    }

    .wordmark .mark {
        width: 34px;
        height: 34px;
    }

    .header-actions {
        gap: 8px;
    }

    .install-app {
        padding: 8px 10px;
        font-size: .52rem;
    }

    .frequency {
        display: none;
    }

    .radio-stage {
        display: grid;
        min-height: auto;
        padding: 26px 16px 34px;
        gap: 6px;
    }

    .eyebrow {
        flex-wrap: wrap;
        gap: 8px;
        font-size: .57rem;
        letter-spacing: .13em;
    }

    .divider {
        width: 24px;
    }

    .stage-copy h1 {
        margin: .7em 0 .38em;
        font-size: clamp(2.75rem, 14vw, 4rem);
        line-height: .86;
        letter-spacing: -.07em;
    }

    .dj-line {
        gap: 12px;
    }

    .dj-line span {
        font-size: .57rem;
    }

    .dj-line strong {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .player-orbit {
        width: min(96vw, 380px);
        margin: -6px auto -16px;
    }

    .play-button {
        width: 104px;
        height: 104px;
        font-size: 1.55rem;
    }

    .player-state {
        bottom: 13%;
    }

    #visualizer {
        width: 96%;
        height: 40%;
        opacity: .88;
    }

    .now-card {
        width: 100%;
        padding: 19px 18px;
        gap: 5px 12px;
        border-radius: 15px;
    }

    .now-card strong {
        font-size: clamp(1.15rem, 6vw, 1.55rem);
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .player-controls {
        display: grid;
        grid-template-columns: auto auto minmax(80px, 1fr);
        gap: 9px;
    }

    .player-controls input[type=range] {
        width: 100%;
        min-width: 80px;
    }

    .social-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 12px 16px 54px;
    }

    .side-stack {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .chat-card {
        min-height: 390px;
        padding: 18px;
    }

    .chat-card > header {
        align-items: center;
    }

    .chat-join {
        margin: 42px auto;
    }

    .messages {
        max-height: 330px;
    }

    .reactions-card,
    .request-card {
        padding: 20px 18px;
    }

    .reactions {
        gap: 6px;
    }

    .reactions button {
        flex: 1;
        width: auto;
        min-width: 0;
        height: 50px;
    }

    .history-section {
        padding: 0 16px 64px;
    }

    .public-footer {
        padding: 24px 16px max(28px, env(safe-area-inset-bottom));
    }

    .studio-dashboard,
    .admin-page {
        padding: 26px 14px 58px;
    }

    .dashboard-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .broadcast-badge {
        width: 100%;
        margin-top: 18px;
    }

    .console-card {
        padding: 17px;
    }

    .wide-form,
    .wide-form.dj-profile-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .auto-detect-row {
        align-items: stretch;
        flex-direction: column;
    }

    .spotify-controller-heading,
    .spotify-controller-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .spotify-button {
        width: 100%;
    }

    input,
    select {
        font-size: 16px;
    }
}

@media (max-width: 430px) {
    .stage-copy h1 {
        font-size: clamp(2.55rem, 13.6vw, 3.45rem);
    }

    .player-orbit {
        width: min(100%, 350px);
    }

    .chat-join .inline-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .chat-join .inline-form button {
        min-height: 46px;
    }

    .stats-strip {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .stats-strip > div {
        min-width: 0;
        padding: 13px;
    }
}

@media (orientation: landscape) and (max-height: 560px) and (hover: none) {
    .radio-stage {
        padding-top: 20px;
    }

    .player-orbit {
        width: min(62vh, 360px);
        margin: -20px auto;
    }
}
