/* ─── Reset & tokens ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #06091180;
  --bg-solid:    #060911;
  --bg2:         #0c1220;
  --surface:     #101828;
  --surface2:    #162035;
  --border:      #1e304f;
  --border2:     #243756;
  --gold:        #f59e0b;
  --gold-dim:    rgba(245,158,11,.15);
  --blue:        #3b82f6;
  --blue-dim:    rgba(59,130,246,.2);
  --violet:      #7c3aed;
  --violet-dim:  rgba(124,58,237,.2);
  --white:       #f1f5ff;
  --muted:       #5c7199;
  --muted2:      #3d5278;
  --red:         #ef4444;
  --green:       #22c55e;
  --radius:      14px;
  --radius-pill: 100px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bot:    env(safe-area-inset-bottom, 0px);
  --font:        'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --grad:        linear-gradient(135deg, #60a5fa, #a78bfa);
  --grad-text:   linear-gradient(135deg, #93c5fd 0%, #c4b5fd 50%, #f5c842 100%);
}

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

#app { height: 100dvh; position: relative; overflow: hidden; }

/* ─── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: opacity .22s ease, transform .22s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

.screen.slide-out {
  opacity: 0;
  transform: translateX(-24px);
}

/* ─── Brand header (search screen) ───────────────────────────────────────── */
.brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(20px, calc(var(--safe-top) + 12px)) 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(12,18,32,.95) 0%, rgba(6,9,17,.85) 100%);
  backdrop-filter: blur(12px);
  position: relative;
}

.brand-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,.4) 30%, rgba(167,139,250,.4) 70%, transparent);
}

.brand-logo svg {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(96,165,250,.4));
}

.brand-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.brand-settings-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent;
}
.brand-settings-btn svg { width: 16px; height: 16px; }
.brand-settings-btn:active { color: var(--white); border-color: var(--blue); }

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.01em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.brand-tagline {
  font-size: .7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ─── Generic screen header (sync / playing) ──────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(16px, var(--safe-top)) 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-solid);
  min-height: 58px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  padding: 4px 8px 4px 0;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.back-btn svg { width: 22px; height: 22px; }

.header-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Screen body ─────────────────────────────────────────────────────────── */
.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-body {
  gap: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
}

/* ─── Search wrap ─────────────────────────────────────────────────────────── */
.search-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 10px;
}

/* ─── Search row ──────────────────────────────────────────────────────────── */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.search-row input {
  width: 100%;
  background: var(--surface);
  color: var(--white);
  border: 2px solid rgba(96,165,250,.55);
  border-radius: var(--radius-pill);
  padding: 15px 44px 15px 46px;
  font-size: 1.03rem;
  font-family: var(--font);
  font-weight: 500;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.14);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search-row input:focus {
  border-color: #93c5fd;
  background: var(--surface2);
  box-shadow: 0 0 0 4px var(--blue-dim), 0 4px 24px rgba(59,130,246,.16);
}
.search-row input::placeholder { color: var(--muted2); font-weight: 400; }

.search-spinner {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Language select ─────────────────────────────────────────────────────── */
.sync-lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 2px;
}
.sync-lang-row label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
#sync-lang-select {
  appearance: none;
  flex: 1;
  background: var(--surface);
  color: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 36px 10px 14px;
  font-size: .9rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235c7199' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  outline: none;
  transition: border-color .2s;
}
#sync-lang-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }

/* ─── Status line ─────────────────────────────────────────────────────────── */
.status-line {
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  padding: 8px 18px;
  animation: fadeIn .2s ease;
}
.status-line.error { color: var(--red); }
.status-line.warn  { color: var(--gold); }

/* ─── Results list ────────────────────────────────────────────────────────── */
.results-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 12px;
}

.result-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px 10px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color .18s, background .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
  animation: slideUp .22s ease;
}
.result-item:active {
  background: var(--surface2);
  border-color: var(--blue);
  transform: scale(.988);
}

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

.result-main { flex: 1; min-width: 0; }
.result-title {
  font-size: .97rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 400;
}
.result-arrow { color: var(--muted2); font-size: 1.1rem; flex-shrink: 0; }

/* Poster thumbnail */
.result-poster {
  position: relative;
  width: 42px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface2), var(--bg2));
  border: 1px solid var(--border);
}
.result-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.result-poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--muted);
}

.result-more-row {
  list-style: none;
  margin-top: 8px;
}

