* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Courier New', monospace;
    background: #111;
    color: #fff;
}

[hidden] {
    display: none !important;
}

/* =========================
   HOMEPAGE
   ========================= */

.home-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.home {
    flex: 1;
    position: relative;
    min-height: 0;
}

/* Website name */

.site-name {
    position: absolute;

    top: 28%;
    left: 50%;

    transform: translate(-50%, -50%);

    margin: 0;

    width: 100%;

    text-align: center;

    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.15em;
}

/* Navigation */

.home-nav {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    display: flex;
    justify-content: center;
    align-items: center;

    gap: 2.5rem;

    width: 100%;
}

.home-nav a {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 220px;
    height: 90px;

    border: 1px solid #555;

    background: #111;

    color: #fff;

    text-decoration: none;

    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.12em;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.home-nav a:hover {
    background: #222;
    border-color: #fff;
}

/* Footer */

footer {
    flex-shrink: 0;

    padding: 1.5rem 2rem;

    text-align: center;

    color: #666;

    font-size: 0.8rem;
}


/* =========================
   RADIO PAGE
   ========================= */

.radio-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.radio {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 2rem 3rem 2.5rem;
    display: flex;
    flex-direction: column;
}

.radio-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 64px;
    padding: 0 0 1.25rem;
    border-bottom: 1px solid #555;
}

.radio-station {
    justify-self: start;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
    font-weight: 400;
    letter-spacing: 0.14em;
}

.radio-status {
    justify-self: center;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 0.35rem 1px 0.5rem;
    border-radius: 50%;
    background: #e56b32;
}

.status-live {
    color: #e56b32;
}

.radio-listeners {
    justify-self: end;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
}

.radio-listeners span {
    color: #fff;
}

.radio-main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(280px, 1fr) minmax(340px, 0.95fr);
    gap: clamp(2.5rem, 5vw, 6rem);
    align-items: start;
    padding: clamp(3rem, 7vh, 6rem) clamp(1rem, 3vw, 3rem) 2rem;
}

