/* TalkieGo Radio — editorial / broadcast aesthetic */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
    --bg0: #0a0c10;
    --bg1: #12161f;
    --glass: rgba(255, 255, 255, 0.06);
    --glass2: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8ecf4;
    --muted: #8b95a8;
    --accent: #5eead4;
    --accent2: #38bdf8;
    --accentWarm: #fb923c;
    --accentWarm2: #f59e0b;
    --danger: #fb7185;
    --radius: 14px;
    --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --player-dock-height: 168px;
    --viz-dock-height: 106px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(56, 189, 248, 0.12), transparent),
        radial-gradient(900px 500px at 100% 0%, rgba(94, 234, 212, 0.1), transparent), var(--bg0);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--accent2);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.radio-app {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem calc(var(--player-dock-height) + var(--viz-dock-height) + 2rem);
}

.radio-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.brand-block h1 {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand-block .tagline {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}
.brand-block .eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin: 0 0 0.4rem;
}

.top-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--glass);
    color: var(--text);
    font-size: 0.85rem;
}
.ghost-link:hover {
    border-color: var(--glass2);
    text-decoration: none;
}

.filters-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 720px) {
    .filters-panel {
        grid-template-columns: 1fr;
    }
}

.field label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.field select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg1);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
}
.field select:focus {
    border-color: rgba(94, 234, 212, 0.45);
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.station-scroll {
    max-height: min(52vh, 520px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.station-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.station-card {
    --station-load-pct: 0%;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 0.75rem 0.65rem 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--glass), transparent);
    width: 100%;
    color: inherit;
    font: inherit;
    transition: border-color 0.15s, transform 0.12s, background 0.15s;
}
.station-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--station-load-pct);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.28), rgba(251, 146, 60, 0.22));
    opacity: 0;
    transition: width 0.18s linear, opacity 0.18s ease;
    pointer-events: none;
    z-index: 0;
}
.station-card:hover {
    border-color: rgba(94, 234, 212, 0.35);
    transform: translateY(-1px);
}
.station-card.is-active {
    border-color: rgba(251, 146, 60, 0.6);
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.22), rgba(245, 158, 11, 0.08));
}
.station-card.is-loading {
    border-color: rgba(251, 146, 60, 0.52);
}
.station-card.is-loading::before {
    opacity: 0.92;
}

.station-play {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    position: relative;
    z-index: 1;
    border-radius: calc(var(--radius) - 4px);
}
.station-play:focus-visible {
    outline: 2px solid rgba(94, 234, 212, 0.55);
    outline-offset: 2px;
}

.station-play .meta {
    min-width: 0;
}
.station-play .title {
    font-weight: 600;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.station-play .sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-play .play-hint {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--accent);
}
.station-card.is-active .station-play .play-hint,
.station-card.is-loading .station-play .play-hint {
    color: #ffd7b0;
    border-color: rgba(251, 146, 60, 0.45);
    background: radial-gradient(circle at 30% 30%, rgba(251, 146, 60, 0.28), rgba(245, 158, 11, 0.12));
}

.station-copy {
    flex-shrink: 0;
    align-self: center;
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    font-family: var(--font);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.station-card.is-active .station-copy,
.station-card.is-loading .station-copy {
    color: #ffd7b0;
    background: transparent;
    border-color: rgba(251, 146, 60, 0.34);
}
.station-copy:hover {
    color: #ffe7cf;
    border-color: rgba(251, 146, 60, 0.42);
    background: rgba(251, 146, 60, 0.14);
}
.station-copy:focus-visible {
    outline: 2px solid rgba(94, 234, 212, 0.55);
    outline-offset: 2px;
}

.empty-hint {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.error-banner {
    margin-bottom: 1rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.35);
    color: #fecdd3;
    font-size: 0.9rem;
}

.maint-panel {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.maint-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.maint-btn {
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(251, 146, 60, 0.35);
    background: linear-gradient(145deg, rgba(251, 146, 60, 0.22), rgba(245, 158, 11, 0.12));
    color: #ffe7cf;
    font: inherit;
    cursor: pointer;
}

.maint-btn.ghost {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.maint-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.maint-status {
    color: var(--muted);
    font-size: 0.9rem;
}

.maint-report {
    margin: 0.85rem 0 0;
    padding: 0.75rem 0.85rem;
    max-height: 15rem;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(10, 12, 16, 0.68);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Spectrum + waveform (above player) */
.radio-viz-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--player-dock-height) + 0.6rem);
    z-index: 38;
    padding: 0 0.75rem;
    pointer-events: none;
}

.radio-viz-inner {
    max-width: 1180px;
    margin: 0 auto;
    min-height: var(--viz-dock-height);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: rgba(10, 12, 16, 0.75);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.radio-viz-canvas {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.radio-viz-canvas.spectrum {
    height: 52px;
}

.radio-viz-canvas.waveform {
    height: 40px;
    border-top: 1px solid var(--border);
}

/* Player dock */
.player-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(10, 12, 16, 0.92) 30%, var(--bg0));
    z-index: 40;
}

.player-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(18, 22, 31, 0.95));
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.asr-strip {
    max-width: 1180px;
    margin: 0.55rem auto 0;
    padding: 0 0.35rem;
}
.asr-controls {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    font-size: 0.76rem;
    color: var(--muted);
}
.asr-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    user-select: none;
    color: var(--text);
}
.asr-toggle input {
    accent-color: var(--accent);
}
.asr-lang-label {
    margin: 0;
    font-weight: 500;
}
.asr-lang-select {
    font-family: var(--font);
    font-size: 0.76rem;
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg1);
    color: var(--text);
}
.asr-lang-select:disabled {
    opacity: 0.45;
}
.asr-hint {
    flex: 1 1 160px;
    min-width: 0;
    font-size: 0.68rem;
    color: var(--muted);
    opacity: 0.85;
}
.asr-translate-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    user-select: none;
    color: var(--text);
    margin-left: 0.15rem;
}
.asr-translate-toggle input {
    accent-color: var(--accent2);
}

