/* OnAir — app styles. Colors come from Fluent design tokens so light and dark themes both work.
   Breakpoints: phone < 600px, tablet 600–1023px (menu folds into the hamburger), desktop >= 1024px. */

:root {
    --app-gutter: 32px;
    --app-radius: 14px;
    --app-max-width: 1280px;
    --card-min: 160px;
    --card-gap: 16px;
    --section-gap: 40px;
}

@media (max-width: 1023px) {
    :root {
        --app-gutter: 24px;
        --card-min: 150px;
        --section-gap: 36px;
    }
}

@media (max-width: 599px) {
    :root {
        --app-gutter: 16px;
        --card-min: 136px;
        --card-gap: 12px;
        --section-gap: 30px;
    }
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground1);
    font-family: var(--fontFamilyBase, "Segoe UI", system-ui, sans-serif);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

/* Snappier taps on phones and tablets (no double-tap zoom delay, no grey flash). */
a, button, fluent-button, fluent-link, [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
    letter-spacing: -0.01em;
}

/* Blazor moves focus to the page heading after navigation for screen readers; no ring needed for that. */
h1:focus {
    outline: none;
}

.muted {
    color: var(--colorNeutralForeground3);
}

/* Theme toggle icons */
body:not([data-theme="dark"]) .hidden-if-light,
body[data-theme="dark"] .hidden-if-dark {
    display: none !important;
}

/* Fluent's reboot stylesheet loads after this file, so links that should look like plain text say so explicitly. */
.station-card__link,
.station-card__link:hover,
.tile,
.tile:hover,
.mood-tile,
.mood-tile:hover,
.genre-tile,
.genre-tile:hover,
.player__name,
.player__logo {
    color: var(--colorNeutralForeground1);
    text-decoration: none;
}

.chip:hover {
    text-decoration: none;
}

/* ---------- Layout ---------- */

/* Fluent paints the layout header in the brand color; a calm neutral header lets the content lead. */
.fluent-layout-item.app-header[area="header"] {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    overflow: visible;
    background: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    border-bottom: 1px solid var(--colorNeutralStroke2);
}

.app-header .fluent-layout-hamburger fluent-button {
    color: var(--colorNeutralForeground1) !important;
}

.app-header .fluent-layout-hamburger:hover {
    border-radius: var(--borderRadiusMedium, 6px);
    background-color: var(--colorSubtleBackgroundHover);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--colorNeutralForeground1);
}

.brand svg {
    width: 32px;
    height: 32px;
}

.header-search {
    flex: 1 1 auto;
    max-width: 460px;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-country {
    width: 220px;
}

.icon-link {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--borderRadiusMedium, 6px);
    color: var(--colorNeutralForeground2);
}

.icon-link:hover {
    background: var(--colorSubtleBackgroundHover);
}

.fluent-layout-item.app-nav[area="nav"] {
    background: var(--colorNeutralBackground1);
    border-right: 1px solid var(--colorNeutralStroke2);
    padding: 12px 8px;
}

.nav-country {
    display: none;
    padding: 4px 8px 12px;
}

.nav-footer {
    margin: 20px 12px 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--colorNeutralForeground3);
}

.app-content {
    background: var(--colorNeutralBackground2);
}

.page {
    max-width: var(--app-max-width);
    margin: 0 auto;
    padding: var(--app-gutter) max(var(--app-gutter), env(safe-area-inset-right)) 40px max(var(--app-gutter), env(safe-area-inset-left));
}

.offline-bar {
    margin: 12px var(--app-gutter) 0;
}

.fluent-layout-item.app-footer[area="footer"] {
    background: var(--colorNeutralBackground1);
    border-top: 1px solid var(--colorNeutralStroke2);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}

@media (max-width: 1023px) {
    .header-country {
        width: 180px;
    }
}

