/* ── Botsunyuu · stylesheet ─────────────────────────────────────────────────────
   Standalone child site of N3Hub built on the Reels module. Clean, native-
   feeling dark UI: a single source of light, quiet surfaces, restrained accent
   color. Icons are SVGs (no emoji), motion is subtle and meaningful
   (fade/slide), and the layout breathes. */

:root {
  --bg: #0a0c12;
  --bg-2: #10131c;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --panel-3: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.08);
  --ink: #eef1f8;
  --ink-dim: rgba(238, 241, 248, 0.62);
  --ink-faint: rgba(238, 241, 248, 0.36);
  --acc: #ff5c9d;
  --acc-2: #53d8e8;
  --gold: #f3c969;
  --green: #7fdca4;
  --radius: 18px;
  --sans: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; }

/* Kill pull-to-refresh / rubber-band overscroll: vertical swipes drive the
   feed, and a browser-triggered refresh mid-scroll loses your session. */
html, body { overscroll-behavior: none; }

/* Rapid tapping (次のリール, rail buttons) must not trigger mobile
   double-tap zoom or show grey tap flashes. */
button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(255, 92, 157, 0.06), transparent 60%),
    radial-gradient(700px 420px at 5% 105%, rgba(83, 216, 232, 0.05), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.rl-ic {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

/* ── header ─────────────────────────────────────────────────────────────────── */
.rl-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  flex: 0 0 auto;
  z-index: 5;
}

.rl-back {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.rl-back .rl-ic { width: 16px; height: 16px; }
.rl-back:hover { color: var(--ink); border-color: var(--panel-3); background: var(--panel); }

.rl-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rl-logo {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--acc), #b06cf0);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 14px rgba(255, 92, 157, 0.35);
}
.rl-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.rl-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.rl-pool {
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.rl-icon-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}
.rl-icon-btn .rl-ic { width: 18px; height: 18px; }
.rl-icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.rl-icon-btn:active { transform: scale(0.92); }

/* ── shell: the phone-like column ───────────────────────────────────────────── */
.rl-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 6px 16px 14px;
  gap: 14px;
}

/* ── video stage ────────────────────────────────────────────────────────────── */
.rl-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 42vh;
  width: 100%;
  background: #000;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.45);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform: translateY(calc(var(--rl-swipe, 0) * 1px));
  transition: transform 0.3s var(--ease);
}
.rl-stage.rl-dragging { transition: none; }

/* One slide layer per media slot (Instagram/TikTok snap-scroll feel):
   the parked layer waits just below the stage and slides in on advance,
   while the current layer slides up out of view. */
.rl-media-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.46s var(--ease);
  will-change: transform;
}
.rl-media-layer.is-current { transform: translateY(0); z-index: 1; }
.rl-media-layer.is-next    { transform: translateY(100%); }
.rl-media-layer.is-exiting { transform: translateY(-100%); z-index: 2; }
.rl-media-layer.is-exiting-down { transform: translateY(100%); z-index: 2; }
.rl-media-layer.is-prev-enter  { transform: translateY(-100%); }
.rl-media-layer.no-anim    { transition: none; }

/* Transparent touch-catcher above the media (but below the rail): captures
   vertical swipes even over the YouTube iframe. */
.rl-touch-catcher {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  cursor: default;
}

#rlVideo, #rlVideo2, .rl-yt-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.rl-yt-host iframe { width: 100%; height: 100%; }

/* Inactive media slot: shown inside its slide layer (which is below the
   visible stage), but the YT host is parked off-screen so YouTube keeps a
   real element size (display:none would break its layout) and the preloaded
   player can buffer muted without being seen. */
.rl-yt-host.is-offscreen {
  left: -9999px;
  right: auto;
  top: 0;
  bottom: auto;
  width: 480px;
  height: 270px;
}

/* Hide YouTube's chrome (title bar, "Watch on YouTube", logo): the stage is
   much taller than the letterboxed 16:9 picture, so stretching the iframe
   vertically and centering it pushes YouTube's edge overlays (title top-left,
   "Watch on YouTube" top-right, control bar bottom) outside the visible area.
   Only the letterbox bars get cropped — the picture stays fully visible. */
