/* ============================================================================
   Iter v6.51: Submission-Detail-Seite (loest Foto-Modal auf Pinnwand ab)
   ============================================================================
   Saubere eigene Seite statt Modal - kein Spalt-Problem, kein z-index-Drama,
   linkbar als URL, browser-history-tauglich.
   ============================================================================ */

.sub-detail {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 0 32px;
}

/* ===== Top-Bar ===== */
.sub-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card, #181818);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    position: sticky;
    top: 0;
    z-index: 5;
}
.sub-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text, #fff);
    text-decoration: none;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    transition: background 0.15s;
}
.sub-detail-back:hover,
.sub-detail-back:focus-visible {
    background: rgba(255,255,255,0.12);
}
.sub-detail-back > span:first-child {
    font-size: 18px;
    line-height: 1;
}
.sub-detail-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sub-detail-spacer {
    width: 80px;
    flex-shrink: 0;
}
@media (max-width: 540px) {
    .sub-detail-back-label { display: none; }
    .sub-detail-back { padding: 8px 10px; }
    .sub-detail-spacer { width: 40px; }
}

/* ===== Foto-Bereich ===== */
.sub-detail-photo-wrap {
    width: 100%;
    background: var(--bg, #000);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 70vh;
    overflow: hidden;
}
.sub-detail-photo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}
.sub-detail-photo-placeholder {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted, rgba(255,255,255,0.6));
}
.sub-detail-photo-placeholder > span {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
}
.sub-detail-photo-placeholder > p {
    margin: 0;
    font-size: 15px;
}

/* ===== Meta-Bereich ===== */
.sub-detail-meta {
    padding: 16px;
}
.sub-detail-quest {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text, #fff);
    line-height: 1.3;
}
.sub-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.sub-detail-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    font-size: 13px;
    color: var(--text, #fff);
}
.sub-detail-stat .icon { font-size: 15px; line-height: 1; }
.sub-detail-stat-stars { background: rgba(255, 210, 63, 0.16); color: #ffd23f; }
.sub-detail-stat-best  { background: rgba(3, 215, 226, 0.16); color: #03d7e2; }
.sub-detail-stat-pending { background: rgba(255, 168, 0, 0.16); color: #ffa800; }

.sub-detail-caption {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--text, #fff);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== Duell-Banner ===== */
.sub-detail-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
}
.sub-detail-banner .icon { font-size: 22px; line-height: 1; }
.sub-detail-banner-duel-win {
    background: linear-gradient(135deg, rgba(255, 210, 63, 0.2), rgba(255, 168, 0, 0.2));
    color: #ffd23f;
    border: 1px solid rgba(255, 210, 63, 0.4);
}
.sub-detail-banner-duel {
    background: rgba(255,255,255,0.06);
    color: var(--text, #fff);
}

/* ===== Sections (Visibility, Melden, etc.) ===== */
.sub-detail-section {
    padding: 16px;
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}
.sub-detail-section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, rgba(255,255,255,0.7));
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sub-detail-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--text-muted, rgba(255,255,255,0.65));
    line-height: 1.4;
}

/* ===== Visibility-Switcher ===== */
.sub-detail-vis-segments {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.sub-detail-vis-seg {
    position: relative;
    cursor: pointer;
}
.sub-detail-vis-seg input { position: absolute; opacity: 0; pointer-events: none; }
.sub-detail-vis-seg span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 12px;
    font-size: 12px;
    text-align: center;
    background: rgba(255,255,255,0.04);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    line-height: 1.3;
}
.sub-detail-vis-seg span:first-letter {
    font-size: 22px;
}
.sub-detail-vis-seg input:checked + span {
    background: rgba(3, 215, 226, 0.16);
    border-color: rgba(3, 215, 226, 0.6);
    color: #03d7e2;
}
.sub-detail-vis-seg:active span { transform: scale(0.97); }

/* ===== Action-Buttons (Hervorheben, Loeschen) ===== */
.sub-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}
.sub-detail-action-form { margin: 0; }
.sub-detail-action-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    background: var(--bg-card, #181818);
    color: var(--text, #fff);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.sub-detail-action-btn:hover,
.sub-detail-action-btn:focus-visible {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.24);
}
.sub-detail-action-btn:active { transform: scale(0.98); }
.sub-detail-action-icon { font-size: 18px; line-height: 1; }
.sub-detail-action-danger {
    border-color: rgba(255, 82, 82, 0.4);
    color: #ff5252;
}
.sub-detail-action-danger:hover,
.sub-detail-action-danger:focus-visible {
    background: rgba(255, 82, 82, 0.1);
    border-color: rgba(255, 82, 82, 0.7);
    color: #ff5252;
}

/* ===== Light-Mode Anpassungen ===== */
[data-theme="light"] .sub-detail-photo-wrap { background: #f0f0f0; }
[data-theme="light"] .sub-detail-stat { background: rgba(0,0,0,0.06); color: #111; }
[data-theme="light"] .sub-detail-action-btn { background: #fff; }
[data-theme="light"] .sub-detail-action-btn:hover { background: #f7f7f7; }
[data-theme="light"] .sub-detail-back { background: rgba(0,0,0,0.05); color: #111; }
[data-theme="light"] .sub-detail-back:hover { background: rgba(0,0,0,0.1); }
[data-theme="light"] .sub-detail-vis-seg span { background: #fff; color: #111; }

/* ===== Tile-Link auf Pinnwand (statt Modal-Button) ===== */
a.ig-tile-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
a.ig-tile-link:focus-visible {
    outline: 2px solid var(--accent, #ffd23f);
    outline-offset: 2px;
}
