:root {
  --bg: #0b0b0f;
  --card: #15151c;
  --line: #262631;
  --text: #ececf1;
  --muted: #9a9aab;
  --accent: #f5b83d;
  --accent-text: #1a1305;
  --live: #ff4d5a;
  --ok: #3ecf8e;
  --warn-bg: #3a2a0c;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 0.9rem; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #20202a;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { background: #2a2a36; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--live); color: var(--live); }
.btn.big { width: 100%; padding: 14px; font-size: 1.1rem; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #20202a;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.pill.live { background: rgb(255 77 90 / 0.15); color: var(--live); }

input {
  font: inherit;
  color: var(--text);
  background: #0f0f15;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}

/* Yayıncı sayfası */
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.steps { margin: 16px 0 0; padding-left: 20px; color: var(--muted); }
.steps b { color: var(--text); }
.warn { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--accent); }
.link-row { display: flex; gap: 8px; }
.viewer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.viewer:first-child { border-top: 0; padding-top: 0; }
.viewer .stats { flex-basis: 100%; font-size: 0.85rem; color: var(--ok); font-variant-numeric: tabular-nums; }
#onizleme { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; }

/* İzleyici sayfası */
body.viewer-page { overflow: hidden; }
.stage { position: fixed; inset: 0; background: #000; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.6);
}
.overlay[hidden] { display: none; }
.panel {
  width: min(360px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  gap: 12px;
  text-align: center;
}
.panel label { text-align: left; color: var(--muted); font-size: 0.9rem; margin-bottom: -6px; }
.panel[hidden] { display: none; }
.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.stage video.fill { object-fit: cover; }

/* iPhone Safari videonun üstündeki öğelerde sadece opacity değişince ekranı yeniden çizmeyebiliyor;
   ayrı katman (translateZ) ve visibility ile kontroller gerçekten kaybolur. */
.controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateZ(0);
  transition: opacity 0.3s, visibility 0s;
}
.controls > * { pointer-events: auto; }
.controls.faded { opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0s 0.3s; }
.controls.faded > * { pointer-events: none; }
.controls .btn { background: rgb(20 20 28 / 0.75); }
.controls-top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.controls-bottom {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(20 20 28 / 0.75);
}
.controls-bottom .btn { background: #2a2a36; }
.round { min-width: 48px; height: 48px; padding: 0 12px; border-radius: 999px; }
.big-round { min-width: 60px; height: 60px; font-size: 1.4rem; }
.time { min-width: 9ch; font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgb(20 20 28 / 0.9);
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
.notice { margin: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-bg); color: var(--accent); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--muted); font-size: 0.9rem; }
.check input { width: auto; }
.floating {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 2;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
}
.floating[hidden] { display: none; }