.rl-yt-host:not(.is-offscreen) iframe {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 135%;
  max-width: none;
  max-height: none;
}

/* Cover YouTube's bottom-right logo with a black patch the same color as the
   letterbox bars. pointer-events:none keeps clicks flowing to the iframe. */
.rl-yt-host:not(.is-offscreen)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 92px;
  height: 34px;
  background: #000;
  pointer-events: none;
  z-index: 2;
}

/* subtitle overlay */
.rl-sub-overlay {
  position: absolute;
  left: 0;
  right: 82px;
  bottom: 0;
  padding: 48px 18px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
  z-index: 2;
}

.rl-sub-role {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(83, 216, 232, 0.85);
  text-transform: uppercase;
  margin-bottom: 6px;
  min-height: 0.9em;
}

.rl-sub-jp {
  font-size: clamp(1rem, 2.7vw, 1.28rem);
  font-weight: 700;
  line-height: 1.55;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
  word-break: keep-all;
  animation: rl-sub-in 0.28s var(--ease);
}
@keyframes rl-sub-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.rl-sub-jp .hl-point {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 92, 157, 0.9), rgba(83, 216, 232, 0.8));
  border-radius: 6px;
  padding: 0 5px;
  box-shadow: 0 0 16px rgba(255, 92, 157, 0.4);
}

.rl-sub-en {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 5px;
  line-height: 1.45;
  animation: rl-sub-in 0.28s 0.04s var(--ease) both;
}

/* side rail */
.rl-side-rail {
  position: absolute;
  right: 14px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 3;
}

.rl-rail-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 14, 22, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s var(--ease), background 0.18s, border-color 0.18s;
}
.rl-rail-btn .rl-ic { width: 20px; height: 20px; }
.rl-rail-btn:hover { background: rgba(28, 32, 44, 0.75); border-color: rgba(255, 255, 255, 0.3); }
.rl-rail-btn:active { transform: scale(0.9); }

/* play/pause icon swap */
.rl-ic-play { display: block; }
.rl-ic-pause { display: none; }
.rl-rail-btn.is-playing .rl-ic-play { display: none; }
.rl-rail-btn.is-playing .rl-ic-pause { display: block; }

/* mute icon swap */
.rl-ic-vol { display: block; }
.rl-ic-mute { display: none; }
.rl-rail-btn.is-muted { color: var(--gold); }
.rl-rail-btn.is-muted .rl-ic-vol { display: none; }
.rl-rail-btn.is-muted .rl-ic-mute { display: block; }

/* subtitle state dot: 0 off, 1 JP, 2 JP+EN */
.rl-rail-btn.is-off { opacity: 0.45; }
.rl-rail-btn[data-state="0"] .rl-ic { opacity: 0.5; }
.rl-rail-btn[data-state="1"]::after,
.rl-rail-btn[data-state="2"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acc-2);
  box-shadow: 0 0 6px rgba(83, 216, 232, 0.7);
}
.rl-rail-btn[data-state="1"]::after { background: var(--gold); box-shadow: 0 0 6px rgba(243, 201, 105, 0.7); }

/* clip progress */
.rl-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 4;
}
.rl-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--acc), var(--acc-2));
  transition: width 0.12s linear;
}

/* loading */
.rl-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(6, 8, 12, 0.78);
  backdrop-filter: blur(2px);
  z-index: 6;
  transition: opacity 0.3s;
}
.rl-loading.is-hidden { opacity: 0; pointer-events: none; }

.rl-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--acc);
  animation: rl-spin 0.8s linear infinite;
}
@keyframes rl-spin { to { transform: rotate(360deg); } }

.rl-loading-text { font-size: 0.78rem; color: var(--ink-dim); letter-spacing: 0.04em; }

.rl-yt-note {
  position: absolute;
  inset: auto 14px 14px;
  z-index: 5;
  font-size: 0.7rem;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 6px 10px;
}

