/* ============================================
   🎨 dk.llyric — Design System (iStore Style)
   ============================================ */
:root {
  --bg-color: #0b0b0f;
  --card-bg: #16161c;
  --text-color: #ffffff;
  --subtext-color: #8e8e93;
  --accent: #0a84ff;
  --accent2: #0062d2;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(22, 22, 28, 0.72);
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-2xl: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ============================================
   🌫️ الخلفية المبلورة
   ============================================ */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: #1a0a05;
}
.ambient-bg::before {
  content: '';
  position: absolute;
  inset: -60px;
  background-image: var(--ambient-image, url('https://images.unsplash.com/photo-1514525253161-7a46d19cd819?w=1200&q=80'));
  background-size: cover;
  background-position: center;
  filter: blur(60px) saturate(160%) brightness(0.4);
  transform: scale(1.3);
  opacity: 0.9;
  transition: background-image 0.5s ease;
}
.ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,11,15,0.4), rgba(11,11,15,0.9));
}

/* ============================================
   🔝 Top Bar
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 15, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.topbar-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-back:active { transform: scale(0.9); }
.topbar-back svg { width: 20px; height: 20px; }

.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: -0.2px;
}

.topbar-action {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.4);
}
.topbar-action:active { transform: scale(0.9); }
.topbar-action svg { width: 18px; height: 18px; fill: #fff; }

/* ============================================
   👁️ Preview Area (المعاينة المباشرة)
   ============================================ */
.preview-area {
  padding: 20px 16px;
  display: flex;
  justify-content: center;
}

.preview-card {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  background: rgba(20, 15, 12, 0.55);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-cover {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a1a24, #0b0b0f);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}
.preview-header-text {
  flex: 1;
  min-width: 0;
}
.preview-song {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.preview-artist {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.preview-lyrics {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 4px;
}
.preview-lyric-line {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.5;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.preview-footer svg { width: 16px; height: 16px; fill: #fff; opacity: 0.9; }
.preview-footer span {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

/* ============================================
   📋 Editor Content
   ============================================ */
.editor-content {
  padding: 0 16px 40px;
  max-width: 500px;
  margin: 0 auto;
}

.editor-section {
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.editor-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--subtext-color);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-section-title svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2.2;
}

/* ============================================
   📤 Upload Button
   ============================================ */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: rgba(10, 132, 255, 0.08);
  border: 1.5px dashed rgba(10, 132, 255, 0.4);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-btn:active {
  transform: scale(0.98);
  background: rgba(10, 132, 255, 0.15);
}
.upload-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
}

.upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 10px;
}
.upload-preview img {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.upload-preview-info {
  flex: 1;
  min-width: 0;
}
.upload-preview-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-preview-meta {
  font-size: 11px;
  color: var(--subtext-color);
  margin-top: 2px;
}
.upload-preview-remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.3);
  color: #ff453a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: bold;
  font-family: inherit;
}

/* ============================================
   ✏️ Inputs
   ============================================ */
.editor-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-color);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}
.editor-input:last-child { margin-bottom: 0; }
.editor-input:focus {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.05);
}
.editor-input::placeholder {
  color: var(--subtext-color);
  opacity: 0.7;
}

/* ============================================
   📝 Lyrics Rows
   ============================================ */
.lyric-row {
  display: grid;
  grid-template-columns: 1fr 70px 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.lyric-text-input,
.lyric-time-input {
  padding: 12px 12px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  width: 100%;
}
.lyric-time-input {
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.lyric-text-input:focus,
.lyric-time-input:focus {
  border-color: var(--accent);
}
.lyric-remove-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 69, 58, 0.12);
  border: 1px solid rgba(255, 69, 58, 0.25);
  color: #ff453a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  font-family: inherit;
}

