:root {
  --bg-deep: #090a10;
  --bg-panel: #11131c;
  --bg-card: #171a26;
  --bg-elevated: #1e2233;
  --bg-glass: rgba(23, 26, 38, 0.82);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(139, 92, 246, 0.45);

  --text-primary: #f3f4f8;
  --text-secondary: #a6adbb;
  --text-muted: #6b7280;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.28);
  --accent-indigo: #6366f1;
  --accent-gold: #fbbf24;
  --accent-gold-bg: rgba(251, 191, 36, 0.14);
  --accent-orange: #f97316;
  --accent-orange-bg: rgba(249, 115, 22, 0.16);
  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-bg: rgba(244, 63, 94, 0.16);
  --accent-cyan: #06b6d4;

  --font-sans: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout (Full-Width No Left Rail) */
.app-shell {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Left Vertical Navigation Rail */
.left-rail {
  background: #0c0e16;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  z-index: 30;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.logo-orb {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 55%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.logo-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.rail-nav, .rail-Bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 0 6px;
}

.rail-btn {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 10px;
  font-weight: 600;
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.rail-btn.active {
  background: var(--accent-purple-glow);
  border-color: var(--border-focus);
  color: #fff;
}

.rail-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: var(--accent-orange);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
}

/* Main Content Wrapper */
.main-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
}

/* Top Studio Header Bar */
.top-header {
  min-height: 48px;
  background: rgba(17, 19, 28, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  gap: 8px 12px;
  z-index: 20;
  flex-shrink: 0;
}

.url-loader-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 600px;
}

.app-brand-badge {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-right: 4px;
  flex-shrink: 0;
  user-select: none;
}

.preset-select {
  max-width: 150px;
  text-overflow: ellipsis;
}

.input-icon-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.yt-icon {
  position: absolute;
  left: 10px;
  pointer-events: none;
}

.input-icon-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 7px 10px 7px 34px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  transition: border 0.2s;
}

.input-icon-wrap input:focus {
  border-color: var(--accent-purple);
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

/* 3-Pass Sandwich Routine Switcher */
.pass-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0d0f17;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.pass-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11.5px;
  transition: all 0.18s;
  white-space: nowrap;
}

.pass-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.pass-tab.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(99, 102, 241, 0.2));
  border-color: rgba(139, 92, 246, 0.55);
  color: #fff;
}

.pass-num {
  font-weight: 800;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-gold);
}

.pass-label {
  font-weight: 600;
}

.pass-arrow {
  color: var(--text-muted);
  font-size: 13px;
}

