/* ═══════════════════════════════════════════════════════════════════════
   Cutarr Design System  (immich-similar)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #0d0d0d;
  --panel:        #181818;
  --border:       #2a2a2a;
  --border-hover: #3a3a3a;
  --gold:         #c4963b;
  --gold-dim:     #8a6a2a;
  --blue:         #7a9ec9;
  --green:        #6b9e6b;
  --red:          #c96b6b;
  --text:         #e0e0e0;
  --text-dim:     #888;
  --text-muted:   #555;
  --font-serif:   'Georgia', 'Times New Roman', serif;
  --font-sans:    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Reset ─────────────────────────────────────────────────────────── */

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

html, body {
  /* Keep pull-to-refresh / overscroll navigation INSIDE the app:
     a pull-down at the top of a scrollable area must not reload the
     page or navigate away (mobile browsers). */
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Login (OAuth PIN flow) ─────────────────────────────────────────── */

.login-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.login-logo-img {
  height: 40px;
  width: auto;
  display: block;
}

.login-sub {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 36px;
}

.btn-plex-connect {
  font-size: 15px;
  padding: 12px 32px;
  background: var(--gold);
  color: #111;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: background 0.2s;
}

.btn-plex-connect:hover {
  background: #d4a84b;
}

.login-pin-code {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text);
  letter-spacing: 2px;
  margin-bottom: 12px;
  word-break: break-all;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
}

.login-pin-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.login-pin-link {
  display: inline-block;
  color: var(--blue);
  font-size: 16px;
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.2s;
}

.login-pin-link:hover {
  color: #a0c0e8;
}

.login-pin-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
}

.login-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: login-spin 0.8s linear infinite;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

.login-pin-error {
  margin-top: 16px;
  color: var(--red);
  font-size: 13px;
}

.login-pin-cancel {
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 18px;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.login-pin-cancel:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.login-error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-error-text {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Header ────────────────────────────────────────────────────────── */

header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 24px;
}

header h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  letter-spacing: 2px;
}

.header-logo {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-clip {
  color: #ffffff;
}

.brand-arr {
  color: var(--gold);
}

.search-row {
  flex: 1;
  max-width: 520px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-row input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-row input:focus {
  border-color: var(--gold-dim);
}

.search-row input::placeholder {
  color: var(--text-muted);
}

.search-row select {
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s;
  min-width: 150px;
}

.search-row select:focus {
  border-color: var(--gold-dim);
}

.search-row select option {
  background: var(--panel);
  color: var(--text);
}

/* ── Now Playing Banner ────────────────────────────────────────────── */

.now-playing-banner {
  background: linear-gradient(135deg, rgba(196, 150, 59, 0.15), rgba(196, 150, 59, 0.05));
  border-top: 1px solid var(--gold-dim);
  padding: 10px 24px;
}

.np-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.np-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  font-weight: 600;
}

.np-title {
  font-weight: 600;
  color: var(--text);
}

.np-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

.btn-quick-clip {
  background: var(--gold);
  color: #0d0d0d;
  border: none;
  font-weight: 600;
}

.btn-quick-clip:hover {
  background: #d4a64b;
}

.np-dismiss {
  margin-left: auto;
  color: var(--text-dim);
  border-color: transparent;
  background: transparent;
}

.np-dismiss:hover {
  color: var(--text);
  border-color: var(--border);
}

.np-progress {
  margin-top: 8px;
}

/* ── Main ──────────────────────────────────────────────────────────── */

main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  overflow-y: auto;
}

/* ── Results Header ────────────────────────────────────────────────── */

.results-header {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.result-count {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
}

/* ── Grid ──────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Card ──────────────────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  box-shadow: var(--shadow);
}

.card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
}

.card-content {
  display: flex;
  flex-direction: column;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.card-info {
  padding: 10px 12px 12px;
}

.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  gap: 6px;
}

.btn:hover {
  background: #222;
  border-color: var(--border-hover);
}

.btn:active {
  background: #1a1a1a;
}

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

.btn-primary {
  background: var(--gold);
  color: #0d0d0d;
  border-color: var(--gold);
  font-weight: 600;
}

.btn-primary:hover {
  background: #d4a64b;
  border-color: #d4a64b;
}

.btn-primary:disabled {
  background: var(--gold-dim);
  border-color: var(--gold-dim);
  opacity: 0.5;
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-back {
  margin-bottom: 20px;
}

/* ── Target Card (detail view) ─────────────────────────────────────── */

.target-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.target-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--gold);
}

