/* Livestream: show the complete 16:9 picture on phones instead of cropping it. */
@media (max-width: 639px) {
  .mtd-responsive-table:not([data-mobile-layout="standings"]) {
    min-width: var(--mtd-table-mobile-min-width, 680px);
  }

  main section.container > div.grid > div.relative > div.relative.flex.aspect-video {
    aspect-ratio: 16 / 9 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  main section.container > div.grid > div.relative > div.relative.flex.aspect-video > video {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    background: #000 !important;
  }

  .mtd-watch-chat-grid {
    gap: 0.5rem !important;
  }

  .mtd-sticky-player {
    position: sticky !important;
    top: 0.5rem !important;
    z-index: 30 !important;
    box-shadow: 0 10px 28px rgb(0 0 0 / 55%);
  }

  .mtd-sticky-player > div:first-child {
    left: 0.75rem !important;
    top: 0.75rem !important;
  }

  .mtd-sticky-player > div:first-child > div {
    padding: 0.28rem 0.55rem !important;
    font-size: 0.65rem !important;
  }

  .mtd-player-status-panel {
    width: 100%;
    max-width: 100% !important;
    padding: 3.35rem 1rem 1.15rem !important;
    overflow: hidden;
  }

  .mtd-player-status-title {
    max-width: 100%;
    font-size: clamp(1rem, 5.5vw, 1.35rem) !important;
    line-height: 1.12 !important;
    letter-spacing: 0.04em !important;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  .mtd-player-status-detail {
    max-width: 100%;
    margin-top: 0.7rem !important;
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    overflow-wrap: anywhere;
    text-wrap: pretty;
  }

  .mtd-player-status-icon {
    margin-bottom: 0.65rem !important;
    font-size: 1.75rem !important;
    line-height: 1 !important;
  }

  .mtd-player-status-action {
    max-width: 100%;
    margin-top: 1rem !important;
    padding: 0.55rem 0.8rem !important;
    font-size: 0.7rem !important;
  }

  .mtd-mobile-chat iframe {
    height: clamp(360px, calc(100dvh - 19rem), 560px) !important;
  }

  .mtd-live-title-overlay {
    top: 0.45rem;
    max-width: calc(100% - 6rem);
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    line-height: 1.1;
  }

  .mtd-stream-description-card {
    margin-top: 0.75rem;
    padding: 0.9rem 1rem;
  }
}

/* Version 60: öffentliche Bildergalerie mit automatischem Wechsel. */
.mtd-auto-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 0.5rem;
  background: #050505;
}

.mtd-auto-gallery > .mtd-gallery-slide {
  position: absolute !important;
  inset: 0;
  display: none !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.mtd-auto-gallery > .mtd-gallery-slide[data-active="true"] {
  display: block !important;
}

.mtd-auto-gallery .mtd-gallery-image {
  display: block;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #050505;
}

.mtd-gallery-controls {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.mtd-gallery-arrow,
.mtd-gallery-dot {
  pointer-events: auto;
  cursor: pointer;
}

.mtd-gallery-arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 999px;
  background: rgb(0 0 0 / 68%);
  color: #fff;
  font: 700 2rem/1 Rajdhani, sans-serif;
  transition: border-color 160ms ease, background 160ms ease;
}

.mtd-gallery-arrow:hover,
.mtd-gallery-arrow:focus-visible {
  border-color: #ef1018;
  background: #ef1018;
  outline: none;
}

.mtd-gallery-previous { left: 1rem; }
.mtd-gallery-next { right: 1rem; }

.mtd-gallery-counter {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 0.25rem;
  background: rgb(0 0 0 / 76%);
  color: #fff;
  font: 700 0.78rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
}

.mtd-gallery-dots {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  display: flex;
  gap: 0.42rem;
  transform: translateX(-50%);
}

.mtd-gallery-dot {
  width: 0.6rem;
  height: 0.6rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 999px;
  background: rgb(0 0 0 / 65%);
}

.mtd-gallery-dot[data-active="true"] {
  border-color: #ef1018;
  background: #ef1018;
}

@media (max-width: 640px) {
  .mtd-auto-gallery { aspect-ratio: 4 / 3; }
  .mtd-gallery-arrow { width: 2.25rem; height: 2.25rem; font-size: 1.65rem; }
  .mtd-gallery-previous { left: 0.5rem; }
  .mtd-gallery-next { right: 0.5rem; }
  .mtd-gallery-counter { right: 0.55rem; bottom: 0.55rem; }
  .mtd-gallery-dots { bottom: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mtd-gallery-arrow { transition: none; }
}

.mtd-live-title-overlay {
  position: absolute;
  left: 50%;
  top: 4%;
  z-index: 20;
  max-width: min(72%, 620px);
  translate: -50% -8px;
  padding: 0.38rem 0.7rem;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 0.35rem;
  background: rgb(0 0 0 / 78%);
  color: #fff;
  font-family: Rajdhani, sans-serif;
  font-size: clamp(0.78rem, 1.35vw, 1.08rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, translate 220ms ease;
}

.mtd-player-live-badge {
  transition: opacity 220ms ease, translate 220ms ease;
}

.mtd-player-live-badge.is-ui-hidden {
  translate: 0 -4px;
  opacity: 0 !important;
  pointer-events: none !important;
}

.mtd-chat-header .mtd-chat-live-label {
  position: absolute;
  top: 50%;
  right: 1rem;
  margin-left: 0;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 1.05rem;
}

.mtd-chat-header {
  position: relative;
}

.mtd-mobile-live-banner {
  display: none;
}

.mtd-mobile-live-banner[hidden] {
  display: none !important;
}

.mtd-stream-description-card {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  position: relative;
  z-index: 1;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.mtd-stream-description-card[hidden] {
  display: none !important;
}

.mtd-stream-description-card h2 {
  margin: 0;
  font-family: Rajdhani, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.035em;
}

.mtd-stream-description-content {
  color: hsl(var(--foreground));
  font-size: 0.93rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.mtd-stream-description-content p {
  margin: 0 0 0.8rem;
  white-space: pre-wrap;
}

.mtd-stream-description-content p:last-child {
  margin-bottom: 0;
}

.mtd-stream-description-content a {
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
  cursor: pointer;
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* Keep large article images inside the editor without reducing upload quality. */
.mtd-article-manager,
.mtd-content-builder,
.mtd-content-block-editor,
.mtd-block-media-editor {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mtd-article-manager > *,
.mtd-content-builder > *,
.mtd-content-block-editor > *,
.mtd-block-media-editor > *,
.mtd-block-media-editor .grid,
.mtd-block-media-editor label {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mtd-block-media-editor input,
.mtd-block-media-editor select,
.mtd-block-media-editor textarea,
.mtd-block-media-editor button {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mtd-block-media-editor input[type="file"],
.mtd-block-media-editor input[type="range"] {
  width: 100%;
}

.mtd-block-media-editor input[type="file"] {
  overflow: hidden;
}

.mtd-content-builder .mtd-content-image {
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  background: #050505;
}

.mtd-content-builder .mtd-content-image button,
.mtd-content-builder .mtd-content-image img {
  width: 100% !important;
  max-width: 100% !important;
}

.mtd-content-builder .mtd-content-image img {
  display: block !important;
  height: auto !important;
  max-height: 520px !important;
  object-fit: contain !important;
}

.mtd-content-block-editor {
  overflow: visible !important;
}

.mtd-geoblock-detail {
  display: none !important;
}

.mtd-geoblock-icon {
  color: #ffd000 !important;
}

.mtd-geoblock-badge {
  border-color: #ef1018 !important;
  background: rgb(239 16 24 / 10%) !important;
  color: #ef1018 !important;
}

.mtd-geoblock-retry {
  display: none !important;
}

.mtd-nav-live-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgb(255 0 0 / 55%));
  animation: mtd-live-pulse 1.6s ease-in-out infinite;
}

.mtd-nav-live-indicator[hidden] {
  display: none !important;
}

@keyframes mtd-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.48; }
}

.mtd-live-title-overlay.is-visible {
  translate: -50% 0;
  opacity: 1;
}

.mtd-broadcast-title-card {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
}

.mtd-broadcast-title-card label {
  font-family: Rajdhani, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mtd-broadcast-title-card input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.mtd-broadcast-title-card textarea {
  width: 100%;
  min-height: 10rem;
  resize: vertical;
  padding: 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  line-height: 1.5;
}

.mtd-broadcast-title-card p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

.mtd-fullscreen-launch {
  position: absolute;
  z-index: 25;
  right: 3.1rem;
  bottom: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 58%);
  color: #fff;
  font: 700 1.15rem/1 sans-serif;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 160ms ease, opacity 180ms ease, transform 180ms ease;
}

.mtd-fullscreen-launch:hover {
  background: rgb(255 255 255 / 18%);
}

.mtd-fullscreen-launch[hidden] {
  display: none !important;
}

.mtd-cast-control {
  position: absolute;
  right: 8.35rem;
  bottom: 0.35rem;
  z-index: 26;
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 58%);
  color: #fff;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, opacity 180ms ease, transform 180ms ease;
}

.mtd-cast-control[hidden] {
  display: none !important;
}

.mtd-cast-control:hover,
.mtd-cast-control:focus-visible {
  background: rgb(255 255 255 / 18%);
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.mtd-cast-control:active {
  transform: scale(0.94);
}

.mtd-cast-control.is-connected {
  background: #ef1018;
}

.mtd-cast-control.is-ui-hidden,
.mtd-fullscreen-launch.is-ui-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.3rem);
}

.mtd-cast-icon {
  position: relative;
  display: block;
  width: 1.2rem;
  height: 0.9rem;
  overflow: hidden;
  border: 2px solid currentColor;
  border-radius: 0.15rem;
  box-sizing: border-box;
}

.mtd-cast-icon::before,
.mtd-cast-icon::after {
  position: absolute;
  left: -0.12rem;
  bottom: -0.12rem;
  content: '';
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 100% 0 0;
  transform: rotate(-45deg);
  transform-origin: left bottom;
}

.mtd-cast-icon::before {
  width: 0.56rem;
  height: 0.56rem;
}

.mtd-cast-icon::after {
  width: 0.9rem;
  height: 0.9rem;
}

.mtd-cast-icon > span {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0.2rem;
  height: 0.2rem;
  border-radius: 50%;
  background: currentColor;
}

.mtd-cast-message {
  position: absolute;
  right: 0.75rem;
  bottom: 3rem;
  z-index: 27;
  max-width: min(22rem, calc(100% - 1.5rem));
  padding: 0.55rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 0.35rem;
  background: rgb(0 0 0 / 88%);
  color: #fff;
  font: 600 0.78rem/1.35 Inter, sans-serif;
  text-align: left;
  box-shadow: 0 8px 24px rgb(0 0 0 / 42%);
}

.mtd-cast-message[hidden] {
  display: none !important;
}

.mtd-fullscreen-chat-toggle:hover,
.mtd-fullscreen-chat-reopen:hover {
  border-color: #ef1018;
  background: rgb(239 16 24 / 86%);
}

.mtd-fullscreen-chat-toggle,
.mtd-fullscreen-chat-reopen {
  display: none;
}

.mtd-watch-chat-grid:fullscreen,
.mtd-watch-chat-grid.mtd-fullscreen-fallback {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 520px) !important;
  gap: 0 !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #000 !important;
}

.mtd-watch-chat-grid:fullscreen.mtd-chat-collapsed,
.mtd-watch-chat-grid.mtd-fullscreen-fallback.mtd-chat-collapsed {
  grid-template-columns: minmax(0, 1fr) !important;
}

.mtd-watch-chat-grid:fullscreen .mtd-sticky-player,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-sticky-player {
  position: relative !important;
  top: auto !important;
  width: 100% !important;
  height: 100vh !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
}

.mtd-watch-chat-grid:fullscreen .mtd-player-enhanced,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-player-enhanced {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
}

.mtd-watch-chat-grid:fullscreen video,
.mtd-watch-chat-grid.mtd-fullscreen-fallback video {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  background: #000 !important;
}

.mtd-watch-chat-grid:fullscreen aside,
.mtd-watch-chat-grid.mtd-fullscreen-fallback aside {
  width: 100% !important;
  height: 100vh !important;
  min-height: 0 !important;
  max-height: none !important;
  border-radius: 0 !important;
}

.mtd-watch-chat-grid:fullscreen aside iframe,
.mtd-watch-chat-grid.mtd-fullscreen-fallback aside iframe {
  height: calc(100vh - 3.2rem) !important;
  max-height: none !important;
}

.mtd-watch-chat-grid:fullscreen.mtd-chat-collapsed aside,
.mtd-watch-chat-grid.mtd-fullscreen-fallback.mtd-chat-collapsed aside {
  display: none !important;
}

.mtd-watch-chat-grid:fullscreen .mtd-fullscreen-chat-toggle,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-fullscreen-chat-toggle,
.mtd-watch-chat-grid:fullscreen.mtd-chat-collapsed .mtd-fullscreen-chat-reopen,
.mtd-watch-chat-grid.mtd-fullscreen-fallback.mtd-chat-collapsed .mtd-fullscreen-chat-reopen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mtd-watch-chat-grid:fullscreen .mtd-fullscreen-chat-toggle,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-fullscreen-chat-toggle {
  margin-left: 0.55rem;
}

.mtd-watch-chat-grid:fullscreen .mtd-chat-header .mtd-chat-live-label,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-chat-header .mtd-chat-live-label {
  position: static;
  margin-left: auto;
  transform: none;
}

.mtd-watch-chat-grid:fullscreen .mtd-fullscreen-chat-reopen,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-fullscreen-chat-reopen {
  position: fixed;
  z-index: 100002;
  top: 0.75rem;
  right: 0.75rem;
}

.mtd-fullscreen-chat-toggle,
.mtd-fullscreen-chat-reopen,
.mtd-recordings-heading button,
.mtd-recording-item button {
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.4rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 700;
  cursor: pointer;
}

.mtd-watch-chat-grid:fullscreen .mtd-fullscreen-launch,
.mtd-watch-chat-grid.mtd-fullscreen-fallback .mtd-fullscreen-launch {
  display: none;
}

.mtd-recordings-manager {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
}

.mtd-recordings-heading,
.mtd-recording-item,
.mtd-recording-item > div {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mtd-recordings-heading,
.mtd-recording-item {
  justify-content: space-between;
}

.mtd-recordings-heading h2,
.mtd-recordings-heading p {
  margin: 0;
}

#mtd-recordings-list {
  display: grid;
  gap: 0.65rem;
}

.mtd-recording-item {
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
}

.mtd-recording-item > div:first-child {
  align-items: flex-start;
  flex-direction: column;
  gap: 0.1rem;
}

.mtd-recording-item span,
#mtd-recordings-status {
  color: hsl(var(--muted-foreground));
  font-size: 0.82rem;
}

.mtd-recording-item button.is-danger {
  border-color: #ef1018;
  color: #ff5960;
}

.mtd-archive-mode > :not(#mtd-archive-page) {
  display: none !important;
}

.mtd-archive-page {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto;
  display: grid;
  gap: 1rem;
}

.mtd-archive-page-heading,
.mtd-archive-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mtd-archive-page-heading h1,
.mtd-archive-page-heading p,
.mtd-archive-kicker {
  margin: 0;
}

.mtd-archive-kicker {
  color: #ef1018;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mtd-archive-page-heading a,
.mtd-admin-archive-link,
.mtd-archive-save-row button {
  padding: 0.65rem 0.9rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.45rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.mtd-archive-settings,
.mtd-archive-link-card {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
}

.mtd-archive-settings label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}

.mtd-archive-settings input,
.mtd-recording-name {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.4rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.mtd-recording-name,
.mtd-recording-item-v39 .mtd-recording-info > input[type="text"],
.mtd-recording-name:hover,
.mtd-recording-name:focus,
.mtd-recording-name:active {
  appearance: none !important;
  background: #070707 !important;
  background-color: #070707 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
  border: 1px solid #34343a !important;
  border-radius: 0.4rem !important;
  padding: 0.55rem 0.65rem !important;
  color-scheme: dark;
}

.mtd-recording-name::selection {
  background: #ef1018;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.mtd-selected-countries-summary {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.6rem;
  background: hsl(var(--background) / 0.55);
}

.mtd-selected-countries-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.mtd-selected-countries-heading strong {
  font-family: Rajdhani, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.025em;
}

.mtd-selected-countries-heading span {
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
}

.mtd-selected-country-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mtd-selected-country-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgb(239 16 24 / 55%);
  border-radius: 999px;
  background: rgb(239 16 24 / 9%);
  color: hsl(var(--foreground));
  font-size: 0.8rem;
  font-weight: 700;
}

.mtd-selected-country-chip small {
  color: #ef1018;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
}

.mtd-selected-country-empty {
  color: hsl(var(--muted-foreground));
  font-size: 0.82rem;
}

.mtd-recording-item-v39 .mtd-recording-info {
  flex: 1 1 22rem;
  min-width: 0;
}

.mtd-recording-item-v39 .mtd-recording-actions {
  flex: 0 0 auto;
}

.mtd-custom-404-host {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: clamp(2rem, 5vh, 4.5rem) clamp(1.25rem, 5vw, 6rem);
  background: #080808;
  color: #fff;
}

.mtd-custom-404 {
  width: min(100%, 72rem);
  text-align: center;
}

.mtd-custom-404-code {
  margin: 0 0 2rem;
  color: #ef1018;
  font-family: Rajdhani, sans-serif;
  font-size: clamp(7rem, 22vw, 13rem);
  font-weight: 800;
  line-height: 0.68;
  letter-spacing: 0.04em;
}

.mtd-custom-404 h1 {
  margin: 0;
  color: #fff;
  font-family: Rajdhani, sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  line-height: 1.08;
}

.mtd-custom-404-copy {
  max-width: 62rem;
  margin: 1.5rem auto 2rem;
  color: #b8b8c2;
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
}

/* Startseite: Newsbilder im vollstaendigen 16:9-Kartenformat statt im flachen Ausschnitt. */
.mtd-home-news-image {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  object-fit: cover !important;
}

.mtd-off-week-admin {
  display: grid;
  gap: 0.75rem;
  padding: 0.25rem 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mtd-off-week-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.mtd-off-week-dates {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 16rem));
  gap: 0.75rem;
}

.mtd-off-week-admin.is-enabled .mtd-off-week-dates {
  display: grid;
}

.mtd-off-week-dates label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.mtd-off-week-dates input {
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.mtd-off-week-admin p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

.mtd-off-week-public {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  padding: 2rem 1.5rem;
  color: rgb(255 255 255 / 82%);
  font-size: 0.95rem;
  line-height: 1.55;
  text-align: center;
}

.mtd-off-week-public p {
  max-width: 34rem;
  margin: 0;
}

.mtd-off-week-public .mtd-off-week-greeting {
  color: #fff;
  font-weight: 700;
}

.mtd-custom-404-copy p { margin: 0.8rem 0; }
.mtd-custom-404-copy strong { color: #fff; font-weight: 800; }

.mtd-custom-404-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1.6rem;
  border: 1px solid #ef1018;
  border-radius: 0.35rem;
  background: #ef1018;
  color: #fff;
  font-family: Rajdhani, sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.mtd-custom-404-home:hover,
.mtd-custom-404-home:focus-visible {
  background: #fff;
  color: #080808;
}

@media (max-width: 899px) {
  .mtd-off-week-dates { grid-template-columns: 1fr; }
  .mtd-fullscreen-launch { display: none; }
  .mtd-cast-control { right: 8.35rem; }
  .mtd-mobile-live-banner:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgb(239 16 24 / 55%);
    background: linear-gradient(90deg, #a5080d, #ef1018, #a5080d);
    color: #fff;
    font-family: Rajdhani, sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    text-align: center;
    text-decoration: none;
    animation: mtd-live-pulse 1.6s ease-in-out infinite;
  }
  .mtd-recordings-heading,
  .mtd-recording-item { align-items: stretch; flex-direction: column; }
  .mtd-archive-page-heading,
  .mtd-archive-save-row,
  .mtd-recording-item-v39 .mtd-recording-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Tabellen-Baustein: native Einstellungen pro vorhandener Spalte. */
.mtd-table-column-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid hsl(var(--primary) / 45%);
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 6%);
}

.mtd-table-column-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.45rem;
  background: hsl(var(--background) / 80%);
}

.mtd-table-column-card input[type="number"] {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.65rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.mtd-table-scroll {
  max-width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-color: #ef1018 rgb(255 255 255 / 10%);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.mtd-table-scroll::-webkit-scrollbar {
  height: 0.55rem;
}

.mtd-table-scroll::-webkit-scrollbar-track {
  background: rgb(255 255 255 / 10%);
}

.mtd-table-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #ef1018;
}

@media (min-width: 640px) {
  .mtd-table-scroll {
    overflow-x: visible !important;
    scrollbar-width: none;
  }

  .mtd-table-scroll::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 639px) {
  .rounded-lg:has(.mtd-responsive-table) {
    padding-right: 0 !important;
    padding-left: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .rounded-lg:has(.mtd-responsive-table) > * {
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .mtd-table-scroll {
    margin-inline: -0.25rem;
    padding-bottom: 0.35rem;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]) th,
  .mtd-responsive-table:not([data-mobile-layout="standings"]) td {
    padding: 0.65rem 0.75rem !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]) th {
    white-space: nowrap !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mtd-table-scroll { scroll-behavior: auto; }
}

/* Version 75: public tables stay completely inside the phone viewport.
   Desktop and the special standings layout remain unchanged. */
@media (max-width: 639px) {
  .mtd-table-scroll:has(.mtd-responsive-table:not([data-mobile-layout="standings"])) {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
    padding-bottom: 0 !important;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
  }

  .mtd-table-scroll:has(.mtd-responsive-table:not([data-mobile-layout="standings"]))::-webkit-scrollbar {
    display: none !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]) th,
  .mtd-responsive-table:not([data-mobile-layout="standings"]) td {
    min-width: 0 !important;
    padding: 0.48rem 0.24rem !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
    font-size: clamp(0.5rem, 2.55vw, 0.68rem) !important;
    line-height: 1.25 !important;
  }

  /* Individuell in /admin/handy bearbeitete Tabellen nutzen auf der
     Public-Seite exakt dieselbe Schriftgröße wie in der Handy-Vorschau. */
  .mtd-responsive-table[data-mobile-custom="true"] th,
  .mtd-responsive-table[data-mobile-custom="true"] td {
    font-size: var(--mtd-mobile-font-size, 12px) !important;
  }

  /* Calendar tables: compact number column and useful room for track/event names.
     Individually edited Handy tables keep their own pixel ratios. */
  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(3):last-child) col:nth-child(1) {
    width: 8% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(3):last-child) col:nth-child(2) {
    width: 65% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(3):last-child) col:nth-child(3) {
    width: 27% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(3):last-child) th,
  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(3):last-child) td {
    font-size: clamp(0.62rem, 2.9vw, 0.78rem) !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) col:nth-child(1) {
    width: 7% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) col:nth-child(2) {
    width: 37% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) col:nth-child(3) {
    width: 38% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) col:nth-child(4) {
    width: 18% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) th,
  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(4):last-child) td {
    font-size: clamp(0.56rem, 2.7vw, 0.72rem) !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:nth-child(1) {
    width: 5% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:nth-child(2) {
    width: 49% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:nth-child(3),
  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:nth-child(4),
  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:nth-child(5) {
    width: 7% !important;
  }

  .mtd-responsive-table:not([data-mobile-layout="standings"]):not([data-mobile-custom="true"]):has(tr > :nth-child(5):last-child) col:last-child {
    width: 25% !important;
  }
}

/* Version 77: the element library lives outside the simulated phone.
   On wide screens it stays large and sticky on the left. */
.mtd-mobile-editor-frame {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: 0;
}

.mtd-mobile-editor-frame .mtd-content-builder {
  grid-template-columns: minmax(0, 1fr) !important;
  justify-content: center;
  align-items: start;
}

.mtd-mobile-editor-frame .mtd-content-builder aside {
  position: static !important;
}

.mtd-mobile-editor-frame .mtd-content-builder > div {
  width: min(100%, 430px);
  margin-inline: auto;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--background));
  box-shadow: 0 18px 60px rgb(0 0 0 / 35%);
}

