/* ==========================================================================
   Standardsichere Vollbilddialoge
   ========================================================================== */

.cf-native-dialog {
  position: fixed;
  inset: auto;
  top: var(--cf-dialog-top,0px);
  left: var(--cf-dialog-left,0px);
  width: var(--cf-dialog-width,100vw);
  height: var(--cf-dialog-height,100vh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--page-a);
  color: var(--text);
  box-sizing: border-box;
}
.cf-native-dialog::backdrop { background: var(--page-a); }
.cf-native-dialog:focus { outline: 0; }

/* --------------------------------------------------------------------------
   Challenge-Medium in groß
   -------------------------------------------------------------------------- */
.cf-challenge-media-dialog { background: #0b0c10; }
.cf-challenge-media-dialog::backdrop { background: #0b0c10; }
.cf-challenge-media-screen {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--editor-surface);
}
.cf-challenge-media-head {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  gap: 10px;
  padding: max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 10px max(12px,env(safe-area-inset-left));
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: var(--editor-surface);
}
.cf-challenge-media-back,
.cf-challenge-media-close,
.cf-challenge-media-nav {
  border: 1px solid rgba(255,255,255,.16);
  background: #12141a;
  color: #f5f7fb;
  font: inherit;
}
.cf-challenge-media-back {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 700;
}
.cf-challenge-media-back svg,
.cf-challenge-media-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cf-challenge-media-count {
  justify-self: center;
  color: #d8dce7;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.cf-challenge-media-close {
  justify-self: end;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.cf-challenge-media-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px 56px max(12px,env(safe-area-inset-bottom));
  background: #0b0c10;
}
.cf-challenge-media-object {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  border: 0;
  box-shadow: none;
  transform: none;
  opacity: 1;
  visibility: visible;
}
video.cf-challenge-media-object { background: #000; }
.cf-challenge-media-nav {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
}
.cf-challenge-media-nav.is-prev { left: 8px; }
.cf-challenge-media-nav.is-next { right: 8px; }

/* --------------------------------------------------------------------------
   Challenge-/Update-Editor
   -------------------------------------------------------------------------- */
.cf-content-editor-dialog { background: var(--editor-surface); }
.cf-content-editor-dialog::backdrop { background: var(--editor-surface); }
.cf-content-editor-screen {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--editor-surface);
}
.cf-content-editor-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(12px,env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--editor-line);
  background: var(--editor-head-bg);
}
.cf-content-editor-heading { min-width: 0; display: grid; gap: 3px; }
.cf-content-editor-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px,4vw,27px);
  line-height: 1.08;
  letter-spacing: -.025em;
}
.cf-content-editor-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--editor-line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}
.cf-content-editor-close svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.cf-content-editor-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--editor-surface);
}
.cf-content-editor-form {
  width: min(780px,100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 16px 16px max(28px,calc(env(safe-area-inset-bottom) + 18px));
}
.cf-editor-section {
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--editor-line);
  background: var(--editor-row-bg);
}
.cf-editor-section-head {
  display: grid;
  grid-template-columns: 30px minmax(0,1fr);
  align-items: start;
  gap: 10px;
}
.cf-editor-section-head > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb,var(--accent) 48%,var(--editor-line));
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.cf-editor-section-head > div { min-width: 0; display: grid; gap: 3px; }
.cf-editor-section-head h3 { margin: 0; color: var(--text); font-size: 16px; line-height: 1.2; }
.cf-editor-section-head p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.cf-editor-fields { display: grid; gap: 13px; }
.cf-editor-two-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.cf-editor-field,
.cf-content-editor-form .challenge-category-field,
.cf-content-editor-form .editor-media-caption {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
}
.cf-editor-field small { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.cf-content-editor-form input:not([type="hidden"]):not([type="file"]),
.cf-content-editor-form textarea,
.cf-content-editor-form select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  border: 1px solid var(--editor-line);
  border-radius: 0;
  padding: 11px 12px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: none;
}
.cf-content-editor-form textarea { min-height: 112px; resize: vertical; }
.cf-content-editor-form input:focus,
.cf-content-editor-form textarea:focus,
.cf-content-editor-form select:focus {
  outline: 2px solid color-mix(in srgb,var(--accent) 72%,transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.cf-content-editor-form .challenge-category-combobox { width: 100%; }
.cf-content-editor-form .challenge-category-combobox input,
.cf-content-editor-form .challenge-category-picker { min-height: 46px; }
.cf-content-editor-form .editor-media-section {
  padding: 0;
  border: 0;
  background: transparent;
}
.cf-content-editor-form .editor-media-list { gap: 10px; }
.cf-content-editor-form .editor-media-help { line-height: 1.45; }
.cf-content-editor-actions {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 10px;
  padding-top: 2px;
}
.cf-content-editor-actions > button { min-height: 48px; margin: 0; }

/* --------------------------------------------------------------------------
   Bildbearbeitung – zweiter nativer Dialog über dem Beitragseditor
   -------------------------------------------------------------------------- */
.cf-image-crop-dialog { background: var(--editor-surface); color: var(--text); }
.cf-image-crop-dialog::backdrop { background: rgba(0,0,0,.72); }
.cf-image-crop-screen {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b0c10;
}
.cf-image-crop-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(12px,env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--editor-line);
  background: var(--editor-head-bg);
}
.cf-image-crop-head h3 { margin: 2px 0 0; font-size: 19px; color: var(--text); }
.cf-image-crop-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--editor-line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 18px;
}
.cf-image-crop-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.cf-image-crop-stage {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  background: var(--editor-canvas-stage);
}
.cf-image-crop-controls {
  display: grid;
  grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr);
  gap: 12px;
  padding: 14px 16px 2px;
}
.cf-image-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 16px max(18px,env(safe-area-inset-bottom));
}