.target-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Player ────────────────────────────────────────────────────────── */

/* Frame strip — thumbnail row across the movie */
.frame-strip {
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.frame-strip-inner {
  display: flex;
  gap: 6px;
}

.frame-thumb {
  flex-shrink: 0;
  width: 120px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  background: #111;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
}

.frame-thumb:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.frame-thumb.active {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(196,150,59,0.4);
}

.frame-thumb.in-range {
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(196,150,59,0.25);
}

/* Gold tint overlay on in-range frames */
.frame-thumb.in-range::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(196,150,59,0.12);
  pointer-events: none;
}

.frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-thumb-time {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: #fff;
  text-shadow: 0 0 4px rgba(0,0,0,0.9);
  z-index: 1;
}

/* ── Phone (≤ 480px) ──────────────────────────────────────────── */

/* ── Clip shortcut link ─────────────────────────────────────────── */

.clip-shortcut {
  font-size: 12px;
  color: var(--gold);
  text-decoration: none;
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.clip-shortcut:hover {
  background: rgba(196,150,59,0.1);
}

@media (max-width: 480px) {

  /* Header */
  .header-inner {
    padding: 8px 0;
  }
  header h1 {
    font-size: 16px;
  }
  .search-row {
    gap: 6px;
  }
  .search-row input {
    padding: 7px 10px;
    font-size: 13px;
  }
  .search-row select {
    padding: 7px 8px;
    font-size: 11px;
    min-width: auto;
  }

  /* Library grid — two columns */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card {
    border-radius: 8px;
  }
  .card-info {
    padding: 8px 10px 10px;
  }
  .card-name {
    font-size: 13px;
  }

  /* Detail view */
  main {
    padding: 12px;
  }
  .target-card {
    padding: 16px;
    margin-bottom: 16px;
    gap: 8px;
  }
  .target-name {
    font-size: 18px;
  }
  .target-meta {
    font-size: 12px;
  }
  .btn-back {
    margin-bottom: 12px;
  }

  /* Video preview */
  #preview-video {
    max-height: 220px;
  }
  /* Frame strip — smaller thumbs */
  .frame-thumb {
    width: 84px;
    height: 52px;
  }

  /* Clip gallery */
  .clip-card {
    width: 100%;
    max-width: none;
  }
  .clip-gallery-grid {
    flex-direction: column;
    gap: 12px;
  }

  /* Now Playing banner */
  .np-content {
    gap: 8px;
    font-size: 12px;
  }
  .btn-quick-clip {
    font-size: 11px;
    padding: 4px 8px;
  }

}

/* ── Progress Bar ──────────────────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Empty State ───────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Clip Gallery ─────────────────────────────────────────────────── */

.clip-gallery {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.clip-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.clip-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: 300px;
  flex-shrink: 0;
}

.clip-card video {
  width: 100%;
  display: block;
  max-height: 180px;
  background: #000;
}

.clip-gif {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
  display: block;
}

