/* ===== AMPER RADIO (amradio.js) ===== */
/* The window lays itself out as a column: title, menu, then the player that fills the rest */
#amradio-window {
    --kp-hi: var(--pv-hi);     /* the Win98 checkbox (.kp-check) of the site uses it */
}

#amradio-window.visible {
    display: flex;
    flex-direction: column;
}

#amradio-window > .window-header,
#amradio-window > .window-menu-bar {
    flex-shrink: 0;
}

.window-content.ar-content {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 6px 3px;
    overflow: hidden;
    box-sizing: border-box;
}

.ar-player {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* --- the display: visualizer and the green LCD --- */
.ar-display {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: #000;
    border: 2px solid;
    border-color: var(--window-border-darker) var(--pv-hi) var(--pv-hi) var(--window-border-darker);
}

.ar-vis {
    flex-shrink: 0;
    width: 152px;
    height: 52px;
    image-rendering: pixelated;
    cursor: pointer;
    border: 1px solid #1c3a1c;
}

.ar-lcd {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #00e000;
    text-shadow: 0 0 4px rgba(0, 224, 0, 0.45);
}

.ar-lcd-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.ar-mode {
    padding: 0 4px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #000;
    background: #007000;
    text-shadow: none;
}

.ar-mode.live {
    background: #e00000;
    color: #fff;
    animation: ar-blink 1.6s steps(1) infinite;
}

@keyframes ar-blink {
    50% { opacity: 0.55; }
}

.ar-kbps {
    padding: 0 3px;
    font-size: 10px;
    color: #00a000;
    border: 1px solid #006000;
    cursor: pointer;
    white-space: nowrap;
}

.ar-kbps:empty {
    display: none;
}

.ar-time {
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
}

.ar-marquee {
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    font-weight: bold;
}

.ar-marquee span {
    display: inline-block;
}

/* A long title scrolls, like the one in Winamp */
.ar-marquee.scroll span {
    padding-left: 100%;
    animation: ar-marquee 14s linear infinite;
}

@keyframes ar-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

.ar-lcd-sub {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 11px;
    color: #00a000;
}

/* --- buttons --- */
.ar-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

/* Transport buttons: drawn icons (text arrows sat at different heights) */
.ar-controls .pv-btn.ar-btn {
    width: 30px;
    min-width: 30px;
    padding: 0;
    justify-content: center;
}

.ar-controls .pv-btn.ar-play {
    width: 36px;
}

.ar-btn svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
    flex-shrink: 0;
}

.ar-btn:not(:disabled):active svg {
    transform: translate(1px, 1px);
}

.ar-btn:disabled svg {
    filter: drop-shadow(1px 1px 0 var(--pv-hi));
}

.pv-btn.ar-live,
.pv-btn.ar-eq-btn {
    justify-content: center;
}

.pv-btn.ar-eq-btn {
    min-width: 30px;
    font-weight: bold;
}

.pv-btn.ar-live.on {
    color: #c00000;
    font-weight: bold;
}

.pv-btn.ar-eq-btn.on {
    color: #008000;
}

/* --- Win98 drop-down list (the preset) --- */
.ar-combo {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 118px;
    height: 21px;
    padding: 0 20px 0 4px;
    box-sizing: border-box;
    background: var(--white);
    color: #000;
    border: 1px solid;
    border-color: var(--window-border-dark) var(--pv-hi) var(--pv-hi) var(--window-border-dark);
    box-shadow: inset 1px 1px 0 var(--window-border-darker), inset -1px -1px 0 var(--window-border-light);
    cursor: default;
    outline: none;
    user-select: none;
}

.ar-combo-value {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 2px;
}

.ar-combo:focus .ar-combo-value {
    color: #fff;
    background: var(--active-titlebar-start);
}

.ar-combo-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    bottom: 2px;
    width: 16px;
    background: var(--button-bg);
    box-shadow: inset -1px -1px var(--window-border-darker), inset 1px 1px var(--window-border-light),
                inset -2px -2px var(--window-border-dark), inset 2px 2px var(--pv-hi);
}

.ar-combo-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4px;
    margin-top: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-color);
}

.ar-combo[aria-expanded="true"] .ar-combo-btn {
    box-shadow: inset 1px 1px var(--window-border-dark), inset -1px -1px var(--window-border-dark);
}

.ar-combo[aria-expanded="true"] .ar-combo-btn::before {
    margin: -1px 0 0 1px;
}

.ar-combo-list {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    z-index: 30;
    max-height: 160px;
    overflow-y: auto;
    background: var(--white);
    color: #000;
    border: 1px solid #000;
}

.ar-combo-item {
    padding: 1px 4px;
    white-space: nowrap;
}

.ar-combo-item.active {
    color: #fff;
    background: var(--active-titlebar-start);
}

:root[data-theme="cyberpunk"] .ar-combo,
:root[data-theme="cyberpunk"] .ar-combo-list {
    background: #0d1117;
    color: #00ffff;
}

