@font-face {
    font-family: telehack;
    src: url(../fonts/courier_telehack.ttf);
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('/fonts/IBMPlexMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body {
    background-color: #000000;
    margin: 0;
    padding: 20px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

/* CRT scanline + flicker overlay */
@keyframes flicker {
  0%   { opacity: 0.27861; }
  5%   { opacity: 0.34769; }
  10%  { opacity: 0.23604; }
  15%  { opacity: 0.90626; }
  20%  { opacity: 0.18128; }
  25%  { opacity: 0.83891; }
  30%  { opacity: 0.65583; }
  35%  { opacity: 0.67807; }
  40%  { opacity: 0.26559; }
  45%  { opacity: 0.84693; }
  50%  { opacity: 0.96019; }
  55%  { opacity: 0.08594; }
  60%  { opacity: 0.20313; }
  65%  { opacity: 0.71988; }
  70%  { opacity: 0.53455; }
  75%  { opacity: 0.37288; }
  80%  { opacity: 0.71428; }
  85%  { opacity: 0.70419; }
  90%  { opacity: 0.7003;  }
  95%  { opacity: 0.36108; }
  100% { opacity: 0.24387; }
}

@keyframes textShadow {
  0%   { text-shadow: 0.44px 0 1px rgba(0,30,255,0.5),  -0.44px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  5%   { text-shadow: 2.79px 0 1px rgba(0,30,255,0.5),  -2.79px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  10%  { text-shadow: 0.03px 0 1px rgba(0,30,255,0.5),  -0.03px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  15%  { text-shadow: 0.40px 0 1px rgba(0,30,255,0.5),  -0.40px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  20%  { text-shadow: 3.48px 0 1px rgba(0,30,255,0.5),  -3.48px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  25%  { text-shadow: 1.61px 0 1px rgba(0,30,255,0.5),  -1.61px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  30%  { text-shadow: 0.70px 0 1px rgba(0,30,255,0.5),  -0.70px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  35%  { text-shadow: 3.90px 0 1px rgba(0,30,255,0.5),  -3.90px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  40%  { text-shadow: 3.87px 0 1px rgba(0,30,255,0.5),  -3.87px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  45%  { text-shadow: 2.23px 0 1px rgba(0,30,255,0.5),  -2.23px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  50%  { text-shadow: 0.08px 0 1px rgba(0,30,255,0.5),  -0.08px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  55%  { text-shadow: 2.38px 0 1px rgba(0,30,255,0.5),  -2.38px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  60%  { text-shadow: 2.20px 0 1px rgba(0,30,255,0.5),  -2.20px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  65%  { text-shadow: 2.86px 0 1px rgba(0,30,255,0.5),  -2.86px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  70%  { text-shadow: 0.49px 0 1px rgba(0,30,255,0.5),  -0.49px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  75%  { text-shadow: 1.89px 0 1px rgba(0,30,255,0.5),  -1.89px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  80%  { text-shadow: 0.08px 0 1px rgba(0,30,255,0.5),  -0.08px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  85%  { text-shadow: 0.10px 0 1px rgba(0,30,255,0.5),  -0.10px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  90%  { text-shadow: 3.44px 0 1px rgba(0,30,255,0.5),  -3.44px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  95%  { text-shadow: 2.18px 0 1px rgba(0,30,255,0.5),  -2.18px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
  100% { text-shadow: 2.62px 0 1px rgba(0,30,255,0.5),  -2.62px 0 1px rgba(255,0,80,0.3),  0 0 3px; }
}

/* Scanlines */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    z-index: 9999;
    pointer-events: none;
}

/* Flicker */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.05);
    z-index: 9999;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

.radio-player {
    max-width: 500px;
    margin: 50px auto;
    text-align: center;
}

h1 {
    color: white;
    font-family: Consolas;
    text-align: center;
    text-shadow: 0.05rem 0 0.06rem #ea36af, -0.125rem 0 0.06rem #75fa69;
    letter-spacing: 0.125em;
    animation-duration: 0.08s;
    animation-name: textflicker;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    margin-bottom: 30px;
}

@keyframes textflicker {
    from {
        text-shadow: 1px 0 0 #ea36af, -2px 0 0 #75fa69;
    }
    to {
        text-shadow: 2px 0.5px 2px #ea36af, -2px -0.5px 2px #75fa69;
    }
}

.album-art {
    margin: 30px auto;
    width: 200px;
    height: 200px;
}

.album-art img {
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.track-info {
    margin: 20px 0;
}

.track-info p {
    color: white;
    font-family: Consolas;
    margin: 5px 0;
    animation: textShadow 1.6s infinite;
}

#track-title {
    font-size: 16px;
    color: #00FF00;
}

#track-artist {
    font-size: 14px;
}

.controls {
    margin: 30px 0;
}

button {
    box-sizing: border-box;
    border: none;
    min-width: 120px;
    min-height: 30px;
    padding: 0 12px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    font-size: 14px;
    font-weight: 600;
    background: silver;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px grey, inset 2px 2px #dfdfdf;
    cursor: pointer;
}

button:active {
    box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px grey;
    padding: 2px 11px 0 13px;
}

button:hover {
    background: #c0c0c0;
}

.volume-control {
    margin: 30px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.volume-control label {
    color: white;
    font-family: Consolas;
    animation: textShadow 1.6s infinite;
}

#volume {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 3px;
    background: #222;
    border: none;
    border-radius: 0;
    outline: none;
    cursor: pointer;
}

#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 14px;
    background: #00FF00;
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 0 4px #00FF00;
}

#volume::-moz-range-thumb {
    width: 6px;
    height: 14px;
    background: #00FF00;
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 0 4px #00FF00;
}

#volume::-moz-range-track {
    height: 3px;
    background: #222;
    border: none;
}

#volume-val {
    color: #00FF00;
    font-family: Consolas;
    min-width: 50px;
    animation: textShadow 1.6s infinite;
}
/* ========================== RECENTLY PLAYED ========================== */

.history {
    margin: 45px 0 20px;
    text-align: left;
}

.history h2 {
    color: white;
    font-family: Consolas;
    font-size: 14px;
    font-weight: normal;
    letter-spacing: 0.125em;
    text-shadow: 0.05rem 0 0.06rem #ea36af, -0.125rem 0 0.06rem #75fa69;
    margin: 0 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #262626;
}

#history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#history-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 2px;
    border-bottom: 1px dashed #1c1c1c;
    font-family: Consolas;
    animation: textShadow 1.6s infinite;
}

/* Track column has to be allowed to shrink or the ellipsis never kicks in. */
.hist-track {
    flex: 1;
    min-width: 0;
}

.hist-title,
.hist-artist {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hist-title {
    color: #00FF00;
    font-size: 13px;
}

.hist-artist {
    color: #7a7a7a;
    font-size: 12px;
}

.hist-time {
    color: #4a4a4a;
    font-size: 11px;
    white-space: nowrap;
}

/* Jingles and station IDs read as station chrome, not as music. */
#history-list li.jingle .hist-title {
    color: #ea36af;
}

#history-list li.history-empty {
    justify-content: center;
    color: #4a4a4a;
    font-size: 12px;
    border-bottom: none;
}

/* ============================ FREAKY MODE ============================
   Everything below only applies while body.freaky is set by radio.js.
   --freaky-level is driven from live audio amplitude (0..1) when the
   audio-reactive layer is available, and stays at 0 otherwise. */

.controls button {
    margin: 0 5px;
}

#freaky-btn.on {
    background: #00FF00;
    color: #000;
    box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a,
                inset -2px -2px #dfdfdf, inset 2px 2px grey;
}

@keyframes freakyHue {
    from { filter: hue-rotate(0deg) saturate(1.5); }
    to   { filter: hue-rotate(360deg) saturate(1.5); }
}

@keyframes freakyShear {
    0%, 100% { transform: skewX(0deg) translateX(0); }
    8%       { transform: skewX(7deg) translateX(4px); }
    10%      { transform: skewX(-5deg) translateX(-6px); }
    12%      { transform: skewX(0deg) translateX(0); }
    54%      { transform: skewX(3deg) translateX(3px); }
    56%      { transform: skewX(-4deg) translateX(-4px); }
    58%      { transform: skewX(0deg) translateX(0); }
}

@keyframes freakyJitter {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(-3px, 2px); }
    40%      { transform: translate(3px, -2px); }
    60%      { transform: translate(-2px, -3px); }
    80%      { transform: translate(2px, 3px); }
}

/* Rolls the scanline overlay down the screen. */
@keyframes freakyRoll {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 0 100vh, 0 0; }
}

body.freaky .radio-player {
    animation: freakyShear 2.6s infinite, freakyHue 5s linear infinite;
}

body.freaky::before {
    animation: freakyRoll 1.1s linear infinite;
}

/* Scale pulse rides on the container so it cannot fight the img jitter
   animation (animations beat inline styles, so they must not share a target). */
body.freaky .album-art {
    transform: scale(calc(1 + var(--freaky-level, 0) * 0.12));
    transition: transform 0.06s linear;
}

body.freaky .album-art img {
    animation: freakyJitter 0.22s steps(2) infinite;
    filter: drop-shadow(3px 0 0 rgba(255, 0, 0, 0.7))
            drop-shadow(-3px 0 0 rgba(0, 255, 255, 0.7))
            saturate(1.6);
}

/* Speed up the glitch animations the base theme already defines. */
body.freaky h1 {
    animation-duration: 0.03s;
}

body.freaky p,
body.freaky label,
body.freaky #history-list li {
    animation-duration: 0.18s;
}

body.freaky .history h2 {
    animation: textflicker 0.03s infinite alternate;
}

body.freaky #track-title {
    text-shadow: 0 0 calc(4px + var(--freaky-level, 0) * 14px) #00FF00;
}