.asr-captions {
    position: fixed;
    left: 50%;
    bottom: calc(var(--player-dock-height) + var(--viz-dock-height) + 0.75rem);
    transform: translateX(-50%);
    z-index: 39;
    width: min(1180px, calc(100vw - 1.5rem));
    margin-top: 0;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(10, 12, 16, 0.82);
    backdrop-filter: blur(12px);
    max-height: 7rem;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}
.asr-captions:empty {
    display: none;
}

.asr-block {
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.asr-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.asr-original {
    color: var(--text);
}
.asr-translated {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--accent2);
    opacity: 0.95;
}
.asr-translated-pending {
    color: var(--muted);
    font-style: italic;
}

.player-art {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    flex-shrink: 0;
    background: conic-gradient(from 210deg, var(--accent2), var(--accent), #a78bfa, var(--accent2));
    position: relative;
    overflow: hidden;
}
.player-art::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--bg0);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}
.player-art .pulse {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    opacity: 0;
    background: rgba(255, 255, 255, 0.15);
}
.player-art.is-live .pulse {
    animation: pulse 1.8s ease-out infinite;
    opacity: 1;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    70% {
        transform: scale(1.15);
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

.player-main {
    flex: 1;
    min-width: 0;
}
.player-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--mono);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--glass);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover {
    background: var(--glass2);
    border-color: rgba(94, 234, 212, 0.35);
}
.icon-btn.primary {
    width: 52px;
    height: 52px;
    background: linear-gradient(145deg, var(--accent2), var(--accent));
    border: none;
    color: #0a0c10;
    font-size: 1.1rem;
}
.icon-btn.primary:hover {
    filter: brightness(1.06);
}

.volume-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.75rem;
}
.volume-wrap input[type="range"] {
    width: 88px;
    accent-color: var(--accent);
}

.tuac-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.72rem;
    padding-left: 0.35rem;
    border-left: 1px solid var(--border);
}
.tuac-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    user-select: none;
    color: var(--text);
}
.tuac-toggle input {
    accent-color: var(--accent);
}
.tuac-spatial-label {
    margin: 0;
    font-weight: 500;
}
.tuac-wrap input[type="range"] {
    width: 72px;
    accent-color: var(--accent2);
}
.tuac-env-select {
    font-family: var(--font);
    font-size: 0.72rem;
    padding: 0.2rem 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg1);
    color: var(--text);
    max-width: 5.5rem;
}
.tuac-env-select:disabled,
.tuac-wrap input[type="range"]:disabled {
    opacity: 0.45;
}

.player-dock.is-idle .player-art.is-live .pulse {
    animation: none;
    opacity: 0;
}

@media (max-width: 640px) {
    .asr-captions {
        width: calc(100vw - 1rem);
        bottom: calc(var(--player-dock-height) + var(--viz-dock-height) + 0.55rem);
        font-size: 0.84rem;
    }
    :root {
        --viz-dock-height: 92px;
    }
    .volume-wrap {
        display: none;
    }
    .tuac-wrap {
        border-left: none;
        padding-left: 0;
        width: 100%;
        justify-content: center;
    }
    .player-inner {
        flex-wrap: wrap;
    }
    .player-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}
