:root {
  --bg: #0f0f12;
  --bg2: #18181d;
  --bg3: #24242b;
  --fg: #f1f1f3;
  --muted: #9a9aa6;
  --accent: #ff3b3b;
  --star: #ffb400;
  --line: #2c2c34;
  --radius: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7f9; --bg2: #ffffff; --bg3: #ececf1; --fg: #15151a;
    --muted: #63636e; --line: #e2e2e8; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Üst bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 22px;
  background: var(--accent); color: #fff; border-radius: 6px; font-size: 11px;
}
.search { flex: 1; max-width: 560px; margin-inline: auto; }
.search input {
  width: 100%; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font: inherit;
}
.topbar nav a { padding: 6px 12px; border-radius: 8px; }
.topbar nav a.on, .topbar nav a:hover { background: var(--bg3); color: var(--fg); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 20px; }
.foot { text-align: center; color: var(--muted); padding: 30px 20px; font-size: 13px; }

/* Araç çubuğu */
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 8px; background: var(--bg3); font-size: 14px; }
.chip.on { background: var(--fg); color: var(--bg); }
.sort { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.sort a { padding: 5px 12px; border-radius: 7px; font-size: 14px; color: var(--muted); }
.sort a.on { background: var(--bg3); color: var(--fg); }

/* Video ızgarası — 9:16 kartlar */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 14px; }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.card { display: block; min-width: 0; }
.card:hover { color: inherit; }
.card .thumb {
  position: relative; aspect-ratio: 9/16; border-radius: var(--radius); overflow: hidden;
  background: var(--bg3); isolation: isolate;
}
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card .thumb.land img.bg { filter: blur(18px) brightness(.55); transform: scale(1.3); }
.card .thumb.land img.fg { object-fit: contain; }
.card:hover .thumb img.fg { transform: scale(1.04); }
.card .thumb::after {
  content: ""; position: absolute; inset: 55% 0 0; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.card .dur, .card .views-badge {
  position: absolute; z-index: 1; bottom: 8px; font-size: 12px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.card .views-badge { left: 10px; }
.card .dur { right: 8px; background: rgba(0,0,0,.7); padding: 1px 6px; border-radius: 5px; text-shadow: none; }
.meta { padding-top: 8px; }
.meta h3 {
  margin: 0 0 4px; font-size: 14px; line-height: 1.35; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sub.ch { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.stars-static { letter-spacing: 1px; font-size: 13px; }
.stars-static .s.empty { color: var(--bg3); }
.stars-static .s.full { color: var(--star); }
.stars-static .s.half {
  background: linear-gradient(90deg, var(--star) 50%, var(--bg3) 50%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 30px; flex-wrap: wrap; }
.pager a { min-width: 36px; text-align: center; padding: 6px 10px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); }
.pager a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* İzleme sayfası */
.watch { display: grid; gap: 24px; }
.player-box { background: #000; border-radius: var(--radius); overflow: hidden; }
.player-box iframe, .player-box #player, .player-box video { width: 100%; height: 100%; border: 0; display: block; }

/* Dikey (9:16): oynatıcı ekran yüksekliğine sığar, bilgiler yanında */
.is-vertical { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.is-vertical .player-box {
  aspect-ratio: 9/16;
  height: min(calc(100vh - 110px), 900px);
  height: min(calc(100svh - 110px), 900px);
}
.is-vertical .details { position: sticky; top: 80px; max-width: 560px; }

/* Yatay (16:9) */
.is-landscape { grid-template-columns: minmax(0, 1fr); }
.is-landscape .player-box { aspect-ratio: 16/9; max-width: 1100px; }
.is-landscape .details { max-width: 1100px; }

.related { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 18px; }
.related h2 { font-size: 18px; margin: 0 0 14px; }

.details h1 { font-size: 22px; margin: 0 0 8px; line-height: 1.3; }
.meta-line { font-size: 14px; margin-bottom: 16px; }
.desc { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 16px; }

.rating {
  display: grid; gap: 6px; justify-items: start;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  transition: box-shadow .3s;
}
.rating-title { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rating.busy { opacity: .6; pointer-events: none; }
.rating.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--star) 45%, transparent); }
.stars-input { display: flex; }
.stars-input button {
  background: none; border: 0; cursor: pointer; padding: 0 3px;
  font-size: 34px; line-height: 1; color: var(--bg3); transition: transform .1s, color .1s;
}
.stars-input button.sel { color: var(--star); }
.stars-input:hover button.sel:not(.hover) { color: var(--bg3); }
.stars-input button.hover { color: var(--star); transform: scale(1.12); }
.stars-input button:focus-visible { outline: 2px solid var(--star); border-radius: 4px; }
.rating-text { font-size: 14px; }

@media (max-width: 860px) {
  .watch { gap: 16px; }
  .is-vertical { grid-template-columns: minmax(0, 1fr); }
  .is-vertical .stage { display: flex; justify-content: center; margin-inline: -16px; }
  .is-vertical .player-box {
    width: 100%; height: auto; border-radius: 0;
    max-height: calc(100vh - 64px); max-height: calc(100svh - 64px);
    max-width: calc((100svh - 64px) * 9 / 16);
  }
  .is-vertical .details { position: static; }
  .is-landscape .stage { margin-inline: -16px; }
  .is-landscape .player-box { border-radius: 0; }
}

/* Formlar / yönetim */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel.narrow { max-width: 380px; margin: 60px auto; }
.panel h1, .panel h2 { margin-top: 0; }
label { display: block; margin-bottom: 12px; font-size: 14px; }
input:not([type=hidden]), textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px; font: inherit;
  border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
}
.btn:hover { color: #fff; filter: brightness(1.1); }
.btn.ghost { background: var(--bg3); color: var(--fg); }
.btn.danger { background: #b3261e; }
.btn.small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
.alert { padding: 10px 14px; border-radius: 8px; }
.alert.ok { background: color-mix(in srgb, #2e7d32 25%, transparent); }
.alert.err { background: color-mix(in srgb, #c62828 25%, transparent); }
.admin-head { display: flex; justify-content: space-between; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stats div { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stats strong { display: block; font-size: 24px; }
.stats span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list img { border-radius: 6px; }
.actions { white-space: nowrap; }
.actions form { display: inline; }
form.edit { display: grid; gap: 4px; }

@media (max-width: 600px) {
  .wrap { padding: 14px 16px; }
  .topbar { padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
}
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; display: inline-block; }

/* Üretim kaydı (yönetici) */
.production, .fold { margin-top: 16px; background: var(--bg2); border: 1px dashed var(--line); border-radius: var(--radius); }
.fold { border-style: solid; }
.production summary, .fold summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.fold-body { padding: 0 14px 14px; font-size: 14px; line-height: 1.6; max-height: 60vh; overflow: auto; word-break: break-word; }
.prod-body { padding: 0 14px 14px; font-size: 13.5px; max-height: 70vh; overflow: auto; }
.prod-body h4 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.prod-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.prod-kv dt { color: var(--muted); }
.prod-kv dd { margin: 0; word-break: break-word; }
.prod-narr { margin: 0; line-height: 1.6; }
.prod-scenes { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.prod-scenes li { padding-left: 4px; }
.sc-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.sc-time { font: 12px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.sc-narr { font-style: italic; margin: 2px 0; }
.sc-row { color: var(--muted); font-size: 12.5px; }
.sc-row span { display: inline-block; min-width: 48px; font-weight: 600; color: var(--fg); }
.prod-credits { margin: 0; padding-left: 18px; }
.production pre {
  margin: 0; padding: 10px; background: var(--bg); border-radius: 8px; overflow: auto;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word;
}
