/* Active users badge */
.active-users-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 18px;
  /* Solda sabit büyük boşluk mobilde görünmezliğe neden oluyordu */
  margin-left: auto;   /* header içinde sağ uca yasla */
  margin-right: 8px;  /* kullanıcı adı ile 2 boşluk hissi */
  background: #10b981; /* yeşil */
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(16,185,129,0.35);
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

/* Active users panel */
.active-users-panel {
  position: absolute;
  top: 46px; /* header yüksekliğinin altına gelsin */
  left: 16px;
  min-width: 220px;
  max-width: 320px;
  max-height: 50vh;
  overflow: auto;
  background: var(--bg, #111);
  color: var(--fg, #eee);
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  padding: 10px;
  z-index: 4000;
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  font-size: 0.95rem; /* genel panel yazı boyutu */
}

.active-users-panel .title {
  font-weight: 700;
  margin-bottom: 6px;
}

.active-users-panel .user-item {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.9rem; /* okunabilir normal boyut */
}

.active-users-panel .user-item + .user-item { margin-top: 4px; }

.active-users-panel .user-item:hover { background: rgba(255,255,255,0.06); }

.active-users-panel .user-item.tel-op {
  color: #38bdf8;
  font-weight: 700;
}
/* Scrollable sections for sources and mine lists */
.scroll-section{
  height: 40vh !important;   /* varsayılan görünür yükseklik */
  min-height: 180px;         /* içerik azsa da kutu görünsün */
  overflow-y: auto !important;/* dikey scroll */
  overflow-x: hidden !important;/* yatay gizle */
  padding: 6px 0;            /* iç boşluk */
  border: 1px solid var(--border); /* koyu tema uyumu */
  border-radius: 10px;
  background: var(--bg-card);
  margin-bottom: 12px;        /* iki kutu arası boşluk */
  display: block;             /* görünür blok */
  scrollbar-gutter: stable;   /* scrollbar yerini sabit tut */
}

.scroll-section .cards{ padding: 6px; }

/* Apply scroll directly to lists to ensure visibility regardless of wrapper */
#sourcesList, #mineList, #kontrolMainList, #kontrolSubList{
  max-height: none;          /* scroll wrapper'da */
  min-height: 0;
  overflow: visible;         /* içte scroll olmasın */
  background: transparent;
  border: none;
  padding: 6px;
}

/* Make scrollbars more visible */
#sourcesList::-webkit-scrollbar, #mineList::-webkit-scrollbar, .scroll-section::-webkit-scrollbar{
  width: 10px;
}
#sourcesList::-webkit-scrollbar-track, #mineList::-webkit-scrollbar-track, .scroll-section::-webkit-scrollbar-track{
  background: rgba(148,163,184,0.08);
  border-radius: 8px;
}
#sourcesList::-webkit-scrollbar-thumb, #mineList::-webkit-scrollbar-thumb, .scroll-section::-webkit-scrollbar-thumb{
  background: rgba(59,130,246,0.6);
  border-radius: 8px;
}

/* Distinct heights per section for better layout balance */
#sourcesView .scroll-section:first-of-type{ height: 50vh !important; }
#sourcesView .scroll-section:last-of-type{ height: 30vh !important; }

/* Kontrol: tek liste olduğu için tam sayfaya yakın yükseklik kullan */
#kontrolScroll.scroll-section{ height: 78vh !important; min-height: 360px; }

/* Better visual separation between two lists */
#sourcesView .scroll-section + .video-header{ margin-top: 12px; }
/* --- Search & Highlight helpers --- */
mark {
  background: #ff9800; /* orange */
  color: #000;         /* better contrast on orange */
  padding: 0 2px;
  border-radius: 3px;
}

.kontrol-sort{
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.kontrol-sort span{
  cursor: pointer;
  text-decoration: underline;
  margin-right: 8px;
}
.kontrol-sort span.active{
  font-weight: 600;
  color: var(--pri-light);
}

.search-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-bar-container input[type="text"] {
  width: 260px;
  padding: 0.45rem 0.6rem;
}
.search-bar-container .btn-primary,
.search-bar-container .btn-secondary {
  padding: 0.45rem 0.75rem;
}
#clickableText {
  position: relative; /* overlay için stacking context */
  z-index: 0;
}
#clickableText .speaker-marker::before {
  content: "-";
}
#clickableText .speaker-marker::after {
  content: "-";
}
.sentence-highlight {
  display: inline;
  background-clip: content-box;
  padding: 0;            /* boşluk boyama yok */
  margin-right: 0;       /* ayrım yok, satır kayması olmasın */
  border-radius: 0;      
  position: relative;
  z-index: 1;            /* metinle aynı katman */
}
/* 🎨 Kelam Cutter - Modern UI */
:root {
  --pri: #3b82f6;
  --pri-dark: #2563eb;
  --pri-light: #60a5fa;
  --ok: #10b981;
  --ok-dark: #059669;
  --warn: #f59e0b;
  --err: #ef4444;
  --bg: #0a0f1a;
  --bg-card: #0f172a;
  --bg-hover: #1e293b;
  --fg: #f1f5f9;
  --fg-muted: #94a3b8;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #0a0f1a 0%, #1a1f2e 100%);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.6;
}

/* 🎯 Header */
header {
  position: sticky;
  top: 0;
  background: rgba(10, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  z-index: 100;
  box-shadow: 0 4px 6px var(--shadow);
}

/* Logout butonu başlangıçta gizli */
#btnLogout {
  display: none;
}

/* Login sayfasında nav ve sourcesView gizli */
body:has(#loginView:not([style*="display: none"])) nav {
  display: none;
}

body:has(#loginView:not([style*="display: none"])) #sourcesView {
  display: none;
}

