:root{
  --bg:#f3f4f6;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --accent:#1f6feb;
  --brand: var(--accent);
  --shadow: 0 8px 20px rgba(15, 23, 42, .08);
  --radius:16px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: Montserrat, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

.container{
  width:min(1200px, calc(100% - 32px));
  margin:0 auto;
}

.sr-only{
  position:absolute; width:1px; height:1px;
  padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Header */
.main-header{
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(243,244,246,.92);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
}

.header-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0 10px;
  gap:12px;
}

.logo-area{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.dino-logo{
  width:44px;
  height:44px;
  border-radius:50%;
  object-fit:cover;
  flex-shrink:0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.logo-text{
  font-family: Pacifico, cursive;
  font-weight:400;
  font-size:22px;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.header-right select{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
}

.admin-button{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  padding:10px 12px;
  font-size:14px;
  font-weight:800;
  color: var(--text);
  text-decoration:none;
}
.admin-button:hover{ box-shadow: var(--shadow); }
.header-right{ display:flex; align-items:center; gap:10px; }

/* Filters */
.header-filters{ padding:0 0 12px; }
.filters-collapse{
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.flashcard-footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  width: 100%;
}
.flashcard-footer-actions button {
  min-width: 120px;
}
.filters-summary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  cursor:pointer;
  list-style:none;
}
.filters-summary::-webkit-details-marker{ display:none; }

.filters-title{ font-weight:700; display:flex; align-items:center; gap:8px; }
.filters-hint{ color:var(--muted); font-size:12px; }

.filters-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  padding:12px 14px 14px;
  border-top:1px solid var(--border);
}

.filter-item{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:180px;
  flex: 1 1 180px;
}

.search-item{ flex: 2 1 320px; min-width:260px; }

.filter-label{
  font-size:13px;
  font-weight:700;
  color:#111827;
  display:flex;
  align-items:center;
  gap:8px;
}

.filter-item input[type="text"],
.filter-item select{
  border:1px solid var(--border);
  background:#f8fafc;
  border-radius:14px;
  padding:12px 12px;
  font-size:14px;
  outline:none;
}
.filter-item input[type="text"]:focus,
.filter-item select:focus{
  border-color:#c7d2fe;
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
  background:#fff;
}

.checks-item{
  min-width:220px;
  flex: 1 1 220px;
}
.checks-title{
  font-weight:700;
  font-size:13px;
  color:#111827;
}
.check-pill{
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid var(--border);
  border-radius:999px;
  padding:10px 12px;
  background:#fff;
  font-size:13px;
}
.check-pill input{ width:16px; height:16px; }

.actions-item{
  min-width:220px;
  flex: 0 1 220px;
  gap:10px;
}
.apply-filters-button, .clear-filters-button, .load-more-button{
  border:0;
  border-radius:14px;
  padding:12px 12px;
  font-weight:700;
  cursor:pointer;
}
.apply-filters-button{
  background:#111827;
  color:#fff;
}
.clear-filters-button{
  background:#e5e7eb;
  color:#111827;
}

.search-results-summary{
  font-size:13px;
  color:var(--muted);
}
.search-results-summary p{ margin:0; }

.results-click{ cursor:pointer; }
.show-results-btn{
  display:none;
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background:#111827;
  color:#fff;
  font-weight:700;
  cursor:pointer;
}

@media (max-width: 820px){
  .show-results-btn{ display:block; }
}

/* Layout */
.main-layout{
  display:grid;
  grid-template-columns: 1fr;
  gap:16px;
  padding:16px 0 20px;
}

.song-detail-area, .song-list-area{
  background:var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.placeholder-detail-message{
  padding:22px;
  text-align:center;
  color:var(--muted);
}
.waiting-dino{
  width:120px;
  height:120px;
  border-radius:50%;
  object-fit:cover;
  margin-top:10px;
  opacity:.95;
}

.waiting-cover{
  width:min(420px, 100%);
  aspect-ratio: 1 / 1;
  height:auto;
  object-fit:contain;
  margin:14px auto 0;
  display:block;
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: #fff;
  padding: 8px;
}

.video-player-container{ padding:14px; }
.video-player-container iframe{
  width:100%;
  border-radius: 16px;
}
.video-fallback{
  padding:0 14px 14px;
  color:var(--muted);
  font-size:13px;
}
.video-fallback.hidden{ display:none; }
.open-youtube{ color:var(--accent); font-weight:700; text-decoration:none; }

/* PDF download button (старый класс, но новый использует .resource-link) */
.detail-resources{ margin-top:10px; }
.pdf-download{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  font-weight:700;
  text-decoration:none;
}
.pdf-download:hover{ box-shadow: var(--shadow); }

.song-meta{
  padding:0 14px 14px;
}
.song-title-detail{ margin:0; font-size:22px; }
.song-artist-detail{ margin:6px 0 10px; color:var(--muted); }
.meta-badges{ display:flex; flex-wrap:wrap; gap:8px; }
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background:#f1f5f9;
  border:1px solid var(--border);
  font-size:12px;
  color:#0f172a;
}

.detail-tabs{
  display:flex;
  gap:8px;
  padding:12px 14px;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
  overflow-x:auto;
}
.detail-tab{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:9px 12px;
  font-weight:700;
  cursor:pointer;
  white-space:nowrap;
}
.detail-tab.active{
  background:#111827;
  color:#fff;
  border-color:#111827;
}
.tab-badge{
  margin-left:6px;
  background:#fff;
  color:#111827;
  border-radius:999px;
  padding:1px 7px;
  font-size:12px;
  font-weight:800;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.detail-panels{ padding:14px; }
.detail-panel{ display:none; }
.detail-panel.active{ display:block; }

/* Panel cards */
.panel-card{
  background:#ffffff;
  border:1px solid var(--border);
  border-radius:16px;
  padding:30px 20px 20px 20px; /* увеличен верхний отступ */
  transition:all 0.2s ease;
}
.panel-card h3{
  margin:0 0 16px 0;
  padding-bottom:8px;
  border-bottom:1px solid var(--border);
}
.muted{ color:var(--muted); margin:0 0 10px; font-size:13px; }

.lyrics-text p{
  margin:0 0 8px;
  line-height:1.45;
  font-size:14px;
}

.simple-list{ margin:0; padding-left:18px; }
.simple-list li{ margin:0 0 6px; color:#0f172a; }
.chips-wrap{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  font-size:13px;
}

/* Tasks */
.tasks-list{ display:flex; flex-direction:column; gap:12px; }
.task-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px;
}
.task-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.task-title{ margin:0; font-size:15px; }
.task-type{
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--border);
  padding:4px 8px;
  border-radius:999px;
  background:#f8fafc;
  white-space:nowrap;
}
.task-instruction{ margin:8px 0 10px; color:#0f172a; font-size:14px; }
.task-body ul{ margin:0; padding-left:18px; }
.task-body li{ margin:0 0 6px; }
.task-actions{ margin-top:10px; display: flex; gap: 8px; flex-wrap: wrap; }
.task-btn{
  border:0;
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
  cursor:pointer;
}
.task-btn.primary{ background:#111827; color:#fff; }
.task-answer{
  display:none;
  margin-top:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px dashed #cbd5e1;
  background:#f8fafc;
  color:#0f172a;
  font-size:14px;
}
.tasks-empty{ color:var(--muted); font-size:14px; }

/* Match задания */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}
.match-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-item {
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 30px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.match-item:hover {
  background: #f1f5f9;
  border-color: var(--accent);
}
.match-item.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(31, 111, 235, 0.2);
}
.match-item.matched {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
  text-decoration: line-through;
  opacity: 0.7;
  pointer-events: none;
}

/* Gap-fill */
.gap-fill-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.gap-fill-form span {
  font-size: 16px;
}
.gap-input, .gap-select {
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 80px;
}
.gap-input:focus, .gap-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Quiz */
.quiz-question {
  margin-bottom: 20px;
  padding: 12px;
  background: white;
  border-radius: 16px;
}
.quiz-option {
  display: block;
  margin: 8px 0;
  font-size: 14px;
}
.quiz-option input {
  margin-right: 8px;
}

/* Grammar rules */
.grammar-rules {
  background: #f1f5f9;
  border-left: 4px solid var(--accent);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* Word bank */
.word-bank {
  margin-top: 10px;
}
.word-bank .chip {
  margin-right: 6px;
  margin-bottom: 6px;
}

/* Flashcards */
.flashcards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}
.flashcards-header h3 { margin: 0; }
.flashcards-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}
.progress-bar-container {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  min-width: 45px;
}
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  padding: 20px 0;
}
.flashcard-wrapper {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  perspective: 1500px;
  min-height: 250px;
}
.flashcard {
  width: 100%;
  height: 250px;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s;
  transform-style: preserve-3d;
}
.flashcard.flipped {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.3s ease;
}
.flashcard-front {
  background: linear-gradient(135deg, var(--accent), #1a4fa0);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.flashcard-front .word {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.flashcard-front .transcription {
  font-size: 16px;
  opacity: 0.9;
  font-style: italic;
}
.flashcard-front .example {
  font-size: 16px;
  margin-top: 8px;
  opacity: 0.9;
}
.flashcard-back {
  background: white;
  color: var(--text);
  transform: rotateY(180deg);
  overflow-y: auto;
}
.flashcard-back .translation {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 15px;
}
.flashcard-back .example {
  font-size: 16px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 10px;
  max-width: 80%;
}
.flashcard-back .example-translation {
  font-size: 14px;
  color: var(--muted);
  opacity: 0.8;
}
.flashcard-learned {
  cursor: default;
  opacity: 0.9;
}
.flashcard-learned .flashcard-front {
  background: linear-gradient(135deg, #10b981, #059669);
}
.flashcard-learned .learned-stamp {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,0.3);
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.flashcards-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.flashcards-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.flashcards-nav-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.flashcards-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.flashcards-counter {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}
.flashcards-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.flashcards-btn {
  padding: 8px 16px;
  background: white;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.flashcards-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.flashcards-btn.danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

/* Live tasks */
.live-task-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  padding: 24px;
  z-index: 1000;
  min-width: 300px;
  max-width: 90%;
  border: 1px solid var(--border);
}
.live-task-content { position: relative; }
.live-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--muted);
  color: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}
.live-option {
  padding: 12px 24px;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 40px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.live-option:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.live-feedback {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 40px;
  color: white;
  font-weight: 500;
  z-index: 1001;
  animation: fadeInOut 2s ease;
}
.live-feedback.correct { background: #10b981; }
.live-feedback.incorrect { background: #ef4444; }
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  90% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Адаптация для мобильных устройств (флешкарты) */
@media (max-width: 640px) {
  .flashcard-wrapper {
    max-width: 300px;
    min-height: 200px;
  }
  .flashcard {
    height: 200px;
  }
}

/* Song page grid */
@media (min-width: 981px) {
  #song-content {
    display: grid;
    grid-template-columns: 450px 1fr; 
    grid-template-areas: 
      "video tabs"
      "video content";
    gap: 24px;
    align-items: start;
  }
  .song-header {
    grid-area: video;
    position: sticky;
    top: 80px;
    height: fit-content;
    z-index: 5;
    margin-bottom: 0 !important; 
  }
  .detail-tabs {
    grid-area: tabs;
    position: sticky;
    top: 60px;
    z-index: 4;
    background: var(--bg);
    padding-top: 10px;
    padding-bottom: 10px;
    margin-top: 0;
  }
  .detail-panels {
    grid-area: content;
    min-width: 0;
    position: sticky;
    top: 140px;
    height: calc(100vh - 160px); /* фиксированная высота */
    overflow-y: auto;
  }
  .detail-panel.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%; /* растягиваем на всю высоту родителя */
  }
  .panel-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  #lyrics-content,
  #tasks-container,
  #vocab-content,
  #grammar-rules-content,
  .flashcards-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

/* Video container */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0;
}
.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Song header */
.song-header {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}
.song-title-text {
  margin: 0 0 8px 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}
.song-artist-text {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: #64748b;
}
.badges-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* Resources under video */
.song-resources {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  width: 100%;
  justify-content: center;
}
.resource-link i { font-size: 18px; }
.resource-link.pdf {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}
.resource-link.pdf:hover { background: #b91c1c; }
.resource-link.miro {
  background: #0a3d5e;
  color: white;
  border-color: #0a3d5e;
}
.resource-link.miro:hover { background: #052d44; }

/* Lyrics controls */
.lyrics-controls {
  display: flex;
  gap: 16px;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 40px;
  flex-wrap: wrap;
}
.control-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #334155;
}
.control-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

/* Lyrics blocks */
.lyric-block {
  margin-bottom: 10px;
}
.lyric-line {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  margin: 2px 0;
  border-radius: 8px;
}
.lyric-line.active {
  background-color: var(--accent);
  color: white;
  font-weight: 600;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.3);
}
.lyric-line:hover:not(.active) {
  background-color: rgba(31, 111, 235, 0.1);
}
.lyric-translation {
  font-size: 0.85em;
  font-style: italic;
  color: var(--muted);
  margin: 2px 0 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

/* ===== КАРТОЧКИ ПЕСЕН (ГЛАВНАЯ) ===== */
.song-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap:12px;
  padding:14px;
}
.main-list-only .song-list-area{
  width:100%;
}
.song-card {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.song-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}
.song-card:focus {
  outline: 3px solid rgba(99,102,241,.25);
}
.song-card::after {
  content: '→';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.song-card:hover::after {
  opacity: 1;
  transform: translate(4px, -50%);
}
.song-card-cover {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e5e7eb;
  transition: transform 0.2s ease;
}
.song-card-info {
  min-width: 0;
  flex: 1;
}
.song-card-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.song-card-info p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.song-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.song-card-tags span {
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #0f172a;
  background-color: #fff;
  border-color: #d1d5db;
  font-weight: 500;
  /* Гарантируем корректное отображение цифр */
  font-variant-numeric: normal;
}
.song-card-restrictions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.restriction-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: #1e293b;
}
.restriction-badge.age {
  background: #fef9c3;
  border-color: #facc15;
}
.restriction-badge.other-lang {
  background: #dbeafe;
  border-color: #3b82f6;
}
/* Toolbar списка песен (заголовок, счётчик, сортировка) */
.song-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.song-list-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
}

.song-list-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.song-list-subtitle {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.song-list-actions {
  flex-shrink: 0;
}

.song-list-actions select {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
/* List pagination */
.list-pagination{
  padding:0 14px 14px;
}
.load-more-button{
  width:100%;
  background:#111827;
  color:#fff;
}
.list-hint{
  margin:10px 0 0;
  text-align:center;
  color:var(--muted);
  font-size:13px;
}

/* Footer */
.main-footer{
  padding:18px 0 30px;
  color:var(--muted);
  text-align:center;
}

/* Mobile */
.mobile-view-toggle{
  display:none;
  gap:8px;
  margin:12px 0 0;
}
.mobile-toggle-btn{
  flex:1;
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:10px 12px;
  font-weight:800;
}

@media (max-width: 980px){
  .main-layout{ grid-template-columns: 1fr; }
  .mobile-view-toggle{ display:flex; }
  body.mobile-show-list #detail-pane{ display:none; }
  body.mobile-show-detail #list-pane{ display:none; }
}

@media (max-width: 480px){
  .dino-logo{ width:38px; height:38px; }
  .logo-text{ font-size:20px; }
  .filters-hint{ display:none; }
}
/* Уменьшаем шрифт подзаголовка списка (Показано: X из Y) */
.song-list-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: normal;
}
/* Стили для панели грамматических правил */
.grammar-rules-content {
  padding: 10px 0;
  font-size: 15px;
  line-height: 1.6;
}

.grammar-rules-content p {
  margin: 0 0 12px 0;
  color: var(--text);
}

.grammar-rules-content p:last-child {
  margin-bottom: 0;
}

/* Стили для выделения важных терминов в грамматике */
.grammar-rules-content strong {
  color: var(--accent);
  font-weight: 600;
}

.grammar-rules-content em {
  font-style: italic;
  color: var(--muted);
}

/* Для лексики */
#vocab-content {
  min-height: 100px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

/* Для текста песни */
#lyrics-content {
  min-height: 200px;
}

/* Для заданий */
#tasks-container {
  min-height: 150px;
}