@media (max-width: 599px) {
    .fluent-layout-item.app-header[area="header"] {
        gap: 8px;
        padding: 0 max(8px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left));
    }

    .brand svg {
        width: 30px;
        height: 30px;
    }

    .header-search,
    .country-picker.header-country {
        display: none;
    }

    .icon-link {
        display: inline-flex;
    }

    .nav-country {
        display: block;
    }
}

/* Phones: the flag in the header opens the country list. */
.country-button {
    width: auto;
    gap: 4px;
    padding: 0 8px;
    text-decoration: none;
}

.country-button .flag {
    width: 22px;
    height: 16px;
}

.country-button__chevron {
    color: var(--colorNeutralForeground3);
}

/* Phones: Share and "Add to Home screen" sit in the header (navigation moved to the tab bar). */
.phone-only {
    display: none;
}

@media (max-width: 599px) {
    .phone-only {
        display: inline-flex;
    }

    .header-actions {
        gap: 2px;
    }

    .app-header .header-actions > fluent-button {
        width: 36px;
        min-width: 36px;
        height: 36px;
        padding: 0;
    }
}

/* Already running from its Home screen icon: nothing left to install. */
@media (display-mode: standalone) {
    .install-button {
        display: none !important;
    }
}

.install-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.install-panel__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-panel__head img {
    flex-shrink: 0;
    border-radius: 10px;
}

.install-panel__head div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.install-panel__head span {
    color: var(--colorNeutralForeground2);
    font-size: 13px;
}

.install-panel__steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.install-panel__steps svg {
    vertical-align: -3px;
}

/* ---------- Tab bar (phones) ---------- */

.tab-bar {
    display: none;
}

@media (max-width: 599px) {
    /* Mini player on top, tabs below. Fluent fixes the footer at 76px, so let it size to its content. */
    .fluent-layout-item.app-footer[area="footer"] {
        height: auto !important;
        padding: 0 0 env(safe-area-inset-bottom);
    }

    .tab-bar {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        height: 56px;
        padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
    }

    .tab-bar a.tab-bar__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--colorNeutralForeground3);
        font-size: 11px;
        font-weight: 600;
        line-height: 1;
        text-decoration: none;
    }

    .tab-bar a.tab-bar__item.is-active {
        color: var(--colorBrandForeground1);
    }

    .tab-bar a.tab-bar__item:focus-visible {
        outline: 2px solid var(--colorStrokeFocus2, var(--colorBrandStroke1));
        outline-offset: -4px;
        border-radius: 10px;
    }
}

/* ---------- Home ---------- */

.home-intro h1 {
    margin: 0;
    font-size: clamp(24px, 3.2vw, 32px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.home-intro__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0;
    color: var(--colorNeutralForeground2);
    font-size: 14px;
}

.home-intro__dot {
    color: var(--colorNeutralForeground3);
}

.mood-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.mood-tile {
    --mood-hue: 4;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: var(--app-radius);
    background: var(--colorNeutralBackground1);
    scroll-snap-align: start;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.mood-tile--work { --mood-hue: 212; }
.mood-tile--workout { --mood-hue: 22; }
.mood-tile--relax { --mood-hue: 172; }
.mood-tile--sleep { --mood-hue: 252; }
.mood-tile--drive { --mood-hue: 42; }

.mood-tile__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: hsl(var(--mood-hue) 80% 95%);
    color: hsl(var(--mood-hue) 60% 34%);
}

body[data-theme="dark"] .mood-tile__icon {
    background: hsl(var(--mood-hue) 35% 22%);
    color: hsl(var(--mood-hue) 75% 76%);
}

.mood-tile__name {
    font-weight: 600;
}

.mood-tile__text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    color: var(--colorNeutralForeground3);
    font-size: 13px;
    line-height: 1.35;
}

/* Phones and tablets: one swipeable row instead of a squeezed grid. */
@media (max-width: 1023px) {
    .mood-grid {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(180px, 1fr);
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        margin: 20px calc(var(--app-gutter) * -1) 0;
        padding: 2px var(--app-gutter) 4px;
        scroll-padding-inline: var(--app-gutter);
    }

    .mood-grid::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 599px) {
    .mood-grid {
        grid-auto-columns: 46%;
    }

    .mood-tile {
        padding: 14px;
    }
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
}

