/* ====================================================
   DICTATION & SHADOWING MODES
   ==================================================== */

/* Hidden utility */
.hidden {
  display: none !important;
}

/* ---- Mode Tabs ---- */
.vl-mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.vl-mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text-medium);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vl-mode-tab:hover {
  color: var(--text-dark);
  background: var(--accent-bg);
}

.vl-mode-tab.active {
  background: var(--secondary-red);
  color: #fff;
  box-shadow: 0 2px 6px var(--secondary-box-shadow);
}

.vl-mode-tab svg {
  flex-shrink: 0;
}

/* Mode description */
.vl-mode-description {
  margin-top: 8px;
}
.vl-mode-description p {
  font-size: 0.72rem;
  color: var(--text-medium);
  line-height: 1.5;
}

/* ---- Shortcuts Notice ---- */
.vl-shortcuts-notice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 34px 5px 16px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-medium);
  flex-wrap: wrap;
}

.vl-shortcut-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.vl-shortcuts-notice kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  color: var(--text-dark);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--border);
  line-height: 1.4;
}

.vl-shortcuts-close {
  position: absolute;
  top: 4px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  color: var(--text-medium);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.vl-shortcuts-close:hover {
  color: var(--text-dark);
  background: var(--background);
}

/* ---- Furigana Accuracy Notice ---- */
.vl-furigana-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  background: color-mix(in srgb, #fbbf24 10%, var(--background));
  border-bottom: 1px solid color-mix(in srgb, #fbbf24 30%, var(--border));
  font-size: 11px;
  color: var(--text-medium);
}

.vl-furigana-notice span {
  flex: 1;
}

.vl-furigana-notice-close {
  background: none;
  border: none;
  color: var(--text-medium);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.vl-furigana-notice-close:hover {
  color: var(--text-dark);
}

.vl-dict-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  background: color-mix(in srgb, var(--secondary-2) 8%, var(--background));
  border-bottom: 1px solid color-mix(in srgb, var(--secondary-2) 25%, var(--border));
  font-size: 11px;
  color: var(--text-medium);
}

.vl-dict-tip.hidden {
  display: none;
}

.vl-dict-tip-icon {
  color: var(--secondary-2);
  flex-shrink: 0;
}

.vl-dict-tip span {
  flex: 1;
}

.vl-dict-tip-close {
  background: none;
  border: none;
  color: var(--text-medium);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.vl-dict-tip-close:hover {
  color: var(--text-dark);
}

/* ---- Standard Controls ---- */
.vl-standard-controls {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  position: sticky;
  top: 48px;
  z-index: 4;
}

/* ---- Dictation Sub-Toggle (inline in controls bar) ---- */
.vl-dict-sub-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--accent-bg);
  border-radius: 8px;
}

.vl-dict-sub-btn {
  flex: 1;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-medium);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vl-dict-sub-btn:hover {
  color: var(--text-dark);
}

.vl-dict-sub-btn.active {
  background: var(--background);
  color: var(--secondary-2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ---- Loading State ---- */
.vl-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 16px;
  color: var(--text-medium);
  font-size: 13px;
  font-weight: 500;
}

.vl-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--secondary-2);
  border-radius: 50%;
  animation: vl-spin 0.8s linear infinite;
}

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

/* ---- Subtitle List Toggle Button (uses .vl-ctrl-btn for base) ---- */

/* ---- Subtitle List (Dictation / Shadowing) ---- */
.vl-subtitle-list {
  overflow-y: auto;
  padding: 0;
  flex: 1;
  min-height: 0;
}

.vl-subtitle-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  margin-bottom: 0;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}

.vl-subtitle-item:hover {
  background: var(--accent-bg);
}

.vl-subtitle-item.active {
  background: var(--caption-active-bg);
  border-left-color: var(--caption-active-border);
}

.vl-sub-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.vl-sub-jp {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.5;
  transition:
    opacity 0.15s ease,
    filter 0.15s ease;
}

/* ---- Dictation: Blur / Reveal ---- */
.vl-sub-jp.blurred {
  filter: blur(8px);
  user-select: none;
  opacity: 0.5;
}

.vl-sub-jp.revealed {
  filter: none;
  opacity: 1;
  color: var(--secondary-light);
}

.vl-sub-jp.revealed-wrong {
  filter: none;
  opacity: 1;
}

/* ---- Word blanks ---- */
.vl-word-visible {
  /* inherit font */
}

