:root {
  --bg: #0f1115;
  --panel: #181b22;
  --line: #262a33;
  --text: #e8e9ec;
  --muted: #8b90a0;
  --accent: #e5a50a;
  --error: #ff6b6b;
  --ok: #4cc38a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand span { color: var(--accent); }
#userbox { display: flex; gap: 12px; align-items: center; color: var(--muted); }

button {
  background: var(--accent); color: #111; border: 0; border-radius: 6px;
  padding: 8px 14px; font-weight: 600; cursor: pointer;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.card {
  max-width: 360px; margin: 12vh auto; padding: 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.card h1 { margin: 0 0 18px; font-size: 20px; }
.card label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.card label input { margin-top: 5px; }
.card button { width: 100%; margin-top: 6px; }
.error { color: var(--error); min-height: 1.4em; margin: 10px 0 0; }
.muted { color: var(--muted); }

main {
  display: grid; grid-template-columns: 1fr 360px; gap: 20px;
  padding: 20px; max-width: 1500px; margin: 0 auto;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; padding: 12px; } }

/* ───── Lejátszó ───── */
#stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000;
  border-radius: 8px; overflow: hidden; user-select: none;
}
#stage video { width: 100%; height: 100%; display: block; background: #000; }
/* állókép forrásváltáskor: ugyanúgy illeszkedik, mint a videó */
.pl-freeze { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
.pl-freeze[hidden] { display: none; }
#stage.pl-fs, #stage:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
/* Teljes képernyőn a böngésző a videót külön „overlay” rétegként adhatja a videókártyának (főleg
   AMD-n, nem 16:9-es, fekete csíkos filmeknél). Egyes meghajtókkal ilyenkor a fölötte lévő vezérlősáv
   nem látszik. A szinte 1-es átlátszóság ezt megakadályozza, a képen semmi nem látszik belőle. */
#stage:fullscreen video, #stage.pl-fs video { opacity: .999; }
#stage.pl-idle { cursor: none; }

.pl-bar {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 28px 12px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  transition: opacity .25s;
}
#stage.pl-idle .pl-bar { opacity: 0; pointer-events: none; }

.pl-progress { position: relative; height: 14px; cursor: pointer; touch-action: none; outline: none; }
.pl-progress::before, .pl-buffered, .pl-hover, .pl-played {
  content: ''; position: absolute; left: 0; top: 5px; height: 4px; border-radius: 2px; transition: height .1s, top .1s;
}
.pl-progress::before { right: 0; background: rgba(255,255,255,.25); }
.pl-buffered { background: rgba(255,255,255,.4); width: 0; }
/* az egér helyéig: áttetsző fehér réteg a betöltött/be nem töltött rész fölött – mindkettő világosabb lesz */
.pl-hover { background: rgba(255,255,255,.35); width: 0; transition: height .1s, top .1s; }
.pl-played { background: var(--accent); width: 0; }
.pl-progress:hover::before, .pl-progress:hover .pl-buffered, .pl-progress:hover .pl-hover, .pl-progress:hover .pl-played { top: 4px; height: 6px; }
.pl-thumb {
  position: absolute; top: 1px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform .1s;
}
.pl-progress:hover .pl-thumb, .pl-progress:focus-visible .pl-thumb { transform: scale(1); }
.pl-tip {
  position: absolute; bottom: 18px; transform: translateX(-50%); padding: 2px 6px; border-radius: 4px;
  background: rgba(20,20,20,.9); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none;
}

.pl-row { display: flex; align-items: center; gap: 4px; height: 40px; }
.pl-spacer { flex: 1; }
.pl-btn {
  width: 40px; height: 40px; padding: 8px; border: 0; border-radius: 6px; background: transparent;
  color: #fff; cursor: pointer; display: grid; place-items: center;
}
.pl-btn:hover { background: rgba(255,255,255,.12); }
.pl-btn svg { width: 24px; height: 24px; fill: currentColor; }
.pl-btn[hidden] { display: none; }
#stage.pl-menu-open .pl-gear > svg { transform: rotate(30deg); }
.pl-gear > svg { transition: transform .2s; }
.pl-time {
  color: #eee; font: inherit; font-size: 13px; font-weight: 400; margin-left: 4px; padding: 6px 10px; border: 0; border-radius: 16px;
  background: transparent; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
}
.pl-time:hover { background: rgba(255,255,255,.12); }
.pl-vol { display: flex; align-items: center; }
/* Hangerő: vékony fehér csík, fehér gomb – keret és kijelölés nélkül */
#stage .pl-volume {
  -webkit-appearance: none; appearance: none; width: 0; height: 20px; margin: 0; padding: 0;
  border: 0; border-radius: 0; outline: none; background: transparent; opacity: 0; cursor: pointer;
  transition: width .2s, opacity .2s;
}
#stage .pl-volume:focus, #stage .pl-volume:focus-visible { outline: none; }
#stage .pl-volume::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(to right, #fff var(--vol, 100%), rgba(255,255,255,.3) var(--vol, 100%));
}
#stage .pl-volume::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: #fff; border: 0;
}
#stage .pl-volume::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); }
#stage .pl-volume::-moz-range-progress { height: 3px; border-radius: 2px; background: #fff; }
#stage .pl-volume::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
#stage .pl-vol:hover .pl-volume, #stage .pl-volume:focus { width: 72px; opacity: 1; margin-right: 6px; }

