/* ==========================================================================
   Yonsei ISE AI English Interview Trainer - Premium Dark/Glassmorphic Theme
   Responsive for PC & Mobile + Large Video Studio + PWA + Live AI STT
   ========================================================================== */

:root {
  --yonsei-blue: #00205b;
  --yonsei-blue-light: #004494;
  --yonsei-blue-glow: rgba(0, 102, 255, 0.4);
  --primary-accent: #0088ff;
  --accent-cyan: #00d2ff;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --bg-dark: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(30, 41, 59, 0.88);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 136, 255, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;

  --sidebar-width: 320px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(0, 68, 148, 0.25) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(0, 136, 255, 0.15) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh; /* mobile: exclude the collapsing browser toolbar */
  overflow-x: hidden;
}

/* App Layout */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh; /* mobile: exclude the collapsing browser toolbar */
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Mobile Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 40;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 15, 30, 0.96);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: transform var(--transition-smooth);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 14px 16px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #004494, #0088ff);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: white;
  box-shadow: 0 0 20px var(--yonsei-blue-glow);
}

.brand-text h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: white;
}

.brand-text span {
  font-size: 10px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mobile-close-btn {
  display: none;
  position: absolute;
  right: 14px;
  top: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 6px 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: #003366;
  border: 2px solid var(--primary-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 12px;
}

.user-info .name {
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.user-info .track {
  font-size: 10px;
  color: var(--text-muted);
}

/* Sidebar Search & Filters */
.sidebar-search-box {
  margin: 6px 12px;
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search-box i {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-search-box input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 11.5px;
  outline: none;
}

.sidebar-search-box input:focus {
  border-color: var(--primary-accent);
  background: rgba(0, 136, 255, 0.05);
}

.category-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.cat-pill {
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 13.5px;          /* 1.35x of the old 10px (0.9x of 15px) */
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.cat-pill.active {
  background: rgba(0, 136, 255, 0.2);
  border-color: var(--primary-accent);
  color: var(--accent-cyan);
  font-weight: 700;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 4px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.badge-count {
  background: rgba(0, 136, 255, 0.15);
  color: var(--primary-accent);
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9.5px;
}

.question-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.question-list::-webkit-scrollbar { width: 4px; }
.question-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

.q-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.q-item:hover { background: rgba(255, 255, 255, 0.04); }
.q-item.active {
  background: linear-gradient(135deg, rgba(0, 68, 148, 0.4), rgba(0, 136, 255, 0.15));
  border-color: var(--border-focus);
  box-shadow: 0 0 12px rgba(0, 136, 255, 0.2);
}

.q-num {
  font-family: 'Outfit', sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  padding: 2px 5px;
  border-radius: 5px;
  flex-shrink: 0;
}

.q-info { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.q-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  white-space: normal;        /* wrap instead of truncating */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;      /* at most two lines */
  -webkit-box-orient: vertical;
}
.q-category { font-size: 9.5px; color: var(--text-muted); }

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-apk-download {
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(0, 210, 255, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-apk-download:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(0, 210, 255, 0.3));
  color: white;
}

.btn-custom-q {
  width: 100%;
  padding: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.top-header {
  padding: 12px 24px;
  background: rgba(10, 15, 30, 0.85);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  display: none;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.badge-theme {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  padding: 2px 8px;
  border-radius: 8px;
  display: inline-block;
  margin-bottom: 2px;
}

.header-title-wrap h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-pwa-install {
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(244, 63, 94, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-md);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: pulse 1.5s infinite alternate;
}

.voice-selector-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.voice-selector-wrap label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); }
.voice-selector-wrap select { background: transparent; border: none; color: white; font-size: 11px; font-weight: 600; outline: none; cursor: pointer; }
.voice-selector-wrap select option { background: #0f172a; color: white; }

.btn-primary-glow {
  padding: 7px 14px;
  background: linear-gradient(135deg, #0055b8, #0088ff);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 15px var(--yonsei-blue-glow);
}

/* Continuous Player Toolbar */
.player-toolbar {
  padding: 8px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(0, 136, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 9;
}

.player-left, .player-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tool {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
  transition: var(--transition-fast);
}

.btn-tool:hover { background: rgba(255, 255, 255, 0.12); color: white; }

.btn-primary-tool {
  background: linear-gradient(135deg, rgba(0, 68, 148, 0.5), rgba(0, 136, 255, 0.3));
  border-color: rgba(0, 136, 255, 0.5);
  color: white;
}

.btn-accent-tool {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(0, 210, 255, 0.25));
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.btn-danger-tool {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
  color: var(--accent-rose);
}

.btn-toggle.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

.speed-control-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 10.5px;
  color: var(--text-muted);
}

.speed-control-wrap select { background: transparent; border: none; color: var(--accent-cyan); font-size: 10.5px; font-weight: 700; outline: none; cursor: pointer; }
.speed-control-wrap select option { background: #0f172a; color: white; }

/* Playing active highlight */
.glass-card.playing-now {
  border-color: var(--primary-accent) !important;
  box-shadow: 0 0 25px rgba(0, 136, 255, 0.35) !important;
}

/* Content Body Grid */
.content-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 6px var(--practice-width, 440px);
  grid-template-rows: 1fr;        /* the row fills the pane, not just its content */
  gap: 10px;
  align-items: stretch;
  padding: 16px 24px 10px;        /* bottom matches .sidebar-footer padding */
  overflow-y: auto;
}

.content-body::-webkit-scrollbar { width: 6px; }
.content-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 6px; }

.study-column, .practice-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  padding: 16px;
  transition: var(--transition-smooth);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: white;
}

.card-hint {
  font-size: 10px;
  color: var(--text-muted);
}

/* Question & Answer Cards */
.en-question {
  font-size: 14px;
  line-height: 1.65;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 8px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-accent);
}

.btn-text-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
}

.btn-text-toggle:hover { color: var(--accent-cyan); }

.ko-content {
  margin-top: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ko-question, .ko-answer {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-sub);
}

.rationale-box {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  color: #38bdf8;
  line-height: 1.5;
}

/* Strategy Tip Box */
.tip-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(0, 136, 255, 0.05));
  border-left: 4px solid #f59e0b;
  padding: 12px 14px;
}

.tip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.tip-header h4 { font-size: 12px; font-weight: 700; color: #fbbf24; }
.tip-text { font-size: 11.5px; line-height: 1.55; color: #e2e8f0; }

/* Keywords & Live Matched Highlight */
/* Keyword cards: one clickable card per must-use term.
   Was a row of 10.5px pills with no room for the Korean gloss. */
.keyword-tags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 8px;
}

.kw-badge {
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-md);
  color: #fbbf24;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.kw-badge:hover {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.55);
  transform: translateY(-1px);
}

.kw-badge .kw-speaker {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  font-size: 11px;
  margin-top: 1px;
}

.kw-badge .kw-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* The term itself -- the part that was unreadably small */
.kw-badge .kw-en {
  font-size: 12px;            /* 0.8x of 15px, sized for the narrow rail */
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.1px;
  word-break: break-word;
}

.kw-badge .kw-ko {
  font-size: 10px;            /* 0.8x of 12.5px */
  font-weight: 400;
  line-height: 1.45;
  color: #cbd5e1;
  word-break: break-word;
}

.kw-badge.speaking {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}
.kw-badge.speaking .kw-speaker {
  background: #3b82f6;
  color: #fff;
  animation: kwPulse 1s ease-in-out infinite;
}
@keyframes kwPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

.kw-badge.matched {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}
.kw-badge.matched .kw-speaker { background: rgba(16, 185, 129, 0.3); color: #34d399; }
.kw-badge.matched .kw-ko { color: #a7f3d0; }

/* "play every keyword" control in the card header */
.btn-kw-playall {
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-sm);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-kw-playall:hover { background: rgba(245, 158, 11, 0.28); }
.btn-kw-playall.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #93c5fd;
}

/* PREP Breakdown */
.prep-breakdown {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.prep-item {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.prep-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.prep-p { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.prep-r { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.prep-e { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.prep-c { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.prep-text { font-size: 11px; line-height: 1.45; color: var(--text-sub); }

.full-script-box {
  margin: 10px 0;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.full-script-box h4 {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.en-script { font-size: 12.5px; line-height: 1.65; color: #e2e8f0; }

.btn-audio {
  padding: 5px 10px;
  background: rgba(0, 136, 255, 0.12);
  border: 1px solid rgba(0, 136, 255, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-accent-glow {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(0, 210, 255, 0.2));
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* ==========================================================================
   ENLARGED VIDEO & AUDIO STUDIO (대화면 스튜디오)
   ========================================================================== */
.studio-card {
  border-color: rgba(0, 210, 255, 0.2);
}

.camera-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-tool {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon-tool:hover {
  background: rgba(0, 136, 255, 0.2);
  color: white;
}

.btn-small {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 10.5px;
  cursor: pointer;
}

.btn-small:hover { background: rgba(255, 255, 255, 0.1); color: white; }

/* Large Video Viewfinder */
.large-video-container {
  width: 100%;
  height: 310px; /* ENLARGED SCREEN */
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.large-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror view */
}

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #64748b;
  text-align: center;
  padding: 20px;
}

.camera-placeholder i { font-size: 40px; color: #334155; }
.camera-placeholder h4 { font-size: 13px; color: #94a3b8; font-weight: 700; }
.camera-placeholder p { font-size: 11px; max-width: 320px; line-height: 1.5; }

/* Eye Contact Guideline */
.eye-contact-line {
  position: absolute;
  top: 32%;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(0, 210, 255, 0.35);
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
  padding-right: 10px;
}

.eye-contact-line span {
  font-size: 9.5px;
  color: rgba(0, 210, 255, 0.7);
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 6px;
  border-radius: 4px;
  transform: translateY(-50%);
}

/* Live REC Badge */
.live-rec-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(244, 63, 94, 0.85);
  backdrop-filter: blur(4px);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.6);
}

.pulse-circle {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
  animation: blink 0.8s infinite;
}

@keyframes blink { 50% { opacity: 0.2; } }

/* Real-Time Audio Level Meter */
.vu-meter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.vu-meter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.vu-meter-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.vu-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #f43f5e);
  transition: width 0.05s ease-out;
}

.vu-status-text {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ==========================================================================
   LIVE AI SPEECH-TO-TEXT (STT) SUBTITLES
   ========================================================================== */
.live-stt-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 136, 255, 0.2);
}

.stt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.stt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.stt-dot.active {
  background: #00d2ff;
  box-shadow: 0 0 10px #00d2ff;
  animation: blink 1s infinite;
}

.stt-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stt-text {
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
  min-height: 34px;
  font-style: italic;
}

/* ==========================================================================
   AI ANSWER PERFORMANCE FEEDBACK REPORT
   ========================================================================== */
.ai-feedback-report {
  margin-top: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(0, 136, 255, 0.08));
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.35);
  animation: slideIn 0.3s ease;
}

.report-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.report-header h4 {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
}

.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: white;
  display: block;
}

.stat-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
}

.report-comment {
  font-size: 11px;
  line-height: 1.5;
  color: #cbd5e1;
}

/* Timer Card */
.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px 0;
}

.time-text {
  font-family: 'Outfit', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: white;
  letter-spacing: 2px;
}

.time-label { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }

.timer-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.timer-badge.phase-prep { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.timer-badge.phase-speech { background: rgba(244, 63, 94, 0.15); color: #fb7185; }

.timer-progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 12px 0;
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0088ff, #00d2ff);
  transition: width 1s linear;
}

.timer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 6px;
}

.btn-timer {
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
}

.btn-prep { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: #fbbf24; }
.btn-speech { background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.3); color: #fb7185; }
.btn-reset { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); color: var(--text-muted); }

/* Recorded Media Playback Station */
.media-playback-station {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.station-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 8px;
}

.recorded-video-wrap {
  width: 100%;
  height: 220px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}

.recorded-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.recorded-audio-wrap audio {
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
}

.download-action-row {
  display: flex;
  gap: 6px;
}

.btn-download {
  flex: 1;
  padding: 7px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-download-video {
  background: linear-gradient(135deg, rgba(0, 136, 255, 0.3), rgba(0, 210, 255, 0.2));
  border: 1px solid rgba(0, 136, 255, 0.5);
  color: #60a5fa;
}

.btn-download-video:hover {
  background: linear-gradient(135deg, rgba(0, 136, 255, 0.5), rgba(0, 210, 255, 0.4));
  color: white;
}

.btn-download:last-child {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
}

/* Checklist */
.checklist-card .card-body { display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; align-items: flex-start; gap: 7px; }
.check-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent-emerald); cursor: pointer; }
.check-item label { font-size: 11px; line-height: 1.5; color: var(--text-sub); cursor: pointer; }

/* Toast */
.audio-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--primary-accent);
  box-shadow: 0 0 25px rgba(0, 136, 255, 0.4);
  backdrop-filter: blur(12px);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.toast-content { display: flex; flex-direction: column; }
.toast-title { font-size: 10.5px; font-weight: 700; color: var(--accent-cyan); }
.toast-sub { font-size: 11.5px; font-weight: 500; color: white; }

.toast-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.audio-toast button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; }

/* ==========================================================================
   MOBILE RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
  .app-container { flex-direction: column; height: 100vh; height: 100dvh; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 290px;
    height: 100%;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.active { display: block; }
  .mobile-menu-btn, .mobile-close-btn { display: block; }
  .content-body { grid-template-columns: 1fr; grid-template-rows: none; padding: 12px 14px; }
  .top-header { padding: 10px 14px; flex-wrap: wrap; gap: 8px; row-gap: 6px; }
  .header-left { min-width: 0; flex: 1 1 auto; }
  .header-title-wrap { min-width: 0; }
  .header-title-wrap h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-right { flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .header-right select { max-width: 46vw; }
  .player-toolbar { padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
  .player-left { flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .player-left .btn-tool { white-space: nowrap; padding: 6px 9px; }
  .large-video-container { height: 240px; }
  .prep-breakdown { grid-template-columns: 1fr; }
  .report-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .header-right .voice-selector-wrap label span { display: none; }
  .player-left span, .btn-primary-tool span, .btn-accent-tool span { font-size: 10px; }
  .large-video-container { height: 200px; }
  .header-title-wrap h1 { font-size: 13.5px; }
  .header-right select { max-width: 40vw; font-size: 11px; }
  .player-left, .player-right { flex-wrap: wrap; gap: 6px; }
  .report-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .download-action-row { flex-direction: column; }
  .download-action-row .btn-download { width: 100%; justify-content: center; }
  /* keep tap targets at the 44px accessibility minimum */
  .btn-tool, .btn-timer, .btn-audio { min-height: 40px; }
}


/* ==========================================================================
   RESIZABLE PANES
   Two drag handles: sidebar|main and study|practice. Widths persist in
   localStorage; double-click restores the default.
   ========================================================================== */
.pane-resizer {
  flex: 0 0 6px;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 30;
  transition: background var(--transition-fast);
  touch-action: none;
}
.pane-resizer::before {
  content: "";
  position: absolute;
  inset: 0 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
}
.pane-resizer:hover::before,
.pane-resizer.dragging::before {
  background: var(--primary, #0088ff);
  box-shadow: 0 0 10px rgba(0, 136, 255, 0.6);
}

/* the study/practice handle sits inside the scrolling grid */
.pane-resizer-columns {
  align-self: stretch;
  min-height: 100%;
  margin: 0 -3px;
}

/* while dragging, stop text selection and iframe/video capture */
body.resizing,
body.resizing * {
  user-select: none !important;
  cursor: col-resize !important;
}

@media (max-width: 1024px) {
  /* single-column layout: nothing to resize */
  .pane-resizer { display: none; }
}


/* ==========================================================================
   MIDDLE PANE SPLIT
   Question and model answer read down the left; the must-use keywords and the
   strategy tip sit in a narrow rail on the right so they stay visible while
   the answer is being read.
   ========================================================================== */
.study-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
  grid-template-rows: 1fr;        /* same reason: stretch the row, not just align */
  gap: 16px;
  align-items: stretch;
  min-height: 100%;
}

.study-main,
.study-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* the rail is narrow, so keywords stack one per row */
.study-rail .keywords-card {
  flex: 0 0 auto;                 /* natural height; no stretching */
}

.study-rail .keyword-tags {
  grid-template-columns: 1fr;
  gap: 16px;                      /* 2x the previous 8px spacing */
  align-content: start;
}

.study-rail .kw-badge {
  padding: 10px 12px;
  gap: 8px;
}

/* The tip card follows the keyword list immediately -- with five keywords it
   should sit right under them, not be pushed to the bottom of the column. */
.study-rail .tip-card {
  flex: 0 0 auto;
}

/* Cards size to their content. Stretching the answer card to reach the sidebar
   footer line just left an empty band inside it, so it hugs its text instead. */
.study-main .answer-card {
  flex: 0 0 auto;
}

.study-rail .kw-badge .kw-speaker {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.study-rail .card-header h3 { font-size: 13px; }
.study-rail .btn-kw-playall { font-size: 11px; padding: 5px 9px; }
.study-rail .card-hint { font-size: 10px; }

/* the rail follows the reading column once the layout is a single column */
@media (max-width: 1240px) {
  .study-column {
    grid-template-columns: 1fr;
    grid-template-rows: none;     /* stack naturally instead of one forced row */
  }
  .study-rail .keyword-tags {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }
}


/* ==========================================================================
   MOBILE STACKING OVERRIDE  (must stay last so it wins the cascade)

   On a phone the desktop grid caused two problems. `grid-template-rows: 1fr`
   plus `min-height: 100%` on .study-column pinned that column to one viewport
   height, so its taller content overflowed and painted over the practice
   column below it. Grid row sizing buys nothing in a single column, so the
   layout switches to plain flex stacking and the cards simply follow DOM
   order: question, model answer, keywords, tip, then the recording studio.
   ========================================================================== */
@media (max-width: 1024px) {
  .content-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 14px;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .study-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;              /* the desktop 100% is what caused the overlap */
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .study-main,
  .study-rail {
    gap: 14px;
    min-height: 0;
  }

  /* nothing in this layout should stretch to absorb leftover height */
  .study-main .answer-card,
  .study-rail .keywords-card,
  .study-rail .tip-card,
  .practice-column {
    flex: 0 0 auto;
  }

  .study-rail .keyword-tags {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    align-content: start;
  }

  .pane-resizer { display: none; }
}