.result-section {
  list-style: none;
  margin: 10px 2px 2px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.result-more-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(59,130,246,.22), rgba(124,58,237,.20));
  border: 1px solid rgba(96,165,250,.6);
  color: #dbeafe;
  font-family: var(--font);
  font-size: .93rem;
  font-weight: 700;
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: border-color .15s, color .15s, background .15s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.result-more-btn:active {
  color: var(--white);
  border-color: #93c5fd;
  background: linear-gradient(135deg, rgba(59,130,246,.30), rgba(124,58,237,.28));
  transform: scale(.99);
}
.result-more-btn:disabled {
  opacity: .7;
  cursor: default;
  transform: none;
}

/* ─── Sync screen ─────────────────────────────────────────────────────────── */
.sync-body { justify-content: flex-start; gap: 20px; }

.sync-intro {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sync-intro-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sync-label {
  font-size: .95rem;
  font-weight: 600;
}
.sync-guide-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.sync-guide-btn.active,
.sync-guide-btn:active {
  color: #dbeafe;
  border-color: rgba(96,165,250,.6);
  background: rgba(59,130,246,.2);
}
.sync-guide-tip {
  margin: 0 auto;
  max-width: 34ch;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.35;
}
.sync-guide-tip strong { color: var(--white); }

/* ─── Cue position browse button ──────────────────────────────────────────── */
.cue-pos-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: var(--font);
  font-size: .78rem;
  color: var(--muted);
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.cue-pos-btn:hover, .cue-pos-btn:active {
  background: rgba(255,255,255,.13);
  color: var(--white);
}

/* Cue card */
.cue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cue-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.cue-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--white);
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, background .1s;
}
.cue-nav-btn:active { background: var(--bg2); border-color: var(--blue); }
.cue-nav-btn:disabled { opacity: .3; cursor: default; }
.cue-pos {
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .04em;
}

.sync-cue-text {
  padding: 20px 18px 12px;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.sync-cue-time {
  padding: 0 18px 16px;
  font-size: .74rem;
  color: #8da4cb;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}

.sync-search-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(96,165,250,.58);
  background: linear-gradient(135deg, rgba(59,130,246,.24), rgba(124,58,237,.2));
  color: #dbeafe;
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .12s, color .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.sync-search-btn:active {
  color: var(--white);
  border-color: #93c5fd;
  transform: scale(.99);
}

.start-btn {
  width: 100%;
  padding: 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s, transform .1s;
}
.start-btn:active { opacity: .85; transform: scale(.98); }

/* ─── Playing screen ──────────────────────────────────────────────────────── */
.playing-header { justify-content: space-between; gap: 8px; }

.playing-movie-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.header-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color .1s, border-color .1s;
}
.header-chip:active,
.header-chip.active { color: var(--white); border-color: var(--blue); }

.header-chip-add { color: var(--muted2); }
.header-chip-add.active {
  color: var(--gold);
  border-color: var(--gold);
}

.header-icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color .1s, border-color .1s;
}
.header-icon-btn svg { width: 16px; height: 16px; }
.header-icon-btn:active { color: var(--white); border-color: var(--blue); }

.sync-badge {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%,100% { opacity: 1; }
  50%      { opacity: .45; }
}

#subtitle-area {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 12px;
}

.subtitle-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}

#subtitle-text {
  font-size: calc(clamp(1.1rem, 4.8vw, 1.5rem) * var(--sub1-scale, 1));
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  color: var(--sub1-color, #f1f5ff);
  white-space: pre-line;
  word-break: break-word;
  text-shadow:
    0 2px 10px rgba(0,0,0,.95),
    1px 1px 0 rgba(0,0,0,1),
    -1px -1px 0 rgba(0,0,0,1);
  min-height: 2.9em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity .18s ease;
}

/* Secondary subtitle (dual mode) — softer, smaller, distinct tint */
#subtitle-text-2 {
  font-size: calc(clamp(.95rem, 4vw, 1.25rem) * var(--sub2-scale, 1));
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  color: var(--sub2-color, #f59e0b);
  white-space: pre-line;
  word-break: break-word;
  text-shadow:
    0 2px 10px rgba(0,0,0,.95),
    1px 1px 0 rgba(0,0,0,1),
    -1px -1px 0 rgba(0,0,0,1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  transition: opacity .18s ease;
}
#subtitle-text-2.hidden { display: none; }

/* When dual mode is active, the primary text no longer reserves empty space */
.subtitle-stack.dual #subtitle-text { min-height: 0; }

/* Readability background box behind subtitles (toggle in settings) */
#subtitle-area.sub-bg #subtitle-text:not(:empty),
#subtitle-area.sub-bg #subtitle-text-2:not(:empty) {
  background: rgba(0, 0, 0, .58);
  padding: 4px 12px;
  border-radius: 8px;
  text-shadow: none;
}