.player-column {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.cover-art {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

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

.progress-track {
    width: 100%;
    height: 4px;
    margin-top: 1.5rem;
    background: #333;
}

.progress-fill {
    width: 46%;
    height: 100%;
    background: #aaa;
}

.player-controls {
    display: flex;
    justify-content: center;
}

.play-button {
    width: 58px;
    height: 58px;
    border: 1px solid #777;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.play-button:hover {
    border-color: #fff;
    background: #1d1d1d;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-control label {
    font-size: 0.85rem;
    color: #ccc;
}

.volume-control input[type="range"] {
    width: 100%;
}

.now-playing {
    padding-top: 0.25rem;
}

.section-label {
    margin-bottom: 2rem;
    color: #777;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
}

.track-title {
    margin-bottom: 0.8rem;
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1.1;
    font-weight: 400;
}

.track-artist {
    margin-bottom: 0.45rem;
    font-size: 1.1rem;
    color: #ccc;
}

.track-album {
    font-size: 0.95rem;
    color: #777;
}

.radio-side {
    min-width: 0;
}

.next-track {
    padding-bottom: 2rem;
    border-bottom: 1px solid #444;
    width: 100%;
    overflow: hidden;
}

.next-track .section-label {
    margin-bottom: 1rem;
}

.next-title {
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.next-artist,
.next-album {
    color: #777;
    font-size: 0.85rem;
}

.next-album {
    margin-top: 0.2rem;
}

.next-track-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.next-art {
    width: 80px;
    height: 80px;
    flex: 0 0 80px;
    overflow: hidden;
    background: #191919;
}

.next-art img {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    object-fit: cover;
    display: block;
}

.next-art img[hidden] {
    display: none !important;
}

#next-art-placeholder {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#next-art-placeholder[hidden] {
    display: none !important;
}

.next-info {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}

.next-title,
.next-artist,
.next-album {
    display: block;
    width: 100%;
    text-align: left;
    overflow-wrap: anywhere;
}

.last-played {
    position: relative;
    padding-top: 2rem;
    width: 100%;
    overflow: hidden;
    isolation: isolate;
}

.last-played .section-label {
    margin-bottom: 1rem;
}

.history-list {
    border-top: 1px solid #333;
}

.history-item {
    min-width: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 0.9rem;
    align-items: center;
    min-height: 68px;
    border-bottom: 1px solid #333;
}

.history-art {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    overflow: hidden;
}

.history-art img {
    display: block;

    width: 56px;
    height: 56px;

    object-fit: cover;

    max-width: 56px;
    max-height: 56px;
}

.history-info {
    min-width: 0;
    overflow: hidden;
}

.history-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
}

.history-album {
    margin-top: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #666;
    font-size: 0.75rem;
}

.history-item time {
    color: #666;
    font-size: 0.7rem;
    white-space: nowrap;
}

.request-toggle {
    align-self: flex-end;
    margin-top: 1.5rem;
    padding: 0.8rem 1.1rem;
    border: 1px solid #555;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    cursor: pointer;
}

.request-toggle:hover {
    border-color: #fff;
    background: #222;
}

.request-box {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #444;
}

.request-box label {
    display: block;
    margin-bottom: 0.7rem;
    color: #777;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}

.request-box textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    padding: 0.75rem;
    border: 1px solid #444;
    outline: none;
    background: #111;
    color: #fff;
    font-family: inherit;
}

.request-box button {
    margin-top: 0.7rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid #555;
    background: #111;
    color: #fff;
    font-family: inherit;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.radio-page footer a {
    color: inherit;
    text-decoration: none;
}

.radio-page footer a:hover {
    color: #fff;
}

@media (max-width: 900px) {
    .radio {
        padding: 1.5rem;
    }

    .radio-main {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }

    .player-column {
        max-width: none;
    }

    .now-playing {
        padding-top: 0;
    }

    .radio-side {
        grid-column: 1 / -1;
    }
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 700px) {

    .site-name {
        top: 25%;
    }

    .home-nav {
        top: 60%;

        flex-direction: column;

        width: 100%;

        gap: 1rem;
    }

    .home-nav a {
        width: min(320px, 80vw);
        height: 75px;
    }
}
/* Stable artwork and bounded station history. */
.cover-art { width: 100%; background: #191919; display: grid; place-items: center; }
.cover-art img { position: absolute; inset: 0; }
.cover-art img[hidden] { display: none; }
.mobile-now-label { display: none; }
.playback-row { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.history-list { height: 273px; overflow-y: auto; overscroll-behavior-y: contain; }
.history-item { height: 68px; min-height: 68px; grid-template-columns: 56px minmax(0, 1fr) auto; }
.history-art { display: grid; place-items: center; background: #191919; font-size: 0.7rem; }
.history-empty { padding: 1rem 0; color: #777; }
.request-box.is-open { display: block; }
.status-dot.offline { background: #777; }
.radio-main > *, .volume-control { min-width: 0; }
.track-title, .track-artist, .track-album { overflow-wrap: anywhere; }

@media (min-width: 901px) and (max-width: 1200px) {
    .radio-main { grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr); gap: 2rem; padding-inline: 0; }
    .radio-side { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
    /* Let the mobile document grow with its content instead of shrinking
       the main flex item into the initial viewport height. */
    .radio-page { height: auto; min-height: 100vh; }
    .radio { flex: 1 0 auto; min-height: auto; padding: 1.25rem 16px 0; }
    .radio-header {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: 0.5rem 0.75rem;
        padding-bottom: 1.25rem;
    }
    .radio-station { grid-column: 1; grid-row: 1 / 3; font-size: clamp(1rem, 4.5vw, 1.5rem); }
    .radio-status { grid-column: 2; grid-row: 1; justify-self: end; }
    .radio-listeners { grid-column: 2; grid-row: 2; justify-self: end; }
    .radio-status, .radio-listeners { font-size: 0.7rem; letter-spacing: 0.04em; text-align: right; }
    .radio-main { flex: 0 0 auto; min-height: auto; display: flex; flex-direction: column; gap: 0; padding: 1.5rem 0 0; }
    .player-column { max-width: none; gap: 1rem; }
    .mobile-now-label { display: block; margin: 0 0 0.25rem; }
    .cover-art { width: 100%; max-width: none; aspect-ratio: 1; }
    .stream-info { width: 100%; text-align: center; font-size: 0.8rem; }
    .playback-row { flex-direction: row; justify-content: center; width: 100%; gap: 1.25rem; }
    .play-button { width: 48px; height: 48px; }
    .volume-control { flex: 1; max-width: 230px; }
    .volume-control input { min-width: 0; min-height: 44px; }
    .now-playing { width: 100%; padding: 1.5rem 0 2rem; text-align: center; border-bottom: 1px solid #444; }
    .now-playing > .section-label { display: none; }
    .track-title { font-size: clamp(1.5rem, 7vw, 2.5rem); }
    .radio-side { width: 100%; }
    .next-track { padding: 2rem 0; text-align: center; }
    .last-played { padding-top: 2rem; }
    .last-played > .section-label { text-align: center; }
    .history-item { gap: 0.65rem; }
    .history-item time { font-size: 0.6rem; }
    .last-played { padding-bottom: 2rem; border-bottom: 1px solid #444; }
    .request-toggle { display: block; width: 75%; min-height: 44px; margin: 2rem auto; text-align: center; }
    .request-box { display: none; margin: 0 0 2rem; }
    .request-box.is-open { display: block; }
    .radio-page footer { border-top: 1px solid #444; margin: 0 16px; padding: 1.5rem 0; }
}

/* Stream controls and three-line history metadata. */
.stream-info { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35rem; }
.stream-reload { border: 0; padding: 0; background: none; color: #ccc; font: inherit; text-decoration: underline; cursor: pointer; }
.stream-reload:hover { color: #fff; }
.stream-reload:focus-visible { outline: 1px solid #fff; outline-offset: 4px; }
#playback-message { flex-basis: 100%; color: #aaa; font-size: 0.75rem; }
#playback-message:empty { display: none; }
.history-list { height: 321px; }
.history-item { height: 80px; min-height: 80px; }
.history-title, .history-artist, .history-album { line-height: 1.25; }
.history-artist { margin-top: 0.2rem; color: #ccc; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-album { margin-top: 0.2rem; }