.pass-badge {
  background: var(--accent-rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
}

.pass-badge.gold {
  background: var(--accent-gold);
  color: #111;
}

/* Header Right Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.control-pill-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 3px 7px;
  border-radius: 8px;
  flex-shrink: 0;
}

.pill-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.header-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 155px;
}

.control-pill-group .header-select {
  border: none;
  padding: 2px 4px;
  background: transparent;
  max-width: 130px;
}

.view-mode-group {
  display: flex;
  background: #0d0f17;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.view-btn.active {
  background: var(--bg-elevated);
  color: #fff;
}

.icon-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-pill-btn:hover {
  border-color: var(--accent-purple);
}

.icon-pill-btn.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--accent-emerald);
  color: #34d399;
}

.ap-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.icon-pill-btn.active .ap-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* MAIN STUDIO 3-COLUMN GRID & LAYOUT MODES */
.studio-grid {
  flex: 1;
  display: grid;
  overflow: hidden;
  gap: 1px;
  background: var(--border-subtle);
}

/* Mode 1: Theater Mode (Default — LR + Trancy Hybrid, Large Video Stage) */
.studio-grid.layout-theater {
  grid-template-columns: 54% 25% 21%;
}

/* Mode 2: Trancy Reading Mode (Balanced Video Left + Wide Gold Script Center + Details Right) */
.studio-grid.layout-reading {
  grid-template-columns: 42% 35% 23%;
}

/* Mode 3: Cinema Focus Mode (Extra-Large Video Left + Script/Dict Right) */
.studio-grid.layout-cinema {
  grid-template-columns: 66% 34% 0%;
}
.studio-grid.layout-cinema .right-drawer {
  display: none;
}

/* COLUMN 1: PLAYER & DUAL SUBTITLE STAGE */
.player-column {
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  gap: 8px;
  overflow-y: auto;
  min-width: 0;
}

.player-video-stage-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.video-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-top-actions {
  flex-shrink: 0;
}

.video-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-badge {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.video-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Video Stage 16:9 Box */
.video-stage-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 56dvh;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.studio-grid.layout-reading .video-stage-container {
  max-height: 40dvh;
}

.studio-grid.layout-cinema .video-stage-container {
  max-height: 66dvh;
}

.yt-iframe-box, #youtubePlayer, .yt-iframe-box iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Audio-Only Curtain (Pass 3) */
.audio-curtain {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #1e1b4b 0%, #090a10 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  z-index: 10;
}

.soundwave-anim {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
}

.soundwave-anim span {
  width: 5px;
  height: 18px;
  background: var(--accent-gold);
  border-radius: 99px;
  animation: wavePulse 1s infinite ease-in-out;
}
.soundwave-anim span:nth-child(2) { animation-delay: 0.15s; height: 32px; }
.soundwave-anim span:nth-child(3) { animation-delay: 0.3s; height: 24px; }
.soundwave-anim span:nth-child(4) { animation-delay: 0.45s; height: 34px; }
.soundwave-anim span:nth-child(5) { animation-delay: 0.6s; height: 16px; }

@keyframes wavePulse {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1.2); opacity: 1; }
}

/* Pass 2 Review Target Floating Banner */
.pass2-verify-banner {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(17, 19, 28, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-rose);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 12;
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.28);
}

.verify-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.verify-left strong {
  font-size: 12.5px;
  color: #fda4af;
}

.verify-left p {
  font-size: 11px;
  color: var(--text-secondary);
}

.verify-actions {
  display: flex;
  gap: 6px;
}

/* Language Reactor Subtitle Timeline Strip */
.timeline-strip-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.timeline-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.mono-time {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.clip-range-info {
  white-space: nowrap;
}

.timeline-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10.5px;
}

.timeline-legend span {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.dot-legend {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}
.dot-legend.current { background: var(--accent-purple); }
.dot-legend.target { background: var(--accent-rose); }
.dot-legend.star { background: var(--accent-gold); }

.subtitle-timeline-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 12px;
  background: var(--bg-panel);
  border-radius: 6px;
  padding: 2px;
  overflow: hidden;
}

.tl-seg {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.tl-seg:hover {
  background: rgba(255, 255, 255, 0.35);
}

.tl-seg.active {
  background: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-purple);
}

.tl-seg.target {
  background: var(--accent-rose);
}

.tl-seg.star {
  background: var(--accent-gold);
}

/* MAIN DUAL-SUBTITLE STAGE CARD */
.main-subtitle-card {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #151824 0%, #10121b 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.sub-card-header {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.sub-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.sub-card-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.lr-play-circle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.45);
}

.sentence-counter {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
}

