/** ChallengeFlow: 09-modals.css */
@layer components {
  /* Modale, Fotoansicht und Hinweise */
  .lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 76px 24px 28px;
    overflow: hidden;
    overscroll-behavior: none;
    z-index: 999;
  }
  .lightbox-content {
    width: min(1500px,calc(100vw - 48px));
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0,1fr) auto;
    justify-items: center;
    gap: 12px;
  }
  .lightbox-image-stage {
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: none;
    border-radius: 0;
  }
  .lightbox-copy {
    width: min(900px,92vw);
    display: grid;
    gap: 5px;
    padding: 12px 16px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 0;
    background: rgba(20,20,22,.82);
    color: #fff;
    text-align: center;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .lightbox-copy strong {
    color: #fff;
    overflow-wrap: anywhere;
  }
  .lightbox-copy p {
    margin: 0;
    color: rgba(255,255,255,.82);
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
  }
  .lightbox .lightbox-close {
    position: fixed;
    top: max(18px,env(safe-area-inset-top));
    right: max(18px,env(safe-area-inset-right));
    z-index: 4;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 50%;
    background: rgba(24,24,27,.94);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 10px 30px rgba(0,0,0,.38);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .lightbox .lightbox-close:hover {
    background: #000;
    color: #fff;
  }
  .lightbox .lightbox-close:focus-visible {
    outline: 3px solid var(--accent-glow);
    outline-offset: 3px;
  }
  .modal-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 500;
    padding: 20px;
  }
  .modal-card h2 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 17px;
  }
  .modal-label {
    display: grid;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--copy);
  }
  .modal-label input {
    border: 1px solid var(--line-strong);
    border-radius: 0;
    padding: 10px 12px;
    font-size: 15px;
    background: var(--input);
    color: var(--text);
  }
  .modal-actions {
    justify-content: flex-end;
  }
  .photo-modal .section-toggle-row {
    margin-top: 10px;
    padding-top: 10px;
  }
  .toast.show {
    opacity: 1;
    transform: translate(-50%,0);
  }
  .timeline-toggle, .overlay-close {
    width: 34px;
    height: 34px;
    min-height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--soft);
    color: var(--text);
    font-size: 15px;
  }
  .form-grid label, .modal-label, .file-drop-field {
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 560;
  }
  .form-grid input, .form-grid textarea, .form-grid select, .modal-label input {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 11px 13px;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.02);
  }
  .modal-overlay, .lightbox {
    background: rgba(3,3,4,.82);
    backdrop-filter: blur(24px) grayscale(.85) brightness(.46) contrast(.9) saturate(.18);
    -webkit-backdrop-filter: blur(24px) grayscale(.85) brightness(.46) contrast(.9) saturate(.18);
  }
  .modal-card {
    width: 100%;
    display: grid;
    gap: 12px;
    max-width: 420px;
    padding: 26px;
    box-shadow: 0 30px 90px rgba(0,0,0,.24);
  }
  .toast {
    position: fixed;
    left: 50%;
    transform: translate(-50%,16px);
    color: #fff;
    font-size: 13.5px;
    z-index: 600;
    opacity: 0;
    transition: opacity .25s ease,transform .25s ease;
    max-width: min(90vw,480px);
    text-align: center;
    bottom: 30px;
    padding: 12px 18px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 0;
    background: rgba(29,29,31,.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    font-weight: 550;
    box-shadow: 0 16px 44px rgba(0,0,0,.24);
  }
  .lightbox img,
  .lightbox video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    box-shadow: 0 30px 90px rgba(0,0,0,.35);
  }
  .lightbox img {
    user-select: none;
    -webkit-user-drag: none;
  }
  .lightbox video {
    width: min(100%,1280px);
    background: #000;
  }
  .overlay-close, .timeline-toggle {
    display: grid;
    place-items: center;
  }
  /* ------------------------------------------------------------------
     Große Update-Medienansicht
     ------------------------------------------------------------------
     Die Ansicht besteht aus drei klar getrennten Ebenen:
     1. vollständiges Originalmedium ohne Beschnitt,
     2. Aktionen und Update-Informationen in derselben Inhaltsbreite,
     3. optionaler Kommentarbereich, der die Seite nach unten erweitert.
     Das Overlay ist bewusst kein zentriertes Grid: Bei langen Diskussionen
     müsste sonst die obere Hälfte des Modals oberhalb von scrollTop 0 liegen.
  */
  .photo-modal-overlay {
    inset: 0;
    z-index: 1500;
    display: block;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    background: var(--page-a);
    opacity: 1;
    transition: opacity .16s ease;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .photo-modal {
    --photo-modal-content-width: min(1180px,calc(100vw - 184px));
    --photo-modal-media-height: min(72dvh,calc(100dvh - 112px),840px);
    position: relative;
    isolation: isolate;
    width: 100vw;
    min-height: 100dvh;
    max-width: none;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: var(--page-a);
    box-shadow: none;
    transform-origin: top center;
    transition: transform .16s ease;
  }
  .photo-modal-controls {
    position: fixed;
    top: max(18px,env(safe-area-inset-top));
    left: max(18px,env(safe-area-inset-left));
    right: max(18px,env(safe-area-inset-right));
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
  }
  .photo-modal-controls > button { pointer-events: auto; }
  .photo-modal-back {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px 0 12px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    box-shadow: none;
    transition: background-color .16s ease,border-color .16s ease,color .16s ease,opacity .16s ease,transform .16s ease;
  }
  .photo-modal-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .photo-modal-back:hover,
  .photo-modal-back:focus-visible {
    border-color: var(--text);
    background: var(--text);
    color: var(--page-a);
    outline: 0;
  }
  .photo-modal .photo-modal-close {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    font-size: 17px;
    box-shadow: none;
    transition: background-color .16s ease,border-color .16s ease,color .16s ease,opacity .16s ease,transform .16s ease;
  }
  .photo-modal .photo-modal-close:hover,
  .photo-modal .photo-modal-close:focus-visible {
    border-color: var(--text);
    background: var(--text);
    color: var(--page-a);
    outline: 0;
  }
  .photo-modal-back.is-closing {
    opacity: .68;
    transform: translateX(-4px) scale(.97);
  }
  .photo-modal .photo-modal-close.is-closing {
    opacity: .64;
    transform: rotate(8deg) scale(.88);
  }
  .photo-modal-overlay.is-closing {
    opacity: 0;
    pointer-events: none;
  }
  .photo-modal-overlay.is-closing .photo-modal {
    transform: translateY(-2px) scale(.998);
  }
  .photo-modal-overview {
    width: 100%;
    min-height: 100dvh;
    overflow: visible;
    background: var(--page-a);
  }

  /* Medienbühne: Das Original bleibt vollständig sichtbar. Die feste Bühne
     definiert nur den verfügbaren Raum; `scale-down` verkleinert große Medien
     proportional, vergrößert kleine Originale aber nicht künstlich. */
  .photo-modal-stage {
    position: relative;
    min-width: 0;
    min-height: 460px;
    display: grid;
    place-items: center;
    padding: 62px 18px 18px;
    overflow: hidden;
    background: var(--page-a);
  }
  .photo-modal-viewer {
    width: 100%;
    min-width: 0;
    min-height: var(--photo-modal-media-height);
    display: grid;
    grid-template-columns: 52px minmax(0,var(--photo-modal-content-width)) 52px;
    justify-content: center;
    align-items: center;
    gap: 12px;
  }
  .photo-modal-nav-slot {
    width: 52px;
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
  }
  .photo-modal-nav-placeholder {
    width: 42px;
    height: 42px;
    display: block;
    visibility: hidden;
  }
  .photo-modal .photo-modal-nav-slot .media-arrow {
    position: static;
    inset: auto;
    width: 42px;
    height: 42px;
    margin: 0;
    display: grid;
    place-items: center;
    transform: none;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    box-shadow: none;
  }
  .photo-modal .photo-modal-nav-slot .media-arrow:hover,
  .photo-modal .photo-modal-nav-slot .media-arrow:focus-visible {
    background: var(--text);
    color: var(--page-a);
    outline: 0;
  }
  .photo-modal .photo-modal-nav-slot .media-arrow:active { transform: scale(.96); }
  .photo-modal .media-arrow svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .photo-modal-media-column {
    width: 100%;
    height: var(--photo-modal-media-height);
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
  }
  .photo-modal-image-shell {
    position: relative;
    touch-action: manipulation;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: transparent;
  }
  .photo-modal-img {
    /* Das Medium bekommt eine wirklich feste Box innerhalb der Bühne.
       Ohne absolute Positionierung kann das intrinsische Seitenverhältnis
       eines Hochformats das Grid-Element trotz height/max-height: 100%
       höher als die Bühne berechnen; overflow: hidden schneidet es dann ab. */
    position: absolute;
    inset: 0;
    margin: auto;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: scale-down;
    object-position: center;
    border: 0;
    filter: none;
    user-select: none;
    -webkit-user-drag: none;
  }
  .photo-modal-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
    outline: none;
    user-select: auto;
  }
  .photo-modal-image-shell.is-video { padding: 0; }

  .photo-double-like-feedback {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0,0,0,.38);
    color: rgba(255,255,255,.94);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%,-50%) scale(.76);
  }
  .photo-double-like-feedback svg {
    width: 31px;
    height: 31px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.2;
  }
  .photo-double-like-feedback.is-visible {
    animation: photo-double-like-pop .62s cubic-bezier(.2,.72,.25,1) both;
  }
  @keyframes photo-double-like-pop {
    0% { opacity: 0; transform: translate(-50%,-50%) scale(.72); }
    24% { opacity: .96; transform: translate(-50%,-50%) scale(1); }
    68% { opacity: .78; transform: translate(-50%,-50%) scale(.94); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(.9); }
  }

  /* Informationen unter dem Medium. Die Aktionsleiste steht bewusst zuerst;
     alle weiteren Inhalte teilen exakt dieselbe Breite wie das Medium. */
  .photo-modal-summary {
    min-width: 0;
    padding: 0 18px 26px;
    border-top: 1px solid var(--line);
    background: var(--page-a);
  }
  .photo-modal-summary-inner {
    width: var(--photo-modal-content-width);
    max-width: 100%;
    margin-inline: auto;
    min-width: 0;
    display: grid;
    background: var(--page-a);
  }
  .photo-modal-actions {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .photo-modal-actions .icon-button {
    width: auto;
    min-width: 48px;
    min-height: 42px;
    flex: 0 0 auto;
    justify-content: center;
    padding-inline: 12px;
  }
  .photo-modal-context {
    min-width: 0;
    display: grid;
    justify-items: start;
    gap: 7px;
    padding: 18px 0 16px;
    text-align: left;
  }
  .photo-modal-challenge-link {
    max-width: min(100%,58ch);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -.02em;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  .photo-modal-challenge-link:hover,
  .photo-modal-challenge-link:focus-visible {
    color: var(--accent);
    outline: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .photo-modal-meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 7px 10px;
    color: var(--muted);
    font-family: var(--font-data);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .photo-modal-meta-row > * + *::before {
    content: '·';
    margin-right: 10px;
    color: var(--muted);
  }
  .photo-modal-meta-row time { color: inherit; }

  /* Bildkommentar und Update-Text sind eigenständige Inhaltsabschnitte.
     Beide verwenden denselben Seitenhintergrund und dieselbe Textbreite. */
  .photo-modal-update-copy,
  .photo-modal-caption {
    width: 100%;
    display: grid;
    gap: 8px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    background: var(--page-a);
  }
  .photo-modal-section-label {
    color: var(--muted);
    font-family: var(--font-data);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .photo-modal-caption p {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
  }
  .photo-modal-update-copy p {
    width: 100%;
    margin: 0;
    max-width: none;
    color: var(--copy);
    font-size: 14px;
    line-height: 1.6;
  }

  /* Historische medienbezogene Kommentare bleiben in derselben großen
     Fotoansicht sichtbar. Dadurch kann eine Kommentar-Benachrichtigung exakt
     zum betreffenden Beitrag springen, statt auf eine tote Stelle zu zeigen. */
  .photo-modal-media-comments {
    width: 100%;
    display: grid;
    gap: 8px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    background: var(--page-a);
  }
  .photo-modal-media-comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .photo-modal-media-comments-head > span:last-child {
    color: var(--muted);
    font-family: var(--font-data);
    font-size: 10px;
    font-weight: 650;
  }
  .photo-modal-media-comments .comments { display: grid; }
  .photo-modal-media-comments .comment {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .photo-update-text {
    width: 100%;
    max-width: none;
  }

  /* Diskussion unter Bildkommentar und Update-Text. Die Liste ist immer
     sichtbar; nur der Editor wird über den Kommentarbutton aufgeklappt. */
  .photo-modal-comments {
    width: 100%;
    padding: 0 18px 42px;
    background: var(--page-a);
  }
  .photo-modal-comments-inner {
    width: var(--photo-modal-content-width);
    max-width: 100%;
    margin-inline: auto;
    padding-top: 2px;
    border-top: 1px solid var(--line);
    background: var(--page-a);
  }
  .photo-modal-comment-composer {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: grid-template-rows .28s cubic-bezier(.22,.75,.25,1),
                opacity .18s ease,
                transform .28s cubic-bezier(.22,.75,.25,1),
                visibility 0s linear .28s;
  }
  .photo-modal-comments.is-composing .photo-modal-comment-composer {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .photo-modal-comment-composer-inner {
    min-height: 0;
    overflow: hidden;
    background: var(--page-a);
  }
  .photo-modal-comments-head {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0 9px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
  }
  .photo-modal-comments-head span {
    color: var(--muted);
    font-family: var(--font-data);
    font-size: 10px;
    font-weight: 650;
  }
  .photo-modal-comment-input {
    display: grid;
    grid-template-columns: minmax(0,1fr) 40px;
    align-items: end;
    gap: 12px;
    min-height: 104px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    background: var(--page-a);
  }
  .photo-modal-comment-input textarea {
    width: 100%;
    min-height: 82px;
    max-height: 180px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 0;
    outline: 0;
    padding: 12px 14px;
    background: var(--soft);
    color: var(--text);
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
  }
  .photo-modal-comment-input textarea:focus {
    border-color: var(--accent);
    outline: 0;
    box-shadow: none;
  }
  .photo-modal-comment-input textarea::-webkit-scrollbar { width: 5px; }
  .photo-modal-comment-input textarea::-webkit-scrollbar-track { background: transparent; }
  .photo-modal-comment-input textarea::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: color-mix(in srgb,var(--muted) 56%,transparent);
  }
  .photo-modal-comment-send {
    position: static;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    color: var(--text);
  }
  .photo-modal-comment-send:hover,
  .photo-modal-comment-send:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    outline: 0;
  }
  .photo-modal-comment-send:disabled { opacity: .55; cursor: wait; }
  .photo-modal-comment-send .ui-icon { width: 17px; height: 17px; }
  .photo-modal-comments-scroll {
    min-height: 0;
    overflow: visible;
    padding: 0 0 14px;
    background: var(--page-a);
  }
  .photo-modal-comments-more {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .photo-modal-comments-more:hover,
  .photo-modal-comments-more:focus-visible {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 4px;
    outline: 0;
  }
  .photo-modal-comments-scroll .comments { display: grid; }
  .photo-modal-comments-scroll .comment {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  /* Challenge-Bilder verwenden dieselbe rahmenlose Bühne, aber keine
     Update-Zusammenfassung und keinen Kommentar-Drawer. */
  .challenge-photo-modal {
    display: grid;
    grid-template-rows: minmax(0,1fr);
  }
  .challenge-photo-modal .photo-modal-stage {
    height: 100%;
    padding: 56px 24px 24px;
  }
  .challenge-photo-modal .photo-modal-img {
    max-height: calc(100dvh - 112px);
  }
  .challenge-photo-modal .photo-modal-viewer {
    grid-template-columns: 64px minmax(0,1fr) 64px;
    gap: 18px;
  }
  .challenge-photo-modal .photo-modal-nav-slot {
    width: 64px;
  }
  .challenge-photo-modal .photo-modal-nav-placeholder {
    width: 48px;
    height: 48px;
  }

  /* Editoren für eigene Challenges und Updates */
  .editor-modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
  }
  .editor-modal {
    width: min(760px,100%);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 0;
    border-radius: 0;
    border: 1px solid var(--editor-line);
    background: var(--editor-surface);
    color: var(--text);
    box-shadow: 0 32px 100px rgba(0,0,0,.34);
  }
  .editor-modal-head {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--editor-line);
    background: var(--editor-head-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .editor-modal-head h2 { margin: 2px 0 0; }
  .editor-kicker {
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 760;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .editor-form {
    padding: 20px 22px 24px;
  }
  .editor-note {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid var(--editor-line);
    border-radius: 0;
    background: var(--editor-note-bg);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
  }
  .editor-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 4px;
  }
  .editor-media-section {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--editor-line);
    border-radius: 0;
    background: color-mix(in srgb,var(--editor-row-bg) 72%,transparent);
  }
  .editor-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .editor-section-head > div {
    display: flex;
    align-items: center;
    gap: 9px;
  }
  .editor-section-head span {
    min-width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 0;
    background: var(--soft);
    color: var(--muted);
    font-size: 11px;
  }
  .editor-media-toolbar {
    align-items: center;
  }
  .editor-media-add {
    min-height: 34px;
    padding: 7px 10px;
    gap: 7px;
  }
  .editor-media-add svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  .editor-media-list {
    display: grid;
    gap: 10px;
  }
  .editor-media-row {
    display: grid;
    grid-template-columns: 154px minmax(0,1fr);
    gap: 13px;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--editor-line);
    border-radius: 0;
    background: var(--editor-row-bg);
  }
  .editor-media-thumb {
    position: relative;
    min-height: 126px;
    overflow: hidden;
    border-radius: 0;
    background: #17181c;
  }
  .editor-media-thumb img,
  .editor-media-thumb video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
  }
  .editor-media-index {
    position: absolute;
    left: 7px;
    top: 7px;
    min-width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 0;
    background: rgba(0,0,0,.72);
    color: #fff;
    font-size: 10px;
  }
  .editor-media-primary {
    position: absolute;
    left: 7px;
    bottom: 7px;
    padding: 5px 7px;
    border-radius: 0;
    background: var(--accent-glow);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .02em;
  }
  .editor-media-thumb .media-play-indicator {
    width: 36px;
    height: 36px;
  }
  .editor-media-content {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 10px;
  }
  .editor-media-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }
  .editor-media-item-head > div:first-child {
    min-width: 0;
    display: grid;
    gap: 3px;
  }
  .editor-media-item-head strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .editor-media-item-head small {
    color: var(--muted);
    font-size: 10.5px;
  }
  .editor-media-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
  }
  .editor-media-action {
    min-width: 30px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--editor-line);
    border-radius: 0;
    background: var(--soft);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    line-height: 1;
  }
  .editor-media-action:hover,
  .editor-media-action:focus-visible {
    border-color: color-mix(in srgb,var(--accent) 55%,var(--editor-line));
    background: var(--accent-soft);
    color: var(--accent);
  }
  .editor-media-action:disabled {
    opacity: .34;
    cursor: default;
  }
  .editor-media-action-wide {
    min-width: auto;
  }
  .editor-media-action.is-danger:hover,
  .editor-media-action.is-danger:focus-visible {
    border-color: rgba(209,0,36,.44);
    background: rgba(209,0,36,.12);
    color: #a1001c;
  }
  .editor-media-caption {
    gap: 5px;
    color: var(--muted);
    font-size: 11px;
  }
  .editor-media-caption textarea {
    min-height: 82px;
    resize: vertical;
  }
  .editor-media-help {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
  }
  .editor-media-empty {
    min-height: 108px;
    display: grid;
    place-content: center;
    gap: 4px;
    border: 1px dashed var(--editor-line);
    border-radius: 0;
    color: var(--muted);
    text-align: center;
  }
  .editor-media-empty strong {
    color: var(--text);
    font-size: 13px;
  }
  .editor-media-empty span {
    font-size: 11px;
  }

  /* Die Bildbearbeitung liegt innerhalb des geöffneten Editors. Dadurch
     bleibt der Seitenhintergrund weiterhin durch genau ein Modal beruhigt. */
  .editor-crop-layer {
    position: fixed;
    inset: 0;
    z-index: 12;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(5,6,8,.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .editor-crop-layer.is-standalone { z-index: 1600; }
  .editor-crop-dialog {
    width: min(900px,100%);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    padding: 0;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 0;
    background: #17181c;
    color: #f3f5fb;
    box-shadow: 0 30px 90px rgba(0,0,0,.54);
  }
  .editor-crop-head {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    background: rgba(23,24,27,.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .editor-crop-head h3 {
    margin: 2px 0 0;
    font-size: 19px;
    color: #f6f8ff;
  }
  .editor-crop-close { position: static; flex: 0 0 auto; }
  .editor-crop-stage {
    position: relative;
    min-height: 300px;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 18px;
    background: #0a0a0a;
  }
  .editor-canvas-stack {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,.10),0 18px 50px rgba(0,0,0,.36);
  }
  .editor-canvas-stack canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
  }
  .editor-canvas-stack #editorCropCanvas { position: relative; }
  #editorDrawCanvas[data-tool="move"] { cursor: grab; }
  #editorDrawCanvas[data-tool="move"].is-dragging { cursor: grabbing; }
  #editorDrawCanvas[data-tool="brush"] { cursor: crosshair; }
  #editorDrawCanvas[data-tool="eraser"] { cursor: cell; }
  .editor-crop-controls {
    display: grid;
    grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr);
    gap: 12px;
    padding: 16px 18px 2px;
  }
  .editor-tool-section {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 13px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 0;
    background: rgba(255,255,255,.035);
  }
  .editor-tool-heading { display: grid; gap: 2px; }
  .editor-tool-heading strong {
    font-size: 13px;
    color: #f3f5fb;
  }
  .editor-tool-heading span {
    color: #c4cad8;
    font-size: 10px;
  }
  .editor-crop-aspects,
  .editor-draw-tools,
  .editor-history-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
  }
  .editor-crop-aspects button,
  .editor-draw-tools button,
  .editor-history-tools button {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 0;
    background: rgba(255,255,255,.06);
    color: #eef2ff;
    font: inherit;
    font-size: 12px;
  }
  .editor-crop-aspects button:hover,
  .editor-crop-aspects button:focus-visible,
  .editor-crop-aspects button.is-active,
  .editor-draw-tools button:hover,
  .editor-draw-tools button:focus-visible,
  .editor-draw-tools button.is-active,
  .editor-history-tools button:hover,
  .editor-history-tools button:focus-visible {
    border-color: var(--accent-glow);
    background: var(--accent-glow);
    color: #e8ecff;
  }
  .editor-history-tools button {
    width: 36px;
    padding-inline: 0;
    font-size: 18px;
    line-height: 1;
  }
  .editor-history-tools button:disabled { opacity: .3; pointer-events: none; }
  .editor-crop-zoom,
  .editor-brush-size {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    color: #eef2ff;
    font-size: 12px;
  }
  .editor-crop-zoom { grid-template-columns: auto minmax(0,1fr); }
  .editor-crop-zoom input,
  .editor-brush-size input { width: 100%; accent-color: var(--accent); }
  .editor-brush-size output {
    min-width: 38px;
    color: #d5dbea;
    font-size: 10px;
    text-align: right;
  }
  .editor-draw-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .editor-draw-settings { display: grid; gap: 12px; }
  .editor-color-control {
    display: grid;
    gap: 7px;
    color: #eef2ff;
    font-size: 12px;
  }
  .editor-color-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
  .editor-color-palette > button,
  .editor-custom-color {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid rgba(255,255,255,.12);
    border-radius: 50%;
    background: var(--draw-color,transparent);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.22);
  }
  .editor-color-palette > button:hover,
  .editor-color-palette > button:focus-visible,
  .editor-color-palette > button.is-active { border-color: #fff; transform: scale(1.06); }
  .editor-custom-color {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    background: conic-gradient(#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);
  }
  .editor-custom-color input { position: absolute; inset: -8px; width: 44px; height: 44px; opacity: 0; cursor: pointer; }
  .editor-tool-section p {
    margin: 0;
    color: #c4cad8;
    font-size: 11px;
    line-height: 1.45;
  }
  .editor-crop-actions { padding: 15px 18px 18px; }

}
