/* =====================================================================
   STÜDYO TELEPROMPTER — Ultra karanlık studio teması
   OLED siyah (#000) + neon yeşil (#33ff9c) + camgöbeği (#22e0ff)
   Modern, büyük tipografi, göz yormayan kontroller.
   ===================================================================== */

:root {
  --bg: #000000;
  --bg-elev: #070a0a;
  --surface: #0c1112;
  --surface-2: #111818;
  --border: #1b2626;
  --border-soft: #142020;
  --neon-green: #33ff9c;
  --neon-cyan: #22e0ff;
  --neon-dim: rgba(51, 255, 156, 0.18);
  --cyan-dim: rgba(34, 224, 255, 0.16);
  --text-hi: #eafaf2;
  --text-mid: #9fb8ad;
  --text-low: #5f726b;
  --danger: #ff4d6d;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-hi);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Ambiyans zemin lekeleri */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(34, 224, 255, 0.05), transparent 45%),
    radial-gradient(circle at 85% 88%, rgba(51, 255, 156, 0.055), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

button, input, textarea, select { font-family: var(--font); cursor: pointer; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 7px; }

/* =====================================================================
   1) LAYOUT — ekran üstte esner, panel altta sabit çubuk
   ===================================================================== */
body { display: flex; flex-direction: column; position: relative; z-index: 1; }

/* ----- Teleprompter ekranı ----- */
.teleprompter {
  position: relative;
  flex: 1 1 100vh;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 5%, #030a07 0%, #000 75%);
  z-index: 1;
}

/* Kenar karartma (profesyonel vignette) */
.screen-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 52%,
    rgba(0, 0, 0, 0.3) 85%,
    rgba(0, 0, 0, 0.88) 100%);
  z-index: 2;
}

/* Scroll taşıyıcısı — JS transform: translateY uygular */
.content {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(var(--scr, 0px));
  width: min(80%, 1120px);
  padding: 14vh 1rem 60vh;   /* üst: başlangıç boşluğu, alt: kaydırma kuyruğu */
  text-align: left;
  overflow: clip;
  will-change: transform;
  line-height: 1.6;
  cursor: grab;
}
.content.dragging { cursor: grabbing; user-select: none; }

/* Ayna (mirror flip) — profesyonel telprompter camı için yatay çevirme.
   translateY(var(--scr)) ile tek transform'da birleştirilir. */
.content.mirrored {
  transform: translateX(-50%) translateY(var(--scr, 0px)) scaleX(-1);
}

/* Konum atlarken (seek/home) kısa yumuşak geçiş */
.content.jumping { transition: transform 0.4s cubic-bezier(0.3, 0.9, 0.3, 1); }

/* Geri sayım (canlı) */
#countdownNumber.count-cyan { text-shadow: 0 0 26px rgba(34,224,255,.85), 0 0 80px rgba(34,224,255,.4); }

.speech-title {
  font-size: calc(var(--base, 48px) * 1.85);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--text-hi);
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
  margin: 0 0 4vh;         /* üst payı .content padding-top sağlar */
  opacity: 0.95;
}

