:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --surface: #12151c;
  --surface-2: #181c26;
  --line: #262c38;
  --line-strong: #3a4356;
  --text: #f5f6f8;
  --soft: #c4cbd8;
  --muted: #8b95a7;
  --ember: #ff5a36;
  --ember-soft: rgba(255, 90, 54, 0.16);
  --ice: #5cc8ff;
  --ice-soft: rgba(92, 200, 255, 0.14);
  --mint: #38d996;
  --mint-soft: rgba(56, 217, 150, 0.14);
  --amber: #ffd58a;
  --warn: #ffb224;
  --danger: #ff4d5a;
  --heading: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3 { font-family: var(--heading); margin: 0; letter-spacing: -0.025em; }
p { margin: 0; }

.muted { color: var(--muted); font-size: 13.5px; }
.status-note { color: var(--ice); font-size: 13px; margin-top: 8px; }
.status-mini { color: var(--muted); font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); transition: transform .1s, background .15s, border-color .15s;
}
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-ember { background: var(--ember); border-color: var(--ember); color: #090b0f; }
.btn-ice { background: var(--ice); border-color: var(--ice); color: #061822; }
.btn-mint { background: var(--mint); border-color: var(--mint); color: #051e13; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.09); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--soft);
}
.chip-ice { border-color: rgba(92,200,255,.35); background: var(--ice-soft); color: var(--ice); }
.chip-mint { border-color: rgba(56,217,150,.35); background: var(--mint-soft); color: var(--mint); }
.chip-ember { border-color: rgba(255,90,54,.4); background: var(--ember-soft); color: #ff8e75; }

.chip-btn {
  padding: 6px 10px; min-height: 34px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--soft);
}
.chip-btn.active { background: var(--ice); border-color: var(--ice); color: #051822; }
.chip-btn.warn-speed.active { background: var(--warn); border-color: var(--warn); color: #1b1100; }

/* Landing */
.landing {
  min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, rgba(92, 200, 255, 0.08), transparent 45%),
              radial-gradient(circle at 80% 80%, rgba(255, 90, 54, 0.08), transparent 45%), var(--bg);
}
.landing-card {
  width: 100%; max-width: 520px; padding: 28px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px;
}
.brand-badge {
  display: inline-block; width: fit-content; font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; padding: 4px 10px; border-radius: 999px;
  background: var(--ember-soft); color: #ff8569; border: 1px solid rgba(255,90,54,.35);
}
.landing-form { display: flex; gap: 8px; flex-wrap: wrap; }
.landing-form input {
  flex: 1; min-width: 220px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
}

/* Top Bar */
.top-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(10, 12, 16, 0.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-left { display: flex; align-items: center; gap: 10px; }
.dot-live {
  width: 10px; height: 10px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 10px rgba(56, 217, 150, 0.7); flex-shrink: 0;
}
.dot-live.offline { background: var(--danger); box-shadow: 0 0 8px rgba(255,77,90,.6); }
.project-title { font-family: var(--heading); font-weight: 700; font-size: 16px; line-height: 1.2; }
.project-sub { font-size: 12px; color: var(--muted); }

.mode-tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab-btn {
  padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--soft);
  display: inline-flex; align-items: center; gap: 5px;
}
.tab-btn.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill-count {
  background: var(--ember); color: #090b0f; font-size: 11px; font-weight: 700;
  padding: 0 6px; border-radius: 999px; font-family: var(--mono);
}

.top-right { display: flex; align-items: center; gap: 8px; }
.remote-pill {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--soft);
}
.remote-pill.ready { border-color: rgba(56,217,150,.5); color: var(--mint); }
.remote-pill.recording { border-color: rgba(255,77,90,.7); color: #ff8089; background: rgba(255,77,90,.12); }

/* Views */
.view-list, .view-timeline, .view-takes {
  max-width: 1060px; margin: 0 auto; padding: 16px 16px 100px;
}

.companion-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  margin-bottom: 16px;
}
.companion-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.companion-sub { color: var(--muted); font-size: 13px; max-width: 560px; }
.companion-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.speed-group, .route-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Scene Cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.scene-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 15px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s;
}
.scene-card.active-remote { border-color: var(--ice); box-shadow: 0 0 0 1px rgba(92,200,255,.3); }
.scene-card.status-cektim { border-color: rgba(56,217,150,.45); }
.scene-card.status-atladim { opacity: 0.65; }
.scene-card.status-sorun { border-color: rgba(255,77,90,.55); }

.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-num {
  font-family: var(--mono); font-weight: 700; font-size: 12px;
  padding: 3px 8px; border-radius: 7px; background: var(--ice); color: #051822;
}
.card-num.extra { background: var(--ember); color: #090b0f; }
.card-en { font-size: 19px; font-weight: 700; line-height: 1.32; color: var(--text); }
.card-tr { font-size: 14.5px; color: var(--amber); line-height: 1.4; }
.card-meta { font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.card-meta b { color: var(--soft); }
.card-bg { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.card-row { display: flex; gap: 6px; flex-wrap: wrap; }
.card-note {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 9px; resize: vertical;
  background: var(--bg); border: 1px solid var(--line); font-size: 13px;
}
.fb-btn.sel-cektim { background: var(--mint); border-color: var(--mint); color: #051e13; }
.fb-btn.sel-atladim { background: #384152; border-color: #65728c; color: #fff; }
.fb-btn.sel-sorun { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ==================== FULLSCREEN LANDSCAPE CAMERA STUDIO ==================== */
.view-camera {
  position: fixed; inset: 0; z-index: 60; background: #000;
  width: 100vw; height: 100dvh; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.camera-stage { position: relative; width: 100%; height: 100%; background: #000; overflow: hidden; }
.camera-video, .preview-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.mirrored { transform: scaleX(-1); }

.sync-flash {
  position: absolute; top: 8px; left: 8px; width: 42px; height: 42px;
  background: #ffffff; z-index: 95; pointer-events: none;
}

/* Portrait blocking prompt */
.portrait-overlay {
  position: absolute; inset: 0; z-index: 90; background: rgba(10, 12, 16, 0.94);
  backdrop-filter: blur(16px); display: grid; place-items: center; padding: 24px; text-align: center;
}
.portrait-box { max-width: 340px; display: grid; gap: 14px; justify-items: center; }
.rotate-icon { font-size: 52px; }

/* Teleprompter Floating Box (Lens-pinned) */
.tp-overlay {
  position: absolute; top: 10px; z-index: 70;
  width: min(64%, 640px); max-height: 48%;
  background: rgba(10, 12, 16, 0.68); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px;
  padding: 10px 16px 12px; overflow-y: auto; pointer-events: auto;
  transition: left .2s, right .2s, transform .2s;
}
.tp-overlay.pos-center { left: 50%; transform: translateX(-50%); }
.tp-overlay.pos-left { left: 74px; transform: none; }
.tp-overlay.pos-right { right: 104px; left: auto; transform: none; }

.tp-progress { height: 4px; background: rgba(255, 255, 255, 0.14); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.tp-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ice), var(--mint)); transition: width 80ms linear; }

.tp-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tp-badge {
  font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.1); color: var(--soft);
}
.tp-badge-ice { background: rgba(92, 200, 255, 0.2); color: var(--ice); }
.tp-badge-rec { background: rgba(255, 77, 90, 0.25); color: #ff7b85; animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.tp-countdown {
  font-family: var(--heading); font-size: 46px; font-weight: 700; text-align: center;
  color: var(--ember); line-height: 1.05; text-shadow: 0 4px 20px rgba(0,0,0,.8);
}
.tp-en {
  font-family: var(--heading); font-size: 30px; font-weight: 700; line-height: 1.25;
  color: rgba(255, 255, 255, 0.94); text-align: center; text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.tp-en .w { transition: color 60ms linear, text-shadow 60ms linear; }
.tp-en .w.past { color: rgba(255, 255, 255, 0.45); }
.tp-en .w.active { color: var(--ice); text-shadow: 0 0 14px rgba(92, 200, 255, 0.75); }
.tp-tr {
  margin-top: 6px; font-size: 16px; font-weight: 500; line-height: 1.3;
  color: var(--amber); text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.8);
}

/* HUD Left & Right Rails */
.hud-left, .hud-right {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 75;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.hud-left { left: 12px; }
.hud-right { right: 14px; }

.hud-icon-btn, .hud-pill-btn {
  min-width: 44px; min-height: 44px; border-radius: 999px;
  background: rgba(10, 12, 16, 0.65); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
}
.hud-pill-btn { padding: 0 12px; font-size: 12.5px; font-family: var(--mono); }
.hud-icon-btn.active, .hud-pill-btn.active { border-color: var(--ice); color: var(--ice); background: rgba(92, 200, 255, 0.22); }
.hud-rehearse { font-family: var(--body); font-size: 12px; }

/* Big Cinema Record Button */
.rec-btn {
  width: 72px; height: 72px; border-radius: 50%; padding: 5px;
  border: 4px solid rgba(255, 255, 255, 0.92); background: rgba(0, 0, 0, 0.35);
  display: grid; place-items: center; transition: transform .12s;
}
.rec-btn:active { transform: scale(0.94); }
.rec-inner {
  width: 100%; height: 100%; border-radius: 50%; background: #e8213a;
  transition: border-radius .18s, transform .18s;
}
.rec-btn.recording .rec-inner { border-radius: 10px; transform: scale(0.55); background: #ff3048; }
.rec-btn.counting .rec-inner { background: var(--warn); }

/* Post-Take Floating Bar */
.post-take-bar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 80;
  width: min(92%, 700px); padding: 10px 14px; border-radius: 14px;
  background: rgba(14, 18, 26, 0.9); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.post-take-status { font-size: 13px; font-weight: 600; color: var(--mint); }
.post-take-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* HUD Drawers */
.hud-drawer {
  position: absolute; left: 68px; top: 50%; transform: translateY(-50%); z-index: 85;
  width: min(360px, calc(100vw - 160px)); max-height: calc(100dvh - 30px); overflow-y: auto;
  background: rgba(14, 18, 26, 0.95); backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px;
  display: grid; gap: 10px;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-close {
  width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.08);
  color: var(--soft); display: grid; place-items: center;
}
.drawer-label { font-size: 12px; font-weight: 600; color: var(--soft); margin-top: 2px; }
.drawer-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.drawer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.slider-row { display: grid; gap: 4px; font-size: 12.5px; color: var(--soft); }
.slider-row input[type="range"] { width: 100%; accent-color: var(--ice); }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 4px 0;
}
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ice); }

/* ==================== TIMELINE PICKER (+ SAHNE / CÜMLE EKLE) ==================== */
.timeline-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.timeline-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.timeline-controls input, .timeline-controls select {
  padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
}
.timeline-controls input { min-width: 240px; }

.selection-bar {
  position: sticky; top: 68px; z-index: 25; margin-bottom: 12px;
  padding: 10px 14px; border-radius: 12px; background: rgba(24, 30, 44, 0.96);
  border: 1px solid var(--ice); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.selection-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.timeline-list { display: grid; gap: 10px; }
.tl-scene {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.tl-scene-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tl-sentences { display: grid; gap: 6px; }
.tl-sent {
  text-align: left; padding: 9px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); display: grid; gap: 3px;
  transition: border-color .12s, background .12s;
}
.tl-sent:hover { border-color: var(--line-strong); }
.tl-sent.selected { border-color: var(--ember); background: var(--ember-soft); }
.tl-sent-top { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tl-sent-en { font-size: 14.5px; font-weight: 600; color: var(--text); }
.tl-sent-tr { font-size: 13px; color: var(--amber); }

/* ==================== TAKES & DIAGNOSTICS ==================== */
.takes-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.takes-actions { display: flex; gap: 8px; }
.panel-block { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel-block h3 { margin-bottom: 12px; font-size: 15.5px; }
.takes-list { display: grid; gap: 10px; }
.take-item {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.take-meta { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.take-meta strong { color: var(--text); font-size: 14px; }
.take-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modals */
.modal {
  width: min(94vw, 640px); padding: 18px; border-radius: 18px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview1x-video { width: 100%; aspect-ratio: 16/9; border-radius: 12px; background: #000; }
.preview1x-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.inline-slider { flex: 1; min-width: 200px; }

.share-body { display: grid; gap: 12px; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; width: fit-content; margin: 0 auto; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input { flex: 1; padding: 9px 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; }
.share-role-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 120;
  padding: 10px 16px; border-radius: 10px; background: #1a2232; border: 1px solid var(--ice);
  color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

@media (max-width: 720px) {
  .cards-grid { grid-template-columns: 1fr; }
  .tp-overlay { width: min(70%, 520px); }
  .tp-en { font-size: 24px; }
  .rec-btn { width: 64px; height: 64px; }
}