body:has(#loginView:not([style*="display: none"])) .brand {
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.brand .brand-title,
.brand .brand-user {
  background: linear-gradient(135deg, var(--pri-light), var(--pri));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 🔘 Navigation Buttons */
nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

nav button {
  padding: 0.45rem 0.6rem;        /* daha dar yatay, biraz daha küçük dikey padding */
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;              /* bir tık küçük font */
  font-weight: 500;
  line-height: 1.15;              /* iki satır için sıkı satır yüksekliği */
  transition: all 0.3s ease;
  position: relative;
  white-space: normal;            /* tek satır zorlamayı kaldır */
  overflow: visible;              /* iki satır sığsın */
  overflow-wrap: normal;          /* kelimeleri ortadan bölme */
  word-break: keep-all;           /* kelime içi kırma yok */
  text-align: center;             /* iki satır ortalı */
  width: 84px;                    /* iki kelimeyi alt alta zorla */
  height: 44px;                   /* tüm butonlar için sabit yükseklik */
  display: flex;                  /* içerik dikey ortalansın */
  align-items: center;
  justify-content: center;
}

nav button::before {
  content: none !important; /* ripple disabled */
}

/* Header sağındaki iki satırlı özel butonlar: genel nav metrikleriyle eşleşsin */
#btnRefresh {
  padding: 0.45rem 0.6rem;  /* nav button ile aynı */
  width: 84px;              /* nav button ile aynı */
  line-height: 1.15;
  text-align: center;
}

/* Özel genişlik override kaldırıldı; nav ile aynı ölçüde */

/* Ripple expansion disabled */
nav button:hover::before { width: 0; height: 0; }

nav button:hover {
  border-color: var(--pri);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

nav button.active {
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  border-color: var(--pri-light);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

nav button.create {
  background: linear-gradient(135deg, var(--ok-dark), var(--ok));
  border-color: var(--ok);
  color: white;
}

nav button.create:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

nav button.create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

nav button.danger {
  background: linear-gradient(135deg, #991b1b, var(--err));
  border-color: var(--err);
  color: white;
}

nav button.danger:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

nav button.right {
  margin-left: auto;
}

/* Sağ blok: right'tan sonra gelen buton (Çıkış) az boşlukla hizalansın */
nav button.right + button { margin-left: 0.5rem; }

/* Yenile butonu: konsolda test edilen özel ölçüler */
#btnRefresh{
  display: inline-block;
  padding: 0;          /* konsoldaki ayar */
  margin-top: 0 !important; /* konsoldaki ayar */
}

/* 📦 Main Content */
main {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

main.tables-mode {
  max-width: calc(100vw - 20px);
  padding: 1rem 0.6rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.view.hidden {
  display: none;
}

.tables-shell {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 12px;
}

.tables-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tables-selected {
  font-weight: 700;
}

.tables-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tables-status {
  color: var(--fg-muted);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.tables-grid-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: calc(100vh - 260px);
  background: #0c1424;
}

.tables-grid {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

.tables-grid th,
.tables-grid td {
  border: 1px solid #2b3954;
  padding: 4px 6px;
  white-space: nowrap;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tables-grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #172642;
  color: #f8fafc;
}

.tables-th-label {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  justify-items: center;
  width: 100%;
  min-height: 48px;
  padding-right: 10px;
}

.tables-th-word {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tables-th-word.is-empty {
  opacity: 0;
}

.tables-col-resizer {
  position: absolute;
  top: 0;
  right: -1px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.tables-col-resizer:hover {
  background: rgba(96, 165, 250, 0.35);
}

.tables-grid td {
  background: #0f1a2e;
  color: #e2e8f0;
  min-width: 30px;
}

body.tables-resizing,
body.tables-resizing * {
  user-select: none !important;
}

.tables-grid th.tables-col-telegram {
  text-align: left;
  padding-left: 10mm !important;
}

.tables-grid th.tables-col-telegram .tables-th-label,
.tables-grid th.tables-col-telegram .tables-th-word {
  justify-items: start;
  justify-content: flex-start;
  text-align: left;
}

.tables-grid th.tables-col-telegram .tables-th-label {
  padding-left: 0;
  padding-right: 0;
}

.tables-grid td.tables-col-telegram {
  cursor: pointer;
}

.tables-grid td.tables-col-telegram:hover {
  background: #172554;
}

.tables-telegram-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
}

.tables-telegram-modal.show {
  display: block;
}

.tables-telegram-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.22);
}

.tables-telegram-modal__panel {
  position: fixed;
  top: var(--tables-modal-top, 64px);
  left: 0;
  right: 0;
  width: min(var(--tables-modal-width, 1200px), calc(100vw - 20px));
  height: calc(100vh - var(--tables-modal-top, 64px) - 8px);
  margin: 0 auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tables-telegram-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 8px;
}

.tables-telegram-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.tables-telegram-modal__sub {
  font-size: 0.82rem;
  color: #94a3b8;
}

.tables-telegram-modal__body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.tables-telegram-modal__textarea {
  width: 100%;
  min-height: 0;
  height: 100%;
  resize: none;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #f8fafc;
  padding: 10px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.tables-telegram-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid #1e293b;
}

.tables-grid td[contenteditable="true"]:focus {
  outline: 2px solid var(--pri);
  background: #162849;
}

.tables-empty {
  padding: 16px;
  color: var(--fg-muted);
}

.tables-link {
  color: #60a5fa;
  text-decoration: underline;
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--fg);
  position: relative;
  padding-bottom: 0.5rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--pri), transparent);
  border-radius: 2px;
}

/* 🎴 Cards */
.cards {
  display: grid;
  gap: 0.6rem; /* kompakt aralık */
}

/* Extra spacing between first cards and next heading in sources view */
#sourcesView .cards + h2 {
  margin-top: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem; /* daha kompakt */
  padding: 0.8rem; /* daha kompakt */
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Sources/Mine/Kontrol kartlarını Bekleyen İşler stiliyle hizala */
#sourcesList .card, #mineList .card, #kontrolMainList .card, #kontrolSubList .card{
  padding: 6px 8px;           /* Jobs ile aynı */
  align-items: flex-start;     /* Jobs ile aynı */
  gap: 8px;                   /* Jobs ile aynı */
  font-size: 13px;            /* Jobs ile aynı */
}

#sourcesList .card b, #mineList .card b, #kontrolMainList .card b, #kontrolSubList .card b{
  font-size: 13px;            /* Başlık boyutu Jobs ile aynı */
}

/* Sources/Mine/Kontrol içindeki birincil butonları (Aç/Devam/Sil) rename rozet yüksekliğine hizala */
#sourcesList .card button:not(.badge),
#mineList .card button:not(.badge),
#kontrolMainList .card button:not(.badge),
#kontrolSubList .card button:not(.badge){
  padding: 2px 8px;           /* transcript-badge / pill ile aynı yükseklik */
  font-size: 12px;            /* pill metniyle aynı */
  border-radius: 6px;
  line-height: 1.2;
}

/* Sources/Mine/Kontrol içindeki rozet/başlık badge'leri: Jobs pill boyutları */
#sourcesList .card .transcript-badge, #mineList .card .transcript-badge, #kontrolMainList .card .transcript-badge, #kontrolSubList .card .transcript-badge,
#sourcesList .card .badge, #mineList .card .badge, #kontrolMainList .card .badge, #kontrolSubList .card .badge,
#sourcesList .card .user-badge, #mineList .card .user-badge, #kontrolMainList .card .user-badge, #kontrolSubList .card .user-badge{
  padding: 2px 8px;           /* Jobs pill (makePill) ile uyumlu */
  font-size: 12px;            /* Jobs pill metni */
  border-radius: 6px;         /* yuvarlatma uyumu */
  line-height: 1.2;
}

/* Çalışmalarım ve Kontrol: başlık ile durum rozeti arasına boşluk */
#mineList .card b + .badge, #kontrolMainList .card b + .badge, #kontrolSubList .card b + .badge{ margin-left: 6px; }

/* Sources header: Butonlar 'Çalışmalarım'daki küçük buton metrikleriyle aynı olsun */
#sourcesView .search-bar-container #btnRefresh,
#sourcesView .search-bar-container #sourcesSearchClear,
#sourcesView .search-bar-container #sourcesSearchButton{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;   /* küçük buton metrikleri */
  height: auto;               /* sabit yükseklik yok */
  line-height: 1.2;
}

/* Input yüksekliği default kalsın (küçük metrikler ile uyumlu) */
#sourcesView .search-bar-container input[type="text"]{
  height: auto;
}

/* Ready state for source cards */
.card.ready {
  background: rgba(59, 130, 246, 0.08); /* var(--pri) tint */
  border-color: rgb(59, 130, 246, 0.8);
}

/* Transcript badge (ready state indicator next to video name) */
.transcript-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem; /* daha kompakt */
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.5rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* Kullanıcı rozetleri (Transcript rozetinin yanına) */
.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem; /* transcript-badge ile aynı */
  border-radius: 999px;
  background: #f59e0b; /* turuncu */
  color: #ffffff;      /* beyaz yazı */
  font-weight: 700;
  font-size: 0.85rem;  /* transcript-badge ile aynı */
  margin-left: 0.5rem; /* transcript-badge sonrası hizalama */
  white-space: nowrap;
  vertical-align: middle;
}

.notes-badge{
  display:inline-flex;
  align-items:center;
  padding:2px 8px;
  margin-left:4px;
  border-radius:6px;
  background:#4b5563; /* gri */
  color:#e5e7eb;
  font-size:11px;
  line-height:1.3;
  cursor:pointer;
  white-space:nowrap;
}

.notes-badge.has-notes{
  background:#b91c1c; /* kırmızı */
  color:#ffffff;
}

/* PC kullanıcı rozeti: eflatun (purple) */
.user-badge.pc{
  background: #a855f7; /* purple-500 */
  border-color: #a855f7;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--pri);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.card:hover::before {
  transform: scaleY(1);
}

.card:hover {
  border-color: var(--pri);
  background: var(--bg-hover);
  transform: translateX(4px);
  box-shadow: 0 8px 16px var(--shadow);
}

.card b {
  font-size: 1.0rem; /* daha kompakt */
  color: var(--fg);
}

.card .meta {
  color: var(--fg-muted);
  font-size: 0.8rem; /* daha kompakt */
  margin-top: 0.2rem;
}