.add-lyric-btn {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.add-lyric-btn:active { transform: scale(0.98); }

/* ============================================
   🎵 Audio Player
   ============================================ */
.audio-player {
  width: 100%;
  margin-top: 10px;
  filter: invert(1) hue-rotate(180deg);
  opacity: 0.9;
}

/* ============================================
   ⚠️ Utilities
   ============================================ */
.hidden { display: none !important; }

/* ============================================
   📱 Mobile
   ============================================ */
@media (max-width: 380px) {
  .editor-content { padding: 0 12px 40px; }
  .editor-section { padding: 14px; }
  .preview-card { max-width: 230px; }
  .lyric-row { grid-template-columns: 1fr 60px 32px; }
}
/* ============================================
   🏠 Home Page Specific Styles
   ============================================ */

/* الهيدر - الشعار */
.brand-logo {
  width: 100%;
  text-align: center;
  padding: 4px 0;
}
.brand-text {
  font-family: 'Inter', 'Cairo', sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1.2px;
  line-height: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
}
.brand-dk { color: #ffffff; }
.brand-dot { color: var(--accent); margin: 0 1px; }
.brand-lyric {
  background: linear-gradient(135deg, #0a84ff, #5ac8fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-tagline {
  font-size: 9px;
  font-weight: 800;
  color: var(--subtext-color);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 2px;
  text-align: center;
}

/* المحتوى الرئيسي */
.home-content {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* زر الدخول للمحرر */
.cta-area {
  width: 100%;
  text-align: center;
  margin: 24px 0 32px;
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #ffffff;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(10, 132, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.cta-btn:active {
  transform: scale(0.96);
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.5);
}
.cta-btn svg {
  width: 20px;
  height: 20px;
}
.cta-hint {
  font-size: 12px;
  color: var(--subtext-color);
  margin-top: 12px;
  font-weight: 600;
}

/* الميزات */
.features {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.feature-item {
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-item:active {
  transform: scale(0.97);
  border-color: rgba(10, 132, 255, 0.4);
}
.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.feature-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  fill: none;
}
.feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.feature-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: -0.2px;
}
.feature-desc {
  font-size: 10.5px;
  color: var(--subtext-color);
  font-weight: 500;
  line-height: 1.4;
}

/* الفوتر */
.home-footer {
  width: 100%;
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}
.home-footer p {
  font-size: 11px;
  color: var(--subtext-color);
  font-weight: 500;
  margin: 0;
}
.home-footer strong {
  color: var(--accent);
  font-weight: 800;
}
/* ============================================
   🎬 Editor — CapCut Style Bottom Nav
   ============================================ */

/* Body خاص بالمحرر */
.editor-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
}

/* منطقة المعاينة */
.editor-preview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 100px;
  overflow-y: auto;
}

.editor-preview-wrap .preview-card {
  max-width: 260px;
}

/* ============================================
   🎛️ Bottom Nav (القائمة العائمة)
   ============================================ */
.editor-nav {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(28, 28, 34, 0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 100;
  width: calc(100% - 32px);
  max-width: 420px;
}

.editor-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-width: 64px;
  height: 54px;
  background: none;
  border: none;
  border-radius: 22px;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.editor-nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  transition: transform 0.25s;
}

.editor-nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow:
    0 6px 18px rgba(10, 132, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.editor-nav-item:active svg {
  transform: scale(0.88);
}

/* ============================================
   📦 Bottom Sheet
   ============================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}
.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(22, 22, 28, 0.96);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 12px 20px calc(100px + env(safe-area-inset-bottom, 0px));
  max-height: 75vh;
  overflow-y: auto;
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}
.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  margin: 0 auto 18px;
}
.sheet-content {
  display: none !important;
}
.sheet-content.active {
  display: block !important;
  animation: sheetContentIn 0.3s ease;
}


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

.sheet-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-color);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

/* تعديل الـ inputs داخل الـ sheet */
.bottom-sheet .editor-input {
  margin-bottom: 10px;
}

/* تعديل المعاينة داخل editor */
.editor-body .ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
}

@media (max-width: 380px) {
  .editor-nav-item { min-width: 56px; font-size: 9.5px; }
  .editor-nav-item svg { width: 20px; height: 20px; }
}
/* ============================================
   🎞️ Lyric Timeline (CapCut Style)
   ============================================ */
.lyric-timeline-wrap {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  height: 0;
  overflow: hidden;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--border-color);
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}
.lyric-timeline-wrap.open {
  height: 110px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--subtext-color);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.timeline-header span:last-child {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 16px 8px;
  position: relative;
  scrollbar-width: none;
}
.timeline-scroll::-webkit-scrollbar { display: none; }

