/**
 * TelccFree — Exercise chrome: centered title capsule + top nav + theme capsule
 * Poppins + theme-dark-exercises are loaded via <link> in HTML (no @import).
 */

/* ── Top navigation bar ── */
body.portal-landing > .telc-exercise-topbar:empty {
  display: none;
  padding: 0;
  min-height: 0;
}

.telc-exercise-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  padding: 12px 16px 8px;
  position: relative;
  z-index: 1200;
  box-sizing: border-box;
}

.telc-exercise-topbar .telc-home-btn {
  margin: 0;
}

.telc-exercise-topbar .telc-header-utils,
.telc-exercise-toolbar .telc-header-utils {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.telc-exercise-topbar .telc-lang-mount,
.telc-exercise-topbar .telc-lang-selector {
  margin-right: 0;
  margin-left: 0;
}

/* Legacy toolbar → topbar layout */
.telc-exercise-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  padding: 12px 16px 8px;
  position: relative;
  z-index: 1200;
  box-sizing: border-box;
  background: transparent;
}

.telc-exercise-toolbar .telc-lang-mount {
  margin-right: 0;
  margin-left: 0;
}

/* ── Centered title capsule ── */
.telc-exercise-header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 16px 20px;
  box-sizing: border-box;
}

.telc-exercise-header__frame {
  width: 100%;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding: 12px 32px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}