/* Mevcut Kaynaklar: kilit ve kullanım bilgisi rozetlerle aynı satırda kalsın */
#sourcesList .card .meta{
  display: inline;             /* blok değil: aynı satırda devam et */
  margin-top: 0;               /* üst boşluğu kaldır */
  margin-left: 6px;            /* user rozetinden sonra küçük boşluk */
  white-space: nowrap;         /* alt satıra inmesin */
  vertical-align: middle;      /* rozetlerle hizala */
}

.card button {
  padding: 0.4rem 0.8rem; /* daha kompakt */
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem; /* daha kompakt */
  transition: all 0.3s ease;
  margin-left: 0.4rem; /* daha kompakt */
}

.card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 🎨 Card Button Class (Parçalar ve Part Detay için) */
.card-btn {
  padding: 2px 8px; /* daha kompakt */
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem; /* daha kompakt */
  transition: all 0.3s ease;
  margin-left: 0.4rem; /* daha kompakt */
}

.card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.card-btn:active {
  transform: translateY(0);
}

/* 📝 Forms & Inputs */
#loginView {
  max-width: 400px;
  margin: 3rem auto;
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px var(--shadow);
}

#loginView h2 {
  text-align: center;
  margin-bottom: 2rem;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#loginForm label {
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

#loginForm input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--fg);
  font-size: 1rem;
  transition: all 0.3s ease;
}

#loginForm input:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#loginForm button {
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}

#loginForm button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* 🎵 Audio Player */
#player, #partsPlayer, #subpartsPlayer {
  width: 100%;
  margin: 1.5rem 0;
  border-radius: 0.75rem;
  background: var(--bg-card);
  padding: 0.5rem;
  border: 1px solid var(--border);
}

/* 🎬 Video Player */
#videoCutter {
  width: 100%;
  max-height: 500px;
  margin: 1.5rem 0;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

#cutInfo {
  color: var(--pri-light);
  font-weight: 600;
  padding: 0px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 📄 Textarea */
textarea#fullText {
  width: 100%;
  min-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--fg);
  padding: 1.25rem;
  font-size: 1rem;
  line-height: 1.8;
  font-family: 'Consolas', 'Monaco', monospace;
  resize: vertical;
  transition: all 0.3s ease;
}

textarea#fullText:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Tam metin clickable DIV görünümü (textarea ile aynı hissiyat) */
#clickableText{
  position: relative;       /* overlay için referans */
  z-index: 0;
  display: block;
  width: 100%;
  min-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--fg);
  padding: 1.25rem;
  font-size: 1rem;
  line-height: 1.8;
  font-family: 'Consolas','Monaco',monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}


/* 🎛️ Controls */
.controls {
  display: flex;
  gap: 8px; /* daha kompakt tek satır */
  align-items: center;
  margin: 0px 0px;
  flex-wrap: nowrap; /* tek satır hedefi */
  background: var(--bg-card);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.controls label {
  display: flex;
  flex-direction: row; /* tek satır */
  gap: 0.5rem;
  align-items: center;
  color: var(--fg-muted);
  font-weight: 500;
  /* yalın etiket - kart görünümü kaldırıldı */
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.controls input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--fg);
  padding: 0.45rem 0.6rem; /* kaynak kart küçük metrikleriyle uyumlu */
  font-size: 0.9rem;
  line-height: 1.2;
  transition: all 0.3s ease;
  max-width: 320px;
}

.controls input:focus {
  outline: none;
  border-color: var(--pri);
}

.controls button {
  padding: 2px 8px; /* .card button metriği */
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem; /* .card ile hizalı */
  line-height: 1.2;
  transition: all 0.3s ease;
}

.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

#selInfo {
  color: var(--pri-light);
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 🎬 Parts List */
.parts {
  display: grid;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.parts .row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px0.75rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.3s ease;
  overflow: hidden;
  gap:8px;
  padding:6px 8px;
}

.parts .row:hover {
  border-color: var(--pri);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.parts .row b {
  font-size: 1.1rem;
  color: var(--pri-light);
}

/* 🌐 Global Tüm Partlar Bölümü (Ultra Kompakt Liste) */
.global-parts-title-bar{
  margin-top: 24px;
  margin-bottom: 4px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.global-parts-main-title{
  font-size: 1.25rem; /* Diğer h2 başlıklarla aynı ölçek */
  font-weight: 700;
  color: var(--fg);
  margin:0;
}

.global-parts-section{
  margin-top: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.75);
}

.global-parts-header{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:4px;
}

.global-parts-title{
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-muted);
}

.global-parts-actions{
  display:flex;
  gap:16px;
  align-items:center;
  flex-wrap:wrap;
}

.link-btn{
  padding:0;
  margin:0;
  background:none;
  border:none;
  color: var(--pri-light);
  font-size: 0.8rem;
  cursor:pointer;
  text-decoration: underline;
}

.link-btn.danger{
  color:#f97373;
}

.link-btn:disabled{
  opacity:0.4;
  cursor:not-allowed;
  text-decoration:none;
}

.global-parts-list{
  max-height: 40vh;
  overflow-y:auto;
  margin-top:4px;
  border-radius:4px;
  border:1px solid rgba(15,23,42,0.9);
  background: rgba(15,23,42,0.9);
}

.global-part-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  padding:2px 6px;
  font-size:13px;
  line-height:1.25;
  border-bottom:1px solid rgba(30,41,59,0.7);
  white-space:nowrap;
}

.global-part-row:last-child{
  border-bottom:none;
}

.global-part-main{
  display:grid;              /* masaüstünde tablo benzeri hizalama */
  grid-template-columns: auto 1fr auto; /* sıra no | isim | meta */
  column-gap:25px;           /* her unsur arası ~50px sabit boşluk */
  align-items:center;
  min-width:0;
}

.global-part-idx{
  color: var(--fg-muted);
  min-width: 24px;
}

.global-part-name{
  color: var(--fg);
  overflow:hidden;
  text-overflow:ellipsis;
}

.global-part-score{
  color: var(--fg-muted);
  font-size:12px;
}

.global-part-actions{
  display:flex;
  gap:10px;
  flex-shrink:0;
}

.global-part-btn{
  padding:0;
  margin:0;
  border:none;
  background:none;
  font-size:12px;
  cursor:pointer;
  text-decoration:underline;
  color: var(--pri-light);
}

.global-part-btn.danger{
  color:#fb7185;
}

/* Grup renk paleti (arka plan + border) */
.global-part-group-1{ border-left:3px solid rgba(59,130,246,0.8); }
.global-part-group-2{ border-left:3px solid rgba(34,197,94,0.8); }
.global-part-group-3{ border-left:3px solid rgba(244,114,182,0.8); }
.global-part-group-4{ border-left:3px solid rgba(234,179,8,0.9); }
.global-part-group-5{ border-left:3px solid rgba(129,140,248,0.9); }

.global-part-group-single{
  border-left:3px solid rgba(148,163,184,0.5);
}

/* Grup renklerini gövde yazılarına uygula */
.global-part-group-1 .global-part-name{ color: rgba(96,165,250,1); }
.global-part-group-2 .global-part-name{ color: rgba(52,211,153,1); }
.global-part-group-3 .global-part-name{ color: rgba(251,113,133,1); }
.global-part-group-4 .global-part-name{ color: rgba(250,204,21,1); }
.global-part-group-5 .global-part-name{ color: rgba(196,181,253,1); }

/* Grup renklerini Görüntüle butonuna da uygula (Sil her zaman danger kırmızı kalır) */
.global-part-group-1 .global-part-btn:not(.danger){ color: rgba(96,165,250,1); }
.global-part-group-2 .global-part-btn:not(.danger){ color: rgba(52,211,153,1); }
.global-part-group-3 .global-part-btn:not(.danger){ color: rgba(251,113,133,1); }
.global-part-group-4 .global-part-btn:not(.danger){ color: rgba(250,204,21,1); }
.global-part-group-5 .global-part-btn:not(.danger){ color: rgba(196,181,253,1); }

