/* ── Nghe & lặp câu: library → lesson ─────────────────────────── */
.rp-status { font-size: .9em; color: var(--text-2); background: var(--primary-soft); border: 1px solid var(--primary-border);
             border-radius: 10px; padding: 8px 14px; margin-bottom: 14px; }
.rp-status:empty { display: none; }
.rp-add { padding: 16px 20px; }
.rp-add-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rp-add .upload-tabs { margin: 0; }
.rp-add-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.rp-add-row input[type=file] { flex: 1; min-width: 220px; }
.rp-add-hint { margin: 8px 0 0; }
.rp-file { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; font-size: .8em; color: var(--muted); }
input[type=file] { font-family: inherit; font-size: .9em; color: var(--muted); }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
#recentCard .session-row { gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: 10px; cursor: pointer; flex-wrap: nowrap; }
#recentCard .session-row:hover { background: var(--surface-2); }
.session-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; background: var(--primary-soft); }
#recentCard .session-meta { display: flex; flex-direction: column; min-width: 0; font-size: .92em; }
#recentCard .session-meta b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#recentCard .session-meta .muted { font-size: .85em; }

.rp-lesson-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rp-lesson-title { min-width: 0; }
.rp-lesson-title h1 { margin: 0; font-size: 1.45em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-toolbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.rp-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.rp-field { display: inline-flex; align-items: center; gap: 6px; font-size: .88em; color: var(--text-2); white-space: nowrap; }
.rp-field input[type=number] { width: 54px; padding: 5px 7px; }
.rp-field select { padding: 5px 8px; }
.rp-check { cursor: pointer; }
.rp-more { position: relative; margin-left: auto; }
.rp-more summary {
  list-style: none; cursor: pointer; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  font-size: .88em; font-weight: 600; color: var(--text-2); background: var(--surface); user-select: none;
}
.rp-more summary::-webkit-details-marker { display: none; }
.rp-more[open] summary { background: var(--surface-3); }
.rp-more-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; width: 320px; padding: 12px 16px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.rp-more-panel .fci-label { margin: 8px 0 0; }
.rp-more-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-more-row button { font-size: .85em; padding: 6px 10px; }
#masterCard h3 + .muted { font-size: .85em; }
#masterVideo { max-height: 340px; object-fit: contain; }

/* one sentence = one compact row; the practice tools open below it */
#result .clip-row { padding: 0; margin: 0 0 8px; border-radius: var(--radius); overflow: hidden; }
.clip-head-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.clip-head-row:hover { background: var(--surface-2); }
.clip-row .clip-select-row label { padding: 0; border: none; background: none; }
.clip-row .clip-select-row input[type=checkbox]:checked + label { background: none; }
.clip-play {
  flex: 0 0 auto; width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); border: none; font-size: .9em;
}
.clip-play:hover:not(:disabled) { background: var(--primary); color: #fff; }
.clip-num { flex: 0 0 auto; min-width: 22px; color: var(--muted); font-size: .82em; font-weight: 700; text-align: right; }
.clip-title { flex: 1; min-width: 0; }
.clip-row .s-text { margin: 0; font-size: 1.02em; font-weight: 500; color: var(--text); }
.clip-hidden-hint { display: none; color: var(--muted); font-style: italic; }
.clip-row .s-text[style*="none"] + .clip-hidden-hint { display: inline; }
.clip-row .s-meta { flex: 0 0 auto; margin: 0; font-size: .8em; font-variant-numeric: tabular-nums; }
.clip-badge { flex: 0 0 auto; font-size: .78em; color: var(--success-text); font-weight: 600; }
.clip-badge:empty { display: none; }
.clip-chevron { flex: 0 0 auto; color: var(--muted); transition: transform .15s; }
.clip-row.open .clip-chevron { transform: rotate(180deg); }
.clip-body { display: none; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.clip-row.open .clip-body { display: block; }
.clip-row.open { box-shadow: var(--shadow); }
.clip-body .pitch-canvas { margin-top: 12px; }
.clip-body .clip-bar { height: 12px; border-radius: 999px; margin: 6px 0 4px; }
.clip-hint { font-size: .78em; color: var(--muted); margin-top: 2px; }
.clip-body .s-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.clip-tools button { font-size: .82em; padding: 6px 11px; background: transparent; }
.clip-tools { padding-top: 10px; border-top: 1px dashed var(--border); }
.clip-rec-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.clip-rec-btn:hover:not(:disabled) { background: var(--danger-text); border-color: var(--danger-text); color: #fff; }
#result .card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
#result .card.active .clip-play { background: var(--primary); color: #fff; }
#result .card.clip-selected { background: var(--surface); }
#result .card.clip-selected .clip-head-row { background: var(--primary-soft); }
@media (max-width: 640px) {
  .clip-row .s-meta { display: none; }
  .rp-more-panel { width: min(320px, calc(100vw - 32px)); }
}

/* Primary actions are pills, like the rest of the design */
button.primary, .cl-btn-primary, .dict-btn-create, .dict-btn-practice, .cl-btn-review, .cl-btn-add,
.rd-upload-btn, .spk-btn { border-radius: 999px; }
.cl-btn-review, .cl-btn-add { box-shadow: none; }

/* Phones & small tablets: the sidebar slides in from a top bar */
@media (max-width: 900px) {
  body { padding: 0 16px 48px; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 55; display: flex; align-items: center; gap: 10px;
    margin: 0 -16px 18px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .app-brand { padding: 0; }
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 59; background: var(--overlay); }
}