.vl-word-blank {
  display: inline-flex;
  min-width: 50px;
  border-bottom: 2px dashed var(--secondary-2);
  margin: 0 2px;
  padding: 0 4px;
  color: transparent;
  position: relative;
  vertical-align: baseline;
}

.vl-blank-hint {
  position: absolute;
  top: -10px;
  right: -4px;
  font-size: 10px;
  color: var(--secondary-2);
  opacity: 0.7;
  pointer-events: none;
  line-height: 1;
}

.vl-word-blank.revealed-correct {
  color: #34d399;
  border-bottom-color: #34d399;
  border-bottom-style: solid;
}

.vl-word-blank.revealed-shown {
  color: var(--secondary-2);
  border-bottom-color: var(--secondary-2);
  border-bottom-style: solid;
  opacity: 0.7;
}

.vl-word-blank.revealed-wrong {
  color: var(--secondary-2);
  border-bottom-color: var(--secondary-2);
  border-bottom-style: solid;
  text-decoration: line-through;
}

/* ---- Word Input ---- */
.vl-word-input-wrap {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.vl-word-input {
  width: 140px;
  background: var(--accent-bg);
  border: 1px solid var(--border) !important;
  color: var(--text-dark);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 4px;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.vl-word-input.input-correct {
  border-color: #34d399 !important;
  color: #34d399;
}

.vl-word-input.input-wrong {
  border-color: var(--secondary-2) !important;
  color: var(--secondary-2);
  animation: vl-shake 0.4s ease;
}

.vl-word-input:focus {
  border: 1px solid var(--secondary-2) !important;
  background: var(--accent-bg) !important;
  outline: none !important;
  box-shadow: none !important;
}

.vl-word-input::placeholder {
  color: var(--text-medium);
  font-size: 12px;
}

/* ---- Sentence Dictation Input ---- */
.vl-dictation-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.vl-dictation-input {
  flex: 1;
  background: var(--accent-bg);
  border: 1px solid var(--border) !important;
  color: var(--text-dark);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.vl-dictation-input.input-correct {
  border-color: #34d399 !important;
  color: #34d399;
}

.vl-dictation-input.input-wrong {
  border-color: var(--secondary-2) !important;
  color: var(--secondary-2);
  animation: vl-shake 0.4s ease;
}

.vl-dictation-input:focus {
  border: 1px solid var(--secondary-2) !important;
  background: var(--accent-bg) !important;
  outline: none !important;
  box-shadow: none !important;
}

.vl-dictation-input::placeholder {
  color: var(--text-medium);
  font-size: 12px;
}

@keyframes vl-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ---- Check Button ---- */
.vl-check-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--secondary-2);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vl-check-btn:hover {
  opacity: 0.9;
}

.vl-check-btn.small {
  padding: 6px 10px;
  font-size: 11px;
}

/* ---- Show Answer Button ---- */
.vl-show-answer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-medium);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  margin-left: 6px;
}

.vl-show-answer-btn:hover {
  background: var(--accent-bg);
  color: var(--secondary-2);
  border-color: var(--secondary-2);
}

.vl-show-answer-btn.small {
  padding: 4px 8px;
  font-size: 10px;
}

/* ---- Dictation Result ---- */
.vl-dictation-result {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  min-height: 16px;
}

.vl-dictation-result.correct {
  color: var(--secondary-light);
}

.vl-dictation-result.wrong {
  color: var(--secondary-2);
}

/* ---- Score Panel ---- */
.vl-score-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--background);
  flex-shrink: 0;
}

.vl-score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.vl-score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-medium);
}

.vl-score-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

.vl-score-number.correct {
  color: var(--secondary-light);
}

.vl-score-number.accent {
  color: var(--secondary-2);
}

.vl-score-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ---- Dictation Reset Button ---- */
.vl-dictation-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-medium);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vl-dictation-reset-btn:hover {
  background: var(--accent-bg);
  color: var(--secondary-2);
  border-color: var(--secondary-2);
}

/* ---- Shadowing Score Badge ---- */
.vl-score-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  align-self: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.vl-score-badge:hover {
  transform: scale(1.15);
}

.vl-score-badge.excellent {
  background: #34d399;
}

.vl-score-badge.good {
  background: #60a5fa;
}

.vl-score-badge.fair {
  background: #fbbf24;
}