/* toast */
.rl-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 24, 36, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  font-size: 0.76rem;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 7;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  animation: rl-toast-in 0.28s var(--ease);
}
@keyframes rl-toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ── point card ─────────────────────────────────────────────────────────────── */
.rl-card {
  flex: 0 0 auto;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  backdrop-filter: blur(4px);
  animation: rl-card-in 0.35s var(--ease);
}
@keyframes rl-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rl-card-inner { padding: 16px 18px 12px; }

/* Per-reel content swap: fresh children animate in with a small stagger,
   so every new card feels alive without moving the card frame itself. */
.rl-card-inner > * { animation: rl-card-item-in 0.34s var(--ease) backwards; }
.rl-card-inner > *:nth-child(2) { animation-delay: 0.05s; }
.rl-card-inner > *:nth-child(3) { animation-delay: 0.1s; }
.rl-card-inner > *:nth-child(4) { animation-delay: 0.15s; }
.rl-card-inner > *:nth-child(n+5) { animation-delay: 0.19s; }
@keyframes rl-card-item-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.rl-card-empty {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  padding: 16px 0 12px;
}

.rl-card-source {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--ink-faint);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.rl-card-source .src-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.rl-card-source .src-title { font-weight: 600; }
.rl-card-source .src-no {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 999px;
}

.rl-point-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.rl-point-value {
  font-size: clamp(1.65rem, 5.2vw, 2.2rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.rl-point-value.is-grammar { color: var(--acc-2); }

.rl-point-reading {
  font-size: 0.95rem;
  color: var(--gold);
  font-weight: 600;
}

.rl-point-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.rl-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.03);
}
.rl-badge.is-vocab { color: var(--acc); border-color: rgba(255, 92, 157, 0.35); }
.rl-badge.is-grammar { color: var(--acc-2); border-color: rgba(83, 216, 232, 0.35); }
.rl-badge.is-level { color: var(--green); border-color: rgba(127, 220, 164, 0.3); }

.rl-point-meaning {
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
}

.rl-point-extra {
  margin-top: 8px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-dim);
}

.rl-point-base {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* controls */
.rl-controls {
  display: flex;
  gap: 10px;
  padding: 10px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rl-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.12s var(--ease), filter 0.18s, background 0.18s, border-color 0.18s;
}
.rl-btn:active { transform: scale(0.96); }
.rl-btn .rl-ic { width: 17px; height: 17px; }

.rl-btn-ghost {
  background: var(--panel);
  color: var(--ink);
}
.rl-btn-ghost:hover { background: var(--panel-2); border-color: var(--panel-3); }

.rl-btn-primary {
  background: linear-gradient(135deg, var(--acc), #b06cf0);
  border: none;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 92, 157, 0.35);
}
.rl-btn-primary:hover { filter: brightness(1.08); }
.rl-btn-primary.is-prompting { animation: rl-pulse 1.5s ease-in-out infinite; }
@keyframes rl-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 92, 157, 0.35); }
  50% { box-shadow: 0 4px 34px rgba(255, 92, 157, 0.75); }
}

/* ── settings sheet ─────────────────────────────────────────────────────────── */
.rl-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 8, 0.55);
  backdrop-filter: blur(3px);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.rl-sheet-backdrop.is-visible { opacity: 1; pointer-events: auto; }

.rl-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: min(480px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 18px 20px 26px;
  z-index: 21;
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.6);
  transition: transform 0.36s var(--ease);
}
.rl-sheet.is-open { transform: translate(-50%, 0); }

.rl-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.rl-sheet-title {
  font-size: 1.02rem;
  font-weight: 800;
}

.rl-sheet-close {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}
.rl-sheet-close .rl-ic { width: 15px; height: 15px; }
.rl-sheet-close:hover { background: var(--panel-2); color: var(--ink); }
.rl-sheet-close:active { transform: scale(0.9); }

.rl-setting { margin-bottom: 22px; }

.rl-setting-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.rl-setting-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

/* the ℹ️ button — small, quiet, non-technical */
.rl-info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: transparent;
  color: var(--ink-faint);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1;
  font-family: Georgia, serif;
  font-style: italic;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.rl-info-btn:hover, .rl-info-btn.is-open {
  border-color: var(--acc);
  color: #fff;
  background: rgba(255, 92, 157, 0.25);
}

