:root {
  --bg: #0a0a0e;
  --bg-2: #121218;
  --surface: #17171f;
  --surface-2: #1f1f29;
  --line: #2a2a36;
  --text: #f2f0ec;
  --muted: #9a98a6;
  --accent: #ff5a4a;
  --accent-ink: #1a0604;
  --gold: #f3c26b;
  --ok: #4fd18b;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0,0,0,.55);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; }
.icon-btn svg, .btn svg, .ctl svg, .send svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
[hidden] { display: none !important; }

/* ---------- top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: linear-gradient(to bottom, rgba(10,10,14,.92), rgba(10,10,14,0));
  transition: background .25s;
}
.topbar.solid { background: rgba(10,10,14,.96); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 22px/1 var(--display); letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); background: rgba(255,255,255,.06); }
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  font: 700 13px/1 var(--display); color: var(--accent-ink);
  background: var(--gold); object-fit: cover;
}

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 20px; cursor: pointer;
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform .12s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff7062; }
.btn-light { background: var(--text); color: #111; }
.btn-light:hover { background: #fff; }
.btn-ghost { background: rgba(255,255,255,.1); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.18); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,107,107,.35); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- views */
.view { min-height: 100vh; }
.page { padding: 96px clamp(16px, 4vw, 48px) 120px; max-width: 1400px; margin: 0 auto; }
.page h1 { font: 800 clamp(28px, 4vw, 44px)/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 32px; max-width: 60ch; }
.center-msg { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 96px 24px; }
.center-msg p { color: var(--muted); }

/* ---------- hero */
.hero {
  position: relative; min-height: min(78vh, 760px);
  display: flex; align-items: flex-end;
  padding: 120px clamp(16px, 4vw, 48px) clamp(40px, 7vh, 80px);
  overflow: hidden;
}
.hero-art { position: absolute; inset: 0; background-size: cover; background-position: center 30%; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 2%, rgba(10,10,14,.55) 40%, rgba(10,10,14,.15) 70%),
    linear-gradient(to right, rgba(10,10,14,.85), rgba(10,10,14,0) 65%);
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; }
.kicker { font: 600 12px/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.hero h1 { font: 800 clamp(40px, 7vw, 84px)/.95 var(--display); letter-spacing: -.04em; margin: 0 0 14px; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.meta span + span::before { content: "•"; margin-right: 10px; opacity: .6; }
.hero p.desc { margin: 0 0 24px; color: #d6d3cf; font-size: 16px; max-width: 56ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- rows */
.rows { padding: 0 0 120px; position: relative; z-index: 2; }
.row { margin-bottom: 36px; }
.row h2 { font: 700 20px/1 var(--display); letter-spacing: -.01em; margin: 0 clamp(16px, 4vw, 48px) 14px; }
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(140px, 15vw, 200px);
  gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px clamp(16px, 4vw, 48px) 16px; scrollbar-width: thin;
}
.card {
  position: relative; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; cursor: pointer;
  scroll-snap-align: start; border: 0; padding: 0; background: var(--surface);
  transition: transform .2s, box-shadow .2s;
}
.card:hover, .card:focus-visible { transform: translateY(-4px) scale(1.03); box-shadow: var(--shadow); outline: none; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .card-label {
  position: absolute; inset: auto 0 0 0; padding: 30px 10px 10px; text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,.9), transparent);
  font: 600 13px/1.25 var(--body);
}
.poster-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px; text-align: left;
}
.poster-fallback b { font: 800 clamp(18px, 2vw, 24px)/1 var(--display); letter-spacing: -.02em; }
.poster-fallback small { color: rgba(255,255,255,.7); margin-top: 6px; }