/* Felirat gomb: bekapcsolva aláhúzás, mint a YouTube-on */
.pl-cc { position: relative; }
.pl-cc.pl-on::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 3px; border-radius: 2px; background: var(--accent);
}
/* HD jelvény a fogaskeréken és a menüben */
.pl-gear { position: relative; }
.pl-gear-badge {
  position: absolute; top: 4px; right: 1px; padding: 0 3px; border-radius: 3px; background: #e5262f; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 13px; letter-spacing: .2px; pointer-events: none;
}
.pl-gear-badge[hidden] { display: none; }
.pl-badge { font-size: 10px; font-weight: 700; margin-left: 2px; vertical-align: super; line-height: 0; color: #ff4e45; }
.pl-item-value .pl-badge { color: #ff4e45; }
.pl-icon { width: 24px; height: 24px; display: grid; place-items: center; }
.pl-icon svg { width: 22px; height: 22px; fill: currentColor; }

.pl-menu {
  position: absolute; z-index: 5; right: 12px; bottom: 64px; min-width: 300px; max-width: calc(100% - 24px);
  max-height: calc(100% - 80px); overflow-y: auto; padding: 8px 0; border-radius: 10px;
  background: rgba(28,28,28,.92); backdrop-filter: blur(6px); box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.pl-menu[hidden] { display: none; }
.pl-item, .pl-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border: 0; border-radius: 0;
  background: transparent; color: #fff; font: inherit; font-size: 14px; font-weight: 400; text-align: left; cursor: pointer;
}
.pl-item:hover, .pl-head:hover { background: rgba(255,255,255,.1); }
.pl-item-label { flex: 1; }
.pl-item-value { color: #bbb; font-size: 13px; }
.pl-chev { color: #bbb; font-size: 18px; line-height: 1; }
.pl-head { border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 6px; padding-left: 8px; font-weight: 600; }
.pl-head svg { width: 22px; height: 22px; fill: currentColor; }
.pl-check { width: 20px; height: 20px; display: grid; place-items: center; }
.pl-check svg { width: 20px; height: 20px; fill: currentColor; }
.pl-selected .pl-item-label { font-weight: 600; }

.pl-sub {
  position: absolute; left: 5%; right: 5%; bottom: 6%; display: flex; flex-direction: column; align-items: center;
  gap: 2px; pointer-events: none; transition: bottom .25s; text-align: center;
}
#stage:not(.pl-idle) .pl-sub { bottom: 70px; }
.pl-sub span {
  background: rgba(0,0,0,.72); color: #fff; padding: 2px 8px; border-radius: 3px;
  font-size: clamp(14px, 2.6vw, 26px); line-height: 1.35; white-space: pre-line;
}
#stage.pl-fs .pl-sub span { font-size: clamp(20px, 3vw, 40px); }

.pl-spinner {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%;
  animation: pl-spin .9s linear infinite; pointer-events: none;
}
.pl-spinner[hidden] { display: none; }
@keyframes pl-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .pl-vol .pl-volume { display: none; }
  .pl-menu { right: 6px; left: 6px; min-width: 0; }
}
#nowPlaying { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; flex-wrap: wrap; }
#status { color: var(--muted); font-size: 13px; }
#status.ok { color: var(--ok); }
#status.err { color: var(--error); }

#library {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; max-height: calc(100vh - 110px);
}
.libhead { display: flex; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
#count { color: var(--muted); font-size: 13px; white-space: nowrap; }
#films { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#films li {
  padding: 9px 10px; border-radius: 6px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
#films li:hover { background: #20242d; }
#films li.active { background: #2a2618; }
#films .name { font-weight: 500; overflow-wrap: anywhere; }
#films .meta { color: var(--muted); font-size: 12px; }
#empty { padding: 16px; margin: 0; }

/* ───── Lejátszó animációk ───── */
/* Lejátszás ↔ szünet ikon átalakulása */
.pl-btn.pl-play { padding: 0; }
.pl-play svg.pl-morph { width: 36px; height: 36px; display: block; }
.pl-morph path { fill: currentColor; transition: d .18s ease-in-out; }

/* Hangerő ikon: hullámok a hangerő szerint, némításnál áthúzás */
.pl-volicon .pl-spk { fill: currentColor; }
.pl-volicon .pl-w1, .pl-volicon .pl-w2, .pl-volicon .pl-x {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  transform-box: view-box; transform-origin: 9px 12px;
  transition: opacity .18s ease, transform .18s ease;
}
.pl-volicon .pl-x { transform-origin: 18px 12px; opacity: 0; transform: scale(.4); }
.pl-vol-low .pl-w2 { opacity: 0; transform: scale(.7); }
.pl-vol-mute .pl-w1, .pl-vol-mute .pl-w2 { opacity: 0; transform: scale(.6); }
.pl-vol-mute .pl-x { opacity: 1; transform: scale(1); }

/* Középen felvillanó lejátszás / szünet jel */
.pl-flash {
  position: absolute; z-index: 1; left: 50%; top: 50%; width: 72px; height: 72px; min-width: 72px; aspect-ratio: 1 / 1;
  margin: -36px 0 0 -36px; box-sizing: border-box;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center;
  opacity: 0; pointer-events: none;
}
.pl-flash svg { width: 40px; height: 40px; fill: currentColor; }

.pl-flash.pl-flash-go { animation: pl-flash .9s ease-out forwards; }
@keyframes pl-flash {
  0% { opacity: 1; transform: scale(.85); }
  45% { opacity: .9; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.5); }
}
/* Felső szöveges visszajelzés (hangerő %, tekerés) */
.pl-toast {
  position: absolute; z-index: 3; left: 50%; top: 10%; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff;
  font-size: 18px; font-weight: 500; pointer-events: none; opacity: 0; transition: opacity .3s;
}
.pl-toast.pl-toast-on { opacity: 1; transition: opacity .1s; }
@media (prefers-reduced-motion: reduce) {
  .pl-morph path, .pl-volicon path { transition: none; }
  .pl-flash.pl-flash-go { animation-duration: .01s; }
}

/* Oldalsó tekerés-számláló (+5, +10 … / -5, -10 …) */
.pl-seek {
  position: absolute; z-index: 3; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 28px;
  background: rgba(0,0,0,.45); color: #fff; font-size: 22px; font-weight: 600;
  pointer-events: none; opacity: 0; transition: opacity .35s;
}
.pl-seek.pl-seek-on { opacity: 1; transition: opacity .1s; }
.pl-seek-right { right: 8%; flex-direction: row-reverse; }   /* „+10 mp ▸▸▸” */
.pl-seek-left { left: 8%; }                                   /* „◂◂◂ -10 mp” */
.pl-seek-arrows { display: flex; gap: 2px; }
.pl-seek-arrows i {
  width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  border-left: 11px solid #fff; opacity: .25;
}
.pl-seek-left .pl-seek-arrows { flex-direction: row-reverse; }
.pl-seek-left .pl-seek-arrows i { border-left: 0; border-right: 11px solid #fff; }
.pl-seek-on .pl-seek-arrows i { animation: pl-chev .75s linear; }
.pl-seek-on .pl-seek-arrows i:nth-child(2) { animation-delay: .12s; }
.pl-seek-on .pl-seek-arrows i:nth-child(3) { animation-delay: .24s; }
@keyframes pl-chev { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ───── Együtt nézés ───── */
#party { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.party-head { display: flex; align-items: center; gap: 8px; }
.party-head strong { flex: 1; }
button.small { padding: 5px 10px; font-size: 13px; }
#partyInfo { font-size: 13px; color: var(--muted); line-height: 1.5; }
#partyInfo b { color: var(--text); font-weight: 600; }
.party-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.party-member { background: #232733; border-radius: 10px; padding: 1px 8px; font-size: 12px; color: var(--text); }
.party-member.host { background: #3a3118; color: var(--accent); }
#partyRooms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#partyRooms:empty { display: none; }
#partyRooms li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; background: #1d2029; font-size: 13px;
}
#partyRooms li .room-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#partyRooms li .room-film { color: var(--muted); }
#films.locked li { cursor: not-allowed; opacity: .55; }
#films.locked li.active { opacity: 1; }
#partyBadge {
  font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #3a3118; color: var(--accent); white-space: nowrap;
}