/* segmented control: one continuous pill of options */
.rl-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 3px;
}
.rl-seg .rl-chip {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 11px;
  padding: 9px 6px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.rl-seg .rl-chip.active {
  background: linear-gradient(135deg, rgba(255, 92, 157, 0.95), rgba(83, 216, 232, 0.85));
  box-shadow: 0 3px 14px rgba(255, 92, 157, 0.35);
}

/* non-segmented rows (video sources) keep the pill look */
.rl-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.rl-chip {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  transition: all 0.18s;
}
.rl-chip:hover { color: var(--ink); border-color: var(--panel-3); }
.rl-chip.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 92, 157, 0.9), rgba(83, 216, 232, 0.75));
  border-color: transparent;
}

/* inline plain-English explanation popover */
.rl-info-pop {
  margin-top: 6px;
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(255, 92, 157, 0.07);
  border: 1px solid rgba(255, 92, 157, 0.22);
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink-dim);
  animation: rl-pop-in 0.22s var(--ease);
}
.rl-info-pop b { color: var(--ink); font-weight: 700; }
@keyframes rl-pop-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── small screens ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .rl-shell { padding: 4px 10px 10px; gap: 10px; }
  .rl-stage { border-radius: 16px; min-height: 46vh; }
  .rl-pool { display: none; }
  .rl-sub-overlay { right: 66px; }

  /* Header, mobile edition. One tight row for brand + actions; the YT/Premium
     toggle drops to its own centered row beneath (see the mode-seg block in
     the Botsunyuu additions section). Everything stays reachable — no more
     horizontal overflow. */
  .rl-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 8px;
    row-gap: 8px;
  }
  .rl-back span { display: none; }          /* arrow-only back pill */
  .rl-back { padding: 8px 9px; }
  .rl-title { gap: 0; }
  .rl-title-text { display: none; }         /* the 没 logo carries the brand */
  .rl-logo { width: 30px; height: 30px; }
  .rl-icon-btn { width: 34px; height: 34px; }
  /* the daily counter leads the action cluster and pins it to the right edge
     (.rl-header-right goes display:contents on mobile, so the auto margin has
     to live on one of the promoted buttons instead) */
  .rl-streak { margin-left: auto; padding: 0 10px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .rl-btn-primary.is-prompting { animation: none; }
  .rl-progress-fill { transition: none; }
  .rl-card, .rl-sub-jp, .rl-sub-en, .rl-toast, .rl-info-pop { animation: none; }
  .rl-sheet, .rl-sheet-backdrop { transition: none; }
  .rl-help, .rl-help-backdrop, .rl-prem { transition: none; }
  .rl-card-inner > * { animation: none; }
  .rl-media-layer { will-change: auto; }
}

/* ── Botsunyuu additions ─────────────────────────────────────────────────────── */

/* daily counter chip in the header */
.rl-streak {
  position: relative;
  width: auto;
  padding: 0 12px;
  gap: 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.rl-streak-count {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold);
}
.rl-streak:hover { color: var(--gold); border-color: rgba(243, 201, 105, 0.4); }

/* saved-point (bookmark) rail button */
.rl-fav-btn.is-active { color: var(--gold); }
.rl-fav-btn.is-active svg path { fill: var(--gold); }

/* help modal — centered card variant of the sheet */
.rl-help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 8, 0.55);
  backdrop-filter: blur(3px);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.rl-help-backdrop.is-visible { opacity: 1; pointer-events: auto; }

.rl-help {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  opacity: 0;
  width: min(420px, calc(100% - 32px));
  max-height: 82vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 18px 20px 22px;
  z-index: 31;
  box-shadow: 0 -16px 60px rgba(0, 0, 0, 0.65);
  transition: transform 0.32s var(--ease), opacity 0.32s var(--ease);
}
.rl-help.is-open { transform: translate(-50%, -50%); opacity: 1; }

.rl-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.rl-help-gesture {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
}
.rl-help-gesture b {
  color: var(--acc-2);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}