/* Aynı renkte üst üste gelmek zorunda kalan gruplar için canlı kırmızı vurgu */
.global-part-group-force-red{
  border-left-color: #f87171 !important;
}
.global-part-group-force-red .global-part-name{
  color: #fca5a5 !important;
}
.global-part-group-force-red .global-part-btn:not(.danger){
  color: #fca5a5 !important;
}

.global-part-intersect-count{
  color:#ffffff;
  font-weight:600;
  margin-left:4px;
}

/* 📱 Global parts list - mobile responsive tweaks */
@media (max-width: 768px){
  .global-parts-section{
    margin-top: 8px;
    margin-left: -4px;
    margin-right: -4px;
    padding: 4px 4px;
  }

  .global-parts-list{
    max-height: 65vh; /* küçük ekranda daha fazla dikey alan */
  }

  .global-part-row{
    white-space: normal;          /* satırlar kırılabilsin */
    align-items: stretch;
    flex-direction: column;       /* 1. satır: main, 2. satır: actions */
  }

  .global-part-main{
    display:flex;                /* mobilde tekrar flex'e dön */
    flex-wrap: wrap;             /* id + isim + meta alt satıra geçebilsin */
    gap: 2px;
  }

  .global-part-actions{
    flex-direction: row;         /* Görüntüle / Sil yan yana, ama 2. satırda */
    justify-content: flex-end;
    padding-top: 2px;
  }

  .global-part-name{
    max-width: 100%;
  }

  .global-part-meta{
    display:block;               /* kullanıcı + kesişim sayısı ayrı satır */
    font-size: 11px;
    color: var(--fg-muted);
  }
}

/* Header badges */
.inbox-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:6px;
  width:22px; height:22px;
  border-radius:50%;
  background:#0ea5a5; /* teal */
  color:#fff;
  font-size:13px;
  font-weight:700;
  box-shadow:0 2px 6px rgba(0,0,0,0.2);
  cursor:pointer;
  user-select:none;
}
.inbox-badge.blink{
  animation: inboxBlink 1.2s infinite;
}
@keyframes inboxBlink{
  0%{ background:#10b981; }
  50%{ background:#22c55e; }
  100%{ background:#10b981; }
}

/* 🏷️ Badges */
.badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

.badge.ok {
  background: linear-gradient(135deg, var(--ok-dark), var(--ok));
  border-color: var(--ok);
  color: white;
}

/* ⏱️ Compact duration badge used in Sources cards */
.duration-badge{
  padding: 2px 6px !important;
  font-size: 12px !important;
  background: rgba(148, 163, 184, 0.15) !important; /* slate-400 tint */
  color: var(--fg-muted) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
}

/* 💡 Hints */
.hint {
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 1rem;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 0.5rem;
  border-left: 3px solid var(--pri);
  margin: 1rem 0;
}

/* 🔄 Refresh Button */
#btnRefresh {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

#btnRefresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* 📤 Upload Page */
.upload-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  transition: all 0.3s ease;
  display: flex;               /* allow vertical alignment */
  flex-direction: column;
  height: 100%;                /* stretch to equal height in grid */
}

.upload-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
  border-color: var(--pri);
}

.upload-card h3 {
  margin-top: 0;
  font-size: 1.5rem;
  color: var(--pri-light);
  margin-bottom: 0.5rem;
}

.upload-desc {
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.upload-card input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  margin: 1rem 0;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 0.75rem;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-card input[type="file"]:hover {
  border-color: var(--pri);
  background: var(--bg-card);
}

/* Standardize file-select inner button to badge metrics */
.upload-card input[type="file"]::file-selector-button {
  padding: 0.45rem 0.9rem;              /* close to .transcript-badge */
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-right: 0.75rem;
  cursor: pointer;
}

.upload-card input[type="file"]::file-selector-button:hover {
  border-color: var(--pri);
}

.upload-card input[type="text"],
.upload-card select {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--fg);
  font-size: 1rem;
}

/* Upload page primary buttons should match standard .card button size */
#btnUploadFile,
#btnDownloadLink {
  width: auto;
  display: inline-block;
  padding: 0.5rem 1rem;                 /* same as .card button */
  background: linear-gradient(135deg, var(--pri-dark), var(--pri));
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: auto;                      /* push to bottom */
  align-self: flex-start;                /* prevent stretch in flex */
}

.live-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
}

.live-crop-panel {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.live-crop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.live-crop-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.live-crop-grid input[type="range"] {
  width: 100%;
}

.live-mic-panel {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(220px, 1fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}

.live-mic-toggle {
  color: var(--fg);
  font-size: 0.9rem;
}

.live-mic-device {
  display: grid;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.live-mic-device select {
  width: 100%;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--fg);
  padding: 6px 8px;
}

.live-mic-meter {
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.8);
  overflow: hidden;
}

.live-mic-meter__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
  transition: width 120ms linear;
}

#btnLiveStart.live-recording {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  border-color: #dc2626 !important;
  color: #fff !important;
  animation: liveRecPulse 0.85s steps(2, jump-none) infinite;
}

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

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-card-title {
  font-weight: 700;
  color: var(--fg);
}

.live-preview {
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: #020617;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.live-preview-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.live-crop-overlay {
  position: absolute;
  border: 2px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  pointer-events: none;
  z-index: 5;
}

.live-crop-enabled .live-preview-wrap {
  cursor: crosshair;
}

.live-recordings-empty {
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
}

.live-recordings-list {
  display: grid;
  gap: 8px;
}

.live-rec-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
}

.live-rec-meta {
  color: var(--fg-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.live-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(2, 6, 23, 0.6);
}

.live-viewer-panel {
  width: min(1200px, calc(100vw - 20px));
  height: min(86vh, calc(100vh - 30px));
  margin: 14px auto 0;
  background: #0b1220;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.live-viewer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-viewer-video {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 10px;
}

/* 📱 Responsive */
@media (max-width: 768px) {
  .brand { font-size: 1.25rem; }
  h2 { font-size: 1.5rem; }
  .card { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .controls { flex-direction: column; align-items: stretch; }
  nav { justify-content: center; }
  nav button.right { margin-left: 0; }
  
  .upload-container {
    grid-template-columns: 1fr;
  }

  .live-grid {
    grid-template-columns: 1fr;
  }

  .live-card {
    min-height: 320px;
  }

  .live-rec-item {
    grid-template-columns: 1fr;
  }

  .live-crop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-mic-panel {
    grid-template-columns: 1fr;
  }
}

/* 🎭 Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ✨ Loading Animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* 🧰 Tools Floater - ekranda daha rahat tıklanabilirlik ve üstte görünürlük */
#toolsFloater {
  position: fixed; /* JS konumlamasına uygun */
  z-index: 10001;  /* tooltip (9999) ve diğer katmanların üstünde */
  display: none;
  gap: 6px;
  padding: 6px 8px;            /* tıklama alanını genişlet */
  border-radius: 8px;
  background: rgba(20, 24, 35, 0.98);
  border: 2px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 20px rgba(0,0,0,0.55);
  pointer-events: auto;         /* tıklamayı yakala */
  display: inline-grid;
  grid-auto-flow: row;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr); /* eşit sütunlar, içerik taşımaz */
  width: fit-content;               /* genişliği içeriğe uydur */
  max-width: 90vw;                  /* ekranda taşmayı engelle */
  align-items: stretch;             /* hücreler dikeyde gerilsin */
  justify-items: stretch;           /* grid öğeleri hücreyi doldursun */
  overflow: visible;                /* içerik kenarlıkta kırpılmasın */
}

/* Floater içindeki butonlar için eşit kolonlu sarıcı */
#toolsFloater .floater-actions{
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 6px;
  width: 100%;
}

#toolsFloater button {
  min-width: 0;                    /* taşmayı engelle, eşitlenmeye izin ver */
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 6px;
  box-sizing: border-box;          /* genişlik hesabı tutarlı olsun */
  margin: 0;                       /* dış boşluk yok */
}

