:root {
  color-scheme: dark;
  --hue: 335;
  --bg: #07070c;
  --surface: rgb(255 255 255 / 5%);
  --surface-strong: rgb(255 255 255 / 10%);
  --line: rgb(255 255 255 / 10%);
  --text: #f6f6fb;
  --muted: #a6a6bb;
  --accent: hsl(var(--hue) 95% 68%);
  --accent-start: hsl(var(--hue) 82% 47%);
  --accent-end: hsl(calc(var(--hue) - 40) 78% 45%);
  --accent-soft: hsl(var(--hue) 95% 68% / 16%);
  --danger: #ff7385;
  --success: #4fe0a4;
  --radius: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70vmax 46vmax at 92% -14%, hsl(var(--hue) 92% 52% / 30%), transparent 68%),
    radial-gradient(60vmax 44vmax at -12% 112%, hsl(calc(var(--hue) + 60) 90% 50% / 20%), transparent 70%);
}

h1, h2, p { margin: 0; }

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, label.button:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.solid { fill: currentColor; stroke: none; }

.muted { color: var(--muted); }

.error { color: var(--danger); font-size: 0.9rem; }

.glass {
  background: rgb(22 22 32 / 78%);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* Gombok */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-strong);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s;
}

.button:active { transform: scale(0.97); }

.button.primary {
  background: linear-gradient(120deg, var(--accent-start), var(--accent-end));
  color: #fff;
  box-shadow: 0 8px 26px -10px var(--accent-start);
}

.button.ghost { background: transparent; border-color: var(--line); }

.button.small { padding: 5px 11px; border-radius: 9px; font-size: 0.85rem; font-weight: 600; }

.button.danger { color: var(--danger); }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-button.remove { color: var(--danger); }

@media (hover: hover) {
  .button:hover { transform: translateY(-1px); }
  .button.ghost:hover { background: var(--surface); }
  .icon-button:hover { background: var(--surface-strong); border-color: rgb(255 255 255 / 22%); }
}

/* Márkanév */

.brand {
  display: inline-block;
  background: linear-gradient(100deg, #fff 10%, var(--accent) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-large {
  font-size: clamp(3rem, 15vw, 5.5rem);
  line-height: 1.05;
  text-align: center;
}

/* Belépés */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}

.login-inner { display: grid; gap: 24px; width: 100%; max-width: 400px; }

.login-card { display: grid; gap: 10px; padding: 24px; border-radius: 20px; }

.login-card label, .modal-form label { font-weight: 600; }

.login-card input, .modal-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(0 0 0 / 30%);
}

.login-card .button { margin-top: 6px; }

/* Keret */

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.side { display: grid; gap: 24px; }
.side .brand { padding: 0 10px; }

