:root {
  --bg: #0b0b0f;
  --surface: #15151c;
  --surface2: #1c1c25;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.16);
  --text: #f2f2f5;
  --muted: #9a9aab;
  --accent: #7c5cff;
  --accent2: #3b82f6;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
  --ok: #4ade80;
  --err: #ff7b86;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 14px 60px; }
svg.i { width: 1.25em; height: 1.25em; flex: none; }

header.hero { text-align: center; padding: 44px 10px 18px; }
.ornament { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; color: var(--accent); border: 1px solid var(--line2); border-radius: 14px; background: var(--surface); }
.ornament svg { width: 22px; height: 22px; }
h1 { margin: 16px 0 4px; font-weight: 700; font-size: clamp(28px, 8vw, 40px); line-height: 1.1; letter-spacing: -0.03em; }
.sub { margin: 0; color: var(--muted); font-size: 15px; }
/* skrytý, ale stále "živý" input – iOS Safari spoľahlivo pošle change aj pre takýto */
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0; }
.sub2 { margin: -4px 0 10px; color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
label.field { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px; /* 16px = iOS Safari nezoomuje */
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #666676; }
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 14px; padding: 17px 16px;
  font-size: 17px; font-weight: 600; font-family: inherit; letter-spacing: -0.01em;
  color: #fff; background: var(--grad);
  border: 0; border-radius: 14px; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 24px rgba(124, 92, 255, 0.28);
  transition: transform 0.15s, opacity 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { opacity: 0.93; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn.small { width: auto; display: inline-flex; margin: 0; padding: 10px 16px; font-size: 14px; border-radius: 12px; box-shadow: none; }
.btn.ghost { color: var(--text); background: var(--surface2); border: 1px solid var(--line2); }
.btn.ghost:hover { background: #24242f; opacity: 1; }
.btn.danger { color: #ff7b86; background: transparent; border: 1px solid rgba(255, 123, 134, 0.55); box-shadow: none; }
.btn.danger:hover { background: rgba(255, 123, 134, 0.12); opacity: 1; }
.btn:disabled { opacity: 0.45; cursor: default; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; text-align: center; }

/* fronta nahrávania */
.queue { margin-top: 12px; display: grid; gap: 8px; }
.qrow { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.qrow .top { display: flex; justify-content: space-between; gap: 10px; }
.qrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .st { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.qrow.ok .st { color: var(--ok); }
.qrow.err .st { color: var(--err); }
.bar { height: 4px; margin-top: 9px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width 0.15s; }
.qrow.ok .bar > i { background: var(--ok); }
.qrow.err .bar > i { background: var(--err); }
.overall { margin-top: 14px; font-weight: 600; text-align: center; }
.overall.ok { color: var(--ok); }
.overall.err { color: var(--err); }
.msg-err { color: var(--err); font-size: 14px; margin-top: 10px; text-align: center; }

/* galéria: sklenená lepkavá lišta */
.gal-bar {
  position: sticky; top: 0; z-index: 20; margin: 24px -14px 8px; padding: 12px 14px;
  background: rgba(11, 11, 15, 0.72);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.gal-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.gal-head h2 { margin: 0; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.gal-head span { color: var(--muted); font-size: 13px; }
.gal-tools { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 4px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.tile {
  position: relative; aspect-ratio: 1; overflow: hidden; border: 0; padding: 0; border-radius: 4px; cursor: pointer; color: var(--muted);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface2) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.3s, transform 0.2s; }
.tile img { opacity: 0; }
.tile img.in { opacity: 1; }
.tile:hover img.in { transform: scale(1.03); }
.tile .ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; gap: 4px; text-align: center; padding: 4px; background: var(--surface); }
.tile .ph svg { width: 28px; height: 28px; opacity: 0.6; }
.tile .play {
  position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(11, 11, 15, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center;
}
.tile .play::after { content: ""; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; margin-left: 2px; }
.tile .del {
  position: absolute; top: 6px; right: 6px; z-index: 2; background: rgba(192, 51, 74, 0.92); color: #fff; border: 0; border-radius: 10px;
  padding: 6px 11px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.tile a { color: var(--muted); text-decoration: none; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.sentinel { height: 40px; text-align: center; color: var(--muted); font-size: 13px; padding-top: 10px; }

/* výber */
.tile .chk {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85); background: rgba(11, 11, 15, 0.35); color: transparent;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tile.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.sel img, .tile.sel video { transform: scale(0.92); border-radius: 6px; }
.tile.sel .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.selbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 640px; margin: 0 auto;
  padding: 12px; background: rgba(21, 21, 28, 0.78); border: 1px solid var(--line2); border-radius: 18px;
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.selbar span { flex: 1 1 100%; font-weight: 600; font-size: 14px; }
.selbar .btn { flex: 1; padding: 11px 8px; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 50; background: #050507; display: flex; flex-direction: column; }
.lb .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; touch-action: pan-y; }
.lb .stage img, .lb .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb .bar2 { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(21, 21, 28, 0.9); border-top: 1px solid var(--line); }
.lb .cap { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 60px; border: 0;
  background: rgba(21, 21, 28, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; font-size: 20px; cursor: pointer;
}
.lb .prev { left: 0; border-radius: 0 14px 14px 0; }
.lb .next { right: 0; border-radius: 14px 0 0 14px; }
.lb .x {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 3; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line2); background: rgba(21, 21, 28, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.lb .nofix { color: var(--muted); text-align: center; padding: 20px; }

/* brána bez kľúča */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.gate .qrico { width: 84px; height: 84px; margin: 0 auto 22px; padding: 20px; color: var(--accent); background: var(--surface); border: 1px solid var(--line2); border-radius: 24px; display: block; }
.gate h2 { font-weight: 700; font-size: 26px; letter-spacing: -0.03em; margin: 0 0 8px; }
.gate p { color: var(--muted); max-width: 340px; margin: 8px auto; }

/* admin */
.stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.stats b { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.login { max-width: 380px; margin: 40px auto; }

/* úspech po nahraní: toast s animovaným fajkou */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 70; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; font-weight: 600; font-size: 14px; white-space: nowrap;
  background: rgba(21, 21, 28, 0.85); border: 1px solid var(--line2); border-radius: 99px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.3s ease-out, toast-out 0.4s ease-in 3.2s forwards;
}
.toast svg { width: 24px; height: 24px; }
.toast circle { fill: var(--ok); }
.toast path { fill: none; stroke: #07120b; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 0.45s ease-out 0.25s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .toast { animation: none; }
  .toast path { stroke-dashoffset: 0; animation: none; }
}

/* značka vlastnej položky */
.tile .mine {
  position: absolute; left: 6px; bottom: 6px; z-index: 1; padding: 2px 8px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  color: #fff; background: rgba(11, 11, 15, 0.62); border: 1px solid rgba(124, 92, 255, 0.7); border-radius: 99px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}
.tile .ph.pend { background: transparent; }

/* počítač: širšie rozloženie, hover, drag & drop */
.drop {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(11, 11, 15, 0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}
.drop > div {
  padding: 48px 64px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; text-align: center;
  border: 2px dashed var(--accent); border-radius: 28px; background: rgba(124, 92, 255, 0.12);
}
.drop small { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.lb .stage { cursor: zoom-out; }
.lb .stage img, .lb .stage video { cursor: default; }

@media (hover: hover) {
  .tile:hover { outline: 2px solid rgba(124, 92, 255, 0.7); outline-offset: -2px; z-index: 1; }
  .lb .nav:hover, .lb .x:hover { background: rgba(124, 92, 255, 0.7); }
}
@media (min-width: 900px) {
  .wrap { max-width: 1200px; padding: 0 24px 80px; }
  header.hero { padding-top: 56px; }
  h1 { font-size: 48px; }
  .card { max-width: 600px; margin-left: auto; margin-right: auto; }
  .gal-bar { margin-left: -24px; margin-right: -24px; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .gal-bar .gal-head { margin: 0; align-items: baseline; gap: 14px; justify-content: flex-start; }
  .grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .tile { border-radius: 6px; }
  .selbar { max-width: 560px; }
  .stats { max-width: 600px; margin-left: auto; margin-right: auto; }
  .login { margin-top: 80px; }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(6, 1fr); gap: 8px; }
}

/* lightbox: rozmazaná miniatúra, kým sa načíta veľká verzia */
.lb .stage img.blur { width: 100%; height: 100%; filter: blur(10px); transform: scale(1.03); object-fit: contain; }
.lb .stage img { transition: filter 0.25s; }
.tile .ph.vid { background: linear-gradient(135deg, var(--surface2), var(--surface)); }