/* Floater içindeki metin göstergesi tam görünsün, satır kırabilsin */
#toolsFloater .accum-info{
  grid-column: 1 / -1;           /* tam genişlik */
  grid-row: 1;                   /* ilk sıra */
  display: block;                /* satırı tamamen kaplasın */
  width: 100%;                   /* grid genişliğini kullan */
  white-space: nowrap;           /* varsayılan: tek satır */
  max-width: 90vw;
  color: var(--fg);
  font-size: 12px;
  line-height: 1.25;
  margin-bottom: 4px;
  text-overflow: clip;           /* ellipsis kullanma */
  overflow: visible;             /* metni kesme */
}

/* Mobilde göstergenin sonu kırpılmasın: satır kırmaya izin ver */
@media (max-width: 768px){
  #toolsFloater .accum-info{
    white-space: normal;         /* çok uzunsa sar */
    overflow-wrap: anywhere;     /* kelime içi kırılabilir */
    word-break: break-word;      /* uzun rakam/timestamp kırılabilsin */
    font-size: 13px;             /* okunabilirlik */
    line-height: 1.3;
  }
}

/* Araçlar ve Parça Oluştur butonlarını aynı ölçüye getir */
#toolsFloater .floater-actions .btn-tools,
#toolsFloater .floater-actions #btnFloaterCreatePart{
  width: 100%;                   /* hücre genişliğini doldur, taşma yok */
  height: 44px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;         /* sütunu tamamen kapla */
  align-self: stretch;           /* yüksekliği de hizala */
  max-width: none;               /* içeriğe göre genişleme yapma */
}

/* Sütun konumlarını açıkça sabitle (otomatik yerleşim sürpriz yapmasın) */
/* Sarıcı grid içinde sırayı zaten paylaşacaklar */

/* İki satırlı metin için küçük hizalama düzeltmesi */
#toolsFloater .twolines{ display:block; line-height: 1.1; }

/* Scroll-to-top floating button */
#scrollTopBtn{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 6mm;
  height: 6mm;
  border-radius: 999px;
  background: var(--pri);
  color: #fff;
  display: none;                 /* JS ile göster/gizle */
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 8px 16px rgba(59,130,246,0.35);
  z-index: 10010;
  border: none;
  cursor: pointer;
}
#scrollTopBtn:hover{ background: var(--pri-dark); }

/* 🎯 Clickable Words */
#clickableText {
  width: 100%;
  background: var(--bg-card);
  color: var(--fg);
  padding: 0 !important; /* Padding yok - sadece arka plan */
  font-size: 1rem;
  line-height: inherit;
  font-family: 'Consolas', 'Monaco', monospace;
  overflow-y: auto;
  border-radius: 0.3rem;
}

.word-clickable {
  position: relative;
  z-index: 10; /* overlay'in üstünde */
  display: inline-block; /* Arkaplan sadece kelime genişliğinde boyansın */
  cursor: pointer;
  padding: 0 !important; /* Padding yok - sadece arka plan */
  padding-right: 0 !important; /* Sağda boşluk uzatma */
  transition: none;
  will-change: background-color, color;
  line-height: inherit;
  border-radius: 0.3rem;
}

.word-clickable:hover {
  z-index: 20; /* hover vurgusu en üstte */
  background: rgba(59, 130, 246, 0.2);
  color: var(--pri-light);
  border-radius: 0.3rem;
  padding-right: 0 !important; /* Sağda boşluk uzatma */
}

/* 🎵 Aktif Kelime Vurgulama (Ses Senkronizasyonu) */
.word-clickable.active-playing {
  z-index: 30; /* sarı takip en üstte */
  background: #0093fb !important;
  color: #ffffff !important;
  padding: 0 !important; /* Padding yok - sadece arka plan */
  padding-right: 0 !important; /* Sağda boşluk uzatma */
  line-height: inherit;
  transition: none;
  will-change: background-color, color;
  border-radius: 0.3rem;
}

/* 🎬 Part Clickable Text Container */
#partClickableText {
  width: 100%;
  padding: 0 !important; /* Padding yok - sadece arka plan */
  padding-right: 0 !important; /* Sağda boşluk uzatma */
  background: var(--bg);
  color: var(--fg);
  line-height: inherit;
  font-family: 'Consolas', 'Monaco', monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-radius: 0.3rem;
}

/* 🎨 Part Container - Part'a ait kelime grupları */
.part-container {  
  display: inline-block;
  padding: 2px 0;
  transition: all 0.2s ease;
  line-height: inherit;
  vertical-align: baseline;
  border-radius: 0;
  background-clip: content-box; /* Boya sadece içerik alanında kalsın */
  position: relative;
  z-index: 5; /* overlay'in üstünde, kelimelerin altında */
}

/* 🟢 İlk Cümle Vurgusu (Start) */
.sentence-start {
  background: #00ff00 !important; /* Canlı yeşil */
  color: #000000 !important; /* Siyah yazı */
  font-weight: bold;
}

/* 🔴 Son Cümle Vurgusu (End) */
.sentence-end {
  background: #ff0000 !important; /* Canlı kırmızı */
  color: #ffffff !important; /* Beyaz yazı */
  font-weight: bold;
}

/* 🎯 Hover Tooltip Buton Bar (İki Satır) - MOUSE YAKININDA */
.word-tooltip {
  position: fixed !important; /* Ekrana göre sabit (scroll sorunu yok) */
  /* left ve top JavaScript'ten dinamik gelecek */
  background: rgba(20, 24, 35, 0.98); /* Koyu, neredeyse opak */
  border: 2px solid rgba(59, 130, 246, 0.5); /* Mavi border */
  border-radius: 0.5rem;
  padding: 0.8rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); /* Daha belirgin gölge */
  backdrop-filter: blur(10px); /* Arka plan bulanıklığı */
  z-index: 9999 !important; /* En üstte */
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  transition: left 0.1s ease, top 0.1s ease; /* Yumuşak geçiş */
}

.word-tooltip.show {
  display: flex;
}

.word-tooltip-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
}

/* 4. satır (Sil butonu) sol hizalama */
.word-tooltip-row-delete {
  justify-content: flex-start !important;
}

.word-tooltip button {
  padding: 0.5rem;
  border: none;
  border-radius: 0.3rem;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-tooltip button:hover {
  background: var(--pri-light);
  transform: scale(1.05);
}

/* Hız/Volüm Değer Göstergesi */
.speed-value {
  font-size: 0.75rem;
  color: var(--fg);
  min-width: 40px;
  text-align: center;
  padding: 0.3rem;
  background: transparent;
  border-radius: 0;
}

/* Global Part Search Card (fullView altında) */
#fullView #player{
  margin-bottom: 0; /* Player ile arama kartı arasındaki boşluğu sıfırla */
}

.part-search-card{
  margin-top: 0;              /* Player'a yapışık olsun */
  margin-bottom: 0.5rem;      /* Altta hafif nefes alanı */
  padding: 0.5rem 0.75rem;    /* Diğer kartlarla uyumlu, kompakt padding */
}

.part-search-card .search-bar-container{
  margin-top: 0;              /* Ekstra üst boşluk olmasın */
}

/* Buton Grupları (Çerçeveli) */
.button-group {
  display: flex !important;
  gap: 0.3rem;
  align-items: center;
  border: 2px solid rgba(59, 130, 246, 0.6) !important; /* Daha belirgin */
  border-radius: 0.5rem;
  padding: 0.4rem;
  background: rgba(59, 130, 246, 0.15) !important; /* Daha belirgin */
}

.button-group.danger {
  border-color: rgba(239, 68, 68, 0.8) !important;
  background: rgba(239, 68, 68, 0.15) !important;
}

/* Düzelt Popup (Ekran Ortası) */
.edit-popup {
  position: fixed !important; /* Ekrana göre sabit */
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: rgba(20, 24, 35, 0.98); /* Koyu, neredeyse opak */
  border: 2px solid rgba(59, 130, 246, 0.5); /* Mavi border */
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); /* Daha belirgin gölge */
  backdrop-filter: blur(10px); /* Arka plan bulanıklığı */
  z-index: 10000 !important; /* Tooltip'ten üstte */
  display: none;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 250px;
}

.edit-popup.show {
  display: flex;
}

.edit-popup label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--fg);
}