.genre-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: 12px;
    background: var(--colorNeutralBackground1);
    font-size: 14px;
    font-weight: 600;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.genre-tile__icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
}

.genre-tile__name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media (max-width: 599px) {
    .genre-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .genre-tile {
        gap: 10px;
        padding: 10px 12px;
        line-height: 1.25;
    }

    /* Two short lines read better than "Oldies & Cla…" on a narrow tile. */
    .genre-tile__name {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        white-space: normal;
    }
}

/* ---------- Chips & tiles ---------- */

.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip-row--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(var(--app-gutter) * -1) 20px;
    padding: 2px var(--app-gutter);
}

.chip-row--scroll::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 8px 14px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: 999px;
    background: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
    background: var(--colorNeutralBackground1Hover);
}

.chip:focus-visible,
.tile:focus-visible,
.mood-tile:focus-visible,
.genre-tile:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2, var(--colorBrandStroke1));
    outline-offset: 2px;
}

.chip--active {
    background: var(--colorBrandBackground);
    border-color: var(--colorBrandBackground);
    color: var(--colorNeutralForegroundOnBrand);
}

.chip--active:hover {
    background: var(--colorBrandBackgroundHover);
}

.chip__count {
    padding: 0 7px;
    border-radius: 999px;
    background: var(--colorNeutralBackground3);
    color: var(--colorNeutralForeground2);
    font-size: 12px;
    font-weight: 600;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.tile {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: var(--app-radius);
    background: var(--colorNeutralBackground1);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tile--current {
    border-color: var(--colorBrandStroke1, var(--colorBrandBackground));
    box-shadow: 0 0 0 1px var(--colorBrandStroke1, var(--colorBrandBackground));
}

.country-list__heading {
    margin-bottom: 12px;
}

.tile__icon {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
}

.tile__name {
    font-weight: 600;
}

.tile__text {
    color: var(--colorNeutralForeground3);
    font-size: 13px;
}

@media (max-width: 599px) {
    .tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .tile {
        padding: 12px;
        column-gap: 10px;
    }

    .tile__icon {
        width: 36px;
        height: 36px;
    }
}

/* Lift effects only where there is a real pointer; on touch they stick after a tap. */
@media (hover: hover) and (pointer: fine) {
    .tile:hover,
    .station-card:hover,
    .mood-tile:hover {
        box-shadow: var(--shadow8);
        transform: translateY(-2px);
    }

    .genre-tile:hover {
        border-color: var(--colorNeutralStroke1);
        box-shadow: var(--shadow4);
    }
}

/* ---------- Sections & headers ---------- */

.section {
    margin-top: var(--section-gap);
}

.section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 14px;
}

.section-header__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.section-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.section-header__link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--colorBrandForegroundLink, var(--colorBrandForeground1));
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.section-header__link:hover {
    text-decoration: underline;
}

@media (max-width: 599px) {
    .section-header__title {
        font-size: 18px;
    }
}

.language-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--colorNeutralForeground2);
}

.list-filter {
    max-width: 420px;
    margin-bottom: 16px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.2;
}

.page-header__icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
}

.page-header__lead {
    margin: 4px 0 0;
    color: var(--colorNeutralForeground2);
}

.page-header__body {
    flex: 1;
    min-width: 0;
}

.page-header__actions {
    flex-shrink: 0;
}

@media (max-width: 599px) {
    .page-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .page-header__icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .page-header__actions {
        flex-basis: 100%;
    }
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    color: var(--colorNeutralForeground3);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--colorNeutralForeground2);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ---------- Station logo ---------- */

.logo {
    position: relative;
    display: grid;
    flex-shrink: 0;
    place-items: center;
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--colorNeutralBackground3);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* Logos are designed for light backgrounds, so they always sit on white once loaded. */
.logo--loaded {
    background: #fff;
}