.vl-score-badge.poor {
  background: #f87171;
}

/* ---- Dictation Active Dot ---- */
.vl-dictation-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary-2);
  align-self: center;
  animation: vl-pulse-dot 1.2s infinite;
}

/* ---- Recording Dot ---- */
.vl-recording-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary-2);
  align-self: center;
  animation: vl-pulse-dot 1.2s infinite;
}

@keyframes vl-pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ====== DICTATION CONTROL PANEL ====== */
.vl-dictation-control-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--background);
  animation: vl-slideUp 0.3s ease;
  height: 250px;
  overflow-y: auto;
}

/* When captions hidden, let panels expand */
.vl-dictation-control-panel.expanded {
  flex: 1;
  height: auto;
  min-height: 250px;
}

.vl-dictation-control-body {
  padding: 14px 16px;
}

/* ====== FEEDBACK PANEL ====== */
.vl-feedback-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--background);
  height: 350px;
  overflow-y: auto;
  animation: vl-slideUp 0.3s ease;
}

.vl-feedback-panel.expanded {
  flex: 1;
  height: auto;
  min-height: 350px;
}

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

.vl-feedback-body {
  padding: 14px 16px;
}

/* Feedback line preview */
.vl-fb-line-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--border);
}

.vl-fb-line-jp {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
  flex: 1;
}

.vl-fb-line-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.vl-fb-record-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 30px;
}

.vl-fb-record-btn {
  border: 1px solid var(--secondary-2);
  background: transparent;
  color: var(--secondary-2);
}

.vl-fb-record-btn:hover {
  background: var(--secondary-2);
  color: #fff;
}

.vl-fb-record-btn.recording {
  background: var(--secondary-2);
  color: #fff;
  border-color: var(--secondary-2);
  animation: vl-pulse-record 1.5s infinite;
}

@keyframes vl-pulse-record {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
}

/* Scores grid */
.vl-fb-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.vl-fb-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  border-radius: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--border);
}

.vl-fb-score-card.overall {
  border-color: var(--secondary-2);
  background: color-mix(in srgb, var(--secondary-2) 10%, var(--background));
}

.vl-fb-score-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.vl-fb-score-value.excellent {
  color: #34d399;
}

.vl-fb-score-value.good {
  color: #60a5fa;
}

.vl-fb-score-value.fair {
  color: #fbbf24;
}

.vl-fb-score-value.poor {
  color: #f87171;
}

.vl-fb-score-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-medium);
}

.vl-fb-words-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-medium);
  margin-bottom: 8px;
}

.vl-fb-words {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.vl-fb-word {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  transition: transform 0.15s ease;
  cursor: default;
}

.vl-fb-word-score {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 600;
}

.vl-fb-word:hover {
  transform: scale(1.1);
}

.vl-fb-word.excellent {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.vl-fb-word.good {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
}

.vl-fb-word.fair {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.vl-fb-word.poor {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  text-decoration: underline wavy #f87171;
  text-underline-offset: 3px;
}

.vl-fb-empty {
  text-align: center;
  padding: 20px 12px;
}

.vl-fb-empty-text {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.5;
}

/* ---- Responsive for new modes ---- */
@media (max-width: 992px) {
  .vl-subtitle-list {
    max-height: none;
  }
}

@media (max-width: 756px) {
  .vl-mode-tab {
    font-size: 11px;
    padding: 7px 6px;
  }

  .vl-subtitle-item {
    padding: 10px;
    gap: 8px;
  }

  .vl-sub-jp {
    font-size: 15px;
  }

  .vl-dictation-input {
    font-size: 13px;
    padding: 7px 10px;
  }

  .vl-word-input {
    width: 120px;
    font-size: 13px;
  }

  .vl-check-btn {
    font-size: 11px;
    padding: 7px 10px;
  }

  .vl-feedback-panel {
    max-height: 55vh;
  }

  .vl-feedback-body {
    padding: 10px 12px;
  }

  .vl-fb-line-jp {
    font-size: 14px;
  }

  .vl-fb-record-btn {
    padding: 5px 10px;
    font-size: 10px;
  }

  .vl-fb-scores {
    gap: 6px;
  }

  .vl-fb-score-card {
    padding: 8px 2px;
  }

  .vl-fb-score-value {
    font-size: 16px;
  }

  .vl-fb-word {
    font-size: 13px;
    padding: 2px 6px;
  }
}