.timeline-track {
  display: flex;
  gap: 2px;
  min-height: 40px;
  position: relative;
  min-width: max-content;
}

.timeline-segment {
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.25), rgba(0, 98, 210, 0.25));
  border: 1.5px solid rgba(10, 132, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 40px;
  user-select: none;
  -webkit-user-select: none;
}
.timeline-segment.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(10, 132, 255, 0.6);
}
.timeline-segment .seg-resize {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 12px;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timeline-segment .seg-resize::after {
  content: '';
  width: 3px;
  height: 20px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 3px;
}

.timeline-playhead {
  position: absolute;
  top: 4px;
  bottom: 8px;
  width: 2px;
  background: #ff453a;
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(255, 69, 58, 0.8);
  z-index: 5;
  transition: left 0.05s linear;
}
.timeline-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff453a;
  box-shadow: 0 0 8px rgba(255, 69, 58, 0.8);
}

/* ============================================
   🔤 Font Controls
   ============================================ */
.font-group {
  margin-bottom: 18px;
}
.font-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--subtext-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.font-label span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.font-family-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.font-family-btn {
  padding: 12px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.font-family-btn.active {
  background: rgba(10, 132, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.font-family-btn:active { transform: scale(0.97); }

.font-slider {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.font-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.5);
}

.font-weight-row, .effect-row {
  display: flex;
  gap: 8px;
}
.font-weight-btn, .effect-btn {
  flex: 1;
  padding: 11px 8px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.font-weight-btn.active, .effect-btn.active {
  background: rgba(10, 132, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.color-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.color-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.color-btn.active {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.sheet-hint {
  font-size: 11.5px;
  color: var(--subtext-color);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* تعديل عرض المعاينة كي يطلع الـ timeline */
.editor-body .editor-preview-wrap {
  padding-bottom: 20px;
  transition: padding 0.3s;
}
.editor-body.timeline-open .editor-preview-wrap {
  padding-bottom: 130px;
}
.editor-body.timeline-open .preview-card {
  max-width: 200px;
}

/* تعديل الـ lyric inputs (بلا رقم) */
.lyric-row {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.lyric-time-input { display: none; }
/* ============================================
   🔧 FIX — Bottom Sheet Layout
   ============================================ */
.bottom-sheet {
  min-height: 200px;
  max-height: 70vh;
  padding: 12px 20px calc(90px + env(safe-area-inset-bottom, 0px));
}

.bottom-sheet .sheet-content.active {
  display: block !important;
  min-height: 100px;
  padding-bottom: 10px;
}

/* نخليو الـ text inputs مرئية بزاف */
.bottom-sheet .lyric-text-input,
.bottom-sheet .lyric-time-input {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  padding: 12px 14px;
  font-size: 14px;
  min-height: 44px;
}

.bottom-sheet .lyric-text-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
/* ============================================
   🎬 CapCut-Style Editor
   ============================================ */

.editor-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
}

/* ===== Topbar ===== */
.editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: rgba(11, 11, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}
.etb-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.etb-btn svg { width: 18px; height: 18px; }
.etb-title-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.etb-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.etb-chevron { width: 14px; height: 14px; flex-shrink: 0; }
.etb-badge {
  font-size: 11px;
  font-weight: 900;
  color: var(--accent);
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.3);
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.etb-export {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
  flex-shrink: 0;
}

/* ===== Preview Area ===== */
.preview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 8px;
  min-height: 0;
}
.preview-frame {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-card {
  width: 100%;
  height: 100%;
  background: rgba(20, 15, 12, 0.55);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  position: relative;
}
.preview-header { display: flex; align-items: center; gap: 10px; }
.preview-cover {
  width: 46px; height: 46px; border-radius: 11px;
  object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, #1a1a24, #0b0b0f);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}
.preview-header-text { flex: 1; min-width: 0; }
.preview-song {
  font-size: 13px; font-weight: 900; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.preview-artist {
  font-size: 10px; color: rgba(255, 255, 255, 0.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.preview-lyrics {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  position: relative;
}

/* ===== Lyric Element (قابل للسحب) ===== */
.lyric-element {
  position: relative;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.2s;
  max-width: 100%;
}
.lyric-element.selected {
  border-color: #ffd60a;
}
.lyric-element.dragging {
  cursor: grabbing;
}
.lyric-text {
  display: block;
  font-family: 'Cairo', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
  white-space: pre-wrap;
  word-break: break-word;
}

/* المقابض تاع السحب */
.lyric-handles {
  position: absolute;
  inset: -4px;
  display: none;
  pointer-events: none;
}
.lyric-element.selected .lyric-handles { display: block; }
.lyric-handles .lh {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffd60a;
  border: 1.5px solid #000;
  border-radius: 50%;
}
.lh-tl { top: 0; left: 0; }
.lh-tr { top: 0; right: 0; }
.lh-bl { bottom: 0; left: 0; }
.lh-br { bottom: 0; right: 0; }

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.preview-footer svg { width: 14px; height: 14px; fill: #fff; opacity: 0.9; }
.preview-footer span { font-size: 11px; font-weight: 700; color: #fff; }

/* ===== Playback Controls ===== */
.playback-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  flex-shrink: 0;
  gap: 8px;
}
.pc-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.pc-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.pc-btn svg polygon { fill: currentColor; stroke: none; }
.pc-time {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* ===== Timeline ===== */
.timeline-wrap {
  flex-shrink: 0;
  background: rgba(11, 11, 15, 0.6);
  border-top: 1px solid var(--border-color);
  padding-bottom: 76px;
  position: relative;
}
.timeline-ruler {
  display: flex;
  padding: 6px 12px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 100%;
}
.timeline-ruler::-webkit-scrollbar { display: none; }
.ruler-tick {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  flex-shrink: 0;
  gap: 2px;
}
.ruler-tick span {
  font-size: 9px;
  font-weight: 700;
  color: var(--subtext-color);
  font-variant-numeric: tabular-nums;
}
.ruler-tick i {
  display: block;
  width: 1px;
  height: 6px;
  background: var(--subtext-color);
  opacity: 0.5;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 12px 8px;
  position: relative;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y; /* ✅ يسمح بالسحب */
  cursor: grab;
}
.timeline-scroll:active {
  cursor: grabbing;
}
.timeline-scroll::-webkit-scrollbar { display: none; }

.timeline-tracks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: max-content;
  min-height: 100px;
}

.track {
  display: flex;
  gap: 2px;
  min-height: 42px;
  align-items: center;
  position: relative;
}

/* Track النص */
.track-text {
  min-height: 46px;
}
.text-segment {
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #bf5af2, #8e44ad);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  padding: 0 12px;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-width: 44px;
  flex-shrink: 0;
}
.text-segment.active {
  border-color: #ffd60a;
  box-shadow: 0 0 16px rgba(255, 214, 10, 0.5);
}
.text-segment .seg-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
}
.text-segment .seg-handle.left { left: -2px; }
.text-segment .seg-handle.right { right: -2px; }
.text-segment.active .seg-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
}

/* Track الصوت */
.track-audio {
  min-height: 46px;
}
.audio-segment {
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff2d92, #d63384);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  min-width: 200px;
  flex-shrink: 0;
  overflow: hidden;
}
.audio-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  overflow: hidden;
}
.audio-waveform span {
  width: 2px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 2px;
  flex-shrink: 0;
}
.audio-waveform span:nth-child(odd) { height: 14px; }
.audio-waveform span:nth-child(even) { height: 22px; }
.audio-waveform span:nth-child(3n) { height: 30px; }
.audio-waveform span:nth-child(4n) { height: 18px; }
.audio-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.audio-add-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.audio-add-btn svg { width: 20px; height: 20px; }

/* Playhead */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #ff453a;
  box-shadow: 0 0 10px rgba(255, 69, 58, 0.8);
  pointer-events: none;
  z-index: 20;
  transform: translateX(-50%);
}
.playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 6px;
  background: #ff453a;
  border-radius: 3px;
}

/* ===== Editor Nav ===== */
.editor-nav {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(28, 28, 34, 0.85);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  z-index: 100;
  width: calc(100% - 32px);
  max-width: 420px;
}

.editor-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  min-width: 60px;
  height: 54px;
  background: none;
  border: none;
  border-radius: 22px;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.editor-nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.editor-nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.5);
  transform: translateY(-2px);
}

/* ===== Bottom Sheet (نفس القديم) ===== */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(22, 22, 28, 0.96);
  backdrop-filter: blur(40px) saturate(180%);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 20px calc(90px + env(safe-area-inset-bottom, 0px));
  max-height: 70vh;
  overflow-y: auto;
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  margin: 0 auto 18px;
}
.sheet-content { display: none; }
.sheet-content.active { display: block; }
.sheet-title {
  font-size: 17px; font-weight: 900; color: #fff;
  margin-bottom: 14px;
}
.sheet-hint {
  font-size: 11.5px; color: var(--subtext-color);
  margin-bottom: 14px; line-height: 1.5;
}

/* Template Locked */
.template-locked {
  display: flex; justify-content: center; padding: 10px 0;
}
.template-thumb {
  width: 140px;
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--accent);
  text-align: center;
}
.tt-card-mini {
  aspect-ratio: 9/16;
  background: rgba(20,15,12,0.7);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tt-cover {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1a1a24, #0b0b0f);
}
.tt-info { text-align: center; }
.tt-title { display: block; font-size: 10px; font-weight: 900; color: #fff; }
.tt-artist { display: block; font-size: 8px; color: rgba(255,255,255,0.6); }
.tt-label { font-size: 10px; font-weight: 800; color: var(--accent); }
/* ============================================
   🔧 FIXES — v2 (User Select + Timeline LTR)
   ============================================ */

/* 1️⃣ منع تحديد النص */
* {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}
input, textarea {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* 2️⃣ الخط الزمني LTR (كيما CapCut) */
.timeline-ruler,
.timeline-scroll,
.timeline-tracks,
.track {
  direction: ltr !important;
}
/* النص داخل السطر يبقى RTL للعربية */
.text-segment,
.audio-label {
  direction: rtl;
}

/* 3️⃣ المقابض أكبر وأسهل للسحب */
.text-segment .seg-handle {
  width: 16px !important;
  top: -4px !important;
  bottom: -4px !important;
  background: transparent;
}
.text-segment .seg-handle.left { left: -6px !important; }
.text-segment .seg-handle.right { right: -6px !important; }
.text-segment.active .seg-handle::after {
  width: 3px !important;
  height: 22px !important;
  background: rgba(0, 0, 0, 0.6) !important;
}

/* 4️⃣ cursor عند السحب */
.text-segment {
  cursor: grab !important;
  touch-action: none;
}
.text-segment.dragging {
  cursor: grabbing !important;
  opacity: 0.9;
  z-index: 10;
}

/* 5️⃣ مؤشر الـ Long Press */
.text-segment.long-pressing {
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.5) !important;
}

/* 6️⃣ قسم التأثيرات الصوتية */
.audio-effects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.audio-effect-card {
  padding: 14px 10px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.audio-effect-card.active {
  background: rgba(10, 132, 255, 0.15);
  border-color: var(--accent);
}
.audio-effect-card:active { transform: scale(0.96); }
.audio-effect-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}
.audio-effect-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2.2;
}
.audio-effect-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 2px;
}
.audio-effect-desc {
  font-size: 10px;
  color: var(--subtext-color);
  font-weight: 500;
}

/* 7️⃣ Toggle للـ Fade */
.fade-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.fade-item {
  flex: 1;
  padding: 12px;
  background: rgba(11, 11, 15, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.fade-item.active {
  background: rgba(10, 132, 255, 0.15);
  border-color: var(--accent);
}
.fade-item-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 6px;
}
.fade-slider {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.fade-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.fade-value {
  font-size: 10px;
  color: var(--accent);
  font-weight: 800;
  text-align: center;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
@keyframes lyricFadeIn {
  from { opacity: 0; filter: blur(6px); transform: scale(0.95); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}
@keyframes lyricFadeOut {
  from { opacity: 1; filter: blur(0); }
  to { opacity: 0; filter: blur(6px); }
}
