:root{
--bg: #101114;
--surface: #17181d;
--surface-2: #1e2027;
--border: #2a2c34;
--text: #e7e6e1;
--text-dim: #8b8d97;
--accent: #e0a940;
--accent-dim: #7a6431;
--radius: 3px;
}

*{ box-sizing: border-box; }

body{
margin: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: var(--text);
padding: 24px;
}

.player{
width: 100%;
max-width: 960px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}

.stage{
position: relative;
background: #000;
aspect-ratio: 16 / 9;
}

video{
width: 100%;
height: 100%;
display: block;
background: #000;
}

video::cue{
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 1.05em;
background: rgba(0,0,0,0.6);
color: #f2f2ee;
}

/* center play/pause glyph shown briefly on toggle */
.stage .flash{
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
opacity: 0;
}
.flash svg{
width: 56px;
height: 56px;
filter: drop-shadow(0 2px 10px rgba(0,0,0,.6));
}
.flash.show{
animation: flashpop .55s ease-out;
}
@keyframes flashpop{
0%   { opacity: 0; transform: scale(0.8); }
25%  { opacity: 1; transform: scale(1); }
100% { opacity: 0; transform: scale(1); }
}

.stage .buffering{
position: absolute;
inset: 0;
display: none;
align-items: center;
justify-content: center;
}
.stage .buffering.show{ display: flex; }
.spinner{
width: 34px; height: 34px;
border: 3px solid rgba(255,255,255,0.18);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* controls */
.controls{
background: var(--surface-2);
padding: 10px 14px 12px;
user-select: none;
transition: opacity .25s ease, transform .25s ease;
}
#player:fullscreen.controls-hidden .controls,
#player:-webkit-full-screen.controls-hidden .controls{
opacity: 0;
transform: translateY(100%);
pointer-events: none;
}
#player:fullscreen.controls-hidden,
#player:-webkit-full-screen.controls-hidden{
cursor: none;
}

.scrub{
position: relative;
height: 14px;
display: flex;
align-items: center;
cursor: pointer;
margin-bottom: 8px;
}
.scrub .track{
position: relative;
width: 100%;
height: 4px;
background: var(--border);
border-radius: 2px;
overflow: hidden;
}
.scrub .buffered{
position: absolute;
top: 0; left: 0; height: 100%;
background: rgba(255,255,255,0.14);
width: 0%;
}
.scrub .fill{
position: absolute;
top: 0; left: 0; height: 100%;
background: var(--accent);
width: 0%;
}
.scrub .knob{
position: absolute;
top: 50%;
width: 12px; height: 12px;
background: var(--accent);
border-radius: 50%;
transform: translate(-50%, -50%);
left: 0%;
box-shadow: 0 0 0 3px rgba(224,169,64,0.18);
opacity: 0;
transition: opacity .15s;
}
.scrub:hover .knob{ opacity: 1; }

.row{
display: flex;
align-items: center;
gap: 6px;
}
.row .spacer{ flex: 1; }

button.ctl{
background: none;
border: none;
color: var(--text);
width: 32px; height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border-radius: var(--radius);
padding: 0;
}
button.ctl:hover{ background: rgba(255,255,255,0.08); }
button.ctl svg{ width: 18px; height: 18px; fill: var(--text); }
button.ctl:hover svg{ fill: var(--accent); }
button.ctl.active svg{ fill: var(--accent); }

.time{
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 12px;
color: var(--text-dim);
letter-spacing: 0.02em;
white-space: nowrap;
padding: 0 2px;
}

.vol{
display: flex;
align-items: center;
gap: 6px;
}
.vol input[type="range"]{
width: 70px;
accent-color: var(--accent);
}

.menu-wrap{ position: relative; }
.menu{
position: absolute;
bottom: 40px;
right: 0;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 4px;
display: none;
flex-direction: column;
min-width: 92px;
z-index: 5;
}
.menu.open{ display: flex; }
.menu button{
background: none;
border: none;
color: var(--text);
font-size: 12px;
text-align: left;
padding: 6px 8px;
border-radius: 2px;
cursor: pointer;
font-family: "SFMono-Regular", Consolas, monospace;
}
.menu button:hover{ background: rgba(255,255,255,0.08); }
.menu button.active{ color: var(--accent); }

input[type="range"]{
-webkit-appearance: none;
background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track{
height: 3px;
background: var(--border);
border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb{
-webkit-appearance: none;
width: 10px; height: 10px;
border-radius: 50%;
background: var(--accent);
margin-top: -3.5px;
}

.playlist{
background: var(--surface);
border-bottom: 1px solid var(--border);
max-height: 220px;
overflow-y: auto;
}
#player:fullscreen,
#player:-webkit-full-screen{
display: flex;
flex-direction: column;
height: 100vh;
max-width: none;
border: none;
border-radius: 0;
}
#player:fullscreen .playlist,
#player:-webkit-full-screen .playlist{
display: none;
}
#player:fullscreen .stage,
#player:-webkit-full-screen .stage{
flex: 1;
aspect-ratio: unset;
height: auto;
}
#player:fullscreen video,
#player:-webkit-full-screen video{
object-fit: contain;
}
.playlist-item{
display: flex;
align-items: center;
gap: 10px;
padding: 10px 14px;
cursor: pointer;
border-left: 2px solid transparent;
}
.playlist-item:hover{ background: rgba(255,255,255,0.04); }
.playlist-item.active{
border-left-color: var(--accent);
background: rgba(224,169,64,0.08);
}
.playlist-item .idx{
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 11px;
color: var(--text-dim);
width: 16px;
}
.playlist-item.active .idx{ color: var(--accent); }
.playlist-item .title{
font-size: 13px;
color: var(--text);
flex: 1;
}
.playlist-item.active .title{ color: var(--accent); }
.playlist-item .playing-dot{
width: 6px; height: 6px;
border-radius: 50%;
background: var(--accent);
opacity: 0;
}
.playlist-item.active .playing-dot{ opacity: 1; }

.meta{
padding: 2px 2px 0;
font-size: 11px;
color: var(--text-dim);
font-family: "SFMono-Regular", Consolas, monospace;
}

@media (prefers-reduced-motion: reduce){
.flash.show, .spinner{ animation: none; }
}