:root {
  --bg: #111317; --card: #1b1e24; --border: #2c313a; --text: #e6e8eb;
  --muted: #8b929c; --accent: #f59e0b; --err: #f87171; --ok: #4ade80;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .ghost vb. display kuralları hidden özniteliğini ezmesin */
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, sans-serif; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
header h1 { font-size: 18px; margin: 0; }
header a { color: var(--muted); text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h2 { font-size: 16px; margin: 0; color: var(--muted); font-weight: 600; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; margin: 28px 0 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.login { width: 100%; max-width: 340px; display: grid; gap: 10px; }
.login h1 { margin: 0 0 6px; font-size: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1 1 260px; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; min-width: 0;
}
textarea { width: 100%; min-height: 46px; resize: vertical; }
button { background: var(--accent); color: #111; border: 0; font-weight: 600; cursor: pointer; }
.ghost {
  display: inline-block; background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 8px; font-weight: 400; padding: 6px 10px; text-decoration: none; cursor: pointer;
}
.ghost:hover { color: var(--text); border-color: var(--muted); }
.ghost:disabled { opacity: .5; cursor: default; color: var(--muted); border-color: var(--border); }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 36px;
  padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.foot b { color: var(--text); font-weight: 600; }
.foot .ghost { padding: 3px 10px; font-size: 13px; }
.dl { display: grid; gap: 8px; }
.dl .row { justify-content: flex-end; }
.msg { margin: 8px 0 0; }
.msg:empty { display: none; }
.list { display: grid; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.item .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.item .name { overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: 13px; }
.item .actions { display: flex; gap: 6px; flex-shrink: 0; }
.bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width .3s; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.ok { color: var(--ok); }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.grid > p { grid-column: 1 / -1; }
.tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.thumb {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9;
  padding: 0; border: 0; border-radius: 0; background: #000; overflow: hidden; font-size: 13px; font-weight: 400;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .15s; }
.thumb.portrait img { object-fit: contain; }
.thumb:hover img { opacity: .8; }
.thumb video.preview {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.thumb.portrait video.preview { object-fit: contain; }
.thumb video.preview.on { opacity: 1; }
.badge, .watched { z-index: 2; }
.badge { position: absolute; background: rgba(0, 0, 0, .75); color: #fff; font-size: 12px; line-height: 1.4; padding: 1px 6px; border-radius: 4px; }
.badge.res { top: 6px; left: 6px; }
.badge.dur { right: 6px; bottom: 6px; }
.watched { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.tile-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 8px 10px 10px; }
.tile .name {
  font-size: 14px; line-height: 1.35; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tile .meta { color: var(--muted); font-size: 12px; }
.tile .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.tile .actions .ghost { font-size: 13px; padding: 4px 10px; }

.storage { flex: 0 1 340px; display: grid; gap: 5px; margin-left: auto; color: var(--muted); font-size: 12px; cursor: default; }
.storage-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); }
.storage-bar .seg { height: 100%; transition: width .4s; }
.storage .videos { background: var(--accent); }
.storage .other { background: #5b626d; }
.storage-text { text-align: right; }
.storage-text b { color: var(--text); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.storage.low .storage-bar { box-shadow: 0 0 0 1px var(--err); }
.storage.low .storage-text, .storage.low .storage-text b { color: var(--err); }
@media (max-width: 560px) { .storage { flex-basis: 100%; } .storage-text { text-align: left; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { flex: 1 1 150px; padding: 6px 10px; font-size: 14px; }
.filters .chip { padding: 6px 14px; font-size: 14px; }
.filters .active { border-color: var(--accent); color: var(--accent); }
.chip {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; font-weight: 400;
}
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips:empty { display: none; }
.byline { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 24px; }
.link {
  min-width: 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px;
  font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link:hover { text-decoration: underline; }
.byline .muted { font-size: 13px; }
.star { flex-shrink: 0; padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 18px; font-weight: 400; line-height: 1; }
.star:hover, .star.on { color: var(--accent); }
.player-info { min-width: 0; }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px; width: min(1000px, 95vw); max-width: 95vw; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.player-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
#player-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog video { display: block; width: 100%; max-height: 80vh; background: #000; }