.sentence-timestamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.linking-pill {
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: #67e8f9;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

/* 2-Step Progressive Blur Stepper */
.progressive-step-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #0b0d14;
  padding: 3px 5px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.progressive-step-bar::-webkit-scrollbar {
  display: none;
}

.step-chip {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}

.step-chip:hover {
  color: var(--text-primary);
}

.step-chip.active {
  background: rgba(139, 92, 246, 0.22);
  border-color: var(--accent-purple);
  color: #fff;
}

.step-divider {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sub-card-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.action-tag-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.action-tag-btn.active-target {
  background: var(--accent-rose-bg);
  border-color: var(--accent-rose);
  color: #fda4af;
}

.action-tag-btn.active-star {
  background: var(--accent-gold-bg);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* English & Korean Subtitle Lines + Clean Tap-Toggle States */
.en-subtitle-wrapper, .ko-subtitle-wrapper {
  position: relative;
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.en-subtitle-wrapper:hover, .ko-subtitle-wrapper:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.main-en-subtitle {
  display: block;
  width: 100%;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.48;
  color: #ffffff;
  text-align: center;
  letter-spacing: -0.01em;
}

.sub-size-md .main-en-subtitle { font-size: 17px; }
.sub-size-lg .main-en-subtitle { font-size: 19px; }
.sub-size-xl .main-en-subtitle { font-size: 23px; }

/* Individual Clickable Word Token (Used inside Transcript List) */
.word-token {
  display: inline-block;
  padding: 1px 1.5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  border-bottom: 2px solid transparent;
  user-select: none;
}

.main-en-subtitle .word-token {
  display: inline;
  padding: 1px 1px;
}

.word-token:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--accent-gold);
}

.word-token.selected-word {
  background: rgba(251, 191, 36, 0.25);
  border-bottom-color: var(--accent-gold);
  color: var(--accent-gold);
}

.word-token.stage-learning {
  color: #fdba74;
  border-bottom: 2px solid var(--accent-orange);
  background: rgba(249, 115, 22, 0.1);
}

.word-token.stage-core {
  color: #fde047;
  border-bottom: 2px solid var(--accent-gold);
  background: rgba(251, 191, 36, 0.12);
}

.word-token.stage-known {
  border-bottom: 2px dotted rgba(16, 185, 129, 0.45);
}

.main-ko-subtitle {
  display: block;
  width: 100%;
  font-size: 15px;
  font-weight: 500;
  color: #e2e8f0;
  text-align: center;
  line-height: 1.45;
}

/* Clean Hidden (Blurred) State: Completely hide underlying text so it never overlaps */
.is-blurred .main-en-subtitle,
.is-blurred .main-ko-subtitle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.blur-overlay-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #cbd5e1;
  background: rgba(17, 20, 32, 0.92);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.en-subtitle-wrapper:not(.is-blurred) .blur-overlay-hint,
.ko-subtitle-wrapper:not(.is-blurred) .blur-overlay-hint {
  display: none !important;
}

/* Quick Shadowing Recorder + Trancy Transport Bar */
.quick-shadow-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.shadow-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-record {
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-record.recording {
  background: var(--accent-rose);
  color: #fff;
  animation: pulseRec 1.2s infinite;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-rose);
}
.btn-record.recording .rec-dot {
  background: #fff;
}

@keyframes pulseRec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
}

.rec-status {
  font-size: 11px;
  color: var(--text-muted);
}

.trancy-transport {
  display: flex;
  align-items: center;
  gap: 5px;
}

.transport-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}

.transport-btn:hover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.16);
}

.transport-btn.active {
  background: var(--accent-purple-glow);
  border-color: var(--accent-purple);
  color: var(--accent-gold);
}

.transport-btn.play-main {
  background: var(--accent-gold);
  color: #090a10;
  border-color: var(--accent-gold);
  padding: 6px 12px;
}

.transport-btn.highlight-e {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.55);
  color: #ddd6fe;
}

.transport-btn kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-secondary);
}

/* COLUMN 2: MIDDLE TRANSCRIPT / VOCAB / 3-PASS PANEL */
.middle-column, .right-drawer {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.panel-tabs-header {
  background: #0e1018;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.script-scroll-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.script-scroll-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.script-scroll-pill:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.script-scroll-pill.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.script-scroll-pill.locked {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.scroll-mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.script-scroll-pill.active .scroll-mode-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
}

.script-scroll-pill.locked .scroll-mode-dot {
  background: var(--accent-gold);
}

.panel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.panel-tabs::-webkit-scrollbar {
  display: none;
}

.panel-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.unified-only-tab {
  display: none;
}

.panel-tab:hover {
  color: var(--text-primary);
}

.panel-tab.active {
  color: #fff;
  border-bottom-color: var(--accent-purple);
}

.tab-count {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
}

.tab-count.gold {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
}

.mid-tab-body, .right-tab-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Transcript Toolbar */
.script-toolbar, .vocab-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(14, 16, 24, 0.6);
}

