:root {
  --bg: #0a0a0a;
  --bg2: #161616;
  --bg3: #202020;
  --card: #1a1a1a;
  --red: #e50914;
  --red-glow: rgba(229, 9, 20, 0.45);
  --accent: #ff2d55;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --u1: #4fc3f7;
  --u2: #ff8a65;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1a0508 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }
code { background: var(--bg3); padding: 2px 6px; border-radius: 5px; font-size: .85em; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(10,10,10,.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 17px; letter-spacing: -.3px;
}
.logo-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--red), var(--accent));
  box-shadow: 0 4px 14px var(--red-glow);
  font-size: 15px; font-weight: 800;
}
.presence {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.presence .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2ecc71; box-shadow: 0 0 0 0 rgba(46,204,113,.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46,204,113,.5); }
  70% { box-shadow: 0 0 0 7px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

/* ---------- Hero ---------- */
.library { padding: 0 16px 40px; max-width: 1100px; margin: 0 auto; }
.hero {
  position: relative;
  margin: 24px 0 28px;
  padding: 36px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(229,9,20,.18), rgba(255,45,85,.06));
  border: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
.hero-glow {
  position: absolute; top: -60px; right: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, var(--red-glow), transparent 70%);
  filter: blur(20px);
}
.hero h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -.6px; }
.hero p { margin: 0; color: #d0d0d0; font-size: 14px; max-width: 360px; }

.love-note {
  margin: 12px 0 0 !important;
  font-size: 14px; font-weight: 600;
  color: #ffd1dc !important;
  min-height: 20px;
  animation: noteFade .6s ease;
}
@keyframes noteFade { from { opacity: 0; transform: translateY(6px); } }

.section-head {
  display: flex; align-items: baseline; gap: 10px; margin: 8px 2px 16px;
}
.section-head h2 { font-size: 19px; margin: 0; font-weight: 700; }
.count { color: var(--muted); font-size: 13px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.05);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s;
  animation: rise .4s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,.5); border-color: rgba(229,9,20,.5); }
.card:active { transform: scale(.97); }
.poster {
  position: relative;
  aspect-ratio: 2/3;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #2b1416, #14171f);
  font-size: 46px;
}
.poster::after {
  content: '▶'; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 30px; color: #fff;
  background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s;
}
.card:hover .poster::after { opacity: 1; }
.badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  color: #fff; font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.15);
}
.card-title { padding: 10px 10px 4px; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.card-sub { padding: 0 10px 12px; font-size: 11px; color: var(--muted); }

/* Progress bar on card */
.pbar { height: 3px; background: rgba(255,255,255,.12); }
.pbar > i { display: block; height: 100%; background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-icon { font-size: 54px; opacity: .5; }
.empty p { font-size: 16px; color: var(--text); margin: 14px 0 6px; }
.empty span { font-size: 13px; }

/* ---------- Player ---------- */
.player-view { padding: 12px 14px 40px; max-width: 940px; margin: 0 auto; }
.player-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.back {
  background: var(--bg2); border: 1px solid rgba(255,255,255,.08);
  color: var(--text); font-size: 14px; font-weight: 600;
  padding: 9px 14px; border-radius: 10px; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.back:active { background: var(--bg3); }
.now-title {
  font-size: 16px; margin: 0; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.video-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.06);
}
video { display: block; width: 100%; max-height: 64vh; background: #000; }

.toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,.8); backdrop-filter: blur(6px);
  color: #fff; font-size: 12.5px; font-weight: 500;
  padding: 8px 16px; border-radius: 30px;
  border: 1px solid rgba(255,255,255,.12);
  opacity: 0; transition: all .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Tap-to-play overlay (autoplay engellendiğinde) */
.tap {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tap-btn {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(135deg, var(--red), var(--accent));
  box-shadow: 0 8px 24px var(--red-glow);
  animation: pulse 2s infinite;
}

/* Resume */
.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  padding: 16px; border-radius: var(--radius); margin: 14px 0;
  border: 1px solid rgba(255,255,255,.07);
}
.resume-title { display: block; font-weight: 700; font-size: 15px; }
.resume-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.resume-actions { display: flex; gap: 8px; }
.btn {
  background: linear-gradient(135deg, var(--red), var(--accent));
  color: #fff; border: none;
  padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px;
  cursor: pointer; box-shadow: 0 4px 14px var(--red-glow);
  transition: transform .12s;
}
.btn:active { transform: scale(.95); }
.btn.ghost { background: var(--bg3); box-shadow: none; }

/* Emoji bar */
.emoji-bar { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.emoji {
  font-size: 22px; background: var(--bg2);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; width: 50px; height: 50px; cursor: pointer;
  transition: transform .12s, background .15s;
}
.emoji:hover { background: var(--bg3); }
.emoji:active { transform: scale(.85); }

.reactions { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float {
  position: absolute; bottom: 8%; font-size: 38px;
  animation: floatUp 2.2s ease-out forwards;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.5));
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100% { transform: translateY(-260px) scale(1.5); opacity: 0; }
}

/* ---------- Chat ---------- */
.chat {
  margin-top: 18px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}
.chat-head {
  padding: 12px 16px; font-weight: 700; font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.messages {
  height: 260px; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px; line-height: 1.4;
  animation: pop .2s ease;
  word-wrap: break-word;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.msg .who { display: block; font-size: 11px; font-weight: 700; margin-bottom: 2px; opacity: .9; }
.msg .time { font-size: 10px; color: rgba(255,255,255,.45); margin-left: 8px; }
/* mine = right, others = left — name always shown on top */
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--red), var(--accent)); border-bottom-right-radius: 4px; }
.msg.mine .who { color: rgba(255,255,255,.9); text-align: right; }
.msg.theirs { align-self: flex-start; background: var(--bg3); border-bottom-left-radius: 4px; }
.msg.theirs .who { color: var(--u2); }
.msg.sys {
  align-self: center; background: none; color: var(--muted);
  font-size: 11.5px; font-style: italic; padding: 2px;
}

.typing { height: 20px; font-size: 12px; color: var(--muted); padding: 0 16px; font-style: italic; }

.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.chat-form input {
  flex: 1; padding: 13px 16px; border-radius: 24px; border: 1px solid rgba(255,255,255,.08);
  background: var(--bg); color: #fff; font-size: 15px; outline: none;
  transition: border-color .15s;
}
.chat-form input:focus { border-color: var(--red); }
.chat-form button {
  background: linear-gradient(135deg, var(--red), var(--accent));
  color: #fff; border: none; width: 48px; border-radius: 50%;
  font-size: 17px; cursor: pointer; box-shadow: 0 4px 12px var(--red-glow);
  transition: transform .12s;
}
.chat-form button:active { transform: scale(.9); }

/* ---------- Gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(800px 500px at 50% 30%, #1a0508, #000);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate-box {
  background: var(--bg2); padding: 32px 26px; border-radius: 20px;
  width: 100%; max-width: 340px; text-align: center;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 30px 60px rgba(0,0,0,.6);
}
.gate-icon { font-size: 40px; }
.gate-box h2 { margin: 14px 0 4px; font-size: 22px; }
.gate-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.gate-box input {
  width: 100%; padding: 14px; border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; background: var(--bg); color: #fff; font-size: 16px; outline: none;
}
.gate-box input:focus { border-color: var(--red); }
.gate-box button {
  width: 100%; padding: 14px; margin-top: 14px;
  background: linear-gradient(135deg, var(--red), var(--accent));
  color: #fff; border: none; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: 0 6px 18px var(--red-glow);
}
.err { color: var(--accent); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ---------- Desktop layout ---------- */
@media (min-width: 860px) {
  .player-view { display: grid; grid-template-columns: 1fr 340px; grid-template-areas: "top top" "video chat" "resume chat" "emoji chat"; gap: 16px 20px; align-items: start; }
  .player-top { grid-area: top; margin: 0; }
  .video-wrap { grid-area: video; }
  #resume { grid-area: resume; margin: 0; }
  .emoji-bar { grid-area: emoji; margin: 0; }
  .chat { grid-area: chat; margin: 0; position: sticky; top: 80px; }
  .messages { height: 420px; }
  video { max-height: 72vh; }
}

/* ---------- Sürpriz: reklam arası ---------- */
.surprise {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(40,0,20,.92), rgba(0,0,0,.96));
  overflow: hidden;
  animation: surpFade .4s ease;
}
@keyframes surpFade { from { opacity: 0; } }