:root[data-theme="cyberpunk"] .ar-combo-list {
    border-color: #ff00ff;
}

.ar-vol-icon {
    width: 16px;
    height: 16px;
    margin-left: 4px;
}

.ar-vol {
    width: 84px;
}

/* --- Win98 trackbars (the seek bar, the volume, the equalizer) --- */
.ar-slider {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: none;
    outline: none;
}

.ar-slider:focus-visible {
    outline: 1px dotted var(--text-color);
}

.ar-slider.disabled {
    cursor: default;
    opacity: 0.45;
}

.ar-groove {
    position: absolute;
    background: var(--window-bg);
    border: 1px solid;
    border-color: var(--window-border-dark) var(--pv-hi) var(--pv-hi) var(--window-border-dark);
    box-shadow: inset 1px 1px 0 var(--window-border-darker);
}

.ar-thumb {
    position: absolute;
    box-sizing: border-box;
    background: var(--button-bg, var(--window-bg));
    border: 1px solid;
    border-color: var(--pv-hi) var(--window-border-darker) var(--window-border-darker) var(--pv-hi);
    box-shadow: inset -1px -1px 0 var(--window-border-dark);
}

.ar-h {
    height: 18px;
}

.ar-h .ar-groove {
    left: 0;
    right: 0;
    top: 7px;
    height: 4px;
}

.ar-h .ar-thumb {
    top: 1px;
    width: 10px;
    height: 16px;
    left: calc(var(--p, 0) * (100% - 10px));
}

.ar-seek {
    width: 100%;
}

/* How much of the track is already downloaded, like the progress in a real player */
.ar-seek .ar-groove {
    background: linear-gradient(90deg, var(--window-border-dark) calc(var(--b, 0) * 100%), var(--window-bg) 0);
}

.ar-v {
    width: 20px;
}

.ar-v .ar-groove {
    top: 0;
    bottom: 0;
    left: 8px;
    width: 4px;
}

.ar-v .ar-thumb {
    left: 1px;
    width: 18px;
    height: 9px;
    top: calc((1 - var(--p, 0.5)) * (100% - 9px));
}

/* --- the equalizer --- */
.ar-eq {
    padding: 2px 8px 6px;
}

.ar-eq[hidden] {
    display: none;
}

.ar-eq-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.ar-check {
    margin-right: 4px;
}

.ar-eq-bands {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    overflow-x: auto;
}

.ar-eq-bands.off .ar-slider {
    opacity: 0.55;
}

.ar-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ar-band-slider {
    height: 76px;
}

/* the 0 dB line across each band */
.ar-band-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    right: 2px;
    top: 50%;
    border-top: 1px dotted var(--window-border-dark);
}

.ar-band-label {
    font-size: 9px;
    white-space: nowrap;
}

.ar-band-sep {
    width: 1px;
    margin: 0 2px 14px;
    background: var(--window-border-dark);
    box-shadow: 1px 0 0 var(--pv-hi);
}

/* --- tabs and lists --- */
.ar-tabs {
    flex-shrink: 0;
    margin-bottom: -7px;
}

.ar-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
}

.ar-page[hidden] {
    display: none;
}

.ar-list {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ar-list .adm-table-wrap,
.ar-lib-main .adm-table-wrap {
    flex: 1 1 auto;
    min-height: 54px;
}

.ar-table td:first-child,
.ar-table th:first-child {
    width: 12px;
    padding-right: 0;
    text-align: center;
}

.ar-table td,
.ar-table td:nth-child(3) {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;      /* the site lets column 3 wrap (Status in the admin list) */
}

.ar-table tr.ar-current td {
    font-weight: bold;
}

/* Hidden means hidden, whatever the layout class of the element says (admin rows for visitors) */
#amradio-window [hidden] {
    display: none !important;
}

/* --- the library: people on the left, their tracks on the right --- */
.ar-lib {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 6px;
}

.ar-people {
    flex: 0 0 130px;
    overflow-y: auto;
    background: #fff;
    color: #000;
    border: 2px solid;
    border-color: var(--window-border-darker) var(--pv-hi) var(--pv-hi) var(--window-border-darker);
}

.ar-person {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 2px 4px;
    cursor: pointer;
    white-space: nowrap;
}

.ar-person span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ar-person-count {
    color: #808080;
}