.script-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 5px 9px;
}

.script-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  width: 100%;
  outline: none;
}

.script-filter-pills, .vocab-sort-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--accent-purple-glow);
  border-color: var(--accent-purple);
  color: #fff;
}

/* Synchronized Dual-Subtitle Script List (LR + Trancy Hybrid) */
.transcript-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.script-row {
  display: grid;
  grid-template-columns: 32px 1fr 28px;
  gap: 8px;
  padding: 10px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: all 0.16s ease;
  cursor: pointer;
}

.script-row:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: #1b1f2e;
}

/* Trancy Gold Active Sentence Highlight + LR Purple Play Button */
.script-row.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(251, 191, 36, 0.08) 100%);
  border-color: var(--accent-gold);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

.script-row.active .row-en-line {
  color: var(--accent-gold);
  font-weight: 700;
}

.row-left-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.row-play-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
}

.script-row.active .row-play-btn {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
}

.row-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.row-center-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.row-en-line {
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--text-primary);
  display: flex;
  flex-wrap: wrap;
  gap: 3px 4px;
}

.row-ko-line {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  transition: filter 0.2s;
}

.row-ko-line.blurred-ko {
  filter: blur(5px);
  opacity: 0.45;
}
.script-row:hover .row-ko-line.blurred-ko {
  filter: blur(0px);
  opacity: 1;
}

.row-badges {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}

.mini-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.mini-badge.target { background: var(--accent-rose-bg); color: #fda4af; }
.mini-badge.linking { background: rgba(6, 182, 212, 0.14); color: #67e8f9; }
.mini-badge.mastered { background: var(--accent-emerald-bg); color: #6ee7b7; }

.row-right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.row-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.15s, color 0.15s;
}
.row-icon-btn:hover { transform: scale(1.15); color: var(--text-primary); }
.row-icon-btn.active-star { color: var(--accent-gold); }
.row-icon-btn.active-target { color: var(--accent-rose); }

/* Mid Tab 2: Video Vocabulary List */
.vocab-helper-note {
  font-size: 11px;
  color: var(--text-muted);
}

.video-vocab-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vocab-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border 0.15s;
}

.vocab-item-card:hover {
  border-color: var(--accent-purple);
}

.vocab-word-main {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.vocab-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.cefr-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.rank-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Mid Tab 3: 3-Pass Checklist & Golden 3 Sentences */
#midTabPass3 {
  overflow-y: auto;
  padding: 10px;
  gap: 12px;
}

.sandwich-guide-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(23, 26, 38, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  padding: 12px;
}

.sg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sg-header h4 {
  font-size: 13px;
  color: #fff;
}

.sg-progress-badge {
  background: var(--accent-emerald-bg);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.sg-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sg-step-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.sg-step-item input {
  margin-top: 3px;
  accent-color: var(--accent-emerald);
}

.sg-step-item strong {
  font-size: 12px;
  color: var(--text-primary);
  display: block;
}

.sg-step-item p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.golden-section-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.golden-section-header h4 {
  font-size: 13px;
  color: var(--accent-gold);
}

.golden-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.golden-sentences-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.golden-card {
  background: var(--bg-card);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.golden-card-en {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-gold);
}

.golden-card-ko {
  font-size: 12px;
  color: var(--text-secondary);
}

.variation-builder {
  background: #0d0f17;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.variation-builder label {
  font-size: 11px;
  font-weight: 700;
  color: #c4b5fd;
}

.variation-input-row {
  display: flex;
  gap: 6px;
}

.variation-input-row input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* COLUMN 3: RIGHT DICTIONARY & AI COACH DRAWER (Trancy < Details + LR Lexa) */
.dict-search-bar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 6px;
}

.dict-search-bar input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  outline: none;
}