html.dark .telc-exercise-header__frame {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(51, 65, 85, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.telc-exercise-header__title {
  margin: 0;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #1e293b;
}

html.dark .telc-exercise-header__title {
  color: #ffffff;
}

.telc-exercise-header__subtitle {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

/* Align Teil 3 reference header */
.header.header--teil3,
header.header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 16px 16px;
}

.header-frame {
  width: 100%;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding: 12px 32px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

html.dark .header-frame {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(51, 65, 85, 0.5);
}

.header-title {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  color: #1e293b;
}

html.dark .header-title {
  color: #ffffff;
}

/* ── Legacy banner overrides (keep nodes for scripts) ── */
.main-header {
  display: block !important;
  width: 100% !important;
  max-width: 36rem !important;
  margin: 0 auto 1.25rem !important;
  text-align: center !important;
  padding: 12px 32px !important;
  border-radius: 9999px !important;
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.35 !important;
}

html.dark .main-header {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #ffffff !important;
  border-color: rgba(51, 65, 85, 0.5) !important;
}

.quiz-header {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  text-align: center !important;
  padding: 0 16px 1rem !important;
  margin: 0 auto 1rem !important;
  max-width: 100% !important;
}

.quiz-header h1 {
  display: inline-block !important;
  width: 100% !important;
  max-width: 36rem !important;
  margin: 0 auto !important;
  padding: 12px 32px !important;
  border-radius: 9999px !important;
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
}

html.dark .quiz-header h1 {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #ffffff !important;
  border-color: rgba(51, 65, 85, 0.5) !important;
}

.quiz-header .subtitle {
  margin-top: 0.65rem !important;
  color: #94a3b8 !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
}

/* Schreiben legacy bar — hide banner, keep timer utilities */
.header-top.telc-header-top--legacy {
  background: transparent !important;
  border: none !important;
  color: inherit !important;
  padding: 0 16px 8px !important;
  display: flex !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.header-top.telc-header-top--legacy .logo-box,
.header-top.telc-header-top--legacy .telc-header-top__title-source {
  display: none !important;
}

.header-top.telc-header-top--legacy .info-top {
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 13px;
  color: #334155;
}

html.dark .header-top.telc-header-top--legacy .info-top {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(51, 65, 85, 0.55);
  color: #e2e8f0;
}

.text-section > h1.telc-title-source--hidden,
h1.telc-title-source--hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
}

/* Bottom nav: hide moved home + theme controls */
.auto-nav-wrap .telc-home-btn,
.auto-nav-wrap #telcThemeToggle,
.auto-nav-wrap .telc-theme-capsule,
.auto-nav-wrap .telc-theme-toggle,
.button-container .telc-home-btn.telc-home-btn--compact {
  display: none !important;
}

/* ── Premium theme toggle capsule (icon-only, transparent) ── */
#telcThemeToggle,
.telc-theme-capsule,
.telc-theme-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#telcThemeToggle:hover,
.telc-theme-capsule:hover,
.telc-theme-toggle:hover {
  transform: translateY(-2px);
  background: transparent !important;
}

.telc-theme-capsule__track {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 9999px;
  background: rgba(241, 245, 249, 0.8);
  border: 1px solid #e2e8f0;
  box-shadow: none;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .telc-theme-capsule__track {
  background: rgba(2, 6, 23, 0.4);
  border-color: #1e293b;
}

#telcThemeToggle:hover .telc-theme-capsule__track,
.telc-theme-capsule:hover .telc-theme-capsule__track {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

html.dark #telcThemeToggle:hover .telc-theme-capsule__track,
html.dark .telc-theme-capsule:hover .telc-theme-capsule__track {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.22);
}

.telc-theme-capsule__btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
  line-height: 1;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.telc-theme-capsule__btn.is-active {
  display: inline-flex;
}

/* Icon-only visibility (CSS fallback + JS sync) */
html:not(.dark) .telc-theme-capsule__btn--moon {
  display: inline-flex !important;
  color: #0f172a;
}

html:not(.dark) .telc-theme-capsule__btn--sun {
  display: none !important;
}

html.dark .telc-theme-capsule__btn--sun {
  display: inline-flex !important;
  color: #fbbf24;
}

html.dark .telc-theme-capsule__btn--moon {
  display: none !important;
}

.telc-theme-capsule__btn--moon.is-active {
  color: #0f172a;
}

html.dark .telc-theme-capsule__btn--sun.is-active {
  color: #fbbf24;
}

.telc-theme-capsule__btn i {
  pointer-events: none;
}

/* Legacy dual-icon states — neutralized */
.telc-theme-capsule__btn--sun.is-active,
.telc-theme-capsule__btn--moon.is-active {
  background: transparent !important;
}

html:not(.dark) .telc-theme-capsule__btn--sun.is-active,
html.dark .telc-theme-capsule__btn--moon.is-active {
  box-shadow: none !important;
}

/* Dashboard navbar capsule */
.navbar-actions .telc-theme-capsule,
.navbar-actions .telc-theme-toggle {
  margin: 0 4px;
}

@media (max-width: 640px) {
  .telc-exercise-topbar,
  .telc-exercise-toolbar {
    padding: 10px 10px 6px;
    gap: 8px;
  }

  .telc-exercise-header__frame,
  .header-frame,
  .main-header,
  .quiz-header h1 {
    padding: 10px 20px !important;
    border-radius: 1.5rem !important;
  }
}

/* ── Sitewide legacy header eradication (post-chrome-ready) ── */
body.telc-exercise-chrome-ready .main-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .main-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-main-header {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #1e293b !important;
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.35 !important;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.telc-exercise-chrome-ready .telc-exercise-header__frame,
body.telc-exercise-chrome-ready .header-frame:not(.telc-exercise-header__frame *),
body.telc-exercise-chrome-ready .telc-legacy-banner-capsule:not(.telc-exercise-header__frame *) {
  width: 100% !important;
  max-width: 36rem !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
  padding: 12px 32px !important;
  border-radius: 9999px !important;
  background: rgba(241, 245, 249, 0.82) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.telc-exercise-chrome-ready .header-frame::after,
body.telc-exercise-chrome-ready .telc-exercise-header__frame::after {
  display: none !important;
  content: none !important;
}

/* Nested title boxes inside the capsule must not draw a second rectangle. */
body.telc-exercise-chrome-ready .telc-exercise-header__frame .header-frame,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .main-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-main-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame h1,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .header-title,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-exercise-header__title,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-div-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-banner-capsule {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: auto !important;
  outline: none !important;
}

body.telc-exercise-chrome-ready header.header.telc-exercise-header--framed,
body.telc-exercise-chrome-ready header.header {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto 1rem !important;
  padding: 0 16px 12px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.telc-exercise-chrome-ready div.header.telc-legacy-div-header,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-div-header {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #1e293b !important;
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.35 !important;
}

html.dark body.telc-exercise-chrome-ready div.header.telc-legacy-div-header,
html.dark body.telc-exercise-chrome-ready .telc-exercise-header__frame .telc-legacy-div-header {
  color: #f1f5f9 !important;
}

html.dark body.telc-exercise-chrome-ready .telc-exercise-header__frame,
html.dark body.telc-exercise-chrome-ready .header-frame:not(.telc-exercise-header__frame *),
html.dark body.telc-exercise-chrome-ready .telc-legacy-banner-capsule:not(.telc-exercise-header__frame *) {
  background: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35) !important;
}

html.dark body.telc-exercise-chrome-ready .main-header,
html.dark body.telc-exercise-chrome-ready .telc-exercise-header__title {
  color: #f1f5f9 !important;
}

body.telc-exercise-chrome-ready .telc-quiz-header--capsule {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto 1rem !important;
  padding: 0 16px 1rem !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

body.telc-exercise-chrome-ready .telc-quiz-header--capsule h1 {
  display: block !important;
  width: 100% !important;
  max-width: 36rem !important;
  margin: 0 auto !important;
  padding: 12px 32px !important;
  border-radius: 9999px !important;
  background: rgba(241, 245, 249, 0.95) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  color: #1e293b !important;
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem) !important;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html.dark body.telc-exercise-chrome-ready .telc-quiz-header--capsule h1 {
  background: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35) !important;
  color: #f1f5f9 !important;
}

/* Audio-title capsule: applied at FIRST PAINT (not gated behind the JS-added
   .telc-exercise-chrome-ready class) so the Hören player renders in its final
   state immediately and does not flip from a dark inline capsule to this one.
   Keyed on h2.audio-title (present in the initial HTML) + the JS capsule class. */
.telc-audio-title-capsule,
h2.audio-title {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: 36rem !important;
  margin: 0 auto 1.25rem !important;
  padding: 14px 24px !important;
  border-radius: 1.5rem !important;
  background: rgba(241, 245, 249, 0.95) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  color: #1e293b !important;
  text-align: center !important;
  animation: none !important;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html.dark .telc-audio-title-capsule,
html.dark h2.audio-title {
  background: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35) !important;
  color: #f1f5f9 !important;
}

.telc-audio-title-capsule .audio-label,
h2.audio-title .audio-label {
  color: inherit !important;
  white-space: normal !important;
}

.telc-audio-title-capsule audio,
h2.audio-title audio {
  width: 100% !important;
  max-width: 100% !important;
  filter: none !important;
}

html.dark .telc-audio-title-capsule audio,
html.dark h2.audio-title audio {
  opacity: 0.95;
}

.telc-audio-title-capsule .code-badge,
h2.audio-title .code-badge {
  background: rgba(24, 119, 242, 0.15) !important;
  color: #1e40af !important;
}

html.dark .telc-audio-title-capsule .code-badge,
html.dark h2.audio-title .code-badge {
  background: rgba(24, 119, 242, 0.22) !important;
  color: #93c5fd !important;
}

/* ── Instagram CTA (shared exercise header) ── */
.telc-ig-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  margin: 0;
  max-width: 100%;
  height: 36px;
  padding: 0 0.72rem;
  border-radius: 999px;
  text-decoration: none;
  color: #64748b;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  flex: 0 0 auto;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.telc-ig-cta:hover {
  color: #db2777;
  background: rgba(219, 39, 119, 0.08);
  border-color: rgba(219, 39, 119, 0.28);
}

.telc-ig-cta:focus-visible {
  outline: 2px solid #db2777;
  outline-offset: 2px;
}

.telc-ig-cta__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #db2777;
}

.telc-ig-cta__ar,
.telc-ig-cta__ig {
  display: inline-block;
  unicode-bidi: isolate;
}

.telc-ig-cta__ig {
  font-weight: 700;
}

html.dark .telc-ig-cta {
  color: #cbd5e1;
  background: rgba(51, 65, 85, 0.45);
  border-color: rgba(71, 85, 105, 0.7);
}

html.dark .telc-ig-cta:hover {
  color: #f9a8d4;
  background: rgba(219, 39, 119, 0.16);
  border-color: rgba(244, 114, 182, 0.4);
}

html.dark .telc-ig-cta__icon {
  color: #f472b6;
}

body.telc-exercise-chrome-ready .telc-exercise-header__frame:has(.telc-ig-cta),
body.telc-exercise-chrome-ready .header-frame:has(.telc-ig-cta) {
  max-width: min(48rem, 100%) !important;
}

/* Keep title dominant; Instagram + eye sit under the topic, not in a second box */
.telc-exercise-header__frame {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.telc-exercise-header__frame > .telc-exercise-header__title,
.telc-exercise-header__frame > .telc-legacy-div-header,
.telc-exercise-header__frame > .header.telc-exercise-header__title {
  flex: 0 1 auto;
  min-width: 0;
  width: 100%;
  text-align: center;
}

.telc-exercise-header__frame > .telc-ig-cta {
  margin: 0;
}

.sb-exam-title-wrap > .telc-ig-cta {
  margin: 0;
}

.telc-exercise-header__frame > .t1-hide-title-btn {
  margin: 0;
}

.t1-title-prefix,
.t1-title-sep {
  display: none !important;
}

body.telc-exercise-chrome-ready .quiz-header h1,
body.telc-exercise-chrome-ready .telc-exercise-header__frame .quiz-header h1,
html body.lesen-teil1-page .telc-exercise-header__frame .main-header,
html body.lesen-teil1-page .telc-exercise-header__frame .telc-exercise-header__title,
html.dark body.lesen-teil1-page .telc-exercise-header__frame .main-header,
html.dark body.lesen-teil1-page .telc-exercise-header__frame .telc-exercise-header__title,
html body.lesen-teil2-page .telc-exercise-header__frame .telc-exercise-header__title,
html body.sb-exam .sb-exam-title,
html.dark body.sb-exam .sb-exam-title {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  border-radius: 0 !important;
}

body.sb-exam header.telc-exercise-header:not(.t3exp-head):not(.sb-exam-head),
html.telc-hoeren-quiz-page header.telc-exercise-header:not(.t3exp-head):not(.hoeren-exam-head) {
  display: none !important;
}

.telc-exercise-header__frame > .telc-exercise-header__subtitle {
  flex: 1 1 100%;
  text-align: center;
}

.t3exp-head__center .telc-ig-cta,
.t3-view-toggle-row .telc-ig-cta {
  margin: 0;
  flex: 0 0 auto;
}

.t3-view-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.65rem;
}

.t3exp-head__center {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.65rem;
}

@media (max-width: 640px) {
  .telc-ig-cta {
    height: auto;
    min-height: 34px;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    white-space: normal;
  }

  .telc-exercise-header__frame {
    justify-content: flex-start;
  }

  .telc-exercise-header__frame > .telc-ig-cta,
  .t3-view-toggle-row .telc-ig-cta,
  .t3exp-head__center .telc-ig-cta {
    flex: 1 1 100%;
    justify-content: center;
    margin-inline-start: 0;
  }
}

/* ── Telegram under site brand ── */
.telc-brand-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
  max-width: min(62vw, 380px);
}

.telc-brand-stack > a.thome-brand,
.telc-brand-stack > a.navbar-brand,
.telc-brand-stack > a.telc-navbar__brand {
  max-width: 100%;
}

.telc-brand-telegram {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  height: 40px;
  padding: 0 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: #0369a1;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.32);
  box-sizing: border-box;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.telc-brand-telegram:hover {
  color: #0c4a6e;
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(14, 165, 233, 0.45);
}

.telc-brand-telegram:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.telc-brand-telegram__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.telc-brand-telegram__ar,
.telc-brand-telegram__label {
  display: inline-block;
  unicode-bidi: isolate;
}

.telc-brand-telegram__label {
  font-weight: 750;
}

html.dark .telc-brand-telegram {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.35);
}

html.dark .telc-brand-telegram:hover {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.28);
}


/* B1 SB T2 in-page variant switch */
.sb-variant-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.6rem;
  max-width: 100%;
}
.sb-variant-switch__btn {
  appearance: none;
  border: 1px solid rgba(0,0,0,.18);
  background: #fff;
  color: inherit;
  border-radius: 0.45rem;
  padding: 0.28rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.sb-variant-switch__btn.is-active,
.sb-variant-switch__btn[aria-pressed="true"] {
  background: #1f4b7a;
  color: #fff;
  border-color: #1f4b7a;
}
@media (max-width: 560px) {
  .sb-variant-switch__btn { font-size: 0.78rem; padding: 0.25rem 0.5rem; }
}

/* ── Reserved space for the shared Lerntipp ──
   telc-exercise-chrome inserts this empty slot while the page is still gated,
   telc-learn-tip fills it afterwards. The height matches the collapsed
   <details> so the late insertion causes no layout shift. */
.telc-learn-tip-slot {
  width: min(920px, calc(100% - 24px));
  margin: 10px auto 16px;
  min-height: 44px;
}
.telc-learn-tip-slot > .telc-learn-tip {
  width: 100%;
  margin: 0;
}

.telc-learn-tip-slot:empty {
  min-height: 0;
  margin: 0;
  display: none;
}

.telc-footer-slot {
  min-height: 0;
}
.telc-footer-slot:empty {
  display: none;
}

.telc-version-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.telc-version-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 32px;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font: 700 12px/1 Inter, system-ui, sans-serif;
  text-decoration: none;
}
.telc-version-switch__btn.is-active,
.telc-version-switch__btn[aria-current="page"] {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}
html.dark .telc-version-switch__btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
html.dark .telc-version-switch__btn.is-active,
html.dark .telc-version-switch__btn[aria-current="page"] {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }
  .telc-exercise-topbar,
  .telc-exercise-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 10px 6px;
  }
  html body .auto-nav-wrap,
  html body.lesen-teil1-page .auto-nav-wrap.t1-impfung-nav-ready,
  html body.lesen-teil2-page .auto-nav-wrap.t1-impfung-nav-ready,
  html body.teil3-experiment-der-hund .auto-nav-wrap.t3-bottom-nav-ready,
  html body.sb-exam .auto-nav-wrap.sb-exam-nav,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    grid-auto-rows: auto !important;
    row-gap: 8px !important;
    column-gap: 10px;
    align-items: center;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  html body .auto-nav-wrap > #telc-report-bar,
  html body .auto-nav-wrap > .telc-report-bar,
  html body.lesen-teil1-page .auto-nav-wrap.t1-impfung-nav-ready > #telc-report-bar,
  html body.lesen-teil2-page .auto-nav-wrap.t1-impfung-nav-ready > #telc-report-bar,
  html body.teil3-experiment-der-hund .auto-nav-wrap.t3-bottom-nav-ready > #telc-report-bar,
  html body.sb-exam .auto-nav-wrap.sb-exam-nav > #telc-report-bar,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready > #telc-report-bar {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    height: auto !important;
  }
  html body .auto-nav-wrap > #autoPrevBtn,
  html body .auto-nav-wrap > #telcHoerenPrevBtn,
  html body.lesen-teil1-page .auto-nav-wrap.t1-impfung-nav-ready > #autoPrevBtn,
  html body.lesen-teil2-page .auto-nav-wrap.t1-impfung-nav-ready > #autoPrevBtn,
  html body.teil3-experiment-der-hund .auto-nav-wrap.t3-bottom-nav-ready > #autoPrevBtn,
  html body.sb-exam .auto-nav-wrap.sb-exam-nav > #autoPrevBtn,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready > #autoPrevBtn,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready > #telcHoerenPrevBtn {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
  }
  html body .auto-nav-wrap > #autoNextBtn,
  html body .auto-nav-wrap > #telcHoerenNextBtn,
  html body.lesen-teil1-page .auto-nav-wrap.t1-impfung-nav-ready > #autoNextBtn,
  html body.lesen-teil2-page .auto-nav-wrap.t1-impfung-nav-ready > #autoNextBtn,
  html body.teil3-experiment-der-hund .auto-nav-wrap.t3-bottom-nav-ready > #autoNextBtn,
  html body.sb-exam .auto-nav-wrap.sb-exam-nav > #autoNextBtn,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready > #autoNextBtn,
  html.telc-hoeren-quiz-page .auto-nav-wrap.t1-impfung-nav-ready > #telcHoerenNextBtn {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: end !important;
  }
  .telc-report-bar:has(+ .auto-nav-wrap) {
    justify-content: center;
    width: 100%;
    max-width: none;
    margin: 8px auto 0;
  }
  .telc-brand-telegram__ar {
    display: none;
  }
}