/* ---------- modal */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.5); color: #fff; }
.film-detail .art { aspect-ratio: 16/8; background-size: cover; background-position: center; position: relative; }
.film-detail .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-2), transparent 60%); }
.film-detail .body { padding: 0 28px 28px; margin-top: -60px; position: relative; }
.film-detail h2 { font: 800 clamp(28px, 4vw, 40px)/1 var(--display); letter-spacing: -.03em; margin: 0 0 10px; }
.film-detail p { color: #d6d3cf; }
.trailer-frame { aspect-ratio: 16/9; width: 100%; display: block; border: 0; background: #000; }

/* ---------- forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; outline: none; transition: border-color .2s;
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- login */
.login-card {
  width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px; text-align: left; box-shadow: var(--shadow);
}
.login-card h1 { font: 800 32px/1 var(--display); letter-spacing: -.03em; margin: 0 0 8px; }
.login-card .or { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0; }
#g-btn { min-height: 44px; display: flex; justify-content: center; }

/* ---------- admin */
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 28px; align-items: start; }
.admin-list { display: grid; gap: 10px; }
.admin-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.admin-item .thumb { width: 52px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; }
.admin-item h3 { margin: 0; font: 700 16px/1.2 var(--display); }
.admin-item small { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.pill.ok { background: rgba(79,209,139,.15); color: var(--ok); }
.pill.no { background: rgba(255,255,255,.08); color: var(--muted); }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.panel h2 { font: 700 20px/1 var(--display); margin: 0 0 18px; }
.imdb-field { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.imdb-row { display: flex; gap: 8px; }
.imdb-row input { flex: 1; min-width: 0; }
.img-preview { display: grid; grid-template-columns: 90px 1fr; gap: 10px; margin-bottom: 14px; align-items: start; }
.img-preview > div { display: grid; gap: 4px; }
.img-preview small { color: var(--muted); font-size: 11px; }
.pv-poster img { width: 90px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: var(--surface); }
.pv-backdrop img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: var(--surface); }
.files { margin-top: 12px; font-size: 13px; background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.files li { margin: 2px 0; }
.files .chosen { color: var(--gold); font-weight: 600; }

/* ---------- room */
.room { padding: 72px clamp(0px, 2vw, 24px) 140px; max-width: 1500px; margin: 0 auto; }
.stage {
  position: relative; background: #000; border-radius: clamp(0px, 1vw, 14px); overflow: hidden;
  aspect-ratio: 16/9; max-height: calc(100vh - 220px); width: 100%; margin: 0 auto;
}
.stage video { width: 100%; height: 100%; display: block; background: #000; }
.stage video::cue { background: rgba(0,0,0,.65); font-family: var(--body); }
.net-info {
  position: absolute; top: calc(50% + 34px); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.65); padding: 5px 12px; border-radius: 999px; font-size: 13px; color: #ddd;
  white-space: nowrap; pointer-events: none;
}
.prep-info { display: block; margin-top: 10px; color: var(--gold); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.embed-host { position: absolute; inset: 0; background: #000; }
.embed-host iframe, .embed-host > div { width: 100%; height: 100%; border: 0; display: block; }
.click-catch { position: absolute; inset: 0 0 76px 0; cursor: pointer; }
.stage.frame .controls { display: none; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5;
  font: 800 clamp(80px, 18vw, 220px)/1 var(--display); color: #fff; letter-spacing: -.04em;
  text-shadow: 0 6px 40px rgba(0,0,0,.8), 0 0 60px rgba(255,90,74,.6);
}
.countdown.tick { animation: cd .9s ease-out; }
@keyframes cd { from { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: .85; } }
.stage-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: radial-gradient(ellipse at center, rgba(10,10,14,.65), rgba(10,10,14,.92)); padding: 24px;
}
.stage-overlay h2 { font: 800 clamp(24px, 3.5vw, 40px)/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 8px; }
.stage-overlay p { color: var(--muted); margin: 0 0 20px; max-width: 46ch; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
.buffering { position: absolute; top: 50%; left: 50%; margin: -21px 0 0 -21px; pointer-events: none; }

.controls {
  position: absolute; inset: auto 0 0 0; padding: 30px 16px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  display: grid; gap: 8px; opacity: 0; transition: opacity .25s;
}
.stage:hover .controls, .stage.show-ui .controls, .stage.paused .controls { opacity: 1; }
.seek { position: relative; height: 18px; cursor: pointer; display: flex; align-items: center; }
.seek-track { position: relative; width: 100%; height: 4px; background: rgba(255,255,255,.22); border-radius: 4px; overflow: hidden; transition: height .15s; }
.seek:hover .seek-track { height: 6px; }
.seek-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 0; }
.seek-hover { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(0,0,0,.8); padding: 3px 7px; border-radius: 6px; font-size: 12px; pointer-events: none; }
.ctl-row { display: flex; align-items: center; gap: 6px; }
.ctl { width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; color: #fff; cursor: pointer; border-radius: 8px; }
.ctl:hover { background: rgba(255,255,255,.12); }
.ctl svg { width: 22px; height: 22px; }
.ctl.fill svg { fill: currentColor; stroke: none; }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: #ddd; margin-left: 6px; white-space: nowrap; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
.spacer { flex: 1; }

.roombar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px;
  padding: 16px clamp(16px, 2vw, 8px); border-bottom: 1px solid var(--line);
}
.roombar h1 { font: 800 clamp(20px, 2.4vw, 28px)/1.1 var(--display); letter-spacing: -.02em; margin: 0; }
.roombar small { color: var(--muted); }
.members { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.member { display: flex; align-items: center; gap: 8px; background: var(--surface); padding: 5px 12px 5px 5px; border-radius: 999px; font-size: 13px; }
.member .avatar { width: 28px; height: 28px; font-size: 12px; box-shadow: 0 0 0 2px var(--surface); transition: box-shadow .12s; }
.member.speaking .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok), 0 0 14px 2px rgba(79,209,139,.6); }
button.member { border: 1px solid transparent; cursor: pointer; color: inherit; font: inherit; }
button.member:hover { border-color: var(--line); background: var(--surface-2); }
.member .spk { display: flex; color: var(--muted); opacity: 0; transition: opacity .15s; }
.member .spk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.member:hover .spk, .member.silenced .spk { opacity: 1; }
.member.silenced { opacity: .55; }
.member.silenced .spk { color: var(--danger); }
.member.silenced span:not(.spk):not(.mic):not(.avatar) { text-decoration: line-through; }
.silence-all.on { background: rgba(255,107,107,.15); color: var(--danger); }
.member .mic { color: var(--muted); display: flex; }
.member .mic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.member .mic.off { color: var(--danger); }

.voicebar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding: 14px clamp(16px, 2vw, 8px);
}
.mic-btn { min-width: 170px; }
.mic-btn.live { background: var(--ok); color: #04170c; }
.mic-btn.muted { background: rgba(255,107,107,.15); color: var(--danger); }
.slider { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.slider input { width: 120px; accent-color: var(--accent); }
.invite { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.invite input { width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--muted); }
.tip { font-size: 12px; color: var(--muted); padding: 0 clamp(16px, 2vw, 8px); }

body.theater .topbar { display: none; }
body.theater .room { padding: 0; max-width: none; }
body.theater .stage { max-height: 100vh; height: 100vh; aspect-ratio: auto; border-radius: 0; }
body.theater .roombar, body.theater .voicebar, body.theater .tip { display: none; }

/* ---------- chat */
.chat {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 360px; height: 440px; display: flex; flex-direction: column;
  background: rgba(18,18,24,.94); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  transition: width .2s, height .2s;
}
.chat[data-size="large"] { width: min(560px, calc(100vw - 32px)); height: min(78vh, 760px); }
.chat[data-size="min"] { height: 48px; width: 240px; }
.chat[data-size="min"] .chat-body { display: none; }
.chat-head { display: flex; align-items: center; padding: 6px 6px 6px 8px; border-bottom: 1px solid var(--line); }
.chat[data-size="min"] .chat-head { border-bottom: 0; }
.chat-title { flex: 1; display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 6px; font-weight: 600; text-align: left; }
.chat-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chat-title .dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.chat-actions { display: flex; }
.chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-list { flex: 1; overflow-y: auto; margin: 0; padding: 12px; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.msg { display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.msg .avatar { width: 28px; height: 28px; font-size: 11px; }
.msg .name { font-size: 12px; font-weight: 600; color: var(--gold); }
.msg .name time { color: var(--muted); font-weight: 400; margin-left: 6px; }
.msg .text { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine .name { color: var(--accent); }
.sys { text-align: center; font-size: 12px; color: var(--muted); }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; }
.chat-form input:focus { border-color: var(--accent); }
.send { width: 40px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.send svg { width: 18px; height: 18px; }
.chat-locked { padding: 24px; text-align: center; color: var(--muted); margin: auto; }

/* ---------- toasts */
.toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: pop .2s ease-out; }
.toast.err { border-color: rgba(255,107,107,.5); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

/* Sadržaj ne smije ostati ispod chata */
body[data-chat="normal"] .page { padding-bottom: 500px; }
body[data-chat="large"] .page { padding-bottom: 82vh; }

/* U sobi na širokom ekranu chat je bočna traka (kao Twitch), pa ne prekriva film */
@media (min-width: 1100px) {
  body.in-room .room { max-width: none; margin-right: 372px; transition: margin .2s; }
  body.in-room .chat:not([data-size="min"]) { top: 76px; bottom: 16px; height: auto; width: 340px; }
  body.in-room[data-chat="large"] .room { margin-right: 492px; }
  body.in-room .chat[data-size="large"] { width: 460px; }
  body.in-room[data-chat="min"] .room { margin-right: auto; max-width: 1500px; }
  body.in-room.theater .chat:not([data-size="min"]) { top: 16px; }
  body.in-room.theater[data-chat="min"] .room { max-width: none; }
}

/* ---------- responsive */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .invite { margin-left: 0; width: 100%; }
  .invite input { flex: 1; width: auto; }
}
@media (max-width: 640px) {
  .topbar { gap: 12px; }
  .nav a { padding: 6px 8px; font-size: 14px; }
  .brand span { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .chat { right: 8px; left: 8px; bottom: 8px; width: auto; height: 50vh; }
  body.in-room .chat[data-size="normal"] { height: 36vh; }
  body.in-room[data-chat="normal"] .room { padding-bottom: 40vh; }
  .chat[data-size="large"] { width: auto; height: 80vh; }
  .chat[data-size="min"] { width: auto; left: auto; }
  .stage { max-height: none; }
  .slider input { width: 90px; }
  .film-detail .body { padding: 0 18px 22px; }
}
