/*
 Theme Name:   Twenty Twenty-Four Child
 Description:  Individuelles Child-Theme optimiert nach Lehr-Lern-Psychologie. Beinhaltet klebrige Sidebars ohne Layout-Shift, optimalen Whitespace, elaboriertes Feedback und visuelle Autonomie-Marker.
 Author:       Ihr Name
 Template:     twentytwentyfour
 Version:      1.2.0
*/


/* ==========================================================================
   0. CSS-Variablen – globales Design-System (an erster Stelle, keine Fallbacks)
   ========================================================================== */
:root {
  /* Markenfarben */
  --navy:         #1a2a4a;   /* Überschriften, Icons, primärer Text          */
  --blue:         #1f6fa8;   /* Akzent – Links, Ränder, aktive Elemente      */
  --orange:       #d4680a;   /* Sekundärakzent – h2-Randlinie                */
  --blue-light:   #e8f2fb;   /* Blau-Tönung für Hintergründe                 */
  --teal-light:   #e0f2f1;
  --red:          #c0392b;
  --red-light:    #fdf0ee;
  --gray-light:   #f4f5f7;   /* Seiten-Hintergrund                           */

  /* Navigation (bewusst vom Inhalt-Navy getrennt) */
  --nav-bg:       #2c3e50;   /* Navigationsleiste Hintergrund                */
  --nav-dropdown: #34495e;   /* Dropdown-Hintergrund                         */

  /* Texthierarchie */
  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --text-tertiary:  #94a3b8;

  /* Komponenten-Tokens */
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 2px 8px rgba(26, 42, 74, 0.08);

  /* z-index-Skala */
  --z-content: 100;
  --z-sidebar: 200;
  --z-overlay: 300;
  --z-nav:    1000;
  --z-modal:  9999;
}

body {
	text-align: left;
	hyphens: auto;
	-webkit-hyphens: auto;
	background-color: var(--gray-light);
}


/* ==========================================================================
   1. Obere Navigation & Dropdown (Sticky)
   ========================================================================== */
.top-navigation {
    background-color: var(--nav-bg);
    padding: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.admin-bar .top-navigation { top: 32px; }
.main-menu { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.main-menu > li { position: relative; }
.main-menu a { color: #ffffff; text-decoration: none; padding: 15px 20px; display: block; font-family: inherit; transition: background 0.3s; }
.main-menu a:hover { background-color: var(--nav-dropdown); }

/* Hover-Effekt für Untermenü-Einträge (hellere Stufe, da Hintergrund bereits #34495e) */
.main-menu .sub-menu a:hover,
.dropdown li a:hover {
    background-color: #4a6278;
}

/* Pfeil-Indikator für Menüpunkte mit Untermenü */
.main-menu > li.menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    margin-left: 7px;
    vertical-align: middle;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(255, 255, 255, 0.75);
    transition: transform 0.25s ease, border-top-color 0.25s ease;
}
.main-menu > li.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
    border-top-color: #ffffff;
}

/* FIX: WordPress rendert Untermenüs als .sub-menu – beide Klassen abdecken */
.dropdown,
.main-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--nav-dropdown);
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    z-index: calc(var(--z-nav) - 1);
}
.dropdown li a,
.main-menu .sub-menu li a {
    padding: 12px 15px;
    border-bottom: 1px solid var(--nav-bg);
}
.main-menu li:hover > .dropdown,
.main-menu li:hover > .sub-menu {
    display: block;
}

/* ==========================================================================
   2. Layout-Strukturen, Klebrige Sidebars & Whitespace
   ========================================================================== */