.rl-help-note {
  margin-top: 14px;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* saved-points list */
.rl-saved-list { display: flex; flex-direction: column; gap: 8px; }
.rl-saved-empty {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 18px 8px;
}
.rl-saved-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px 10px 12px;
}
.rl-saved-watch {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  text-align: left;
  padding: 2px 0;
}
.rl-saved-value { font-size: 1.02rem; font-weight: 800; color: var(--ink); }
.rl-saved-watch:hover .rl-saved-value { color: var(--acc); }
.rl-saved-reading { font-size: 0.76rem; color: var(--gold); font-weight: 600; }
.rl-saved-meaning {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rl-saved-del {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.rl-saved-del .rl-ic { width: 14px; height: 14px; }
.rl-saved-del:hover { color: #f07a7a; border-color: rgba(240, 122, 122, 0.35); background: rgba(240, 122, 122, 0.08); }

/* ── feed-mode toggle (YT / Premium) in the header ─────────────────────────── */
.rl-mode-seg {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.rl-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  background: transparent;
  border: none;
  border-radius: 999px;
  height: 28px;
  padding: 0 11px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.rl-mode-btn .rl-ic { width: 14px; height: 14px; }
.rl-mode-btn:hover { color: var(--ink); }
.rl-mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 92, 157, 0.95), rgba(83, 216, 232, 0.85));
  box-shadow: 0 3px 14px rgba(255, 92, 157, 0.35);
}
/* once unlocked, the active premium segment glows gold instead of pink */
.rl-mode-seg.has-premium .rl-mode-btn[data-mode="premium"].active {
  background: linear-gradient(135deg, #f3c969, #e09a3e);
  box-shadow: 0 3px 14px rgba(243, 201, 105, 0.35);
  color: #20160a;
}
.rl-mode-btn.is-locked { opacity: 0.72; }

@media (max-width: 520px) {
  /* Promote the header-right children (toggle, streak, saved, help, settings)
     to direct flex items of .rl-header so the toggle can wrap onto its own
     full-width row instead of squeezing everything off-screen. */
  .rl-header-right { display: contents; }
  .rl-mode-seg {
    order: 10;
    flex: 1 1 100%;
    justify-content: center;
    height: 38px;
    margin-top: 2px;
  }
  .rl-mode-btn { height: 32px; padding: 0 16px; }
  .rl-mode-btn span { display: inline; }    /* the dedicated row fits labels again */
  .rl-mode-btn .rl-ic { width: 15px; height: 15px; }
}

/* locked video-source chip in the settings sheet */
.rl-chip.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}
.rl-chip.is-locked:hover { color: var(--ink-dim); border-color: var(--line); }

/* ── premium unlock modal ──────────────────────────────────────────────────── */
.rl-prem {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  opacity: 0;
  width: min(420px, calc(100% - 32px));
  max-height: 82vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid rgba(243, 201, 105, 0.25);
  border-radius: 24px;
  padding: 18px 20px 22px;
  z-index: 31;
  box-shadow: 0 -16px 60px rgba(0, 0, 0, 0.65);
  transition: transform 0.32s var(--ease), opacity 0.32s var(--ease);
}
.rl-prem.is-open { transform: translate(-50%, -50%); opacity: 1; }

.rl-prem-desc {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink-dim);
}
.rl-prem-ok {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--gold);
  background: rgba(243, 201, 105, 0.09);
  border: 1px solid rgba(243, 201, 105, 0.3);
  border-radius: 12px;
  padding: 10px 13px;
}
.rl-prem-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(243, 201, 105, 0.07);
  border: 1px solid rgba(243, 201, 105, 0.24);
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-dim);
}
.rl-prem-note a { color: var(--gold); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.rl-prem-note a:hover { color: #fff; }

.rl-prem-form { display: flex; gap: 8px; margin-top: 14px; }
.rl-prem-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
}
.rl-prem-input::placeholder { color: var(--ink-faint); }
.rl-prem-input:focus { border-color: var(--acc); background: var(--panel-2); }
.rl-prem-submit { flex: 0 0 auto; }
.rl-prem-submit:disabled { opacity: 0.6; cursor: default; }
.rl-prem-error {
  margin-top: 10px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: #f07a7a;
}
