/* Listen Lab — CEFR difficulty UI
   Keeps the existing warm paper / olive palette; levels step from pale to deep
   instead of using a rainbow so the page still reads as one product. */

.cefr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  background: #f0ede6;
  color: #9a9484;
  flex: none;
  vertical-align: middle;
}
.cefr-badge.lv-a1 { background: #eef2e6; color: #6b7f52; }
.cefr-badge.lv-a2 { background: #e4ebd8; color: #63784b; }
.cefr-badge.lv-b1 { background: #d8e3c6; color: #55703f; }
.cefr-badge.lv-b2 { background: #c9d8b2; color: #4a6636; }
.cefr-badge.lv-c1 { background: #b9c9a0; color: #3f5a2c; }
.cefr-badge.lv-c2 { background: #a8b98c; color: #33491f; }
.cefr-badge.unknown { background: #f2efe8; color: #a09a8b; }
.cefr-badge.stale { background: #f7e9dc; color: #a06a42; }

.lesson-card-body h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.history-head .cefr-badge { margin-left: 2px; }

.cefr-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8f9782;
}
.cefr-filter select {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: #49543c;
  background: #fbfaf6;
  border: 1px solid #ddd8ca;
  border-radius: 999px;
  padding: 5px 26px 5px 10px;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #8f9782 50%), linear-gradient(135deg, #8f9782 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.difficulty-panel {
  margin: 0 0 18px;
  border: 1px solid #e3dfd3;
  border-radius: 14px;
  background: #fbfaf6;
  overflow: hidden;
}
.difficulty-panel summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.difficulty-panel summary::-webkit-details-marker { display: none; }
.difficulty-panel summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 9px;
  color: #a3aa96;
  transition: transform .18s ease;
}
.difficulty-panel[open] summary::after { transform: rotate(180deg); }
.difficulty-title {
  font-size: 12px;
  color: #46503a;
  font-weight: 600;
}
.difficulty-conf {
  font-size: 10px;
  color: #9aa28c;
}
.difficulty-kicker {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #b0b6a4;
}
.difficulty-panel summary::after { margin-left: 0; }
.difficulty-kicker { margin-left: 0; }
.difficulty-conf { margin-left: auto; }

.difficulty-body { padding: 0 16px 6px; }
.difficulty-note {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.8;
  color: #7d8570;
}
.difficulty-inner { display: block; }

.difficulty-dims {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.diff-dim {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #e8e3d6;
  border-radius: 10px;
  background: #fffdf8;
}
.diff-dim-label {
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #a3aa96;
}
.diff-dim strong {
  font-size: 16px;
  font-weight: 600;
  color: #3d4733;
  line-height: 1.2;
}
.diff-dim small { font-size: 9.5px; color: #9aa28c; line-height: 1.5; }

.difficulty-h {
  margin: 14px 0 8px;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #a3aa96;
  font-weight: 600;
}

.difficulty-bars { display: flex; flex-direction: column; gap: 5px; }
.diff-bar {
  display: grid;
  grid-template-columns: 44px 1fr 34px;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  color: #8a927d;
}
.diff-bar-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #ece7d9;
  overflow: hidden;
}
.diff-bar-fill {
  display: block;
  height: 6px;
  min-width: 0;
  border-radius: 999px;
  background: #a8bd8a;
}
.diff-bar.lv-a1 .diff-bar-fill { background: #cfdcb4; }
.diff-bar.lv-a2 .diff-bar-fill { background: #bfd0a0; }
.diff-bar.lv-b1 .diff-bar-fill { background: #a9bf8a; }
.diff-bar.lv-b2 .diff-bar-fill { background: #93ad74; }
.diff-bar.lv-c1 .diff-bar-fill { background: #8fa96f; }
.diff-bar.lv-c2 .diff-bar-fill { background: #769157; }
.diff-bar.lv-unknown .diff-bar-fill { background: #cbb79f; }
.diff-bar-val { text-align: right; }

.difficulty-reasons {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  line-height: 1.9;
  color: #6f7862;
}
.difficulty-reasons li { margin-bottom: 2px; }

.difficulty-hard { display: flex; flex-direction: column; gap: 6px; }
.difficulty-hard-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #e8e3d6;
  border-radius: 10px;
  background: #fffdf8;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.difficulty-hard-item:hover { border-color: #c9d3b4; background: #fdfbf3; }
.difficulty-hard-time {
  font-size: 10px;
  color: #a3aa96;
  padding-top: 2px;
}
.difficulty-hard-text {
  font-size: 12px;
  line-height: 1.75;
  color: #3f4835;
}
.difficulty-hard-item small {
  grid-column: 2;
  font-size: 9px;
  color: #a3aa96;
}

.difficulty-meta {
  margin: 13px 0 4px;
  font-size: 9px;
  line-height: 1.8;
  color: #a3aa96;
}

.difficulty-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 16px 14px;
}
.difficulty-actions .outline.small { flex: none; }
.difficulty-foot {
  flex: 1 1 220px;
  font-size: 9px;
  line-height: 1.7;
  color: #a8ad9c;
}

#analyzeAllBtn { margin-left: auto; }

@media (max-width: 830px) {
  .difficulty-dims { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .difficulty-kicker { display: none; }
}

@media (max-width: 560px) {
  .difficulty-panel summary { padding: 10px 13px; gap: 8px; flex-wrap: wrap; }
  .difficulty-body { padding: 0 13px 4px; }
  .difficulty-actions { padding: 2px 13px 13px; }
  .difficulty-dims { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .diff-dim { padding: 8px 9px; }
  .diff-dim strong { font-size: 14px; }
  .diff-dim small { font-size: 9px; }
  .difficulty-hard-item { grid-template-columns: 38px 1fr; }
  .cefr-filter { margin-left: auto; }
  #analyzeAllBtn { margin-left: 0; }
  .section-bar { flex-wrap: wrap; gap: 8px; }
}

.cefr-manual {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: .06em;
  color: #8f9782;
  flex: none;
}
.cefr-manual select {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0;
  color: #49543c;
  background: #fffdf8;
  border: 1px solid #ddd8ca;
  border-radius: 999px;
  padding: 4px 24px 4px 9px;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #8f9782 50%), linear-gradient(135deg, #8f9782 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.cefr-badge.manual { box-shadow: inset 0 0 0 1px rgba(70, 90, 50, .45); }
.manual-note {
  color: #7d6a45;
  background: #fbf4e6;
  border: 1px solid #efe2c8;
  border-radius: 9px;
  padding: 7px 10px;
  margin: 0 0 11px;
}

@media (max-width: 560px) {
  .difficulty-actions .cefr-manual { flex: 1 1 100%; }
}