.breadcrumbs { background-color: #f5f6fa; padding: 10px 0; border-bottom: 1px solid #dcdde1; font-family: inherit; font-size: 0.9em; }
.breadcrumbs-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.breadcrumbs a { color: var(--blue); text-decoration: none; }
.breadcrumbs .breadcrumb-separator { margin: 0 8px; color: var(--text-tertiary); }
.breadcrumbs .current { color: var(--text-tertiary); }
html { scroll-behavior: smooth; }

.site-container { max-width: 1200px; margin: 30px auto; padding: 0 20px; display: flex; font-family: inherit; gap: 30px; }

/* LERNPSYCHOLOGIE: Feste Breitenregelung und Sichtbarkeits-Steuerung verhindert Text-Springen (Layout Shift) */
.sidebar-left, .sidebar-right { 
    position: -webkit-sticky; 
    position: sticky; 
    top: 70px; 
    height: fit-content; 
    max-height: calc(100vh - 90px); 
    overflow-y: auto; 
}
.admin-bar .sidebar-left, .admin-bar .sidebar-right { top: 102px; max-height: calc(100vh - 122px); }

.sidebar-left { flex: 0 0 250px; }

/* Rechte Sidebar bleibt im Flexbox-Layout reserviert, wird aber unsichtbar geschaltet */
.sidebar-right { 
    flex: 0 0 240px; 
    visibility: hidden; 
    opacity: 0; 
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out; 
}
.sidebar-right.is-active { 
    visibility: visible; 
    opacity: 1; 
}

/* LERNPSYCHOLOGIE: Strukturierender Whitespace für klare kognitive Abschnitte */


.section-navigation { background-color: #f8f9fa; padding: 20px; border-radius: 5px; border: 1px solid #e2e8f0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 15px; }
.sidebar-header h3 { margin: 0 !important; }
#qr-toggle-btn { background: none; border: none; cursor: pointer; color: var(--navy); padding: 6px; display: flex; align-items: center; border-radius: 4px; }
#qr-toggle-btn:hover, #qr-toggle-btn.active { background-color: #edf2f7; color: var(--blue); }
.qr-code-box { text-align: center; padding: 12px; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 15px; }
.qr-code-box img { max-width: 220px; margin: 0 auto; display: block; }
#qr-text-display { margin: 12px 0 8px 0; font-size: 1.2em; font-weight: bold; color: #c0392b; word-wrap: break-word; text-align: center; }
#qr-text-input { width: 100%; padding: 8px; margin-top: 10px; border: 1px solid #ccd1d9; border-radius: 4px; font-size: 0.85em; box-sizing: border-box; }
.section-navigation ul { list-style: none; padding: 0; margin: 0; }
.section-navigation li a { display: block; padding: 8px 0; color: #333; text-decoration: none; border-bottom: 1px solid #edf2f7; }
.section-navigation ul ul { list-style: none; padding-left: 15px; margin: 5px 0; }
.section-navigation ul ul ul { padding-left: 15px; margin: 3px 0; }
.section-navigation li a.depth-2 { font-weight: bold; color: var(--navy); }
.section-navigation li a.depth-3 { font-weight: normal; color: #555555; font-size: 0.9em; padding: 6px 0; }
.section-navigation li a.depth-4 { font-weight: normal; color: var(--text-tertiary); font-size: 0.82em; padding: 4px 0; font-style: italic; }
.section-navigation li a.sidebar-link.active { color: var(--blue) !important; font-weight: bold !important; }

/* ==========================================================================
   3. Haftnotiz-Design (Post-it) & Glossar
   ========================================================================== */
.definition-box.haftnotiz { background: #fff9c4; padding: 25px 20px 20px 20px; border-radius: 2px; box-shadow: 0 10px 20px rgba(0,0,0,0.1), 0 6px 6px rgba(0,0,0,0.12); position: relative; transform: rotate(-1.5deg); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.definition-box.haftnotiz:hover { transform: rotate(0deg) scale(1.03); box-shadow: 0 14px 28px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.15); }
.definition-box.haftnotiz::before { content: ""; position: absolute; top: -9px; left: 30%; width: 40%; height: 18px; background: rgba(255, 255, 255, 0.5); box-shadow: 0 1px 3px rgba(0,0,0,0.05); transform: rotate(1deg); }
.definition-box.haftnotiz h3 { margin-top: 0; color: #795548; font-family: 'Courier New', Courier, monospace; font-size: 1.1em; border-bottom: 1px dashed #bcaaa4; padding-bottom: 5px; }
#definition-text { font-size: 0.95em; line-height: 1.65; color: #3e2723; margin: 0; }
.close-def-btn { position: absolute; top: 4px; right: 8px; background: none; border: none; font-size: 22px; font-weight: bold; color: #795548; cursor: pointer; line-height: 1; transition: color 0.2s; }
.close-def-btn:hover { color: #d32f2f; }
.glossary-term { border-bottom: 2px dotted var(--blue); color: var(--navy); cursor: help; font-weight: 500; transition: background-color 0.2s; padding: 0 2px; }
.glossary-term:hover { background-color: rgba(41, 128, 185, 0.1); }
.glossary-term.active-term { background-color: #f1c40f; color: #000000; }
.page-glossary { margin-top: 50px; padding-top: 30px; border-top: 3px double #e2e8f0; }
#glossary-list dt { font-weight: bold; color: var(--blue); font-size: 1.1em; margin-top: 15px; }
#glossary-list dd { margin-left: 0; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #edf2f7; color: #4a5568; }

/* ==========================================================================
   4. Integrierte Quiz- & Aufgaben-Styles
   ========================================================================== */
.gsg-wrapper { color: #333; }
.gsg-quiz-card { background-color: #f8f9fa; border: 1px solid #e9ecef; border-radius: 10px; padding: 25px; margin-bottom: 30px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.gsg-quiz-card h3 { margin-top: 0; color: #333; }
.gsg-question { margin-bottom: 20px; }
.gsg-question p { font-weight: bold; margin-bottom: 10px; }
.gsg-radio-label { display: block; margin-bottom: 8px; cursor: pointer; }
.gsg-question::before { content: "Selbsteinschätzung"; display: inline-block; background-color: #f3e5f5; color: #6a1b9a; font-size: 11px; font-weight: bold; padding: 2px 8px; border-radius: 10px; margin-bottom: 6px; letter-spacing: 0.03em; }
.gsg-question-check::before { content: "✔︎ Wissensfrage"; display: inline-block; background-color: #e3f2fd; color: #005a9c; font-size: 11px; font-weight: bold; padding: 2px 8px; border-radius: 10px; margin-bottom: 6px; letter-spacing: 0.03em; }
.gsg-radio-label.gsg-feedback-correct { color: #2e7d32; font-weight: bold; }
.gsg-radio-label.gsg-feedback-correct::after { content: " ✓ Richtig"; color: #2e7d32; font-size: 13px; }
.gsg-radio-label.gsg-feedback-wrong { color: #c62828; }
.gsg-radio-label.gsg-feedback-wrong::after { content: " ✗ Falsch"; color: #c62828; font-size: 13px; }
.gsg-radio-label.gsg-feedback-missed::after { content: " ← Richtige Antwort"; color: #2e7d32; font-size: 12px; font-style: italic; }

/* LERNPSYCHOLOGIE: Visualisierung von elaboriertem Feedback (Erklärungsboxen) */
.gsg-elaborated-feedback {
    margin-top: 10px;
    padding: 12px 15px;
    background-color: #f0f4f8;
    border-left: 4px solid var(--blue);
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: var(--navy);
    line-height: 1.6;
    animation: fadeIn 0.3s ease-out forwards;
}

.gsg-btn { background-color: #333; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.3s ease; }
.gsg-btn:hover { background-color: #111; }
.gsg-recommendation { display: none; background-color: #f8f9fa; border: 1px solid #ddd; padding: 15px; border-radius: 8px; margin-bottom: 30px; text-align: center; font-weight: bold; line-height: 1.6; }
.gsg-tasks-container { display: none; }
.gsg-tabs { display: flex; border-bottom: 2px solid #e9ecef; margin-bottom: 20px; flex-wrap: wrap; }
.gsg-tab-btn { background: none; border: none; padding: 12px 20px; font-size: 16px; font-weight: bold; color: #6c757d; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.3s ease; }
.gsg-tab-btn:hover { color: #333; }

/* LERNPSYCHOLOGIE: Kennzeichnung des empfohlenen Niveaus stärkt die Autonomie, da sichtbare Alternativen bleiben */
.gsg-tab-btn.is-recommended::after {
    content: " ★ Empfehlung";
    font-size: 0.75em;
    color: #e67e22;
    vertical-align: super;
    margin-left: 5px;
}

.btn-niveau-1.active { color: #2e7d32; border-bottom-color: #2e7d32; }
.theme-green .gsg-task-header { background-color: #e8f5e9; border-left: 4px solid #2e7d32; color: #1b5e20; }
.theme-green .gsg-level-info { background-color: #f1f8e9; border-left: 4px solid #7cb342; }
.btn-niveau-2.active { color: #005a9c; border-bottom-color: #005a9c; }
.theme-blue .gsg-task-header { background-color: #e3f2fd; border-left: 4px solid #005a9c; color: #003c6c; }
.theme-blue .gsg-level-info { background-color: #e1f5fe; border-left: 4px solid #03a9f4; }
.btn-niveau-3.active { color: #6a1b9a; border-bottom-color: #6a1b9a; }
.theme-purple .gsg-task-header { background-color: #f3e5f5; border-left: 4px solid #6a1b9a; color: #4a148c; }
.theme-purple .gsg-level-info { background-color: #faf5ff; border-left: 4px solid #ab47bc; }
.gsg-level-info { padding: 15px 20px; margin-bottom: 25px; border-radius: 0 6px 6px 0; color: #333; }
.gsg-level-info h4 { margin-top: 0; margin-bottom: 8px; }
.gsg-level-info p { margin: 0; }
.gsg-tab-content { display: none; animation: fadeIn 0.4s; }
.gsg-tab-content.active { display: block; }

@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(5px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.gsg-task-item { margin-bottom: 15px; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.gsg-task-header { width: 100%; text-align: left; padding: 15px 20px; font-size: 16px; font-weight: bold; border: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background-color 0.2s; }
.gsg-task-header:hover { filter: brightness(0.95); }
.gsg-task-icon { font-size: 14px; transition: transform 0.3s; }
.gsg-task-header.active .gsg-task-icon { transform: rotate(180deg); }
.gsg-task-body { display: none; padding: 20px; background-color: white; border-top: 1px solid #e0e0e0; }
.gsg-task-body p { margin-top: 0; }
.gsg-help-btn { background-color: transparent; color: #555; border: 1px solid #aaa; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; margin-top: 15px; display: inline-flex; align-items: center; gap: 5px; transition: all 0.2s; }
.gsg-help-btn:hover { background-color: #f8f9fa; color: #000; border-color: #555; }
.gsg-help-content { display: none; background-color: #fff8e1; border-left: 3px solid #ffc107; padding: 15px; margin-top: 15px; border-radius: 0 4px 4px 0; font-size: 14.5px; color: #5a4a00; }
.gsg-hint-step { display: none; padding-bottom: 10px; }
.gsg-hint-step.visible { display: block; animation: fadeIn 0.3s; }
.gsg-hint-step + .gsg-hint-step.visible { border-top: 1px dashed #e6c84a; padding-top: 10px; margin-top: 5px; }
.gsg-hint-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid #e6c84a; }
.gsg-hint-counter { font-size: 13px; color: #7a6200; font-style: italic; }
.gsg-hint-next-btn { background-color: #ffc107; color: #5a4a00; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; transition: background-color 0.2s; }
.gsg-hint-next-btn:hover { background-color: #e6ab00; }
.gsg-hint-next-btn:disabled { background-color: #e0e0e0; color: #aaa; cursor: default; }
.gsg-progress-wrapper { margin-bottom: 20px; background-color: #f8f9fa; padding: 15px; border-radius: 6px; border: 1px solid #e0e0e0; }
.gsg-progress-label { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 10px; font-size: 15px; }
.gsg-progress-container { width: 100%; background-color: #e0e0e0; border-radius: 8px; height: 12px; overflow: hidden; }
.gsg-progress-bar { height: 100%; width: 0%; transition: width 0.5s ease; background-color: #2e7d32; }
.theme-green .gsg-progress-bar { background-color: #2e7d32; }
.theme-blue .gsg-progress-bar { background-color: #005a9c; }
.theme-purple .gsg-progress-bar { background-color: #6a1b9a; }
.gsg-checkbox-label { cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: normal; font-size: 14px; color: #555; padding: 4px 8px; border-radius: 4px; transition: background-color 0.2s; }
.gsg-checkbox-label:hover { background-color: rgba(0,0,0,0.05); }
.gsg-task-checkbox { width: 16px; height: 16px; cursor: pointer; }
.gsg-solution-container { display: none; margin-top: 25px; padding: 20px; border: 2px dashed #4caf50; background-color: #f1f8e9; border-radius: 8px; animation: fadeIn 0.5s; }
.gsg-solution-container h4 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.vig-table, .sol-table { border-collapse: collapse; margin: 12px 0; font-family: monospace; font-size: 14px; width: 100%; }
.vig-table th, .sol-table th { border: 1px solid #aaa; padding: 6px 8px; background-color: #eceff1; text-align: left; font-weight: bold; }
.sol-table th { background-color: #f5f5f5; }
.vig-table td, .sol-table td { border: 1px solid #ccc; padding: 6px 8px; text-align: center; min-width: 28px; }
.vig-table .filled { background-color: #e8f5e9; font-weight: bold; }
.vig-table .empty { background-color: #fff9c4; color: #999; }
.vig-table .result, .sol-table .highlight { background-color: #e3f2fd; font-weight: bold; }
.sol-table .highlight { background-color: #c8e6c9; }
.vig-note { background-color: #e8eaf6; border-left: 3px solid #5c6bc0; padding: 10px 14px; margin: 12px 0; border-radius: 0 4px 4px 0; font-size: 14px; color: #283593; }
.partner-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: bold; margin-bottom: 8px; }
.partner-a { background-color: #fff3e0; color: #e65100; }
.partner-b { background-color: #e8f5e9; color: #1b5e20; }
.partner-ab { background-color: #e3f2fd; color: #0d47a1; }

/* ==========================================================================
   7. Sidebar als Overlay-Drawer
   ========================================================================== */

/* Sidebar aus dem Flex-Flow herausnehmen: liegt jetzt als festes Overlay
   über dem Inhalt. Der Hauptinhalt füllt dadurch automatisch die volle Breite. */
.sidebar-left {
    position: fixed;
    left: 0;
    top: 90px;                          /* angehoben für sauberen Header-Abschluss */
    width: 300px;                       /* breiter */
    height: calc(100vh - 90px);
    max-height: none;
    z-index: 200;
    overflow-y: auto;
    background-color: #fff;
    box-shadow: 3px 0 14px rgba(0, 0, 0, 0.15);
    transform: translateX(0);
    transition: transform 0.35s ease;
}
.admin-bar .sidebar-left {
    top: 122px;
    height: calc(100vh - 122px);
}

/* Eingeklappt: Sidebar gleitet nach links aus dem Viewport */
.sidebar-left.is-collapsed {
    transform: translateX(-100%);
}

/* Toggle-Button: sitzt immer an der rechten Kante der Sidebar.
   Da die Sidebar stets bei left:0 beginnt, reichen zwei feste Werte. */
#sidebar-collapse-btn {
    position: fixed;
    left: 300px;                        /* Startzustand: Sidebar offen (= neue Breite) */
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--z-overlay);
    background-color: var(--nav-bg);
    color: #fff;
    border: none;
    border-radius: 0 5px 5px 0;
    width: 16px;
    height: 52px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.35s ease, background-color 0.2s;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.2);
    padding: 0;
}
#sidebar-collapse-btn:hover { background-color: var(--blue); }
.admin-bar #sidebar-collapse-btn { top: calc(50% + 16px); }

/* ==========================================================================
   8. Scroll-to-top Button
   ========================================================================== */
#scroll-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: var(--z-overlay);
    background-color: var(--nav-bg);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
}
#scroll-to-top-btn.is-visible { opacity: 1; visibility: visible; }
#scroll-to-top-btn:hover { background-color: var(--blue); }

/* Rechte Sidebar ebenfalls als festes Overlay – nimmt keinen Platz mehr im Flex-Flow
   ein, damit der Hauptinhalt ohne Versatz mittig liegt. */
.sidebar-right {
    position: fixed;
    right: 0;
    top: 90px;
    width: 280px;
    height: calc(100vh - 90px);
    max-height: none;
    flex: none;
    z-index: 200;
    overflow-y: auto;
    padding: 20px;
}
.admin-bar .sidebar-right {
    top: 122px;
    height: calc(100vh - 122px);
}

/* Hauptinhalt zentrieren (beide Sidebars sind jetzt Overlays, nicht mehr im Flex-Flow).
   flex: 0 1 auto setzt flex-basis auf auto, damit die width-Eigenschaft greift –
   flex: 1 aus dem Basisstyle hinterließ flex-basis: 0, was die Breite auf 0 zwang.
   WICHTIG: position:relative + left statt transform – transform würde einen neuen
   Containing Block für alle position:fixed-Kinder erzeugen (z.B. #vigenere-sidebar)
   und ihre Viewport-Positionierung zerstören. left hat diesen Nebeneffekt nicht. */
.main-content {
    flex: 0 1 auto;
    width: 100%;
    max-width: 700px;
    margin-inline: auto;
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(26,42,74,0.08);
    margin-bottom: 2rem;
    position: relative;
    left: 0;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/*
 * Wenn ein rechtes Panel (Bildansicht oder Vigenère-Tafel) geöffnet ist:
 * Inhalt nach links verschieben, sodass er im verbleibenden Raum zentriert liegt.
 *
 * left statt transform: position:relative+left erzeugt keinen Containing Block –
 * position:fixed-Kinder (z.B. #vigenere-sidebar) bleiben am Viewport verankert.
 *
 * Formel: ideal = Panel-Breite / 2  (zentriert den Inhalt exakt im freien Raum)
 * max() wählt den weniger negativen Wert → verhindert Off-Screen auf schmalen Viewports.
 * Linkes Limit: calc(-50vw + 370px)  (370 = halbe Content-Breite 350 + 20px Rand)
 */
body.panel-right-open .main-content {
    left: max(
        calc(var(--panel-right-w, 0px) / -2),
        calc(-50vw + 370px)
    );
}

/* ==========================================================================
   9. Content-Area Styling (Option 2 Design-System)
   ========================================================================== */

/* Absätze */
.main-content p {
    margin-bottom: 1.75rem;
    line-height: 1.8;
    font-size: 16px;
}

.main-content p:last-of-type {
    margin-bottom: 0;
}

/* Überschriften mit besseren Abständen */
.main-content h1 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 2em;
    color: var(--navy);
}

.main-content h2 {
    color: var(--blue);
    border-left: 4px solid var(--orange);
    padding-left: 1rem;
    margin-top: 3rem;
    margin-bottom: 1.75rem;
    font-size: 1.8em;
    font-weight: 800;
}

.main-content h2:not(:first-child)::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(to right, var(--blue), transparent);
    margin-bottom: 1.5rem;
    margin-left: -1rem;
    padding-left: 1rem;
}

.main-content h3 {
    color: var(--navy);
    border-left: 3px solid rgba(31, 111, 168, 0.35);
    padding-left: 0.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-size: 1.4em;
    font-weight: 700;
}

.main-content h4 {
    margin-top: 1.75rem;
    margin-bottom: 1rem;
    font-size: 1.15em;
    color: var(--navy);
    border-left: 2px solid var(--text-tertiary);
    padding-left: 0.5rem;
}

/* Trennlinien */
.main-content hr {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 2rem 0;
}

/* Listen */
.main-content ul,
.main-content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.75rem;
}

.main-content li {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #334155;
}

.main-content ul ul,
.main-content ol ol {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Tabellen */
.main-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
}

.main-content table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--navy);
    border-bottom: 2px solid #e2e8f0;
}

.main-content table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.main-content table tr:last-child td {
    border-bottom: none;
}

.main-content table tr:hover {
    background-color: #f8f9fa;
}

/* Code-Blöcke */
.main-content code {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #c0392b;
}

.main-content pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
}

.main-content pre code {
    background: none;
    padding: 0;
    color: var(--navy);
}

/* Blockquotes */
.main-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--blue);
    background: #e8f2fb;
    color: #0c3a5c;
    border-radius: 0 8px 8px 0;
}

.main-content blockquote p {
    margin-bottom: 0;
}

/* Links */
.main-content a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 2px solid rgba(31, 111, 168, 0.28);
    transition: border-color 0.2s ease;
}

.main-content a:hover {
    border-bottom-color: var(--blue);
}

/* Bilder */
.main-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}

.main-content figure {
    margin-bottom: 1.5rem;
}

.main-content figcaption {
    text-align: center;
    font-size: 0.875em;
    color: #64748b;
    font-style: italic;
    margin-top: 0.5rem;
}

/* ==========================================================================
   10. Image Viewer (Sidebar + Modal)
   ========================================================================== */

/* Clickable images */
.main-content img {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.main-content img:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

/* Image Viewer Sidebar */


/* ==========================================================================
   11. Highlight-Boxen (einseitig definierte Info/Warn/Erfolg-Kästen)
   ========================================================================== */

/* Basisklasse */
.highlight {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid;
  margin: 1rem 0;
}

/* Varianten */
.highlight-info    { background: var(--blue-light);  border-color: var(--blue);   color: #0c3a5c; }
.highlight-teal    { background: var(--teal-light);  border-color: #80cbc4;       color: #0d3d46; }
.highlight-danger  { background: var(--red-light);   border-color: var(--red);    color: #6b1a14; }
.highlight-success { background: #e8f5e9;            border-color: #4caf50;       color: #1b5e20; }
.highlight-orange  { background: #f8f8f8;            border-color: var(--orange); color: #5a3000; }

/* Modifikatoren */
.highlight-mb      { margin-bottom: 2rem; }
.highlight-sm      { font-size: 13px; }
.highlight-sm.highlight-info { padding: 0.6rem 1.25rem; }
.highlight-italic  { font-style: italic; }
.highlight-code    { overflow-x: auto; }
.text-center       { text-align: center; }

/* ==========================================================================
   12. Utility-Klassen (ersetzen häufig auftretende Inline-Styles)
   ========================================================================== */
.table-scroll          { overflow-x: auto; margin: 1rem 0; }
.code-block            { overflow-x: auto; margin: 1rem 0; padding: 1rem 1.25rem;
                         background: #f4f4f4; border-radius: 6px;
                         font-family: monospace; font-size: 12px; line-height: 2.2; }
.section-divider       { border: 0; height: 1px; background: #e2e8f0; margin: 2rem 0; }
.flex-wrap-gap         { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.info-card             { background: #fff; padding: 12px; border-radius: 6px;
                         border: 1px solid #e2e8f0; }
.content-image         { max-width: 100%; height: auto; border-radius: 8px;
                         box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.mono                  { font-family: monospace; }
.hidden                { display: none; }
.mb-2                  { margin-bottom: 2rem; }
.mt-1                  { margin-top: 1.25rem; }
.mt-xs                 { margin-top: 0.75rem; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 600;
}
.badge-orange { background: #fff3e0; color: var(--orange); border: 1px solid var(--orange); margin-left: 8px; }

/* ==========================================================================
   13. Lizenz-/Quellenzeile am Seitenanfang
   ========================================================================== */
.license-header        { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.license-figure        { max-width: 20%; margin-right: 5pt; flex-shrink: 0; }
.license-header p      { font-size: 14px; color: #555; margin: 0; }

/* ==========================================================================
   14. Vigenère-Sidebar (Slide-in Panel für die interaktive Tabelle)
   ========================================================================== */


/* ==========================================================================
   15. Komponentenraster (Grid-Layouts für Cards)
   ========================================================================== */

/* Highlight-Grid (2-spaltig responsive) */
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.highlight-grid .highlight { margin: 0; height: 100%; box-sizing: border-box; }

/* Kryptographie-Komponenten-Grid */
.krypto-components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.component-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.component-card h5 { margin: 0 0 0.5rem 0; font-size: 15px; color: var(--navy); font-weight: 700; }
.component-card p  { margin: 0 !important; font-size: 13.5px; line-height: 1.5; color: #334155; }

/* Angriffs-Karten */
.attack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.attack-card {
  background: var(--gray-light);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.attack-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26,42,74,0.12); }
.attack-image-wrapper {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 0.5rem;
  width: 100%; max-width: 180px; height: 110px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}
.attack-image-wrapper img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.attack-content { width: 100%; text-align: left; }
.attack-card h5 { margin: 0 0 0.5rem 0; font-size: 16px; color: var(--navy); font-weight: 700;
                  border-bottom: 2px solid #e2e8f0; padding-bottom: 0.25rem; }
.attack-card p  { margin: 0 !important; font-size: 13.5px; line-height: 1.5; color: #334155; }

/* Häufigkeitsanalyse-Grid */
.frequency-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.frequency-card {
  background: #f4f5f7;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.frequency-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26,42,74,0.12); }
.frequency-card img {
  max-width: 100%; height: auto; border-radius: 8px;
  border: 1px solid #e2e8f0; margin-bottom: 0.75rem; cursor: pointer;
}
.frequency-card figcaption { font-size: 13px; color: #64748b; font-style: italic; margin-top: 0.5rem; }

/* Geheimtext-Karte */
.secret-message-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.secret-message-image {
  max-width: 100%; width: 100%; max-width: 400px;
  border-radius: var(--radius); border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(26,42,74,0.06);
}
.secret-message-image figcaption {
  margin-top: 0.75rem; text-align: center; font-size: 13px; color: #64748b; font-style: italic;
}
.cipher-text-box {
  background: #f8f9fa;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.8;
  text-align: center;
  color: var(--navy);
  letter-spacing: 0.05em;
  width: 100%; max-width: 500px;
  margin: 1rem auto !important;
  overflow-x: auto;
}
.cipher-text-box .line { margin: 0.5rem 0; }

/* Kommunikationsdiagramm */
.comm-diagram {
  display: flex;
  align-items: center; justify-content: center;
  padding: 1.25rem;
  background: var(--gray-light);
  border-radius: var(--radius-lg);
  margin: 1.25rem 0;
  flex-wrap: wrap; gap: 0.5rem;
}
.comm-node {
  background: var(--orange); color: white;
  border-radius: 50%; width: 75px; height: 75px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; text-align: center;
  box-shadow: var(--shadow); flex-shrink: 0;
}
.comm-arrow        { flex: 1; min-width: 120px; max-width: 260px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.comm-arrow-label  { background: var(--navy); color: white; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-align: center; width: 100%; }
.comm-arrow-line   { width: 100%; height: 3px; background: var(--navy); position: relative; }
.comm-arrow-line::after { content: '▶'; position: absolute; right: -1px; top: 50%; transform: translateY(-50%); color: var(--navy); font-size: 12px; }


/* ==========================================================================
   16. Barrierefreiheit – Fokus-Stile
   ========================================================================== */

/* Globaler Fokus-Ring: sichtbar bei Tastaturnavigation, nicht bei Mausklick */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Browser-Standard-Outline nur bei Mausklick unterdrücken */
:focus:not(:focus-visible) {
    outline: none;
}

/* Buttons und interaktive Elemente: Fokus nicht durch outline-none verstecken */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}


/* ==========================================================================
   17. Responsive – Mobile & Tablet (max-width: 900px)
   ========================================================================== */
@media (max-width: 900px) {

    /* Linke Sidebar standardmäßig eingeklappt */
    .sidebar-left {
        transform: translateX(-100%);
    }

    /* Toggle-Button an linken Rand */
    #sidebar-collapse-btn {
        left: 0 !important;
    }

    /* Hauptinhalt: volle Breite, reduzierter Padding */
    .main-content {
        max-width: 100%;
        padding: 1.5rem 1.25rem;
        border-radius: 0;
        box-shadow: none;
    }

    .site-container {
        margin: 0 auto;
        padding: 0;
    }

    /* Navigation: horizontal scrollbar statt Umbruch */
    .main-menu {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .main-menu::-webkit-scrollbar { display: none; }

    .main-menu a {
        white-space: nowrap;
        padding: 13px 16px;
    }

    /* Dropdowns auf Mobile deaktivieren (Touch-Navigation) */
    .main-menu .sub-menu,
    .dropdown {
        display: none !important;
    }

    /* Breadcrumbs: etwas kompakter */
    .breadcrumbs-container {
        padding: 0 12px;
    }

    /* Quiz/Aufgaben: Tab-Buttons scrollbar */
    .gsg-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .gsg-tab-btn {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 14px;
    }
}


/* ==========================================================================
   18. Wide-Embed – Breiterer Container für eingebettete Inhalte (z. B. iFrame)
   ========================================================================== */

/*
 * Bricht aus dem 700px-Content-Container heraus und zentriert sich im Viewport.
 *
 * Funktionsweise:
 *   left: 50%            → verschiebt den linken Rand des Elements zur Mitte
 *                          des Elterncontainers (.main-content, 620px Innenbreite)
 *   translateX(-50%)     → zieht das Element um die Hälfte seiner eigenen Breite
 *                          zurück → Nettoeffekt: perfekte Zentrierung im Viewport.
 *   width: min(980px, …) → begrenzt auf den sinnvollen Maximalwert des Lernpfads,
 *                          schrumpft auf kleineren Bildschirmen.
 *
 * Nutzung im Seiteninhalt:
 *   <div class="wide-embed">
 *     <iframe src="/pfad/zur/datei.html"></iframe>
 *   </div>
 */
.wide-embed {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: min(980px, calc(100vw - 40px));
    margin-bottom: 2rem;
}

.wide-embed iframe {
    width: 100%;
    border: none;
    border-radius: var(--radius);
    display: block;
    min-height: 100vh; /* Lernpfad nutzt min-height: 100vh pro Seite */
}

/* Auf Mobile: Außenabstand reduzieren */
@media (max-width: 900px) {
    .wide-embed {
        width: calc(100vw - 24px);
    }
}

/* ==========================================================================
   13. Rechte Panels – Einheitliches Design-System
   (Bildansicht + Vigenère-Quadrat teilen dieselbe Basis)
   ========================================================================== */

/* ── Gemeinsame Container-Basis ───────────────────────────────────────────── */
.vigenere-sidebar,
.image-viewer-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 560px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--blue);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.vigenere-sidebar.is-open,
.image-viewer-sidebar.is-open {
    transform: translateX(0);
}

/* ── Panel-Header (blauer Streifen oben) ─────────────────────────────────── */
.panel-header {
    padding: 14px 18px;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 12px;
}

.panel-header-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Schließen-Button: rund, halbtransparent weiß */
.panel-header-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.panel-header-close:hover {
    background: rgba(255, 255, 255, 0.38);
}

/* ── Info-Leiste (zwischen Header und Inhalt) ─────────────────────────────── */
.panel-info-bar {
    padding: 10px 16px;
    flex-shrink: 0;
    background: var(--gray-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.panel-info-bar p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 6px;
}

.panel-info-bar p:last-child { margin-bottom: 0; }

.panel-info-indicator {
    padding: 7px 10px;
    background: #fff;
    border-left: 4px solid var(--orange);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-primary);
}

/* ── Scrollbarer Inhaltsbereich ───────────────────────────────────────────── */
/* .panel-content  → neuer Name (Bildansicht)  */
/* .sidebar-scroll-content → Alias (Vigenère, bestehend im HTML) */
.panel-content,
.sidebar-scroll-content {
    overflow: auto;
    flex: 1;
    padding: 16px;
}

/* ── Bildansicht: Bild-Darstellung ───────────────────────────────────────── */
.panel-image-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.panel-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.panel-image:hover {
    transform: scale(1.015);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.panel-image-caption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    width: 100%;
}

.panel-hint {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--blue-light);
    border-radius: var(--radius);
    border-left: 3px solid var(--blue);
    font-size: 0.85rem;
    color: #0c3a5c;
}

/* ── Image Viewer Modal (Vollbild) ────────────────────────────────────────── */
.image-viewer-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88);
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-viewer-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.image-viewer-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.image-viewer-modal-img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    width: auto; height: auto;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.image-viewer-modal-close {
    position: absolute;
    top: -45px; right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.image-viewer-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.image-viewer-modal-caption {
    margin-top: 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    font-size: 0.9rem;
    font-style: italic;
}

/* ── Responsive: Mobile & Tablet ─────────────────────────────────────────── */
@media (max-width: 720px) {
    /* Panels: Vollbild, Slide-up von unten */
    .vigenere-sidebar,
    .image-viewer-sidebar {
        width: 100%;
        top: auto;
        bottom: 0;
        height: 75vh;
        border-left: none;
        border-top: 4px solid var(--blue);
        transform: translateY(100%);
    }

    .vigenere-sidebar.is-open,
    .image-viewer-sidebar.is-open {
        transform: translateY(0);
    }
}