/**
 * DeutschMaak — Exercise tile design (B1 + B2)
 * Default: plain card frame, no success border, no validée icon.
 * Perfect score (.show-validee): ✓ badge only; reward rings on score circle only.
 */

html:not(.telc-scores-ready) .score-dot:not(.score-static),
html:not(.telc-scores-ready) .user-score-badge:not(.score-static),
html:not(.telc-scores-ready) a.ex-btn .score-dot:not(.score-static),
html:not(.telc-scores-ready) div.ex-btn .score-dot:not(.score-static) {
  visibility: hidden !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: transparent !important;
}

html.telc-scores-ready .score-dot,
html.telc-scores-ready .user-score-badge {
  visibility: visible;
}

:root {
  --telc-tile-pink: #e91e8c;
  --telc-tile-blue: #1976d2;
  --telc-tile-text: #1a1a2e;
  --telc-tile-border: #f0d0e8;
  --telc-tile-radius: 16px;
  --telc-tile-green: #2e7d32;
  --telc-tile-red: #e53935;
  --telc-tile-blue-tier: #1976d2;
  --telc-tile-gold: #f9a825;
}

.section-card,
.section-body {
  overflow: visible !important;
}

.exercise-grid,
.telc-exercise-grid,
#hoeren-hub-grid,
#hoeren-teil1-grid,
#hoeren-teil2-hub-grid,
#hoeren-teil3-hub-grid,
#b1-hoeren-t1-grid,
#b1-hoeren-t2-grid,
#b1-hoeren-t3-grid,
[id^="hoeren-"][id$="-grid"],
[id^="sprechen-"],
[id^="hoeren-turkei-"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding: 10px 10px 4px 4px;
  overflow: visible !important;
}

@media (max-width: 640px) {
  .exercise-grid,
  .telc-exercise-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .exercise-grid,
  .telc-exercise-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ── Default card frame (always visible, neutral — no success styling) ── */
a.ex-btn,
div.ex-btn,
button.ex-btn {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  height: 4rem !important;
  min-height: 4rem !important;
  max-height: 4rem !important;
  text-decoration: none !important;
  background: linear-gradient(135deg, #fce4ec 0%, #e3f2fd 100%) !important;
  border: 1.5px solid var(--telc-tile-border) !important;
  color: var(--telc-tile-text) !important;
  padding: 1rem !important;
  border-radius: var(--telc-tile-radius) !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  transition: all 0.22s ease !important;
  box-shadow: 0 2px 6px rgba(233, 30, 140, 0.07) !important;
  position: relative !important;
  overflow: hidden !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent;
}

a.ex-btn.show-validee,
div.ex-btn.show-validee,
button.ex-btn.show-validee,
div.ex-btn.ex-version-picker-trigger.show-validee {
  overflow: visible !important;
}

a.ex-btn:hover,
div.ex-btn:hover,
button.ex-btn:hover {
  background: linear-gradient(135deg, #f8bbd0 0%, #bbdefb 100%) !important;
  border-color: #e8a0cc !important;
  transform: translateY(-3px) scale(1.015) !important;
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.18) !important;
}

a.ex-btn:active,
div.ex-btn:active,
button.ex-btn:active {
  transform: translateY(-1px) scale(1.005) !important;
}

a.ex-btn:focus-visible,
div.ex-btn:focus-visible {
  outline: 2px solid rgba(233, 30, 140, 0.45) !important;
  outline-offset: 2px !important;
}

a.ex-btn::before,
div.ex-btn::before,
button.ex-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--telc-tile-pink), var(--telc-tile-blue));
  border-radius: 3px 0 0 3px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

a.ex-btn:hover::before,
div.ex-btn:hover::before,
button.ex-btn:hover::before {
  opacity: 1;
}

/* Validée hidden by default */
a.ex-btn::after,
div.ex-btn::after,
button.ex-btn::after {
  content: none !important;
  display: none !important;
}

/* Legacy is-completed must not show reward visuals */
a.ex-btn.is-completed,
div.ex-btn.is-completed,
button.ex-btn.is-completed {
  border-color: var(--telc-tile-border) !important;
  box-shadow: 0 2px 6px rgba(233, 30, 140, 0.07) !important;
}

a.ex-btn.is-completed::after,
div.ex-btn.is-completed::after,
button.ex-btn.is-completed::after {
  content: none !important;
  display: none !important;
}

/* ── Perfect score: validée checkmark only (no card border change) ── */
a.ex-btn.show-validee,
div.ex-btn.show-validee,
button.ex-btn.show-validee {
  border-color: var(--telc-tile-border) !important;
  box-shadow: 0 2px 6px rgba(233, 30, 140, 0.07) !important;
}

a.ex-btn.show-validee::after,
div.ex-btn.show-validee::after,
button.ex-btn.show-validee::after {
  content: "✓" !important;
  display: flex !important;
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--telc-tile-green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  z-index: 20;
  pointer-events: none;
}

.ex-btn .ex-label,
a.ex-btn .ex-label,
div.ex-btn .ex-label {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  line-height: 1.25 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding-right: 0.5rem !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  pointer-events: none !important;
  color: #1e293b !important;
}

/* Badge row — never shrink */
.ex-btn .ex-static-scores,
a.ex-btn .ex-static-scores,
div.ex-btn .ex-static-scores {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.375rem !important;
  margin-left: auto !important;
  pointer-events: none !important;
}