.logo__img {
    width: 100%;
    height: 100%;
    padding: 10%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.logo--loaded .logo__img {
    opacity: 1;
}

.logo__initials {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, hsl(var(--logo-hue) 62% 52%), hsl(calc(var(--logo-hue) + 35) 58% 38%));
    color: #fff;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

.logo--sm {
    width: 48px;
    border-radius: 10px;
}

.logo--sm .logo__initials {
    font-size: 1rem;
}

.logo--md {
    width: 100%;
}

.logo--lg {
    width: 120px;
}

.logo--xl {
    width: 180px;
    border-radius: 20px;
    box-shadow: var(--shadow8), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.logo--xl .logo__initials {
    font-size: 3.4rem;
}

/* ---------- Station cards ---------- */

.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--card-gap);
}

/* A single swipeable strip (e.g. "Continue listening"): about six cards on desktop, a peek of the next on phones. */
.station-grid--row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 5 * var(--card-gap)) / 6);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-bottom: 6px;
}

.station-grid--row > * {
    scroll-snap-align: start;
}

@media (max-width: 1023px) {
    .station-grid--row {
        grid-auto-columns: calc((100% - 3 * var(--card-gap)) / 4.3);
        scrollbar-width: none;
        margin: 0 calc(var(--app-gutter) * -1);
        padding: 0 var(--app-gutter) 6px;
        scroll-padding-inline: var(--app-gutter);
    }
}

@media (max-width: 599px) {
    .station-grid--row {
        grid-auto-columns: 42%;
    }
}

.station-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: var(--app-radius);
    background: var(--colorNeutralBackground1);
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.station-card--current {
    border-color: var(--colorBrandStroke1, var(--colorBrandBackground));
    box-shadow: 0 0 0 1px var(--colorBrandStroke1, var(--colorBrandBackground));
}

.station-card__art {
    position: relative;
    margin-bottom: 10px;
}

.station-card__link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Stretch the link over the whole card; the play and favorite buttons sit above it. */
.station-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--app-radius);
}

.station-card__link:focus-visible {
    outline: none;
}

.station-card__link:focus-visible::after {
    outline: 2px solid var(--colorStrokeFocus2, var(--colorBrandStroke1));
    outline-offset: 2px;
}

.station-card__name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: 2.6em;
    padding-right: 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.station-card__meta {
    overflow: hidden;
    color: var(--colorNeutralForeground3);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Play on the logo's bottom-right corner, favorite top-right, "playing" badge top-left. */
.station-card__play {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    box-shadow: var(--shadow8);
}

.station-card__fav {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    /* Fluent keeps text padding on this icon-only size, which would squeeze the heart to nothing. */
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow4);
    color: #424242;
    transition: opacity 0.15s ease;
}

body[data-theme="dark"] .station-card__fav {
    background: rgba(41, 41, 41, 0.9);
    color: #e0e0e0;
}

/* With a mouse, an unsaved heart appears on hover/focus to keep the grid calm; touch screens always show it. */
@media (hover: hover) and (pointer: fine) {
    .station-card__fav:not(.is-saved) {
        opacity: 0;
    }

    .station-card:hover .station-card__fav,
    .station-card:focus-within .station-card__fav {
        opacity: 1;
    }
}