#playing-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 0;
}

.nudge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.nudge-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .1s, border-color .1s, background .12s;
  white-space: nowrap;
  position: relative;
  z-index: 0;
}
.nudge-btn.nudge-lg  { font-size: .85rem; padding: 9px 14px; }
.nudge-btn.nudge-sm  { font-size: .78rem; padding: 9px 10px; }
.nudge-btn:active    { color: var(--white); border-color: var(--blue); }
.nudge-btn.pop {
  z-index: 2;
  animation: nudge-pop .32s ease;
}
@keyframes nudge-pop {
  0%   { transform: scale(1); }
  32%  {
    transform: scale(1.22);
    color: var(--white);
    border-color: var(--blue);
    background: var(--blue-dim);
    box-shadow: 0 0 0 5px var(--blue-dim), 0 6px 18px rgba(59,130,246,.28);
  }
  100% { transform: scale(1); }
}

.help-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, color .1s;
}
.help-btn:active { border-color: var(--gold); color: var(--gold); }

/* Help tooltip */
.help-tooltip {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  width: min(300px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: fadeIn .2s ease;
}
.help-tooltip::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  rotate: 45deg;
}
.help-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.help-sign {
  font-size: 1.4rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.2;
}
.help-sign.plus  { color: var(--blue); }
.help-sign.minus { color: var(--gold); }
.help-desc {
  font-size: .82rem;
  color: var(--white);
  line-height: 1.4;
}
.help-desc em   { font-style: normal; font-weight: 600; }
.help-desc small { color: var(--muted); font-size: .75rem; display: block; margin-top: 2px; }

.resync-open-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  transition: border-color .1s;
  width: 100%;
}
.resync-open-btn:active { border-color: var(--gold); color: var(--gold); }

#stop-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px max(10px, var(--safe-bot));
}
.pause-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: .8rem;
  padding: 8px 22px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, color .1s;
}
.pause-btn:active       { border-color: var(--blue); }
.pause-btn.is-paused    { border-color: var(--blue); color: var(--blue); }
.stop-btn {
  background: none;
  border: 1px solid rgba(239,68,68,.3);
  color: var(--muted);
  font-family: var(--font);
  font-size: .8rem;
  padding: 8px 22px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stop-btn:active { color: var(--red); border-color: var(--red); }

/* ─── Fullscreen mode ─────────────────────────────────────────────────────── */
#screen-playing.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
}

#screen-playing.is-fullscreen #playing-header,
#screen-playing.is-fullscreen #playing-controls,
#screen-playing.is-fullscreen #stop-row,
#screen-playing.is-fullscreen #help-tooltip {
  display: none !important;
}

#screen-playing.is-fullscreen #subtitle-area {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#screen-playing.is-fullscreen #subtitle-text {
  font-size: clamp(1.3rem, 4vw, 2rem);
  min-height: auto;
  align-items: center;
}

#screen-playing.is-fullscreen #subtitle-text-2 {
  font-size: clamp(1.05rem, 3.2vw, 1.6rem);
}

/* Fullscreen tap zone (covers subtitle area for tap-to-controls) */
.fs-tapzone {
  position: absolute;
  inset: 0;
  z-index: 210;
}

/* Fullscreen controls overlay (shown on tap) */
#fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  transition: opacity .25s ease;
}
#fs-overlay.visible { pointer-events: all; }
#fs-overlay:not(.visible) { opacity: 0; }

.fs-overlay-panel {
  background: linear-gradient(to top, rgba(7,11,20,.95) 60%, transparent);
  padding: 12px 16px max(16px, var(--safe-bot));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fs-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fs-movie-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gold);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fs-exit-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: .8rem;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