.ar-person.selected {
    color: #fff;
    background: var(--active-titlebar-start, #000080);
}

.ar-person.selected .ar-person-count {
    color: #fff;
}

.ar-person-empty {
    padding: 6px;
    color: #808080;
}

.ar-lib-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ar-lib-main.ar-drop .adm-table-wrap {
    outline: 2px dashed #000080;
    outline-offset: -4px;
}

.ar-lib-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.ar-lib-actions {
    flex-wrap: wrap;
}

.ar-quota {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ar-quota[hidden] {
    display: none;
}

.ar-quota-bar {
    flex: 0 0 120px;
    height: 12px;
    padding: 1px;
    background: #fff;
    border: 1px solid;
    border-color: var(--window-border-dark) var(--pv-hi) var(--pv-hi) var(--window-border-dark);
}

.ar-quota-fill {
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(90deg, var(--active-titlebar-start, #000080) 0 8px, transparent 8px 10px);
}

.ar-quota-fill.full {
    background: repeating-linear-gradient(90deg, #c00000 0 8px, transparent 8px 10px);
}

.ar-hint {
    padding: 3px 6px;
    background: #ffffe1;
    color: #000;
    border: 1px solid #808080;
}

.ar-hint[hidden] {
    display: none;
}

/* --- themes --- */
:root[data-theme="cyberpunk"] .ar-lcd {
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

:root[data-theme="cyberpunk"] .ar-lcd-sub {
    color: #ff00ff;
}

:root[data-theme="cyberpunk"] .ar-mode {
    background: #ff00ff;
}

:root[data-theme="cyberpunk"] .ar-display,
:root[data-theme="cyberpunk"] .ar-vis {
    background: #0d1117;
    border-color: #ff00ff;
}

:root[data-theme="cyberpunk"] .ar-people {
    background: #0d1117;
    color: #00ffff;
}

/* --- phones --- */
@media (max-width: 768px) {
    /* The site sizes windows in vh; on phones 100vh is taller than what is visible
       (the address bar), so the bottom ended up under the taskbar. dvh is what is visible */
    #amradio-window,
    #amradio-window.maximized {
        top: 4px !important;
        left: 1vw !important;
        width: 98vw !important;
        height: calc(100vh - 62px) !important;
        height: calc(100dvh - 62px) !important;
    }

    /* Everything in one column that scrolls, instead of squeezing the lists to nothing */
    .window-content.ar-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 4px 2px;
        gap: 5px;
    }

    /* At least this tall; when the window has room left, the lists take it */
    .ar-page,
    .ar-list,
    .ar-lib {
        flex: 1 0 auto;
    }

    .ar-list .adm-table-wrap,
    .ar-lib-main .adm-table-wrap {
        flex: 1 0 168px;
        height: auto;
    }

    /* The site makes every button 44 px tall on phones; here that broke the rows apart */
    #amradio-window .pv-btn {
        height: 34px;
        min-height: 34px;
        min-width: 34px;
        padding: 0 9px;
        font-size: 13px;
    }

    #amradio-window .pv-btn:not(:disabled):active,
    #amradio-window .pv-btn.is-pressed {
        padding: 1px 8px 0 10px;
    }

    .ar-controls {
        flex-wrap: nowrap;
        gap: 4px;
    }

    .ar-controls .pv-btn.ar-btn {
        width: 38px;
        min-width: 38px;
        padding: 0;
    }

    .ar-controls .pv-btn.ar-play {
        width: 44px;
    }

    .ar-controls .pv-sep {
        display: none;
    }

    .ar-btn svg {
        width: 12px;
        height: 12px;
    }

    .adm-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .ar-vol-icon {
        display: none;
    }

    .ar-vol {
        flex: 1 1 60px;
        width: auto;
        min-width: 50px;
    }

    .ar-h {
        height: 26px;
    }

    .ar-h .ar-groove {
        top: 11px;
    }

    .ar-h .ar-thumb {
        top: 2px;
        width: 14px;
        height: 22px;
        left: calc(var(--p, 0) * (100% - 14px));
    }

    .ar-vis {
        width: 104px;
        height: 48px;
    }

    .ar-display {
        gap: 4px;
        padding: 3px;
    }

    .ar-lcd {
        font-size: 11px;
    }

    .ar-time {
        font-size: 13px;
    }

    .ar-band-slider {
        height: 64px;
    }

    .ar-eq-top {
        flex-wrap: wrap;
    }

    .ar-combo {
        height: 32px;
        width: 140px;
        font-size: 14px;
    }

    .ar-lib {
        flex-direction: column;
    }

    .ar-people {
        flex: none;
        max-height: 96px;
    }

    .ar-person {
        padding: 5px 6px;
    }

    /* The status bar stays at the bottom when the tab is short */
    #amradio-window .ar-content > .pv-statusbar {
        margin-top: auto;
        flex-shrink: 0;
    }

    .ar-quota {
        flex-wrap: wrap;
    }

    .ar-quota-bar {
        flex: 1 1 80px;
    }

    #ar-quota-text {
        white-space: nowrap;
    }

    .ar-table td,
    .ar-table td:nth-child(3) {
        max-width: 120px;
    }

    .ar-table td,
    .ar-table th {
        padding: 4px 5px;
    }
}

:root[data-theme="cyberpunk"] .ar-quota-bar {
    background: #0d1117;
}

:root[data-theme="cyberpunk"] .ar-quota-fill {
    background: repeating-linear-gradient(90deg, #ff00ff 0 8px, transparent 8px 10px);
}

:root[data-theme="cyberpunk"] .ar-kbps {
    color: #ff00ff;
    border-color: #ff00ff;
}