.station-card__eq {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

.station-card--skeleton {
    gap: 8px;
}

.station-card__skeleton-logo {
    aspect-ratio: 1;
    border-radius: 12px;
}

.station-grid__more {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Phones: station lists become rows (logo, name, heart, play), like a music app's track list: about three times
   as many stations per screen, and one big play button per row. Swipeable strips keep their cards. */
@media (max-width: 599px) {
    .station-grid:not(.station-grid--row) {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .station-grid:not(.station-grid--row) .station-card {
        display: grid;
        grid-template-columns: 56px minmax(0, 1fr) auto auto;
        align-items: center;
        column-gap: 10px;
        padding: 8px 6px 8px 8px;
        border-radius: 12px;
    }

    /* The logo, heart and play button become cells of the row. */
    .station-grid:not(.station-grid--row) .station-card__art {
        display: contents;
    }

    .station-grid:not(.station-grid--row) .station-card .logo {
        grid-column: 1;
        grid-row: 1;
        width: 56px;
        border-radius: 10px;
    }

    .station-grid:not(.station-grid--row) .station-card .logo__initials {
        font-size: 1.15rem;
    }

    .station-grid:not(.station-grid--row) .station-card__link {
        grid-column: 2;
        grid-row: 1;
    }

    .station-grid:not(.station-grid--row) .station-card__link::after {
        border-radius: 12px;
    }

    .station-grid:not(.station-grid--row) .station-card__name {
        min-height: 0;
        font-size: 15px;
    }

    .station-grid:not(.station-grid--row) .station-card__meta {
        font-size: 13px;
    }

    .station-grid:not(.station-grid--row) .station-card__fav {
        position: static;
        grid-column: 3;
        grid-row: 1;
        width: 40px;
        min-width: 40px;
        height: 40px;
        background: transparent;
        box-shadow: none;
        color: var(--colorNeutralForeground3);
    }

    body[data-theme="dark"] .station-grid:not(.station-grid--row) .station-card__fav {
        background: transparent;
        color: var(--colorNeutralForeground3);
    }

    /* 44px: the comfortable size for a thumb. */
    .station-grid:not(.station-grid--row) .station-card__play {
        position: static;
        grid-column: 4;
        grid-row: 1;
        width: 44px;
        min-width: 44px;
        height: 44px;
        box-shadow: none;
    }

    .station-grid:not(.station-grid--row) .station-card__eq {
        top: auto;
        bottom: 12px;
        left: 12px;
    }

    .station-grid:not(.station-grid--row) .station-card--skeleton {
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-rows: auto auto;
        row-gap: 8px;
        align-content: center;
        min-height: 72px;
        box-sizing: border-box;
    }

    .station-grid:not(.station-grid--row) .station-card__skeleton-logo {
        grid-row: 1 / span 2;
        width: 56px;
        border-radius: 10px;
    }

    .station-grid__more fluent-button {
        width: 100%;
    }
}

/* ---------- Equalizer ---------- */

.eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--colorBrandBackground);
    box-sizing: content-box;
}

.eq span {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: #fff;
    transform-origin: bottom;
    animation: eq-bounce 0.9s ease-in-out infinite;
}

.eq span:nth-child(2) {
    animation-delay: -0.3s;
}

.eq span:nth-child(3) {
    animation-delay: -0.6s;
}

@keyframes eq-bounce {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .eq span {
        animation: none;
        transform: scaleY(0.7);
    }

    .station-card, .tile, .chip, .mood-tile, .genre-tile {
        transition: none;
    }
}

/* ---------- Station page ---------- */

.station-hero {
    display: flex;
    gap: 28px;
    align-items: center;
    padding: 24px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: 20px;
    background: var(--colorNeutralBackground1);
}

.station-hero__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.station-hero h1 {
    margin: 0;
    font-size: clamp(24px, 3.4vw, 34px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.station-hero__location {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--colorNeutralForeground2);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.station-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.listen-button {
    min-width: 160px;
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0 0;
}

.facts div {
    padding: 10px 16px;
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: 12px;
    background: var(--colorNeutralBackground1);
}

.facts dt {
    color: var(--colorNeutralForeground3);
    font-size: 12px;
}

.facts dd {
    margin: 2px 0 0;
    font-weight: 600;
}

@media (max-width: 1023px) {
    .logo--xl {
        width: 150px;
    }
}

@media (max-width: 599px) {
    .station-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 18px;
    }

    .logo--xl {
        width: 112px;
    }

    .listen-button {
        flex: 1 1 100%;
    }

    /* Save, Share and Website share one row under the big Listen button. */
    .station-hero__actions > :not(.listen-button) {
        flex: 1 1 0;
        min-width: 0;
    }

    .facts {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .facts div {
        padding: 10px 12px;
    }
}

/* ---------- Player bar ---------- */

/* Three zones, as in most music apps: what is on (left), one big play button (center), sound and sleep (right). */
.player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    width: 100%;
    height: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
}

/* While a station is live, a thin brand line runs along the top of the bar. */
.fluent-layout-item.app-footer[area="footer"]:has(.player--playing) {
    box-shadow: inset 0 2px 0 var(--colorBrandBackground), 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.player__now {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.player__logo {
    position: relative;
    display: block;
    flex-shrink: 0;
    border-radius: 10px;
}

.player .logo--sm {
    width: 52px;
}

.player__logo--empty {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    background: var(--colorNeutralBackground3);
    color: var(--colorNeutralForeground3);
}

/* Small "now playing" bars on the artwork. */
.player__eq {
    position: absolute;
    bottom: 4px;
    left: 4px;
    height: 10px;
    padding: 3px 4px;
    border-radius: 5px;
}

.player__eq span {
    width: 2px;
}

.player__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.player__name {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
}

a.player__name:hover {
    text-decoration: underline;
}

.player__status {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    color: var(--colorNeutralForeground3);
    font-size: 12px;
    line-height: 16px;
    white-space: nowrap;
}

.player__where,
.player__error {
    overflow: hidden;
    text-overflow: ellipsis;
}

.player__error {
    color: var(--colorStatusDangerForeground1, #c50f1f);
}

.live-badge {
    flex-shrink: 0;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--colorBrandBackground);
    color: var(--colorNeutralForegroundOnBrand, #fff);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 16px;
    text-transform: uppercase;
}

.player__fav {
    flex-shrink: 0;
}

.player__controls {
    display: flex;
    justify-content: center;
}

.player__toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    box-shadow: var(--shadow4);
}

.player__extras {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: 0;
}

.player__volume {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* A slim track that fills with the brand color up to the thumb (--fill is kept current by interop.js). */
.volume-slider {
    --fill: 80%;
    width: 112px;
    height: 24px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--colorBrandBackground) var(--fill), var(--colorNeutralStroke1) var(--fill));
}

.volume-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: none;
    border-radius: 50%;
    background: var(--colorBrandBackground);
    box-shadow: 0 0 0 3px var(--colorNeutralBackground1), var(--shadow4);
    transition: transform 0.1s ease;
    appearance: none;
    -webkit-appearance: none;
}

.volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--colorNeutralStroke1);
}