/* Для карточек */
.flashcards-container {
  min-height: 350px;
  display: flex;
  flex-direction: column;
}

.flashcard-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Стили для пустых состояний */
.muted {
  color: var(--muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
  background: #f8fafc;
  border-radius: 12px;
  margin: 0;
}

/* Для мобильных устройств */
@media (max-width: 980px) {
  .detail-panel.active {
    min-height: auto;
  }
  
  .panel-card {
    min-height: auto;
  }
}

.flashcard-footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  width: 100%;
}
.flashcard-footer-actions button {
  min-width: 120px;
}
/* Flashcards (дополнительно) */
.flashcards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}
.flashcards-header h3 { margin: 0; }
.flashcards-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}
.progress-bar-container {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  min-width: 45px;
}
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  padding: 20px 0;
}
.flashcard-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  perspective: 1500px;
  min-height: 220px;
}
.flashcard {
  width: 100%;
  height: 220px;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s;
  transform-style: preserve-3d;
}
.flashcard.flipped {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.3s ease;
  overflow-y: auto; /* прокрутка при переполнении */
}
.flashcard-front {
  background: linear-gradient(135deg, var(--accent), #1a4fa0);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.flashcard-front .word {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.flashcard-front .transcription {
  font-size: 14px;
  opacity: 0.9;
  font-style: italic;
  margin-bottom: 8px;
}
.flashcard-front .example {
  font-size: 15px;
  margin-top: 6px;
  opacity: 0.9;
}
.flashcard-back {
  background: white;
  color: var(--text);
  transform: rotateY(180deg);
  border: 1px solid var(--border);
}
.flashcard-back .translation {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.flashcard-back .example {
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 10px;
  max-width: 90%;
}
.flashcard-back .example-translation {
  font-size: 14px;
  color: var(--muted);
  opacity: 0.8;
}
.flashcard-learned {
  cursor: default;
  opacity: 0.9;
}
.flashcard-learned .flashcard-front {
  background: linear-gradient(135deg, #10b981, #059669);
}
.flashcard-learned .learned-stamp {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,0.3);
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.flashcards-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.flashcards-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.flashcards-nav-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.flashcards-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.flashcards-counter {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}
.flashcards-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}
.flashcards-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.flashcards-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.flashcards-btn.danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}
/* Результаты заданий */
.result-message {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 30px;
  font-weight: 500;
  text-align: center;
}
.result-message.correct {
  background: #d1fae5;
  color: #065f46;
}
.result-message.incorrect {
  background: #fee2e2;
  color: #991b1b;
}
/* Кнопка возврата в каталог */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px 0;        /* отступы сверху и снизу */
  padding: 10px 18px;
  background-color: #f1f5f9;    /* светло-серый фон */
  border: 1px solid var(--border);
  border-radius: 40px;           /* скруглённые края */
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s, box-shadow 0.2s;
  font-size: 15px;
}
.back-link:hover {
  background-color: #e2e8f0;    /* чуть темнее при наведении */
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.back-link i {
  font-size: 14px;
}

/* Кнопка возврата, расположенная над видео (внутри song-header) */
.back-link-over-video {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;  /* отступ снизу, чтобы отделить от заголовка */
  padding: 8px 16px;
  background-color: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
  width: fit-content;   /* ширина по содержимому */
}
.back-link-over-video:hover {
  background-color: #e2e8f0;
}
.back-link-over-video i {
  font-size: 12px;
}

html {
  scroll-padding-top: 120px; /* отступ сверху при прокрутке (высота шапки + вкладки) */
}
/* Стили для кнопки "Проверить" (если используется класс .check-btn) */
.check-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  background: #111827;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.check-btn:hover {
  background: #2d3748;
}