.edit-popup input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.9rem;
}

.edit-popup button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 0.3rem;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.edit-popup button:hover {
  background: var(--pri-light);
  transform: scale(1.02);
}

.telegram-message-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: stretch;
}

.telegram-message-main {
  min-width: 0;
}

.telegram-message-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
}

.telegram-message-actions button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.telegram-message-link {
  text-align: center;
  margin-top: 2px;
}

@media (max-width: 920px) {
  .telegram-message-card {
    grid-template-columns: 1fr;
  }

  .telegram-message-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .telegram-message-actions button {
    width: auto;
    min-width: 160px;
  }

  .telegram-message-link {
    width: 100%;
    text-align: left;
  }
}

/* 🔍 Video Header + Search Bar */
.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(20, 24, 35, 0.95);
  border-bottom: 2px solid rgba(59, 130, 246, 0.5);
  gap: 1rem;
  flex-wrap: wrap;
}

.video-header h2 {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.search-bar-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

#searchInput {
  width: 250px;
  padding: 0.5rem 0.75rem;
  border: 2px solid rgba(59, 130, 246, 0.5);
  border-radius: 0.375rem;
  background: rgba(30, 34, 45, 0.9);
  color: #e2e8f0;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

#searchInput:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.8);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: rgba(59, 130, 246, 1);
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: rgba(100, 116, 139, 0.8);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(100, 116, 139, 1);
  transform: translateY(-1px);
}

.btn-nav {
  padding: 0.5rem 0.75rem;
  background: rgba(59, 130, 246, 0.6);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

.btn-nav:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.9);
  transform: scale(1.05);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.search-results {
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

/* 🟠 Turuncu Vurgu (Tüm Eşleşenler) */
.word-highlight-search-all {
  background-color: #ff9800 !important;
  color: #000 !important;
  font-weight: bold;
  border-radius: 3px;
  padding: 2px 0; /* Yalnızca dikey padding, yatay padding yok -> trailing space boyanmaz */
}

/* 🟡 Sarı Vurgu (Aktif) */
.word-highlight-search-active {
  background-color: #ffeb3b !important;
  color: #000 !important;
  font-weight: bold;
  border-radius: 3px;
  padding: 2px 0; /* Yalnızca dikey padding, yatay padding yok -> trailing space boyanmaz */
  animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* 🔍 Arama Popup */
.search-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 24, 35, 0.98);
  border: 2px solid rgba(59, 130, 246, 0.6);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  min-width: 350px;
}

/* Global parça arama paneli ve önizleme, tooltip ve diğer overlay'lerin HER ZAMAN üstünde olsun */
#partSearchPanel,
#partPreviewPopup {
  z-index: 10020 !important;
}

/* Inline global parça arama sonucu listesi */
.part-search-inline-list {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.part-search-inline-row {
  margin-bottom: 0.25rem;
}

.part-search-inline-btn {
  width: 100%;
  text-align: left;
}

/* Inline parça önizleme kutusu */
.part-preview-inline {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  max-height: 40vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.search-popup.show {
  display: block;
}

.search-popup h3 {
  margin: 0 0 1rem 0;
  color: #e2e8f0;
  font-size: 1.25rem;
}

.search-popup input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid rgba(59, 130, 246, 0.5);
  border-radius: 0.375rem;
  background: rgba(30, 34, 45, 0.9);
  color: #e2e8f0;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.search-popup input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.popup-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.popup-buttons button {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

/* Danger button-group */
.button-group.danger {
  border-color: rgba(239, 68, 68, 0.8) !important;
  background: rgba(239, 68, 68, 0.15) !important;
}

/* 🔍 Arama Navigasyon Barı (Ekran Ortası - Sabit) */
.search-nav-bar {
  position: fixed;
  left: 50%; /* Yatayda ortala */
  top: calc(50% + 25px); /* Ortanın 25px altı */
  transform: translateX(-50%); /* Tam ortala */
  background: rgba(20, 24, 35, 0.95);
  border: 2px solid rgba(255, 152, 0, 0.8); /* Turuncu border */
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  display: none; /* Başlangıçta gizli */
  gap: 0.75rem;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  backdrop-filter: blur(10px);
}

.search-nav-bar.show {
  display: flex;
}

.nav-btn {
  padding: 0.4rem 0.8rem;
  background: rgba(59, 130, 246, 0.8);
  color: white;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 1);
  transform: scale(1.1);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-counter {
  color: #ffeb3b; /* Sarı */
  font-weight: bold;
  font-size: 0.95rem;
  min-width: 50px;
  text-align: center;
}

.nav-close {
  padding: 0.4rem 0.8rem;
  background: rgba(239, 68, 68, 0.8);
  color: white;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-close:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.05);
}

/* 📊 Progress Bar System */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.loading-content h3 {
  text-align: center;
  color: var(--fg);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* Progress Steps Container */
.progress-steps {
  width: 100%;
  margin: 20px 0;
}

/* Single Step */
.progress-step {
  margin-bottom: 1.5rem;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.progress-step.active {
  opacity: 1;
}

.progress-step.completed {
  opacity: 1;
}

/* Step Header */
.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.step-icon {
  font-size: 1.2rem;
  margin-right: 0.5rem;
  min-width: 30px;
}

.step-title {
  flex: 1;
  font-weight: 500;
  color: var(--fg);
}

.step-percent {
  font-weight: bold;
  color: var(--pri);
  min-width: 50px;
  text-align: right;
  font-size: 1rem;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.4s ease;
  border-radius: 14px;
  position: relative;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Animated Stripes */
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.1) 10px,
    rgba(255, 255, 255, 0.1) 20px
  );
  animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

/* Completed State */
.progress-step.completed .progress-fill {
  background: linear-gradient(90deg, #10b981, #059669);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.progress-step.completed .step-icon {
  filter: grayscale(0);
}

.progress-step.completed .step-percent {
  color: var(--ok);
}

/* Active State */
.progress-step.active .step-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Total Progress */
.total-progress {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

#totalPercent {
  font-weight: bold;
  color: var(--pri);
  font-size: 1.1rem;
}

#estimatedTime {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* FULL sayfada odak alanı vurgulama */
#clickableText.full-dim .word-clickable:not(.within-focus) {
  opacity: .3;
  filter: saturate(.6);
  transition: opacity .15s ease, filter .15s ease;
}

#clickableText.full-dim .word-clickable.within-focus {
  opacity: 1 !important;
  filter: none !important;
  position: relative;
}

/* (opsiyonel) odak bloğunun kenarlarına ince kılavuz çizgiler */
#clickableText.full-dim .word-clickable.within-focus.first-in-block::before,
#clickableText.full-dim .word-clickable.within-focus.last-in-block::after {
  content: '';
  position: absolute;
  top: -2px; bottom: -2px;
  width: 0;
  border-left: 1px dashed #f59e0b;
}
#clickableText.full-dim .word-clickable.within-focus.first-in-block::before { left: -2px; }
#clickableText.full-dim .word-clickable.within-focus.last-in-block::after  { right: -2px; }



/* Mobile-friendly scroll behavior */
.scroll-section {
  -webkit-overflow-scrolling: touch;
}

