/* player.css — the playmp3 easter egg: a draggable 90s-hacker popup player
   window (display-manager style: terminal title bar, minimize, close,
   fullscreen, CRT boot lines) with a doped audio-reactive WebGL
   visualizer.
   Grade: DARK + undefined — deep blood-crimson rgb(170,45,60) structural
   reds, dim red text, soft/ghosted borders, slightly blurred non-interactive
   text, drifting fog, heavy scanlines. Nothing is crisp; everything
   half-remembers itself. */

#player {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: min(560px, 94vw);
    /* the site's .content is white-space: pre-wrap — keep this subtree normal */
    white-space: normal;
}
#player.player-closed {
    display: none;
}

/* fullscreen visualizer: the whole window fills the screen */
#player:fullscreen,
#player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    left: 0;
    top: 0;
    transform: none;
    display: flex;
    flex-direction: column;
}
#player:fullscreen #player-drag,
#player:-webkit-full-screen #player-drag {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#player:fullscreen #player-body,
#player:-webkit-full-screen #player-body {
    flex: 1;
    height: auto;
    min-height: 0;
}
/* #player-main is height:100% by default, which doesn't resolve when its
   parent's height comes from flex-grow — make it a flex item so the
   column (and the canvas inside it) actually stretches */
#player:fullscreen #player-main,
#player:-webkit-full-screen #player-main {
    flex: 1;
    height: auto;
    min-height: 0;
}

/* --- window frame: soft, smoky edge --- */
#player-drag {
    position: relative;
    background: #000;
    border: 1px solid rgba(170, 45, 60, 0.5);
    box-shadow: 0 0 34px rgba(120, 30, 45, 0.35), inset 0 0 70px rgba(120, 30, 45, 0.06);
    user-select: none;
}
#player-drag.player-grab {
    cursor: grabbing;
}

/* title bar: dark maroon, dim red type, not crisp */
#player-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 8px;
    background: #200609;
    color: rgb(225, 100, 105);
    border-bottom: 1px solid rgba(170, 45, 60, 0.5);
    font-weight: bold;
    cursor: move;
    touch-action: none;
}
#player-windowtitle {
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    filter: blur(0.4px);
    text-shadow: 0 0 6px rgba(170, 45, 60, 0.5);
}
.player-titlebar-btns {
    display: flex;
    gap: 6px;
    flex: none;
}
#player-min,
#player-close {
    width: 22px;
    height: 18px;
    padding: 0;
    line-height: 1;
    background: #000;
    color: rgb(225, 100, 105);
    border: 1px solid rgba(170, 45, 60, 0.55);
    font-family: monospace;
    font-weight: bold;
    font-size: 0.85em;
    cursor: pointer;
}
#player-min:hover,
#player-close:hover {
    color: rgb(255, 130, 135);
    box-shadow: 0 0 8px rgba(170, 45, 60, 0.5);
}

/* --- body: fog over, scanlines over that --- */
#player-body {
    position: relative;
    height: min(400px, 72vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #000;
}
#player.player-min #player-body {
    display: none;
}
#player-body::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg, rgba(255, 90, 90, 0.03) 0 1px, transparent 1px 3px);
    animation: player-scan 0.35s linear infinite;
}
@keyframes player-scan {
    from { background-position: 0 0; }
    to   { background-position: 0 3px; }
}
/* drifting fog: the room is hazy */
#player-body::after {
    content: '';
    position: absolute;
    inset: -20%;
    z-index: 5;
    pointer-events: none;
    background:
        radial-gradient(ellipse 40% 30% at 30% 40%, rgba(120, 30, 45, 0.10), transparent 70%),
        radial-gradient(ellipse 35% 45% at 70% 60%, rgba(80, 20, 60, 0.08), transparent 70%),
        radial-gradient(ellipse 50% 35% at 50% 80%, rgba(60, 20, 30, 0.09), transparent 70%);
    animation: player-fog 26s ease-in-out infinite alternate;
}
@keyframes player-fog {
    from { transform: translate(-2%, -1%) scale(1); }
    to   { transform: translate(2%, 1.5%) scale(1.06); }
}
/* --- fake boot sequence: dim, fades in line by line --- */
#player-boot {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    background: #000;
    color: rgb(210, 88, 93);
    filter: blur(0.3px);
    transition: opacity 0.4s ease;
}
#player-boot.done {
    opacity: 0;
    pointer-events: none;
}
.player-bootline {
    opacity: 0;
}
.player-bootline.show {
    opacity: 1;
}
.player-bootline .ok {
    color: rgb(110, 80, 80);
}