.volume-slider::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: var(--colorBrandBackground);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--colorBrandBackground);
    box-shadow: 0 0 0 3px var(--colorNeutralBackground1), var(--shadow4);
    transition: transform 0.1s ease;
}

.volume-slider:hover::-webkit-slider-thumb,
.volume-slider:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

.volume-slider:hover::-moz-range-thumb,
.volume-slider:active::-moz-range-thumb {
    transform: scale(1.2);
}

.volume-slider:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2, var(--colorBrandStroke1));
    outline-offset: 2px;
    border-radius: 6px;
}

@media (max-width: 1023px) {
    .player {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 16px;
    }

    .volume-slider {
        width: 88px;
    }
}

/* Phones: a mini player above the tabs. Hardware buttons handle volume, so the space goes to the name and controls. */
@media (max-width: 599px) {
    .player {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 4px;
        height: 64px;
        padding: 0 max(8px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
        box-sizing: border-box;
        border-bottom: 1px solid var(--colorNeutralStroke2);
    }

    /* Until there is something to play, the tabs are all the footer needs. */
    .player--idle {
        display: none;
    }

    .player__now {
        gap: 10px;
    }

    .player .logo--sm {
        width: 44px;
    }

    .player__name {
        font-size: 14px;
    }

    .player__toggle {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }

    .player__extras {
        gap: 0;
    }

    .player__volume {
        display: none;
    }
}

/* ---------- Sleep timer ---------- */

.sleep-button.is-active {
    color: var(--colorBrandForeground1);
    font-weight: 600;
}

.sleep-button__left {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sleep-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.sleep-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.sleep-panel__status {
    margin: 0;
    color: var(--colorNeutralForeground2);
    font-size: 13px;
    line-height: 1.4;
}

.sleep-panel__presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.sleep-panel__at {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--colorNeutralStroke2);
}

.sleep-panel__at label {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

/* A short word: Fluent's 96px minimum width would squeeze the time field. */
.sleep-panel__at fluent-button {
    flex-shrink: 0;
    min-width: 64px;
}

.time-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--colorNeutralStroke1);
    border-radius: var(--borderRadiusMedium, 4px);
    background: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    font: inherit;
    color-scheme: light dark;
}