.speech-text {
  font-size: var(--base, 48px);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(255,255,255,0.15), 0 2px 26px rgba(0,0,0,0.55);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* =====================================================================
   GERİ SAYIM overlay
   ===================================================================== */
.countdown-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0,12,7,0.86) 0%, #000 96%);
  z-index: 60;
}
.countdown-overlay.active { display: flex; }
.countdown-overlay .cd-label {
  position: absolute;
  top: 20%;
  left: 0; right: 0;
  text-align: center;
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: 0 0 22px rgba(34, 224, 255, 0.6);
}
#countdownNumber {
  font-size: clamp(6rem, 26vh, 20rem);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 18px rgba(51,255,156,1),
    0 0 50px rgba(51,255,156,.6),
    0 0 110px rgba(51,255,156,.35);
  animation: cdPulse 1s cubic-bezier(0.1,1.3,0.3,1) both;
}
@keyframes cdPulse {
  0%   { transform: scale(1.8); opacity: 0; }
  45%  { transform: scale(0.94); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* =====================================================================
   STATE badge (ekran üst sol)
   ===================================================================== */
.status-badge.scr {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--neon-green);
  background: rgba(0, 14, 8, 0.7);
  border: 1px solid rgba(51, 255, 156, 0.28);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  pointer-events: none;
  backdrop-filter: blur(3px);
}
.status-badge.running { text-shadow: 0 0 9px currentColor; }
.status-badge.paused  { color: var(--neon-cyan); border-color: rgba(34,224,255,.28); }

/* =====================================================================
   2) KONTROL PANELİ
   ===================================================================== */
.control-panel {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-height: 56vh;
  overflow-y: auto;
  background: linear-gradient(to top, #020504 0%, var(--surface) 100%);
  border-top: 1px solid var(--border-soft);
  box-shadow: 0 -10px 44px rgba(0,0,0,0.85);
  padding: 0.85rem 1.6rem 1.1rem;
  z-index: 20;
  display: flex; flex-direction: column; gap: 0.85rem;
}

.panel-header { display: flex; align-items: center; gap: 0.8rem; }
.brand-mark {
  font-size: 1.5rem; width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(51,255,156,.16), rgba(34,224,255,.14));
  border: 1px solid var(--border);
  border-radius: 10px;
}
.brand-text { display: flex; flex-direction: column; flex: 1; }
.brand-name { font-size: 0.92rem; font-weight: 800; letter-spacing: 0.14em; color: var(--text-hi); }
.brand-sub  { font-size: 0.68rem; color: var(--text-low); letter-spacing: 0.1em; }

.icon-btn {
  width: 2.5rem; height: 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--neon-cyan);
  font-size: 1.15rem;
  transition: all .15s ease;
}
.icon-btn:hover { border-color: var(--neon-cyan); box-shadow: 0 0 12px rgba(34,224,255,.3); color: #fff; }

/* Satırlar */
.control-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.control-row.transport { justify-content: space-between; }
.main-buttons { display: flex; gap: 0.6rem; align-items: center; }

/* Butonlar */
.rec-btn, .primary-btn, .ghost-btn {
  border-radius: 11px;
  padding: 0.72rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 0.55rem;
  transition: all .16s ease;
  border: 1px solid transparent;
}
.primary-btn {
  background: linear-gradient(135deg, #0bd47a, #00e5a0);
  color: #00170c;
  box-shadow: 0 4px 22px rgba(51,255,156,.35);
}
.primary-btn:hover { box-shadow: 0 6px 32px rgba(51,255,156,.6); transform: translateY(-1px); }
.primary-btn.playing { background: linear-gradient(135deg, #0fb7ff, #22e0ff); color: #00222c; box-shadow: 0 4px 22px rgba(34,224,255,.42); }

.rec-btn { background: var(--surface-2); border-color: var(--border); color: var(--danger); }
.rec-btn:hover { border-color: var(--danger); box-shadow: 0 0 12px rgba(255,77,109,.3); }
.rec-dot { width: 0.72rem; height: 0.72rem; border-radius: 50%; background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.rec-btn.counting { animation: recFlash 0.8s steps(1) infinite; }
@keyframes recFlash { 50% { opacity: 0.45; } }

.ghost-btn { background: transparent; border-color: var(--border); color: var(--text-mid); }
.ghost-btn:hover { color: var(--text-hi); border-color: var(--neon-green); box-shadow: 0 0 12px var(--neon-dim); }
.ghost-btn.sm { padding: 0.5rem 0.85rem; font-size: 0.78rem; }
button[aria-pressed="true"].live-on,
.ghost-btn.toggle-state[aria-pressed="true"] { color: var(--neon-green); border-color: var(--neon-green); background: var(--neon-dim); }

/* İlerleme */
.progress-row { gap: 0.8rem; }
.time-display { font-variant-numeric: tabular-nums; font-size: 0.9rem; font-weight: 700; color: var(--neon-cyan); min-width: 4.2em; letter-spacing: 0.04em; }
.ruler-wrap { flex: 1; display: flex; align-items: center; }

/* Kaydırıcı */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--neon-green);
  box-shadow: 0 0 12px rgba(51,255,156,.7);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  border: 0;
}

/* Slider alanları */
.sliders { gap: 1.3rem; align-items: flex-end; }
.slider-field { display: flex; flex-direction: column; gap: 0.35rem; flex: 1 1 210px; }
.slider-field label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; font-weight: 700; color: var(--text-mid); letter-spacing: 0.06em; text-transform: uppercase; }
.slider-icon { font-size: 0.9rem; }
.slider-value { font-size: 0.78rem; color: var(--neon-green); font-weight: 700; margin-top: 0.12rem; font-variant-numeric: tabular-nums; }
.mini-actions { display: flex; gap: 0.4rem; margin-top: 0.15rem; }
.mini-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-hi); border-radius: 8px; padding: 0.26rem 0.7rem; font-size: 0.76rem; font-weight: 700; }
.mini-btn:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }

.slider-field.toggles { flex-direction: row; align-items: center; gap: 0.6rem; flex: 0 0 auto; }
.toggle-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-mid); border-radius: 10px;
  padding: 0.62rem 1rem; font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 0.4rem; transition: all .15s ease;
}
.tg-ico { font-size: 1.05rem; }
.toggle-btn:hover { color: var(--text-hi); border-color: var(--neon-cyan); }
.toggle-btn[aria-pressed="true"] { color: var(--neon-green); border-color: var(--neon-green); background: var(--neon-dim); box-shadow: 0 0 14px var(--neon-dim); }

/* =====================================================================
   Metin yönetim bölümü
   ===================================================================== */
.panel-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 0.8rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.section-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-title { font-size: 0.9rem; font-weight: 800; letter-spacing: 0.06em; color: var(--text-hi); }
.preset-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; flex: 1 100%; }
.title-field { flex: 1 1 260px; }
.title-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-hi); border-radius: 9px; padding: 0.55rem 0.8rem; font-size: 0.85rem;
}
.title-input::placeholder { color: var(--text-low); }
.title-input:focus { outline: none; border-color: var(--neon-cyan); }
.preset-select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-hi);
  border-radius: 9px; padding: 0.55rem 0.7rem; font-size: 0.84rem; max-width: 250px;
}
.preset-select:focus { outline: none; border-color: var(--neon-green); }

.text-editor {
  width: 100%; min-height: 150px; max-height: 190px; resize: vertical;
  background: #050808; color: var(--text-hi);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 0.9rem; font-size: 0.86rem; line-height: 1.55; cursor: text;
}
.text-editor:focus { outline: none; border-color: var(--neon-cyan); box-shadow: 0 0 0 2px var(--cyan-dim); }

.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
#wordCount { font-size: 0.74rem; color: var(--text-low); font-weight: 600; }

/* =====================================================================
   Kısayol çubuğu
   ===================================================================== */
.shortcuts {
  border-top: 1px dashed var(--border);
  padding-top: 0.7rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem;
  font-size: 0.66rem; color: var(--text-low);
}
.shortcuts b {
  color: var(--text-mid); background: var(--surface-2);
  border: 1px solid var(--border-soft); padding: 0.1rem 0.4rem;
  border-radius: 5px; margin-right: 0.25rem;
  font-family: ui-monospace, Consolas, monospace;
}

/* =====================================================================
   Toast
   ===================================================================== */
.toast {
  position: fixed; right: 1.2rem; bottom: 1.3rem; z-index: 100;
  background: rgba(5,20,14,0.94); border: 1px solid var(--neon-green);
  color: var(--neon-green); padding: 0.55rem 1rem; border-radius: 10px;
  font-size: 0.82rem; font-weight: 700;
  box-shadow: 0 6px 26px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(14px);
  transition: opacity .24s, transform .24s;
  pointer-events: none; max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.cyan { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.toast.warn { border-color: var(--danger); color: var(--danger); }

/* =====================================================================
   Uyarlama
   ===================================================================== */
@media (max-width: 1000px) {
  .content { width: 92%; }
  .preset-group { margin-left: 0; }
}
@media (max-width: 640px) {
  .sliders { flex-direction: column; align-items: stretch; }
  .brand-sub { display: none; }
  .speech-title { margin-top: 8vh; }
}