.dict-content-area, .ai-coach-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dict-empty-state {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  font-size: 32px;
}

.color-stage-guide {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
}

.stage-row {
  display: block;
  line-height: 1.5;
}

.stage-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.stage-dot.learning { background: var(--accent-orange); }
.stage-dot.core { background: var(--accent-gold); }
.stage-dot.known { background: var(--accent-emerald); }

/* Trancy < Details Word Header Card */
.trancy-word-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.word-title-large {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-gold);
}

.word-syllables {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.word-primary-ko {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

/* LR Stage Selector Buttons */
.lr-stage-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.stage-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 4px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.stage-btn.active-known {
  background: var(--accent-emerald-bg);
  border-color: var(--accent-emerald);
  color: #34d399;
}

.stage-btn.active-learning {
  background: var(--accent-orange-bg);
  border-color: var(--accent-orange);
  color: #fdba74;
}

.stage-btn.active-core {
  background: var(--accent-gold-bg);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.pos-block {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-purple);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
}

.pos-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #c4b5fd;
}

.pos-terms {
  font-size: 12.5px;
  color: var(--text-primary);
  margin-top: 2px;
}

.ext-dict-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ext-link-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}
.ext-link-chip:hover {
  border-color: var(--accent-purple);
  color: #fff;
}

/* AI Coach Cards */
.coach-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coach-section-card h5 {
  font-size: 12.5px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.linking-rule-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
}

.linking-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: #67e8f9;
}

.linking-rule-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.45;
}

.rhythm-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.rhythm-pill {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11.5px;
}
.rhythm-pill.stressed {
  background: var(--accent-gold-bg);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 13px;
}
.rhythm-pill.weak {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 11px;
}

/* SECONDARY VIEWS (CATALOG / PHRASEPUMP / DECK) */
.secondary-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-deep);
}

.view-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.view-header-banner {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.view-header-banner h2 {
  font-size: 18px;
  color: #fff;
  margin-bottom: 4px;
}

.view-header-banner p {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.catalog-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s, border 0.18s;
  cursor: pointer;
}

.catalog-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-purple);
}

.catalog-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.catalog-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* PhrasePump Stage */
.phrasepump-stage {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 28px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.cloze-input {
  background: var(--bg-deep);
  border: 2px solid var(--accent-purple);
  color: var(--accent-gold);
  font-size: 18px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  width: 150px;
  text-align: center;
  outline: none;
}

/* Saved Deck View */
.deck-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.deck-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.deck-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 62vh;
  overflow-y: auto;
}

/* Buttons & Utilities */
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-focus);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost-sm:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.btn-ghost-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-success-sm {
  background: var(--accent-emerald);
  border: none;
  color: #052e16;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  width: 92%;
  max-width: 620px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 18px;
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}

.shortcut-item kbd {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 34px;
  text-align: center;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row p, .setting-block p {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.full-input {
  width: 100%;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.export-buttons-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.export-card-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.export-card-btn:hover {
  border-color: var(--accent-purple);
}
.export-card-btn span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast-msg {
  background: rgba(23, 26, 38, 0.96);
  border: 1px solid var(--accent-purple);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.2s ease;
}

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

/* ============================================================================
   MULTI-DISPLAY RESPONSIVE OPTIMIZATION
   (Ultra-Wide / Laptop / iPad Landscape / iPad Portrait / Smartphone)
   ============================================================================ */

/* Sleek Custom Dark Scrollbars Across All Browsers */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.55);
}

/* Prevent button & badge text wrapping across all screen sizes */
.btn-ghost-sm,
.btn-secondary,
.btn-success-sm,
.btn-record,
.transport-btn,
.filter-chip,
.icon-pill-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Make modals safe on all screen heights */
.modal-panel {
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}
.modal-body {
  overflow-y: auto;
}

/* ----------------------------------------------------------------------------
   1. SLIM SINGLE-ROW TOP HEADER & EXPANDABLE TOOLS
   ---------------------------------------------------------------------------- */
.top-header {
  flex-wrap: wrap;
  min-height: 44px;
  padding: 5px 10px;
  gap: 6px 8px;
}

.url-loader-group {
  flex: 1 1 280px;
  min-width: 240px;
  max-width: 520px;
}

.header-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.custom-edit-trigger {
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--accent-gold);
}
.custom-edit-trigger.active {
  background: rgba(251, 191, 36, 0.2);
  border-color: var(--accent-gold);
  color: #fff;
}