.surprise-card {
  position: relative; z-index: 3; text-align: center;
  background: rgba(20,20,20,.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px; padding: 30px 26px; max-width: 360px; width: 88%;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
  animation: cardPop .5s cubic-bezier(.2,1.3,.4,1);
}
@keyframes cardPop { from { transform: scale(.7); opacity: 0; } }
.surprise-emoji { font-size: 48px; }
.surprise-card h2 {
  margin: 10px 0 8px; font-size: 24px; font-weight: 800;
  background: linear-gradient(90deg, #ff5e7e, #c86dff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.surprise-card p { color: #f0d8e0; font-size: 16px; line-height: 1.5; margin: 0 0 20px; }
.surprise-card .btn { font-size: 15px; padding: 12px 22px; }

/* Konfeti */
.confetti, .balloons { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.conf {
  position: absolute; top: -20px; width: 10px; height: 14px; opacity: .95;
  animation: confFall linear forwards;
}
@keyframes confFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Kalpli balonlar */
.balloon {
  position: absolute; bottom: -80px; font-size: 42px;
  animation: balloonRise ease-in forwards;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.5));
}
@keyframes balloonRise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translateY(-115vh) translateX(var(--sway, 0)); opacity: 0; }
}

/* ---------- Admin paneli ---------- */
.admin-form { display: flex; flex-direction: column; gap: 10px; }
.admin-form input {
  padding: 13px 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1);
  background: var(--bg2); color: #fff; font-size: 15px; outline: none;
}
.admin-form input:focus { border-color: var(--red); }
.admin-form .btn { align-self: flex-start; }
.muted { color: var(--muted); font-size: 14px; }

.jobs { display: flex; flex-direction: column; gap: 12px; }
.job { background: var(--bg2); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; padding: 12px 14px; }
.job-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.job .pbar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.job .pbar > i { transition: width .5s ease; }

.movie-list { display: flex; flex-direction: column; gap: 8px; }
.movie-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg2); border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px; padding: 12px 14px; font-size: 14px;
}
.movie-row .del {
  background: rgba(229,9,20,.15); color: #ff6b6b; border: 1px solid rgba(229,9,20,.4);
  padding: 6px 14px; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.movie-row .del:active { background: rgba(229,9,20,.3); }

/* Codec sonuç satırları */
.codec { font-size: 12px; margin-top: 8px; line-height: 1.4; }
.codec.ok { color: #2ecc71; }
.codec.warn { color: #f1c40f; }
.codec.bad { color: #ff6b6b; }
.movie-info { display: flex; flex-direction: column; gap: 2px; }
.warn-badge { background: rgba(241,196,15,.2) !important; border-color: rgba(241,196,15,.5) !important; color: #ffe08a !important; }