.clip-card-info {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clip-card-name {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.clip-card-actions .btn {
  font-size: 11px;
  padding: 4px 10px;
}

/* ── Error Banner ──────────────────────────────────────────────────── */

.error-banner {
  background: rgba(201, 107, 107, 0.12);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-banner .btn {
  flex-shrink: 0;
}

/* ── Warning text ──────────────────────────────────────────────────── */

.target-warning {
  font-size: 13px;
  color: var(--gold);
  padding: 8px 0;
}

/* ── Shared video player (desktop + mobile) ──────────────────────────── */

.preview-video-shared {
  width: 100%;
  max-height: 480px;
  background: #000;
  border-radius: 10px;
  display: block;
}

@media (max-width: 768px) {
  .preview-video-shared {
    max-height: 60vh;
    height: auto;
    border-radius: 0;
    object-fit: contain;
    /* Android Chrome captures vertical swipes on <video> for its native
       seek gesture, which makes the top ~60% of the clip page dead to
       scrolling. pan-y hands vertical pans to the page scroller while
       taps (play/pause, controls) and horizontal seeks still work. */
    touch-action: pan-y;
  }
}

@media (min-width: 1600px) {
  /* Large screens (1080p / 4K): the 480px cap left the preview a small
     window in the middle of the screen. Widen the app column and let the
     video run tall; the viewport cap keeps it from dominating a shorter
     panel. Mobile and small laptops are untouched. */
  main {
    max-width: 1800px;
  }
  .preview-video-shared {
    max-height: 80vh;
  }
}

/* ── Mobile Clip Editor (bottom-sheet layout) ────────────────────────── */

.clip-editor {
  padding: 0;
}

/* ── Bottom sheet ───────────────────────────────────────────────────── */

.mob-sheet {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  margin-top: -8px;
  position: relative;
  z-index: 2;
  padding: 16px 16px 24px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  /* NOT a scroll container — main is the single page scroller.
     An overflow-y:auto sheet that fits its content (no internal overflow)
     plus overscroll-behavior:contain swallows touch pans on Android
     Chrome: the sheet covers nearly the whole viewport, so the page
     becomes a scroll dead-zone. Removing the scroll-container props lets
     every pan fall through to main. */
}

/* Sheet handle (visual drag indicator at top) */
.mob-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: #3a3a3a;
  border-radius: 2px;
  margin: 0 auto 14px;
}

/* ── Playhead readout: current "Frame at" time ──────────────────────── */

.mob-playhead {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  padding-bottom: 8px;
}

.mob-playhead-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.mob-playhead-value {
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 600;
  font-size: 15px;
}

/* ── Readout row: skip buttons flank start / dur / end ──────────────── */

.mob-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  padding: 2px 0 4px;
}

.mob-readout .mob-dur {
  color: var(--text-dim);
  font-size: 12px;
}

.mob-skip-btn {
  min-width: 44px;
  min-height: 44px;
  background: #222;
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-skip-btn:active {
  background: #2c2c2c;
}

/* ── Overview bar (read-only range indicator — no aiming) ───────────── */

.mob-overview {
  position: relative;
  width: 100%;
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  margin: 8px 0;
  overflow: hidden;
}

.mob-overview-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  background: var(--gold);
  border-radius: 3px;
}

/* ── Film strip toggle (opt-in thumbnail navigator) ─────────────────── */

.mob-filmstrip-row {
  margin: 6px 0 2px;
}

.mob-filmstrip-btn {
  width: 100%;
  min-height: 44px;
  font-size: 13px;
  background: #1e1e1e;
  color: var(--text-dim);
  border: 1px dashed #3a3a3a;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-filmstrip-btn:active {
  background: #2a2a2a;
}

.mob-filmstrip-btn.active {
  background: var(--gold);
  color: #141414;
  border-color: var(--gold);
  border-style: solid;
  font-weight: 700;
}

/* ── Two huge mark buttons — the only selection surface ─────────────── */

.mob-mark-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.mob-mark-btn {
  min-height: 64px;
  font-size: 16px;
  font-weight: 700;
  background: #1e1e1e;
  color: var(--gold);
  border: 2px solid var(--gold);
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-mark-btn:active {
  background: #2a2a2a;
}

.mob-mark-btn-end {
  opacity: 0.75;
}

.mob-mark-btn.just-marked {
  animation: mob-mark-flash 0.6s ease;
}

@keyframes mob-mark-flash {
  0%   { background: #242013; border-color: var(--gold); color: var(--gold); }
  100% { background: #1e1e1e; }
}

/* ── Frame snapshots (IN/OUT previews under the mark buttons) ────────── */

.mob-frame-snaps {
  display: flex;
  gap: 10px;
  margin: 10px 0 4px;
}

.mob-snap {
  position: relative;
  flex: 1;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.mob-snap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.mob-snap-loading {
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

/* Visible "working" feedback while the server-side frame extraction runs
   (2.5-3s+ on this host). Without this the tap looks like it did nothing. */
.mob-snap-loading::after {
  content: "loading frame…";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #bbb;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  animation: mob-snap-pulse 1.1s ease-in-out infinite;
}

@keyframes mob-snap-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.mob-snap-label {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 7px;
  border-radius: 6px;
}

/* ── Unset buttons — contextually shown when an edge is pinned ───────── */

.mob-unset-buttons {
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
}

.mob-unset-btn {
  flex: 1;
  min-height: 44px;
  font-size: 13px;
  background: #1a1a1a;
  color: var(--text-dim);
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-unset-btn:active {
  background: #2a2a2a;
  color: var(--text);
}

/* ── Finetune nudge rows ────────────────────────────────────────────── */

.mob-finetune {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

/* Grid: label spans the full width, 8 buttons flow 4-per-line x 2 lines.
   Every button keeps the fat-thumb minimum (>=44px), just wraps instead
   of squeezing. */
.mob-ft-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mob-ft-label {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mob-ft-btn {
  min-height: 48px;
  font-size: 13px;
  background: #222;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-ft-btn:active {
  background: #2c2c2c;
}

/* ── Preset duration chips ──────────────────────────────────────────── */

.mob-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.mob-preset-btn {
  min-height: 48px;
  padding: 0 18px;
  font-size: 14px;
  background: #1e1e1e;
  color: var(--text);
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-preset-btn:active {
  background: #2a2a2a;
}

.mob-preset-btn.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
  font-weight: 700;
}

/* ── Actions: loop (secondary) + download (primary gold) ────────────── */

.mob-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.mob-loop-btn {
  min-height: 56px;
  font-size: 15px;
  font-weight: 700;
  background: #222;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-loop-btn:active {
  background: #2c2c2c;
}

.mob-download-btn {
  min-height: 56px;
  font-size: 16px;
  font-weight: 700;
  background: var(--gold);
  color: #111;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-download-btn:active {
  filter: brightness(1.1);
}

.mob-download-btn:disabled {
  background: #333;
  color: var(--text-muted);
  cursor: default;
}

/* ── Options (details / summary) ────────────────────────────────────── */

.mob-options {
  margin: 6px 0;
  border-top: 1px solid var(--border);
}

.mob-options summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.mob-options summary::-webkit-details-marker {
  display: none;
}

.mob-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mob-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

/* ── Progress + status ──────────────────────────────────────────────── */

/* #mob-clip-progress reuses the shared .clip-progress/.progress-bar/
   .progress-fill/.progress-text styles defined above. */

.clip-status-mob {
  min-height: 18px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 2px 0;
}

/* ── Landscape: shrink everything so it fits in the short viewport ──── */

@media (max-width: 768px) and (orientation: landscape) {
  .mob-sheet {
    padding: 12px 16px 16px;
  }

  .mob-mark-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .mob-unset-btn {
    min-height: 38px;
    font-size: 12px;
  }

  .mob-ft-btn {
    min-height: 38px;
    font-size: 12px;
  }

  .mob-preset-btn {
    min-height: 40px;
  }

  .mob-download-btn {
    min-height: 48px;
    font-size: 15px;
  }
}

/* ── Desktop unified editor layout ────────────────────────────────────── */

@media (min-width: 769px) {
  .clip-editor {
    /* Full content width — matches the video player above. */
    margin: 24px 0 0;
  }

  /* Desktop: a full-width card, not a bottom sheet. */
  .mob-sheet {
    border-radius: var(--radius);
    margin-top: 0;
    padding: 20px 24px 28px;
    box-shadow: var(--shadow);
  }
  .mob-sheet::before {
    display: none; /* no drag handle on desktop */
  }

  /* Center oversized controls in a comfortable column while the card and
     the range bar keep spanning the full width. */
  .mob-filmstrip-row,
  .mob-mark-buttons,
  .mob-frame-snaps,
  .mob-unset-buttons,
  .mob-finetune,
  .mob-presets,
  .mob-actions {
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .mob-mark-btn {
    min-height: 64px;
    font-size: 18px;
  }

  .mob-ft-row {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  }
  .mob-ft-btn {
    min-height: 44px;
    min-width: 56px;
  }

  .fine-tune summary {
    font-family: var(--font-serif);
    cursor: pointer;
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    list-style: none;
  }
  .fine-tune summary::-webkit-details-marker {
    display: none;
  }
  .fine-tune summary:hover {
    border-color: var(--border-hover);
    color: var(--gold);
  }
  .fine-tune[open] summary {
    border-color: var(--border-hover);
  }
}