@media (max-width: 760px) {
  .cf-challenge-media-stage { padding-inline: 8px; }
  .cf-challenge-media-nav { width: 38px; height: 44px; }
  .cf-challenge-media-nav.is-prev { left: 5px; }
  .cf-challenge-media-nav.is-next { right: 5px; }
  .cf-editor-two-columns { grid-template-columns: minmax(0,1fr); }
  .cf-content-editor-form { padding-inline: 12px; }
  .cf-editor-section { padding: 13px; }
  .cf-image-crop-controls { grid-template-columns: minmax(0,1fr); padding-inline: 10px; }
  .cf-image-crop-stage { min-height: 260px; padding: 10px; }
  .cf-image-crop-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding-inline: 10px; }
}

/* --------------------------------------------------------------------------
   ChallengeFlow-Bestätigungen / Hinweise
   -------------------------------------------------------------------------- */
.cf-confirm-dialog {
  background: transparent;
  color: var(--text);
}
.cf-confirm-dialog::backdrop {
  background: rgba(6,8,12,.68);
}
.cf-confirm-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: max(20px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  box-sizing: border-box;
}
.cf-confirm-card {
  width: min(430px,100%);
  display: grid;
  grid-template-columns: 44px minmax(0,1fr);
  gap: 14px 16px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.cf-confirm-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb,var(--accent) 42%,var(--line-strong));
  color: var(--accent);
  background: color-mix(in srgb,var(--accent) 8%,transparent);
}
.cf-confirm-dialog.is-danger .cf-confirm-mark {
  border-color: color-mix(in srgb,var(--danger) 56%,var(--line-strong));
  color: var(--danger);
  background: color-mix(in srgb,var(--danger) 8%,transparent);
}
.cf-confirm-dialog.is-warning .cf-confirm-mark {
  color: var(--accent);
}
.cf-confirm-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cf-confirm-copy {
  min-width: 0;
  align-self: center;
}
.cf-confirm-copy h2 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.cf-confirm-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.cf-confirm-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
  padding-top: 4px;
}
.cf-confirm-actions > button {
  min-height: 46px;
  margin: 0;
}
@media (max-width: 520px) {
  .cf-confirm-card {
    grid-template-columns: 38px minmax(0,1fr);
    gap: 12px 13px;
    padding: 17px;
  }
  .cf-confirm-mark {
    width: 38px;
    height: 38px;
  }
  .cf-confirm-actions {
    grid-template-columns: minmax(0,1fr);
  }
  .cf-confirm-actions [data-dialog-confirm] { order: -1; }
}