/* Tablet and down */
@media (max-width: 768px) {
  header { padding: 0.5rem; }
  .brand { font-size: 1.25rem; }
  h2 { font-size: 1.35rem; }

  nav { display: flex; flex-wrap: wrap; gap: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  nav button { font-size: 0.9rem; padding: 0.45rem 0.6rem; }
  nav button.right { margin-left: 0; }

  #sourcesScroll, #mineScroll { max-height: calc(50vh - 80px); overflow: auto; -webkit-overflow-scrolling: touch; }

  .cards { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
  .card { flex-direction: column; align-items: stretch; gap: 0.75rem; padding: 0.9rem; }
  .card b { font-size: 1rem; }
  .card .meta { font-size: 0.85rem; }
  .card button { font-size: 0.9rem; padding: 0.45rem 0.6rem; margin-left: 0; }

  .controls { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .controls label { font-size: 0.9rem; }
  .controls input { font-size: 0.95rem; padding: 0.4rem 0.55rem; }
  .controls button { font-size: 0.9rem; padding: 0.5rem 0.8rem; }

  #player, #partsPlayer, #videoCutter { margin: 1rem 0; }
  textarea#fullText { min-height: 35vh; max-height: 55vh; }

  .search-bar-container { gap: 0.4rem; }
  .search-bar-container input[type="text"] { width: 100%; max-width: 320px; font-size: 0.95rem; padding: 0.45rem 0.6rem; }
  .btn-primary, .btn-secondary, .btn-nav, button { min-height: 36px; }

  .upload-container { grid-template-columns: 1fr; }

  /* Allow tooltip on mobile when .show is present and keep it within viewport */
  .word-tooltip { max-width: 92vw; left: 50% !important; right: auto !important; transform: translate(-50%, 0) scale(0.9); }
  .word-tooltip.show { display: flex !important; }
  .word-tooltip button { min-width: 36px; height: 36px; font-size: 1rem; }

  /* Tighter cards/buttons for mobile */
  .cards { gap: 0.45rem; }
  .card { padding: 0.65rem; }
  .card b { font-size: 0.92rem; }
  .card .meta { font-size: 0.8rem; }
  .card button { font-size: 0.82rem; padding: 0.32rem 0.5rem; }
  .transcript-badge { font-size: 0.8rem; padding: 0.35rem 0.6rem; }

  /* Parts list compaction */
  .parts { gap: 0.5rem; padding: 0.75rem; }
  .parts .row { padding: 0.6rem; }
  .parts .row b { font-size: 0.95rem; }
  .card-btn { font-size: 0.78rem; padding: 0.3rem 0.45rem; }
  

  /* Hide page-top search bar only on Full Text view (tooltip search remains) */
  #fullView .video-header .search-bar-container { display: none !important; }
  #fullView .video-header { padding: 0.75rem; }

  /* Hide Kelime Düzelt (btnGlossAdd) and Cümleleri Vurgula (btnHighlightSentences) on mobile */
  #fullView #btnGlossAdd,
  #fullView #btnHighlightSentences { display: none !important; }

  /* Compact Pad Ön/Son controls (first controls block in Full Text) */
  #fullView .controls:first-of-type {
    padding: 0.5rem;
    gap: 0.4rem;
    flex-wrap: nowrap;              /* tek satır */
    overflow-x: auto;               /* taşarsa yatay kaydır */
    -webkit-overflow-scrolling: touch;
    align-items: center;
  }
  #fullView .controls:first-of-type label {
    font-size: 0.9rem;
    gap: 0.4rem;
  }
  #fullView #padPre, #fullView #padPost {
    font-size: 0.88rem;
    padding: 2px 8px;
    width: 80px; /* daha dar numeric inputs */
  }
  #fullView #selInfo {
    padding: 1px 8px;
    font-size: 0.88rem;
    border-radius: 6px;
    line-height: 1.2;
  }

  /* Hide wrong/right inputs and their labels on Full Text (mobile) */
  #fullView label:has(#wrongWord),
  #fullView label:has(#rightWord),
  #fullView #wrongWord,
  #fullView #rightWord { display: none !important; }

  /* Global: slightly smaller cards across pages */
  .card { padding: 0.55rem; }
  .card b { font-size: 0.9rem; }
  .card .meta { font-size: 0.78rem; }
  .card button { font-size: 0.78rem; padding: 0.28rem 0.45rem; }
  .upload-card { padding: 1.25rem; }
  .upload-card h3 { font-size: 1.2rem; }
  .parts .row { padding: 0.55rem; }
}

/* Small phones */
@media (max-width: 640px) {
  /* Layout safety: box sizing + prevent horizontal drift */
  *, *::before, *::after { box-sizing: border-box; }
  .view { width: 100%; }
  input, select, textarea { max-width: 100%; }
  .cards, .parts { overflow: visible; }

  /* Selection/action bars should wrap on phones */
  #selectionBar { display: flex; flex-wrap: wrap; gap: .5rem; }
  #selectionBar button { flex: 1 1 calc(50% - .5rem); min-width: 140px; }
  @media (max-width: 400px) { #selectionBar button { flex: 1 1 100%; min-width: 0; } }

  /* Full view clickable text container safe width */
  #fullView #clickableText { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }

  /* Badges and inline meta should wrap */
  .badge, .meta { white-space: normal; overflow-wrap: anywhere; }

  /* Uzun dosya adları: ellipsis (…) */
  #sourcesList .card b,
  #kontrolMainList .card b,
  #kontrolSubList .card b,
  #mineList .card b,
  #jobsUnifiedList .row b,
  #partsList .row b,
  #partsView h3,
  #videoTitle {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Flex satırlarda ellipsis çalışsın diye min-width:0 */
  #jobsUnifiedList .row > div:first-child,
  #partsList .row > div:first-child,
  #sourcesList .card,
  #mineList .card { min-width: 0; }

  /* Global: prevent horizontal scroll and add comfortable spacing */
  html, body { overflow-x: hidden; }
  main { padding: 0.5rem; }
  header nav { flex-wrap: wrap; gap: .35rem; }
  header nav .tab, header nav .create, header nav .right, header nav .danger { flex: 1 1 auto; }

  /* Search bars become full-width under headers */
  .video-header { gap: .5rem; }
  .video-header .search-bar-container { width: 100%; display: flex; gap: .5rem; }
  .video-header .search-bar-container input { flex: 1; min-width: 0; }

  /* Cards lists: single column stacks */
  #sourcesList.cards, #mineList.cards, #jobsUnifiedList.cards, #partsList.parts {
    display: grid;
    grid-template-columns: 1fr;
    gap: .6rem;
  }

  /* Sources + Mine scroll areas: reduce height and avoid overflow */
  #sourcesView .scroll-section, #mineScroll.scroll-section { max-height: 45vh; }

  /* Upload view: stack cards */
  #uploadView .upload-container { display: flex; flex-direction: column; gap: .75rem; }
  #uploadView .upload-card { width: 100%; }

  /* Jobs unified list: ensure rows/actions wrap and visible */
  #jobsUnifiedList .row { display: flex; flex-direction: column; gap: .5rem; }
  #jobsUnifiedList .row > div:last-child { display: flex; flex-wrap: wrap; gap: .5rem; }
  #jobsUnifiedList .row .card-btn { flex: 1 1 calc(50% - .5rem); min-width: 140px; }

  /* Jobs header search responsive (already uses video-header) */
  .video-header { gap: .5rem; }
  .video-header .search-bar-container { width: 100%; display: flex; gap: .5rem; }
  .video-header .search-bar-container input { flex: 1; min-width: 0; }

  /* Parts list: stack rows and make buttons visible & tappable */
  #partsView #partsList { overflow: visible; }
  #partsView #partsList .row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  #partsView #partsList .row > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }
  #partsView #partsList .row .card-btn {
    flex: 1 1 calc(50% - .5rem);
    min-width: 140px;
  }
  /* If very narrow, make buttons full width */
  @media (max-width: 400px) {
    #partsView #partsList .row .card-btn { flex: 1 1 100%; min-width: 0; }
  }

  /* Part detail card: ensure action bar wraps and stays visible under video */
  #partsView .cards > div { overflow: visible; }
  #partsView video, #partsView audio { width: 100%; max-height: 52vh; }
  #partsView { padding-bottom: 72px; }

  /* Touch target sizing */
  button, .card-btn, .tab { min-height: 44px; }

  /* =============================
     Video Cut (Responsive Tweaks)
     ============================= */
  #videoCutView { padding-bottom: 72px; }
  #videoCutView #videoCutter { width: 100%; max-height: 52vh; background: var(--bg-card); border-radius: 12px; }
  #videoCutView .controls { 
    display: flex; 
    flex-wrap: wrap; 
    gap: .5rem; 
    align-items: stretch;
  }
  #videoCutView .controls label { 
    flex: 1 1 100%; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    gap: .5rem;
  }
  #videoCutView .controls label input { 
    flex: 1 1 auto; 
    min-width: 0; 
    width: 100%;
  }
  #videoCutView .controls button { 
    flex: 1 1 calc(50% - .5rem); 
    min-width: 140px; 
  }
  /* Very small phones: make buttons full width */
  @media (max-width: 400px) {
    #videoCutView .controls button { flex: 1 1 100%; min-width: 0; }
  }

  /* =============================
     Full View (Tam Metin) Mobile
     ============================= */
  #fullView { padding-bottom: 72px; }
  #fullView #player { width: 100%; max-height: 52vh; }
  #fullView .controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
  #fullView .controls label { display:flex; align-items:center; gap:.35rem; }
  #fullView #fullText { width: 100%; min-height: 46vh; }
  #fullView #selectionBar { position: sticky; top: 0; z-index: 50; }

  /* =============================
     Parts View (Parçalar) Mobile
     ============================= */
  #partsView { padding-bottom: 72px; }
  #partsView #partsTitle { margin-top: .25rem; }
  #partsView .parts .row { display: flex; flex-direction: column; gap: .5rem; }
  #partsView .parts .row .meta { line-height: 1.3; }
  #partsView .parts .row .card-btn { min-width: 140px; }
}