.time-input:focus {
    outline: 2px solid var(--colorBrandStroke1, #d52b1e);
    outline-offset: -1px;
}

/* ---------- Misc ---------- */

.flag {
    flex-shrink: 0;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.flag--tile {
    width: 28px;
    height: 21px;
}

.country-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.country-picker > :last-child {
    flex: 1;
    min-width: 0;
}

.country-picker__globe {
    flex-shrink: 0;
    color: var(--colorNeutralForeground2);
}

.search-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 640px;
}

.search-panel__options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.library-tabs {
    margin-top: 4px;
}

.tab-body {
    padding-top: 20px;
}

.tab-body__actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 440px;
    margin: 40px auto;
    text-align: center;
}

.empty-state__icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
}

.empty-state__title {
    margin: 0 0 6px;
    font-size: 20px;
}

.empty-state__text {
    margin: 0;
    color: var(--colorNeutralForeground2);
}

.empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

/* ---------- Site footer: "Radio around the world" ---------- */

.page--footer {
    padding-top: 0;
}

.site-footer {
    margin-top: 16px;
    padding-top: 28px;
    border-top: 1px solid var(--colorNeutralStroke2);
    color: var(--colorNeutralForeground2);
    font-size: 14px;
}

.site-footer__title {
    margin: 0 0 16px;
    color: var(--colorNeutralForeground1);
    font-size: 18px;
}

.world-directory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px 28px;
}

.world-directory__group h3 {
    margin: 0 0 8px;
    color: var(--colorNeutralForeground1);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.world-directory__group ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 4px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.world-directory__group:nth-child(3) {
    grid-column: span 2;
}

.world-directory a,
.site-footer__more a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    color: var(--colorNeutralForeground2);
    text-decoration: none;
}

.world-directory a:hover,
.site-footer__more a:hover {
    color: var(--colorNeutralForeground1);
    text-decoration: underline;
}

.site-footer__more {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 0;
}

.site-footer__credits {
    margin: 12px 0 0;
    color: var(--colorNeutralForeground3);
    font-size: 12px;
}

/* Phones: each continent is one swipeable row of country chips instead of two screens of links. */
@media (max-width: 599px) {
    .world-directory {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .world-directory__group:nth-child(3) {
        grid-column: auto;
    }

    .world-directory__group ul {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 calc(var(--app-gutter) * -1);
        padding: 2px var(--app-gutter);
        scroll-padding-inline: var(--app-gutter);
    }

    .world-directory__group ul::-webkit-scrollbar {
        display: none;
    }

    .world-directory__group li {
        flex-shrink: 0;
    }

    .world-directory a {
        padding: 8px 12px;
        border: 1px solid var(--colorNeutralStroke2);
        border-radius: 999px;
        background: var(--colorNeutralBackground1);
        color: var(--colorNeutralForeground1);
        white-space: nowrap;
    }

    .world-directory a:hover {
        text-decoration: none;
    }
}

/* iPhones zoom into any field under 16px when it gets focus, so phones get 16px text in fields. */
@media (max-width: 599px) {
    fluent-text-input::part(control),
    fluent-dropdown input,
    .time-input {
        font-size: 16px;
    }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: none;
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 1.25rem;
    background: #fff4ce;
    color: #242424;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem;
    border-radius: 8px;
    background: #b32121;
    color: #fff;
}