.header-controls {
  width: 100%;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

/* ----------------------------------------------------------------------------
   LIVE WIDGET CUSTOMIZER DRAWER & ON-SCREEN EDIT HANDLES
   ---------------------------------------------------------------------------- */
.customizer-drawer {
  background: linear-gradient(180deg, #17152b 0%, #10121c 100%);
  border-bottom: 2px solid var(--accent-gold);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
  flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.customizer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.cust-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cust-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-gold);
  white-space: nowrap;
}

.cust-preset-btn,
.cust-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.cust-preset-btn:hover,
.cust-action-btn:hover {
  border-color: var(--accent-purple);
  color: #fff;
}
.cust-preset-btn.active {
  background: var(--accent-purple-glow);
  border-color: var(--accent-purple);
  color: #fff;
}

#customVideoSizeRange {
  width: 110px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.cust-toggle-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}

.cust-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: line-through;
  transition: all 0.15s;
}

.cust-chip.active {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  text-decoration: none;
}

/* Widget Hidden Utility */
.widget-hidden {
  display: none !important;
}

/* On-Screen Edit Handles (Visible when body.custom-edit-active) */
.widget-edit-handle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px dashed var(--accent-gold);
  border-radius: 8px;
  padding: 4px 10px;
  margin-bottom: 4px;
}

body.custom-edit-active .widget-edit-handle {
  display: flex;
}

.w-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-gold);
}

