:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18202a;
  --line: #233040;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #22b8cf;
  --accent-2: #0e7490;
  --ok: #3fb950;
  --warn: #e3b341;
  --err: #f85149;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
button, select, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* ---- üst bar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 52px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; white-space: nowrap; }
.logo {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent-2);
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: 0; padding: 8px 14px; border-radius: var(--radius); cursor: pointer; color: var(--muted);
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.privacy { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- düğmeler ---- */
.btn, .toolbar button, .toolbar select {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 12px; cursor: pointer; white-space: nowrap; min-height: 34px;
}
.btn:hover, .toolbar button:hover { border-color: #345; background: #1d2733; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.primary:hover { background: #0b8aa8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.big-btn { padding: 10px 18px; font-weight: 600; }

/* ---- görünümler ---- */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }

/* ---- görüntüleyici ---- */
.side {
  width: 250px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.side-title { padding: 10px 12px 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.series-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; flex: 1; }
.series-list li.item {
  padding: 9px 10px; border-radius: var(--radius); cursor: pointer; border: 1px solid transparent; margin-bottom: 4px;
}
.series-list li.item:hover { background: var(--panel-2); }
.series-list li.item.active { background: var(--panel-2); border-color: var(--accent-2); }
.series-list .s-top { display: flex; gap: 8px; align-items: center; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--accent-2); color: #fff; }
.series-list .s-desc { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-list .s-meta { font-size: 12px; color: var(--muted); }

.stage-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.toolbar .group { display: flex; gap: 4px; }
.toolbar .group.right { margin-left: auto; }
.toolbar button { padding: 6px 10px; }
.toolbar button.active { background: var(--accent-2); border-color: var(--accent); color: #fff; }
.toolbar button.accent { border-color: var(--accent-2); color: var(--accent); }
.toolbar select { padding: 6px 8px; }

.stage { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
.layer-group { position: absolute; inset: 0; }
.ov {
  position: absolute; z-index: 5; pointer-events: none; font-size: 12px; line-height: 1.5;
  color: #d7e3ee; text-shadow: 0 0 3px #000, 0 0 2px #000; white-space: pre; padding: 8px 10px;
}
.ov.tl { top: 0; left: 0; } .ov.tr { top: 0; right: 0; text-align: right; }
.ov.bl { bottom: 0; left: 0; } .ov.br { bottom: 0; right: 0; text-align: right; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; background: var(--bg); padding: 16px; }
.empty-box, .dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 40px 32px; text-align: center; max-width: 560px; width: 100%;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.big { font-size: 18px; font-weight: 600; }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hint { margin-top: 8px; }
.drop-hint {
  position: absolute; inset: 10px; z-index: 20; border: 3px dashed var(--accent); border-radius: 14px;
  display: grid; place-items: center; font-size: 22px; background: rgba(14, 116, 144, .25);
}
.loading {
  position: absolute; z-index: 15; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; width: 300px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.bar { width: 100%; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.bar.indeterminate i { width: 30%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

.tags {
  width: 420px; flex: none; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.tags[hidden] { display: none; }
.tags-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.tags-head input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px;
}
.tags-head button { background: none; border: 0; cursor: pointer; padding: 0 8px; color: var(--muted); }
.tags-body { overflow: auto; flex: 1; }
#tag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
#tag-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
#tag-table td.t { font-family: ui-monospace, monospace; color: var(--muted); white-space: nowrap; }
#tag-table td.n { white-space: nowrap; }
#tag-table td.v { word-break: break-word; }
#tag-table tr.phi td.n { color: var(--warn); }

/* ---- anonimleştirme ---- */
.view.anon { overflow: auto; }
.anon-inner { max-width: 820px; margin: 0 auto; padding: 32px 16px 60px; display: flex; flex-direction: column; gap: 18px; width: 100%; }
.anon h1 { margin: 0; font-size: 24px; }
.lead { margin: 0; color: var(--muted); }
.dropzone { max-width: none; background: var(--panel); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: rgba(14, 116, 144, .15); }
.selection, .progress-card, .result, .error {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.selection { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sel-actions { display: flex; gap: 8px; }
.progress-card { display: flex; flex-direction: column; gap: 10px; }
.result { border-color: rgba(63, 185, 80, .5); display: flex; flex-direction: column; gap: 10px; }
.result h3 { margin: 0; color: var(--ok); }
.result .stats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); }
.result .stats b { color: var(--text); }
.result .warnings { margin: 0; padding-left: 18px; color: var(--warn); }
.result .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.error { border-color: rgba(248, 81, 73, .5); color: var(--err); }
.info { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.info summary { cursor: pointer; font-weight: 600; }
.info li { margin: 6px 0; }
.warn { color: var(--warn); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px);
}

/* ---- mobil ---- */
@media (max-width: 860px) {
  .privacy { display: none; }
  .topbar { gap: 10px; padding: 0 10px; }
  #tab-viewer { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 30vh; }
  .side-actions { flex-direction: row; }
  .side-actions .btn { flex: 1; }
  .toolbar button span { display: none; }
  .toolbar .group.right { margin-left: 0; }
  .tags { position: fixed; inset: 52px 0 0 0; width: auto; z-index: 50; }
}
