:root {
  --bg: #0b0d10;
  --card: #14171c;
  --card2: #1b1f26;
  --line: #262b34;
  --text: #e8ebf0;
  --muted: #8a93a3;
  --accent: #53fc18;      /* canlı yeşil */
  --accent-ink: #0b0d10;
  --live: #ff3b4e;
  --warn: #ffb020;
  --ok: #3ddc84;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* ---------- Butonlar ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font: inherit; font-weight: 600; cursor: pointer;
  min-height: 46px; touch-action: manipulation; transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger, .btn.live { background: var(--live); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 16px; min-height: 54px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.icon { width: 54px; min-height: 54px; padding: 0; display: grid; place-items: center; }
.btn.icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.icon .slash { display: none; }
.btn.icon.off { color: var(--live); border-color: var(--live); }
.btn.icon.off .slash { display: block; }

/* ---------- Giriş ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; background: var(--card); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; margin-bottom: 4px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
input, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; min-height: 44px;
}
.err { color: var(--live); margin: 0; min-height: 1.2em; font-size: 14px; }

/* ---------- Üst durum hattı ---------- */
.pipeline {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px; background: rgba(11,13,16,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.hop { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; }
.hop b { display: block; font-size: 12px; }
.hop small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hop > div { min-width: 0; }
.arrow { color: var(--muted); font-size: 18px; }
.led { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #3a404b; }
.hop.ok .led { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hop.warn .led { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.hop.bad .led { background: var(--live); box-shadow: 0 0 8px var(--live); }
.hop.live .led { background: var(--live); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255,59,78,.0), 0 0 12px var(--live); opacity: .6; } }

/* ---------- Düzen ---------- */
.layout { display: grid; gap: 12px; padding: 12px 12px calc(16px + var(--safe-b)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
@media (min-width: 860px), (orientation: landscape) and (min-width: 600px) {
  .layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .cam { position: sticky; top: 64px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .preview { aspect-ratio: auto; height: 46dvh; }
  .cam-controls, .cam-settings { margin-top: 8px; }
  .btn.big, .btn.icon { min-height: 46px; }
  .pipeline { padding-top: 6px; padding-bottom: 6px; }
}

/* ---------- Kamera ---------- */
.preview { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.preview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview video.mirror { transform: scaleX(-1); }
.ov-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.ov-top .mono { background: rgba(0,0,0,.55); padding: 3px 7px; border-radius: 6px; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.6); }
.badge.live { background: var(--live); }
.badge.conn { background: var(--warn); color: #111; }
.ov-center { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; pointer-events: none; }
.meter { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }
.cam-controls { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 10px; }
.cam-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.cam-settings label, .form-grid label { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
p.warn { margin: 10px 0 0; padding: 10px; border-radius: 10px; background: rgba(255,176,32,.12); color: var(--warn); font-size: 13px; }

/* ---------- OBS ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 10px 4px; border-radius: 9px; cursor: pointer; min-height: 40px; }
.tab.active { background: var(--card2); color: var(--text); }
.panel { display: none; }
.panel.active { display: block; }
.offline { padding: 12px; border-radius: 10px; background: rgba(255,59,78,.12); color: var(--live); margin-bottom: 12px; font-weight: 600; }
.offline small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; word-break: break-word; }

.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.scene { min-height: 64px; text-align: left; font-size: 15px; word-break: break-word; }
.scene.current { background: var(--live); border-color: transparent; color: #fff; }
.scene.brb-scene:not(.current) { border-style: dashed; }
.brb { padding: 10px; border-radius: 10px; background: rgba(255,176,32,.14); color: var(--warn); font-size: 13px; margin-bottom: 10px; font-weight: 600; }

.audio-list { display: grid; gap: 10px; }
.audio { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px; background: var(--card2); border-radius: 10px; }
.audio .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio .db { font-size: 12px; color: var(--muted); }
.audio input[type=range] { grid-column: 1; padding: 0; min-height: 32px; border: 0; background: transparent; accent-color: var(--accent); }
.audio .btn { min-height: 38px; padding: 6px 12px; font-size: 13px; }
.audio.muted .btn { background: var(--live); color: #fff; border-color: transparent; }
.audio.muted input { opacity: .4; }

.stream-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.stats div { background: var(--card2); border-radius: 10px; padding: 10px; }
.stats dt { font-size: 11px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px; background: var(--card2); border-radius: 10px; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }
.switch { appearance: none; width: 50px; height: 30px; min-height: 0; flex: none; border-radius: 15px; background: #3a404b; position: relative; border: 0; padding: 0; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 23px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Bildirimler / onay ---------- */
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); display: grid; gap: 8px; z-index: 50; pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 14px; animation: in .2s ease-out; }
.toast.warn { border-color: var(--warn); }
.toast.err { border-color: var(--live); }
.toast.ok { border-color: var(--ok); }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }
.confirm { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(340px, 90vw); }
.confirm::backdrop { background: rgba(0,0,0,.6); }
.confirm p { margin: 0 0 16px; font-weight: 600; }
.confirm .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 380px) {
  .hop b { font-size: 11px; }
  .arrow { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.brand-logo { width: 40px; height: 40px; border-radius: 10px; }