.w-btn {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.w-btn.w-hide {
  background: rgba(244, 63, 94, 0.22);
  border-color: var(--accent-rose);
  color: #fda4af;
}

.inline-hide-btn {
  display: none;
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid var(--accent-rose);
  color: #fda4af;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  margin-left: 4px;
}
body.custom-edit-active .inline-hide-btn {
  display: inline-flex;
}

.panel-tab-icon-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.panel-tab-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Dynamic Layout Swapping & Panel Hiding */
.player-column.swap-player-order {
  flex-direction: column-reverse;
}

.studio-grid.swap-bottom-panels .middle-column {
  order: 3;
}
.studio-grid.swap-bottom-panels .right-drawer {
  order: 2;
}

/* Expand remaining panels automatically when Middle or Right panel is hidden */
.studio-grid.hide-mid-panel.hide-right-panel {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}
.studio-grid.hide-mid-panel:not(.hide-right-panel),
.studio-grid.hide-right-panel:not(.hide-mid-panel) {
  grid-template-columns: 56% 44% !important;
}
.studio-grid.hide-mid-panel .unified-only-tab,
.studio-grid.hide-right-panel .unified-only-tab {
  display: inline-flex;
}

.app-shell.hide-nav-rail {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}

/* Connect Video Stage Height to Live Customizer Slider */
.video-stage-container {
  max-height: var(--custom-video-max-h, 46dvh) !important;
}

/* ----------------------------------------------------------------------------
   2. COMPACT LAPTOP & IPAD LANDSCAPE (1025px – 1360px)
   2-Column Studio: Large Left Video Player (58%) | Right Unified 5-Tab Workspace (42%)
   ---------------------------------------------------------------------------- */
@media (min-width: 1025px) and (max-width: 1360px) {
  .studio-grid.layout-theater {
    grid-template-columns: 58% 42%;
  }

  .studio-grid.layout-reading {
    grid-template-columns: 48% 52%;
  }

  .studio-grid.layout-cinema {
    grid-template-columns: 66% 34%;
  }

  .video-stage-container {
    max-height: 48dvh;
  }

  .player-column {
    padding: 8px 12px;
    gap: 6px;
  }

  .main-subtitle-card {
    padding: 8px 12px;
    gap: 5px;
  }

  .en-subtitle-wrapper,
  .ko-subtitle-wrapper {
    padding: 6px 10px;
  }

  .rec-status {
    display: none;
  }

  .unified-only-tab {
    display: inline-flex;
  }

  .studio-grid[data-subpanel="middle"] .right-drawer {
    display: none !important;
  }
  .studio-grid[data-subpanel="right"] .middle-column {
    display: none !important;
  }
  .studio-grid.layout-cinema[data-subpanel="right"] .right-drawer {
    display: flex !important;
  }
}

/* ----------------------------------------------------------------------------
   3. IPAD PORTRAIT & TABLET (700px – 1024px)
   - Bottom Navigation Rail (frees 100% horizontal screen width!)
   - Inverted-T Pro Studio Layout:
     * Top Full-Width (100%): Large 16:9 Widescreen Video + Full-Width 2-Step Blur Subtitle Deck
     * Bottom-Left (52%): Synchronized Transcript / Vocab / 3-Pass Checklist
     * Bottom-Right (48%): Word Dictionary (Details) & Connected Speech AI Coach
   ---------------------------------------------------------------------------- */
@media (min-width: 700px) and (max-width: 1024px) {
  .app-shell {
    display: block;
  }

  .main-wrapper {
    height: 100%;
  }

  .left-rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 12px;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    background: rgba(12, 14, 22, 0.98);
    backdrop-filter: blur(12px);
  }

  .brand-logo {
    display: none;
  }

  .rail-nav,
  .rail-Bottom {
    flex-direction: row;
    width: auto;
    gap: 6px;
    padding: 0;
  }

  .rail-btn {
    flex-direction: row;
    padding: 6px 12px;
    font-size: 11.5px;
    gap: 6px;
  }

  /* Studio Grid: Full-width Upper Video/Sub Deck + Lower 2-Column Split */
  .studio-grid.layout-theater,
  .studio-grid.layout-reading,
  .studio-grid.layout-cinema {
    grid-template-columns: 52% 48%;
    grid-template-rows: auto minmax(380px, 1fr);
    overflow-y: auto;
  }

  .studio-grid.layout-cinema .right-drawer {
    display: flex;
  }

  /* Upper Deck spans 100% full width so the 16:9 YouTube Video is HUGE (~800x430)! */
  .player-column {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    overflow: visible;
    border-bottom: 1px solid var(--border-subtle);
  }

  .player-video-stage-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .video-stage-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 42dvh;
  }

  .studio-grid.layout-cinema .video-stage-container {
    max-height: 52dvh;
  }

  .studio-grid.layout-reading .video-stage-container {
    max-height: 30dvh;
  }

  /* Full-width Subtitle Card with ultra-clean 1-line header & footer */
  .main-subtitle-card {
    padding: 8px 12px;
    gap: 6px;
  }

  .sub-card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 6px;
  }

  .sub-card-top-row {
    width: auto;
    flex: 1 1 auto;
  }

  .progressive-step-bar {
    width: auto;
    flex: 0 1 auto;
  }

  .en-subtitle-wrapper,
  .ko-subtitle-wrapper {
    padding: 7px 10px;
  }

  .sub-size-lg .main-en-subtitle {
    font-size: 18px;
  }

  .main-ko-subtitle {
    font-size: 14px;
  }

  .rec-status {
    display: none;
  }

  .middle-column {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    min-height: 360px;
  }

  .right-drawer {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-height: 360px;
    border-left: 1px solid var(--border-subtle);
  }

  .studio-grid.swap-bottom-panels .middle-column {
    grid-column: 2;
    border-left: 1px solid var(--border-subtle);
  }

  .studio-grid.swap-bottom-panels .right-drawer {
    grid-column: 1;
    border-left: none;
  }

  .studio-grid.hide-mid-panel .right-drawer,
  .studio-grid.hide-right-panel .middle-column {
    grid-column: 1 / -1 !important;
    border-left: none;
  }
}