.nav { display: grid; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, hsl(var(--hue) 82% 47%), hsl(calc(var(--hue) - 40) 78% 45%));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.nav-label { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { color: var(--muted); font-size: 0.85rem; }

.nav-link[aria-current="page"] { background: var(--surface-strong); border-color: var(--line); }

.nav-add { width: 100%; color: var(--muted); }
.nav-add .nav-mark { background: var(--surface); border: 1px dashed var(--line); color: var(--muted); }

@media (hover: hover) {
  .nav-link:hover { background: var(--surface); }
  .nav-link[aria-current="page"]:hover { background: var(--surface-strong); }
}

.side-foot { display: grid; gap: 14px; margin-top: auto; padding: 16px 10px 0; }

.owner-panel { display: grid; gap: 10px; font-size: 0.9rem; }

.stat { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.stat strong { color: var(--text); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.account { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.chip { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.main { min-width: 0; padding: 40px clamp(16px, 4vw, 48px) 120px; }

/* Oldalfej */

.hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px 32px;
  margin-bottom: 36px;
}

.hero-text { min-width: 0; }

.hero h1 {
  font-family: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, system-ui, sans-serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

#page-summary { margin-top: 8px; }
#page-summary:empty { display: none; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.upload-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.target { display: grid; gap: 4px; color: var(--muted); font-size: 0.8rem; font-weight: 600; }

.target select {
  min-width: 170px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #15151f;
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
}

.banner { margin-bottom: 20px; }

/* Polcok és rács */

.library { display: grid; gap: 40px; }

.shelf-title { margin-bottom: 14px; font-size: 1.3rem; font-weight: 750; letter-spacing: -0.02em; }
.shelf-title a { text-decoration: none; }

@media (hover: hover) {
  .shelf-title a:hover { color: var(--accent); }
}

.shelf, .grid { margin: 0; padding: 0; list-style: none; }

.shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 300px);
  gap: 16px;
  padding-bottom: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-strong) transparent;
}

.shelf > .tile { scroll-snap-align: start; }
.shelf.portrait { grid-auto-columns: 170px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.grid.portrait { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

/* Videókártya */

.tile {
  --tile-hue: 280;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}

.tile-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  background: linear-gradient(135deg, hsl(var(--tile-hue) 70% 30%), hsl(calc(var(--tile-hue) + 50) 72% 15%));
  overflow: hidden;
  cursor: pointer;
}

.tile-media:disabled { cursor: default; }
.tile-media:focus-visible { outline-offset: -3px; }

.portrait .tile-media { aspect-ratio: 9 / 16; }

.thumb-bg, .thumb { position: absolute; display: block; }
.thumb-bg:not([src]), .thumb:not([src]) { display: none; }

.thumb-bg {
  inset: -12%;
  width: 124%;
  height: 124%;
  object-fit: cover;
  filter: blur(16px) brightness(0.55);
}

.thumb { inset: 0; width: 100%; height: 100%; object-fit: contain; }

.format {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 1px 7px;
  border-radius: 7px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 1px 7px;
  border-radius: 7px;
  background: rgb(0 0 0 / 70%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.duration:empty { display: none; }

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgb(0 0 0 / 50%);
  border: 1px solid rgb(255 255 255 / 35%);
  color: #fff;
  transform: translate(-50%, -50%);
  transition: transform 0.2s var(--ease), background 0.2s;
}

.play-badge .icon { width: 24px; height: 24px; margin-left: 2px; }

.tile-media:disabled .play-badge { display: none; }

.tile-body { display: flex; align-items: flex-start; gap: 10px; padding: 12px; }
.tile-text { flex: 1; min-width: 0; }

.tile-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.tile-meta { margin-top: 3px; color: var(--muted); font-size: 0.8rem; }

.tile-actions { display: flex; gap: 6px; flex: none; }

.portrait .tile-body { flex-direction: column; }
.portrait .tile-text { flex: none; width: 100%; }

@media (hover: hover) {
  .tile:hover {
    transform: translateY(-4px);
    border-color: hsl(var(--hue) 95% 68% / 55%);
    box-shadow: 0 18px 40px -22px var(--accent-start);
  }

  .tile:hover .play-badge {
    background: linear-gradient(120deg, var(--accent-start), var(--accent-end));
    transform: translate(-50%, -50%) scale(1.12);
  }
}

/* Üres állapot */

.empty {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 72px 20px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  text-align: center;
}

.empty-title { font-size: 1.3rem; font-weight: 750; letter-spacing: -0.02em; }

/* Feltöltési tálca */

.tray {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  max-height: 45vh;
  padding: 14px;
  border-radius: 18px;
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 80%);
}

.tray-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.tray-head h2 { font-size: 1rem; font-weight: 750; }

.queue { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; overflow-y: auto; }

.queue-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.queue-name { min-width: 0; font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; }
.queue-status { color: var(--muted); font-size: 0.8rem; }

.bar { height: 7px; margin: 6px 0 4px; border-radius: 4px; background: var(--surface-strong); overflow: hidden; }

.bar-fill {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-start), var(--accent));
  transition: width 0.2s linear;
}

.queue-row.done .bar-fill { background: var(--success); }
.queue-row.failed .bar-fill { background: var(--danger); }
.queue-row.failed .queue-status { color: var(--danger); }

/* Ráhúzás */

.drop-overlay {
  position: fixed;
  inset: 12px;
  z-index: 30;
  display: grid;
  place-content: center;
  gap: 4px;
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: rgb(7 7 12 / 88%);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  pointer-events: none;
}

.drop-overlay .muted { font-size: 1rem; font-weight: 600; letter-spacing: 0; }

/* Lejátszó */

.player {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: #fff;
}

.player[open] { display: flex; flex-direction: column; }

.player-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
}

#player-title {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player video { flex: 1; min-height: 0; width: 100%; background: #000; }

.player-error {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

/* Párbeszédablak és értesítés */

.modal {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 20px;
  color: var(--text);
}

.modal::backdrop { background: rgb(0 0 0 / 65%); }

.modal-form { display: grid; gap: 10px; }
.modal-form h2 { margin-bottom: 6px; font-size: 1.3rem; font-weight: 750; letter-spacing: -0.02em; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  transform: translateX(-50%);
}

/* A videókereső rejtett elemének lejátszhatónak kell maradnia, ezért nem display: none. */
.thumb-probe {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

/* Telefon és keskeny ablak */

@media (max-width: 860px) {
  .shell { display: flex; flex-direction: column; }

  .rail { display: contents; }

  .side {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 8px;
    padding: 10px 0 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: rgb(7 7 12 / 86%);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .side .brand { padding: 0 16px; font-size: 1.3rem; }

  .nav {
    display: flex;
    gap: 8px;
    padding: 2px 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar { display: none; }

  .nav-link {
    flex: none;
    gap: 7px;
    padding: 5px 12px 5px 6px;
    border-color: var(--line);
    border-radius: 999px;
    background: var(--surface);
  }

  .nav-mark { width: 26px; height: 26px; border-radius: 50%; font-size: 0.78rem; }
  .nav-label { max-width: 150px; font-size: 0.92rem; }
  .nav-add { width: auto; }

  .main { order: 2; flex: 1; padding: 24px 16px 40px; }

  .side-foot { order: 3; margin: 0; padding: 16px; border-top: 1px solid var(--line); }

  .hero { margin-bottom: 26px; }
  .hero-actions, .upload-bar { width: 100%; }
  .upload-bar .target { flex: 1; min-width: 0; }
  .target select { width: 100%; max-width: none; min-width: 0; }

  .shelf { margin-right: -16px; padding-right: 16px; grid-auto-columns: minmax(230px, 72vw); }
  .shelf.portrait { grid-auto-columns: 150px; }

  .tray { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
