:root {
    --navy-900: #0E155E;
    --navy-800: #144169;
    --navy-700: #193E6A;
    --blue-600: #1C4D88;
    --sky-400: #46C9FF;
    --sky-200: #98D9F6;
    --sky-100: #BDE7FF;
    --sky-50: #EAF6FF;
    --slate-500: #58627C;
    --gray-50: #F5F7F8;
    --white: #FFFFFF;
    --amber-500: #E0A030;
    --red-500: #D6483F;

    --font-sans: "Arimo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
    --radius-lg: 24px;
    --radius-pill: 999px;
    --shadow-card: 0 20px 45px -20px rgba(14, 21, 94, 0.25);
    --shadow-soft: 0 2px 10px rgba(14, 21, 94, 0.06);
}

* { box-sizing: border-box; }

[hidden], .is-hidden { display: none !important; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--slate-500);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--font-sans); color: var(--navy-900); margin: 0; }

.wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--navy-700);
    color: var(--white);
    padding: 10px 16px;
    border-radius: 0 0 8px 0;
    z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--gray-50);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.brand { display: flex; align-items: center; gap: 14px; }

/* Official logo: fixed height, width auto, so the mark scales without
   ever being stretched or skewed out of its original proportions. */
.brand-logo {
    display: block;
    line-height: 0;
}
.brand-logo svg {
    height: 26px;
    width: auto;
    display: block;
}
.brand-logo:focus-visible {
    outline: 2px solid var(--sky-400);
    outline-offset: 3px;
    border-radius: 2px;
}

.brand-divider {
    width: 1px;
    height: 18px;
    background: var(--sky-200);
}

.brand-sub {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.14em;
    color: var(--blue-600);
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--slate-500);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color .15s;
}
.header-link:hover { color: var(--navy-700); }

/* ---------- Hero / player ---------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 64px 0 56px;
    background: linear-gradient(180deg, var(--sky-50) 0%, #ffffff 75%);
}

.circuit-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.08;
    pointer-events: none;
}

.player-card {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 40px 40px 32px;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--blue-600);
    background: var(--sky-50);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 18px;
}

.player-card h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
}

.tagline {
    margin: 10px 0 28px;
    font-size: 16px;
    color: var(--slate-500);
}

.visualizer {
    display: block;
    width: 100%;
    height: 64px;
    margin-bottom: 28px;
    border-radius: 12px;
}

/* ---------- Transport ---------- */
.transport {
    display: flex;
    align-items: center;
    gap: 20px;
    text-align: left;
}

.play-button {
    flex: none;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: var(--navy-700);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
    position: relative;
}
.play-button:hover { background: var(--navy-800); }
.play-button:active { transform: scale(0.96); }
.play-button:focus-visible { outline: 2px solid var(--sky-400); outline-offset: 3px; }

.play-button.is-loading::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--sky-200);
    border-top-color: var(--navy-700);
    animation: spin 0.8s linear infinite;
}

.play-button .icon-play { margin-left: 3px; }

.now-playing {
    flex: 1 1 auto;
    min-width: 0;
}

.np-status {
    margin: 0 0 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--slate-500);
}
.np-status.is-live { color: var(--navy-700); }
.np-status.is-warn { color: var(--amber-500); }
.np-status.is-error { color: var(--red-500); }

.np-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--navy-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.volume {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--blue-600);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--sky-100);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--navy-700);
    cursor: pointer;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--sky-200);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--navy-700);
    cursor: pointer;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--sky-200);
}
input[type="range"]:focus-visible { outline: 2px solid var(--sky-400); outline-offset: 2px; }

/* ---------- Badges ---------- */
.badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 26px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--blue-600);
    background: var(--sky-50);
    border: 1px solid var(--sky-100);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
}

/* Stream (on-air/off-air) badge - reflects the broadcast itself, not this
   listener's play/pause state. Starts neutral until the first poll resolves. */
.badge-stream .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--slate-500);
}
.badge-stream.is-on { color: #0F8A5F; background: #E7F8F0; border-color: #C6EEDC; }
.badge-stream.is-on .dot { background: #16B872; animation: pulse 1.6s ease-in-out infinite; }
.badge-stream.is-off { color: #9A3B34; background: #FBEAE8; border-color: #F3D3CF; }
.badge-stream.is-off .dot { background: #C94A3F; }

/* ---------- Recently played ---------- */
.history-section {
    padding: 56px 0 72px;
    background: var(--gray-50);
}

.history-section h2 {
    font-size: 22px;
    margin-bottom: 20px;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.history-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--gray-50);
    font-size: 14px;
}
.history-list li:last-child { border-bottom: none; }

.history-empty { color: var(--slate-500); justify-content: center; }

.history-note {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sky-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-text {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--navy-900);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    flex: none;
    font-size: 12px;
    color: var(--slate-500);
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--gray-50);
    padding: 22px 0;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: space-between;
    font-size: 13px;
    color: var(--slate-500);
}

.footer-row a { color: var(--blue-600); text-decoration: none; }
.footer-row a:hover { text-decoration: underline; }

/* ---------- Motion ---------- */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .badge-stream.is-on .dot { animation: none; }
    .play-button.is-loading::after { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .player-card { padding: 32px 20px 24px; }
    .player-card h1 { font-size: 30px; }
    .transport { flex-wrap: wrap; justify-content: center; text-align: center; }
    .now-playing { order: 3; flex-basis: 100%; text-align: center; }
    .np-title { white-space: normal; }
    .volume { order: 2; }
}