/* Уменьшаем отступ между инструкцией и вопросами */
.task-instruction {
  margin-bottom: 8px; /* было больше, можно подобрать на глаз */
}

/* Если нужно ещё уменьшить интервал между вопросами и кнопкой */
.quiz-question {
  margin-bottom: 8px; /* уменьшите по желанию */
}
/* Уменьшаем отступ после инструкции */
.task-instruction {
  margin-bottom: 2px;  /* подберите нужное значение, например 8px */
}

/* Оставляем стандартный отступ между заданиями (он уже задан в .task-block) */
.task-block {
  margin-bottom: 10px; /* если хотите изменить – отрегулируйте здесь */
}
/* Центрирование текста в карточках */
.flashcard-front,
.flashcard-back {
  justify-content: center !important;
}


/* ===== Модуль проверки произношения на странице песни ===== */
.speech-practice-panel {
  overflow: hidden;
}

.speech-practice-card {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(124, 92, 255, 0.20);
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 144, 188, 0.16), transparent 32%),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 50px rgba(35, 26, 75, 0.10);
  color: #221b3a;
}

.speech-practice-intro {
  margin: 0 0 16px;
  color: rgba(34, 27, 58, 0.70);
  line-height: 1.55;
}

.speech-line-box {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(34, 27, 58, 0.08);
}