/* --- main UI --- */
#player-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px 14px 10px;
    box-sizing: border-box;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.72) 100%);
}
/* --- visualizer (WebGL psychedelic shader; 2D bars if no WebGL) --- */
#player-canvas {
    flex: 1;
    min-height: 70px;
    width: 100%;
    display: block;
    margin: 10px 0;
    border: 1px solid rgba(170, 45, 60, 0.3);
    box-shadow: inset 0 0 24px rgba(60, 15, 25, 0.5);
    cursor: pointer;   /* click the visualizer = play/pause */
}

/* --- controls: dim, soft --- */
#player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}
/* transport: bare terminal text — no chrome, no glow */
#player-controls button {
    background: none;
    color: rgb(190, 85, 90);
    border: none;
    font-family: monospace;
    font-weight: normal;
    font-size: 1em;
    padding: 2px 10px;
    cursor: pointer;
    box-sizing: border-box;
    text-align: center;
    opacity: 0.85;
    /* fixed widths: the play/pause glyph swap must not resize the button */
}
#player-prev,
#player-next {
    width: 40px;
    padding: 2px 0;
}
#player-play {
    width: 48px;
    padding: 2px 0;
}
#player-viz {
    width: 40px;
    font-size: 0.8em;
    letter-spacing: 1px;
    color: rgb(140, 90, 95);
}
#player-fs {
    width: 34px;
    font-size: 0.8em;
    letter-spacing: 1px;
    color: rgb(140, 90, 95);
}
#player-controls button:hover {
    color: rgb(255, 130, 135);
    opacity: 1;
    text-shadow: 0 0 8px rgba(170, 45, 60, 0.45);
}
#player-vollabel {
    margin-left: auto;
    color: rgb(120, 80, 82);
    font-size: 0.8em;
    white-space: nowrap;
}
#player-vol {
    accent-color: rgb(180, 55, 70);
    width: 100px;
    vertical-align: middle;
    opacity: 0.85;
}

/* --- status line: dim, half-legible --- */
#player-status {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(170, 45, 60, 0.35);
    color: rgb(215, 98, 103);
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    filter: blur(0.3px);
}
#player-status .ok { color: rgb(205, 82, 90); }
#player-status .warn { color: rgb(200, 140, 60); }
#player-status-mode { color: rgb(96, 158, 178); letter-spacing: 0.06em; }
#player-status-mode:empty { display: none; }

/* --- CRT power-on boot of the window --- */
.player-booting #player-drag {
    animation: player-crt 0.55s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes player-crt {
    0%   { transform: scale(0.98, 0.01); filter: brightness(6); }
    55%  { transform: scale(1, 0.02);    filter: brightness(3); }
    100% { transform: scale(1, 1);       filter: brightness(1); }
}
#player-sweep {
    position: absolute;
    left: 0;
    right: 0;
    top: -2px;
    height: 2px;
    background: rgba(200, 60, 75, 0.8);
    box-shadow: 0 0 14px 3px rgba(170, 45, 60, 0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 6;
}
.player-booting #player-sweep {
    animation: player-sweep 0.45s ease-out;
}
@keyframes player-sweep {
    0%   { top: -2px; opacity: 1; }
    100% { top: 100%; opacity: 0.2; }
}

/* --- no motion, no glitches: static window --- */
@media (prefers-reduced-motion: reduce) {
    #player-body::before,
    #player-body::after,
    .player-booting #player-drag,
    .player-booting #player-sweep {
        animation: none !important;
    }
}

@media only screen and (max-width: 800px) {
    #player-body { height: min(360px, 66vh); }
    #player-main { padding: 10px; }
}