.ex-btn > .score-dot:not(.score-static),
a.ex-btn > .score-dot:not(.score-static),
div.ex-btn > .score-dot:not(.score-static) {
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

.ex-btn .score-dot,
a.ex-btn .score-dot,
div.ex-btn .score-dot {
  flex-shrink: 0 !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  position: relative !important;
  z-index: 10 !important;
  transition: background 0.25s, transform 0.15s !important;
  box-shadow: none !important;
}

/* Empty placeholder — untouched / never attempted (no score history) */
.ex-btn .score-dot.is-unattempted,
a.ex-btn .score-dot.is-unattempted,
div.ex-btn .score-dot.is-unattempted,
.ex-btn .score-dot:not(.has-score):not(.score-static),
a.ex-btn .score-dot:not(.has-score):not(.score-static),
div.ex-btn .score-dot:not(.has-score):not(.score-static) {
  background-color: rgba(0, 0, 0, 0.03) !important;
  border: 1px dashed rgba(0, 0, 0, 0.2) !important;
  color: rgba(0, 0, 0, 0.28) !important;
  opacity: 1 !important;
  box-shadow: none !important;
  display: flex !important;
  font-weight: 600 !important;
}

html.dark .ex-btn .score-dot.is-unattempted,
html.dark a.ex-btn .score-dot.is-unattempted,
html.dark div.ex-btn .score-dot.is-unattempted,
html.dark .ex-btn .score-dot:not(.has-score):not(.score-static) {
  background-color: rgba(255, 255, 255, 0.04) !important;
  border: 1px dashed rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.35) !important;
}

.ex-btn .score-dot.has-score,
a.ex-btn .score-dot.has-score,
div.ex-btn .score-dot.has-score,
.score-dot.has-score.score-badge,
.ex-btn .score-dot.master-score-badge.has-score {
  opacity: 1 !important;
  border: none !important;
  outline: none !important;
  color: #fff !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  font-weight: 600 !important;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease !important;
}

.ex-btn .score-dot.has-score.score-red,
a.ex-btn .score-dot.has-score.score-red { background: var(--telc-tile-red) !important; }
.ex-btn .score-dot.has-score.score-green,
a.ex-btn .score-dot.has-score.score-green { background: var(--telc-tile-green) !important; }
.ex-btn .score-dot.has-score.score-blue,
a.ex-btn .score-dot.has-score.score-blue { background: var(--telc-tile-blue-tier) !important; }
.ex-btn .score-dot.has-score.score-gold:not(.telc-gold-crown-badge),
a.ex-btn .score-dot.has-score.score-gold:not(.telc-gold-crown-badge) { background: var(--telc-tile-gold) !important; }

/* Legacy yellow tier removed — kept as alias to red for stale markup */
.ex-btn .score-dot.has-score.score-yellow,
a.ex-btn .score-dot.has-score.score-yellow { background: var(--telc-tile-red) !important; }

/* Multi-version parent cards — single master badge (see telc-master-score-card.css) */
.ex-btn.ex-version-picker-trigger .ex-static-scores,
.ex-btn.ex-version-picker-trigger .score-more-indicator {
  display: none !important;
}

.ex-btn.ex-version-picker-trigger {
  overflow: visible !important;
}

.ex-btn.ex-version-picker-trigger > .score-dot.master-score-badge.is-unattempted,
.ex-btn.ex-version-picker-trigger > .score-dot.master-score-badge.is-unplayed {
  display: flex !important;
}

.ex-subtask-frame-dots {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
  z-index: 15;
}

.ex-subtask-micro-dot {
  width: 5px;
  height: 5px;
  min-width: 5px;
  min-height: 5px;
  border-radius: 50%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.ex-subtask-micro-dot.is-dim {
  background-color: #888 !important;
  border: none !important;
  opacity: 0.25 !important;
  box-shadow: none !important;
}

.ex-subtask-micro-dot.is-pass.is-green,
.ex-subtask-micro-dot.is-green {
  background-color: #2e7d32 !important;
  border: 1px solid #2e7d32 !important;
  opacity: 1 !important;
  box-shadow: 0 0 4px rgba(46, 125, 50, 0.65) !important;
}

.ex-subtask-micro-dot.is-pass.is-blue,
.ex-subtask-micro-dot.is-blue {
  background-color: #1976d2 !important;
  border: 1px solid #1976d2 !important;
  opacity: 1 !important;
  box-shadow: 0 0 4px rgba(25, 118, 210, 0.65) !important;
}

.ex-subtask-micro-dot.is-pass.is-gold,
.ex-subtask-micro-dot.is-gold {
  background-color: #fbc02d !important;
  border: 1px solid #f9a825 !important;
  opacity: 1 !important;
  box-shadow: 0 0 4px rgba(251, 192, 45, 0.75) !important;
}

/* Legacy alias — treat generic is-pass as green only */
.ex-subtask-micro-dot.is-pass:not(.is-blue):not(.is-gold) {
  background-color: #2e7d32 !important;
  border: 1px solid #2e7d32 !important;
  opacity: 1 !important;
  box-shadow: 0 0 4px rgba(46, 125, 50, 0.65) !important;
}

/* Legacy static version dots stay hidden inside multi-version cards */
.exercise-grid .ex-static-scores > .score-dot.score-static.is-unplayed {
  display: none !important;
}

@keyframes telcDotPop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.ex-btn .score-dot.popping {
  animation: telcDotPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes telcFreshHighlight {
  0% { box-shadow: 0 0 0 0 rgba(233, 30, 140, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(233, 30, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(233, 30, 140, 0); }
}

.ex-btn.fresh-score {
  animation: telcFreshHighlight 1s ease-out 2;
}

html.dark a.ex-btn,
html.dark div.ex-btn,
html.dark button.ex-btn {
  background: #243047 !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html.dark a.ex-btn:hover,
html.dark div.ex-btn:hover,
html.dark button.ex-btn:hover {
  background: #2d3a4f !important;
  border-color: #64748b !important;
}

html.dark .ex-btn .ex-label,
html.dark a.ex-btn .ex-label {
  color: #f1f5f9 !important;
}