.mtd-mobile-editor-frame .mtd-table-column-settings {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Version 78: Die Tabellen-Vorschau bildet die echte Public-Handyansicht ab.
   Pixelwerte werden als Verhältnis innerhalb des Handyrahmens dargestellt. */
.mtd-mobile-editor-frame .mtd-mobile-table-preview {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

.mtd-mobile-editor-frame .mtd-mobile-table-preview td {
  min-width: 0 !important;
  padding: 0.25rem !important;
  overflow: hidden !important;
}

.mtd-mobile-editor-frame .mtd-mobile-table-preview input {
  width: 100% !important;
  min-width: 0 !important;
  padding: 0.48rem 0.24rem !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  font-size: var(--mtd-mobile-font-size, 12px) !important;
  line-height: 1.25 !important;
}

@media (min-width: 900px) {
  .mtd-mobile-editor-frame .mtd-content-builder {
    grid-template-columns: 300px minmax(0, 430px) !important;
    gap: clamp(2rem, 5vw, 5rem) !important;
  }

  .mtd-mobile-editor-frame .mtd-content-builder aside {
    position: sticky !important;
    top: 1rem !important;
    width: 300px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1rem !important;
    box-shadow: 0 14px 45px rgb(0 0 0 / 28%);
  }

  .mtd-mobile-editor-frame .mtd-content-builder > div {
    width: 430px;
    margin-inline: 0;
  }
}