.speech-line-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: rgba(34, 27, 58, 0.55);
  font-size: 13px;
}

.speech-target-line {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  line-height: 1.35;
}

.speech-word {
  display: inline-block;
  margin: 2px 2px 2px 0;
  padding: 2px 5px;
  border-radius: 9px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.speech-word-neutral { background: rgba(34, 27, 58, 0.05); }
.speech-word-good { background: rgba(43, 184, 117, 0.18); color: #12744a; }
.speech-word-close { background: rgba(255, 194, 77, 0.28); color: #8b5d00; }
.speech-word-miss { background: rgba(255, 105, 135, 0.18); color: #a22745; }

.speech-translation {
  margin: 12px 0 0;
  color: rgba(34, 27, 58, 0.68);
  line-height: 1.45;
}

.speech-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.speech-btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
  background: #251b4d;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 27, 77, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.speech-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 27, 77, 0.22);
}

.speech-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.speech-listen-btn {
  background: #ffffff;
  color: #251b4d;
  border: 1px solid rgba(37, 27, 77, 0.12);
}

.speech-record-btn {
  background: linear-gradient(135deg, #7c5cff, #ff74ad);
}

.speech-practice-card.is-recording .speech-record-btn {
  animation: speechPracticePulse 1s infinite;
}

@keyframes speechPracticePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 116, 173, 0.42); }
  70% { box-shadow: 0 0 0 14px rgba(255, 116, 173, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 116, 173, 0); }
}

.speech-feedback {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}

.speech-score-box,
.speech-status,
.speech-heard {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(34, 27, 58, 0.08);
}

.speech-score-box { padding: 14px; }
.speech-score-box strong { display: block; font-size: 32px; line-height: 1; }
.speech-score-box span { display: block; margin-top: 5px; color: rgba(34, 27, 58, 0.62); font-size: 14px; }

.speech-status {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  color: rgba(34, 27, 58, 0.76);
  line-height: 1.45;
}

.speech-heard {
  padding: 12px 14px;
  color: rgba(34, 27, 58, 0.62);
}

.speech-heard b {
  color: #221b3a;
}

.speech-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.speech-link-btn {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: #6b48e8;
  font-weight: 800;
  cursor: pointer;
}

.speech-link-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.speech-note {
  margin: 14px 0 0;
  color: rgba(34, 27, 58, 0.46);
  font-size: 13px;
}

@media (min-width: 981px) {
  #speech-practice-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

@media (max-width: 680px) {
  .speech-practice-card {
    padding: 16px;
    border-radius: 22px;
  }

  .speech-feedback {
    display: block;
  }

  .speech-status {
    margin-top: 10px;
  }

  .speech-btn {
    width: 100%;
  }
}