@media (max-width: 480px) {
  .brand { font-size: 0.95rem; }
  nav button { font-size: 0.75rem; padding: 0.28rem 0.42rem; }
  .card button { font-size: 0.78rem; padding: 0.28rem 0.42rem; }
  .search-bar-container button { font-size: 0.78rem; padding: 0.28rem 0.42rem; }
  .card { padding: 0.6rem; }
  .card b { font-size: 0.9rem; }
  .parts .row { padding: 0.6rem; }
  .card-btn { font-size: 0.78rem; padding: 0.3rem 0.45rem; }
  #sourcesScroll, #mineScroll { max-height: calc(45vh - 70px); }

  /* Extra compact for small phones */
  #fullView .controls:first-of-type { padding: 0.45rem; gap: 0.35rem; }
  #fullView .controls:first-of-type label { font-size: 0.82rem; gap: 0.3rem; white-space: nowrap; }
  #fullView #padPre, #fullView #padPost { font-size: 0.82rem; padding: 0.22rem 0.35rem; width: 72px; }
  #fullView #selInfo { font-size: 0.82rem; padding: 0.28rem 0.45rem; }

  /* Extra: smaller cards on small phones */
  .card { padding: 0.5rem; }
  .card b { font-size: 0.88rem; }
  .card button { font-size: 0.75rem; padding: 0.25rem 0.38rem; }
  .parts .row { padding: 0.5rem; }
}

/* --- Değişim işaretleri --- */
.hl-change {            /* eflatun zemin: düzenlenen veya eklenen kelimeler */
  background: #6200ff;
  border-radius: 4px;
  padding: 0 2px;
}

.hl-pivot {             /* silmede: boşluğun sağ/solundaki eflatunlu komşu kelimeler */
  background: #6200ff;
  border-radius: 4px;
  padding: 0 2px;
}

/* Silmede: SAĞ kelimenin BAŞINDAKİ doğal boşluğu sarı şerit olarak boyar (layout değiştirmez) */
.hl-gap-before {
  position: relative;          /* pseudo için referans */
}
.hl-gap-before::before{
  content: "";
  position: absolute;
  /* Tipik word spacing ~0.35em; metne taşmadan boşluk bölgesine bindiriyoruz */
  left: -0.55em;               /* boşluk bölgesine taş */
  width: 0.55em;               /* sarı şerit genişliği */
  top: 0;
  bottom: 0;
  background: #ffe600;         /* sarı */
  border-radius: 2px;
  pointer-events: none;        /* tıklama davranışını bozmaz */
  z-index: 0;                  /* metnin arkasında kalsın */
}

/* === Araçlar floater (mavi kapsül) === */
#toolsFloater{
  display: grid;                /* üst sıra: butonlar; alt sıra: gösterge */
  grid-template-columns: 1fr auto;
  grid-auto-rows: auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 6px;
  padding: 6px 8px;
  background: #2563eb;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
  z-index: 60;
}

/* Floater içindeki tüm butonlar: aynı yükseklik/ölçü */
#toolsFloater button{
  height: 30px;          /* ↓ yeşil butonla aynı yükseklik */
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.05;
  transition: transform .08s ease, filter .08s ease, opacity .08s ease;
}
#toolsFloater button:active{ transform: scale(0.98); }

/* Grid konumlandırma: Araçlar sol, Parça Oluştur sağ, gösterge altta tam genişlik */
#toolsFloater .btn-tools{ grid-column: 1; grid-row: 1; }
#btnFloaterCreatePart{ grid-column: 2; grid-row: 1; }
#toolsFloater .accum-info{ grid-column: 1 / span 2; grid-row: 2; }

/* "Araçlar" butonu: bordo ton ve gerçek buton görünümü */
#toolsFloater .btn-tools{
  background: #b91c1c !important;  /* açık bordo */
  color: #fff !important;
  border: 1.5px solid rgba(255,255,255,.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  min-width: 74px;               /* yeşil ile hizalı */
  text-align: center;
}
#toolsFloater .btn-tools:hover{ 
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,.22), inset 0 0 0 1px rgba(0,0,0,.06);
}
#toolsFloater .btn-tools:active{
  transform: translateY(0) scale(0.98);
  filter: brightness(0.95);
}

/* Yeşil "Parça Oluştur": dar, iki satır ortalı */
#btnFloaterCreatePart{
  background: #22c55e !important;
  color: #fff !important;
  width: 74px;
  min-width: 74px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.05;
  font-size: 12px;
  border: 1.5px solid rgba(255,255,255,.35);   /* mavi zeminde buton hissi için hafif beyaz kenar */
  border-radius: 10px;
}
#btnFloaterCreatePart:hover{ 
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,.22), inset 0 0 0 1px rgba(0,0,0,.06);
}
#btnFloaterCreatePart:active{ transform: translateY(0) scale(0.98); filter: brightness(0.95); }

/* Birikim bilgisi - floater içi */
#toolsFloater .accum-info{
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.85;
  color: var(--fg, #f1f5f9);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
  align-self: center;
  text-align: center;
}

/* --- Notlar modalı --- */
.notes-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.65);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.notes-modal{
  width: min(960px, 96vw);
  max-height: 80vh;
  background:#0f172a;
  border-radius:12px;
  box-shadow:0 18px 40px rgba(0,0,0,0.6);
  padding:16px 18px;
  display:flex;
  flex-direction:column;
  gap:10px;
  border:1px solid #1f2937;
}

.notes-modal-title{
  font-size:14px;
  font-weight:600;
  color:#f9fafb;
  margin-bottom:4px;
  word-break:break-all;
}

.notes-modal-list{
  max-height:160px;
  overflow-y:auto;
  background:#020617;
  border-radius:8px;
  padding:8px 10px;
  border:1px solid #111827;
}

.notes-line{
  font-size:12px;
  color:#e5e7eb;
  padding:2px 0;
  border-bottom:1px dashed rgba(55,65,81,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-line:last-child{
  border-bottom:none;
}

@media (max-width: 900px){
  .notes-line{
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

.notes-empty{
  font-size:12px;
  color:#9ca3af;
}

.notes-modal-input{
  min-height:70px;
  max-height:120px;
  resize:vertical;
  width:100%;
  box-sizing:border-box;
  border-radius:8px;
  border:1px solid #374151;
  background:#020617;
  color:#e5e7eb;
  padding:8px 10px;
  font-size:13px;
}

.notes-modal-input:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow:0 0 0 1px rgba(59,130,246,0.5);
}

.notes-modal-buttons{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:4px;
}

.notes-btn{
  border:none;
  border-radius:999px;
  padding:6px 14px;
  font-size:12px;
  cursor:pointer;
}

.notes-btn-primary{
  background:#3b82f6;
  color:#ffffff;
}

.notes-btn-primary:hover{
  background:#2563eb;
}

.notes-btn-secondary{
  background:#111827;
  color:#e5e7eb;
}

.notes-btn-secondary:hover{
  background:#1f2937;
}