/* ----------------------------------------------------------------------------
   4. SMARTPHONE & SMALL SCREENS (<= 699px)
   Single-Column Mobile Studio + Unified 5-Tab Bottom Panel + Bottom Nav Bar
   ---------------------------------------------------------------------------- */
@media (max-width: 699px) {
  .app-shell {
    display: block;
  }

  .main-wrapper {
    height: 100%;
  }

  .left-rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    background: rgba(12, 14, 22, 0.98);
  }

  .brand-logo,
  #openShortcutsModalBtn {
    display: none;
  }

  .rail-nav,
  .rail-Bottom {
    flex-direction: row;
    width: auto;
    gap: 2px;
    padding: 0;
  }

  .rail-btn {
    padding: 6px 8px;
    font-size: 10px;
    gap: 2px;
  }

  /* Compact Mobile Top Header */
  .top-header {
    padding: 6px 8px;
    gap: 6px;
  }

  .url-loader-group {
    flex: 1 1 100%;
  }

  .header-controls {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .header-controls::-webkit-scrollbar {
    display: none;
  }

  .view-mode-group {
    display: none;
  }

  .pass-switcher {
    justify-content: flex-start;
  }

  .pass-tab {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Single Column Scrollable Studio */
  .studio-grid.layout-theater,
  .studio-grid.layout-reading,
  .studio-grid.layout-cinema {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .player-column {
    flex: 0 0 auto;
    padding: 6px 8px;
    gap: 6px;
    overflow: visible;
    border-bottom: 1px solid var(--border-subtle);
  }

  .player-video-stage-group {
    gap: 5px;
  }

  .video-stage-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 36dvh;
  }

  .main-subtitle-card {
    padding: 8px 10px;
    gap: 6px;
  }

  .sub-card-header {
    gap: 5px;
    padding-bottom: 6px;
  }

  .step-chip {
    font-size: 10px;
    padding: 3px 4px;
  }

  .en-subtitle-wrapper,
  .ko-subtitle-wrapper {
    padding: 7px 8px;
  }

  .blur-overlay-hint {
    font-size: 11px;
    padding: 4px 8px;
  }

  .sub-size-lg .main-en-subtitle {
    font-size: 15.5px;
  }

  .main-ko-subtitle {
    font-size: 13px;
  }

  .rec-status,
  #compareNativeMyVoiceBtn {
    display: none;
  }

  .quick-shadow-bar {
    justify-content: space-between;
    gap: 4px;
    padding-top: 4px;
  }

  .transport-btn {
    padding: 5px 7px;
  }
  .transport-btn kbd {
    display: none;
  }

  .unified-only-tab {
    display: inline-flex;
  }

  .middle-column,
  .right-drawer {
    flex: 1 0 420px;
    min-height: 420px;
  }

  .studio-grid[data-subpanel="middle"] .right-drawer {
    display: none !important;
  }
  .studio-grid[data-subpanel="right"] .middle-column {
    display: none !important;
  }

  /* Secondary Views Mobile Adjustments */
  .secondary-view {
    padding: 12px;
  }
  .catalog-grid {
    grid-template-columns: 1fr;
  }
  .deck-two-col {
    grid-template-columns: 1fr;
  }
  .phrasepump-stage {
    padding: 16px;
  }
}