/* ─── Language sheet ──────────────────────────────────────────────────────── */
.lang-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 50vh;
  -webkit-overflow-scrolling: touch;
}
.lang-list li {
  padding: 13px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: .95rem;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.lang-list li:active   { background: var(--surface); }
.lang-list li.selected { background: var(--surface); color: var(--blue); font-weight: 600; }

/* ─── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,28,53,.95);
  border: 1px solid var(--border);
  color: var(--white);
  font-size: .85rem;
  padding: 10px 18px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 300;
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: fadeIn .2s ease;
}

/* ─── Re-sync sheet ───────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sheet-panel {
  position: relative;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px max(16px, var(--safe-bot));
  max-height: 65dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 4px;
}
.sheet-title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.resync-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 2px 0;
}

.resync-cue {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .12s, background .12s;
}
.resync-cue:active { background: var(--bg); border-color: var(--blue); }
.resync-cue.current {
  border-color: var(--gold);
  background: rgba(245,200,66,.07);
}

.resync-cue-time {
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.resync-cue-text {
  font-size: .9rem;
  line-height: 1.4;
  white-space: pre-line;
}

.sheet-search-wrap {
  padding: 0 16px 10px;
}
.sheet-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: .9rem;
  font-family: var(--font);
  color: var(--white);
  outline: none;
  -webkit-appearance: none;
}
.sheet-search-input::placeholder { color: var(--muted2); }
.sheet-search-input:focus { border-color: rgba(96,165,250,.5); background: rgba(255,255,255,.1); }

.sheet-cancel {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .9rem;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.sheet-cancel:active { color: var(--white); }

/* ─── TV episode picker ───────────────────────────────────────────────────── */
.tv-series-title {
  text-align: center;
  color: var(--gold);
  font-size: .95rem;
  font-weight: 600;
}
.tv-picker-status {
  text-align: center;
  color: var(--muted);
  font-size: .84rem;
}
.tv-picker-status.error { color: var(--red); }
.tv-picker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tv-picker-start {
  margin-top: 2px;
  padding: 13px;
  font-size: .95rem;
}

/* ─── Subtitle settings sheet ─────────────────────────────────────────────── */
.settings-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  padding: 2px 0;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-section-title {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-label {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Size preset pills (S / M / L / XL) */
.size-group {
  display: flex;
  gap: 8px;
}
.size-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 700;
  padding: 9px 0;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .12s, border-color .12s, background .12s;
}
.size-btn:active { background: var(--bg); }
.size-btn.active {
  color: var(--white);
  border-color: var(--blue);
  background: var(--blue-dim);
}
.provider-btn { font-size: .8rem; }

/* Color swatches */
.swatch-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--border) inset;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, border-color .12s;
}
.swatch:active { transform: scale(.9); }
.swatch.active { border-color: var(--white); box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px var(--blue); }

/* Toggle row */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-toggle-label {
  font-size: .9rem;
  color: var(--white);
}
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.toggle-switch.on {
  background: var(--blue-dim);
  border-color: var(--blue);
}
.toggle-switch.on::after {
  transform: translateX(20px);
  background: var(--blue);
}

.sheet-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: var(--font);
  font-size: .9rem;
  padding: 10px 36px 10px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235c7199' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.sheet-select:focus {
  border-color: rgba(96,165,250,.55);
}

/* ─── Hero section ────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

.hero-image-wrap {
  position: relative;
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.hero-image-overlay { display: none; }

.hero-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 18px 32px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: .95rem;
  color: #8097bf;
  line-height: 1.65;
  font-weight: 400;
  max-width: 46ch;
}

/* ─── Hero pills ──────────────────────────────────────────────────────────── */
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}

.pill-blue {
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.3);
  color: #93c5fd;
}

.pill-violet {
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.3);
  color: #c4b5fd;
}

.pill-gold {
  background: rgba(245,158,11,.1);
  border-color: rgba(245,158,11,.25);
  color: #fcd34d;
}

.hero-cta-hint {
  font-size: .8rem;
  color: var(--muted2);
  font-weight: 500;
  letter-spacing: .02em;
  margin-top: 4px;
}

/* ─── How it works ────────────────────────────────────────────────────────── */
.how-it-works {
  padding: 28px 18px 36px;
  border-top: 1px solid var(--border);
}

.how-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--white);
  margin-bottom: 18px;
  text-align: center;
}

.how-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.use-cases {
  padding: 8px 18px 28px;
}

.use-case-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.use-case {
  padding: 16px 16px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}

.use-case h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--white);
  margin: 0 0 6px;
}

.use-case p {
  font-size: .88rem;
  line-height: 1.55;
  color: #8097bf;
  margin: 0;
}

.seo-faq {
  padding: 0 18px 40px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.03);
}

.faq-item summary {
  cursor: pointer;
  font-size: .92rem;
  font-weight: 650;
  color: var(--white);
  padding: 13px 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item p {
  font-size: .86rem;
  line-height: 1.55;
  color: #8097bf;
  margin: 0 0 14px;
}

.site-footer {
  padding: 8px 18px 36px;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  font-size: .82rem;
  text-decoration: none;
}

.site-footer a:hover {
  color: #93c5fd;
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

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