/* Gemeinsame Styles für die Kennenlernspiele-Seitenfamilie */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-light: #64748b;
    --accent: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-wrap: break-word;
}

/* --- Header --- */
header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 2.75rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

header .back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.95rem;
}

header .back-link:hover {
    color: white;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1.05rem;
    color: #cbd5e1;
    max-width: 700px;
    margin: 0 auto;
}

/* --- Main --- */
main {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

main.wide {
    max-width: 1200px;
}

/* --- Panel / Karten (Intro, Hinweise, Reflexion) --- */
.panel {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.panel p {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.panel p:last-child {
    margin-bottom: 0;
}

.panel strong {
    color: var(--text-main);
}

/* --- Section headings --- */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    color: var(--text-main);
}

.section-title:first-of-type {
    margin-top: 0;
}

.section-intro {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

/* --- Hub-Kacheln (Übersichtsseite) --- */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.hub-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.hub-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.hub-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.hub-card:hover::after {
    transform: scaleX(1);
}

.hub-icon {
    background-color: #eff6ff;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.1rem;
    font-size: 1.75rem;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.hub-card:hover .hub-icon {
    background-color: var(--primary);
}

.hub-card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.hub-card p {
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.5;
}

.hub-card .hub-count {
    margin-top: 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    background-color: #eff6ff;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
}

/* --- Akkordeon / Karten (Spiele, Methoden) --- */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details.item-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

details.item-card[open] {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

details.item-card summary {
    list-style: none;
    cursor: pointer;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
}

details.item-card summary::-webkit-details-marker {
    display: none;
}

.item-title {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.item-title > span:last-child {
    overflow-wrap: anywhere;
}

.item-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #eff6ff;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.item-meta {
    order: 3;
    flex-basis: 100%;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background-color: #eff6ff;
    color: var(--primary-dark);
    white-space: nowrap;
}

.chevron {
    order: 2;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    stroke: var(--text-light);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
}

details.item-card[open] .chevron {
    transform: rotate(180deg);
}

.item-body {
    padding: 0 1.5rem 1.75rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1.25rem;
}

.item-block {
    margin-bottom: 1.1rem;
}

.item-block:last-child {
    margin-bottom: 0;
}

.item-block h4 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.item-block p,
.item-block li {
    color: var(--text-main);
    line-height: 1.55;
    font-size: 0.98rem;
}

.item-block ul,
.item-block ol {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* --- Video-Einbettung (YouTube, lädt erst beim Aufklappen) --- */
.video-embed-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    margin-top: 0.25rem;
}

.video-embed-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-fallback-link {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    text-align: center;
    padding: 1rem;
    transition: background 0.2s ease;
}

.video-fallback-link:hover {
    background: rgba(0, 0, 0, 0.15);
}

.video-credit {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-light);
}

.video-credit a {
    color: var(--text-light);
}

/* --- Bingo-Raster --- */
.bingo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.bingo-cell {
    background-color: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.9rem 0.6rem;
    font-size: 0.85rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    line-height: 1.35;
    color: var(--text-main);
}

/* --- Feldliste (Steckbrief-Vorlagen) --- */
.field-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.field-list .field-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--primary-dark);
}

.field-list .field-line {
    margin-top: 0.4rem;
    border-bottom: 1px dashed #cbd5e1;
    height: 1.4rem;
}

/* --- Druck-Button --- */
.print-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.print-button:hover {
    background: var(--primary);
    color: white;
}

/* --- Download-Button (PDF-Arbeitsblätter) --- */
.download-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.download-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.worksheet-actions {
    margin: 0.75rem 0 1.25rem;
}

/* --- Footer --- */
footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    background-color: white;
    border-top: 1px solid #e2e8f0;
}

.footer-text {
    color: inherit;
}

.impressum-toggle {
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    font-weight: 600;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    border: 1px solid var(--primary);
    transition: background 0.2s ease, color 0.2s ease;
}

.impressum-toggle:hover,
.impressum-toggle:focus {
    background: var(--primary);
    color: white;
    outline: none;
}

.impressum-panel {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: min(360px, calc(100% - 2rem));
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 25px 50px -15px rgba(15, 23, 42, 0.35);
    border: 1px solid #e2e8f0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1100;
}

.impressum-panel.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.impressum-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.impressum-panel p {
    margin-bottom: 0.75rem;
    color: var(--text-light);
    line-height: 1.45;
}

.impressum-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.impressum-grid h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.impressum-note {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 1rem;
}

.impressum-close {
    display: inline-block;
    margin-top: 1rem;
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.cookie-banner {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 100%);
    width: min(600px, calc(100% - 2rem));
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.4);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    z-index: 1000;
}

.cookie-banner.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.cookie-text {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cookie-button {
    flex: 1;
    min-width: 140px;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.cookie-button.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cookie-button.secondary {
    background: transparent;
    color: var(--text-main);
    border-color: #cbd5e1;
}

.cookie-button.primary:hover {
    background: var(--primary-dark);
}

.cookie-button.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Mobile --- */
@media (max-width: 640px) {
    header { padding: 2rem 1rem; }
    h1 { font-size: 1.6rem; }
    .subtitle { font-size: 0.95rem; }
    main { padding: 1.5rem 1rem 3rem; }
    .panel { padding: 1.25rem 1.1rem; }
    .section-title { font-size: 1.3rem; margin: 2rem 0 1rem; }
    .hub-grid { grid-template-columns: 1fr; gap: 1.1rem; }
    details.item-card summary { padding: 1rem 1.1rem; }
    .item-title { font-size: 1rem; gap: 0.6rem; }
    .item-number { width: 28px; height: 28px; font-size: 0.85rem; }
    .badge { font-size: 0.75rem; padding: 0.25rem 0.6rem; }
    .item-body { padding: 0 1.1rem 1.5rem; padding-top: 1.1rem; }
    .item-block h4 { font-size: 0.82rem; }
    .item-block p, .item-block li { font-size: 0.92rem; }
    .bingo-grid { grid-template-columns: repeat(2, 1fr); }
    .cookie-actions { flex-direction: column; }
    .cookie-button { width: 100%; }
    footer { flex-direction: column; }
    .impressum-panel { right: 1rem; left: 1rem; width: auto; }
}

@media (max-width: 400px) {
    h1 { font-size: 1.35rem; }
    .panel { padding: 1rem 0.9rem; }
    details.item-card summary { padding: 0.9rem 0.9rem; }
    .item-body { padding: 0 0.9rem 1.25rem; padding-top: 1rem; }
    .item-title { font-size: 0.95rem; }
    .bingo-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Druckansicht --- */
@media print {
    header .back-link,
    .print-button,
    .worksheet-actions,
    .video-block,
    footer,
    .cookie-banner,
    .impressum-panel {
        display: none !important;
    }
    header {
        background: none !important;
        color: var(--text-main) !important;
    }
    .subtitle {
        color: var(--text-light) !important;
    }
    body {
        background: white !important;
    }

    /* Akkordeon-Karten werden vor dem Drucken per JS aufgeklappt (open=true);
       diese Regeln sind ein CSS-Fallback, falls das aus irgendeinem Grund
       nicht greift. */
    details.item-card .item-body {
        display: block !important;
    }
    details.item-card .chevron {
        display: none !important;
    }

    /* Jede Karte (Spiel/Methode) beginnt eine neue Seite, damit pro Seite
       immer nur ein Eintrag steht. Der jeweils letzte Eintrag der letzten
       Liste erzwingt keinen Umbruch mehr, damit am Ende keine leere Seite
       entsteht. */
    details.item-card {
        break-inside: avoid;
        break-after: page;
        page-break-after: always;
    }
    .card-list:last-of-type details.item-card:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    /* Überschriften nie allein am Seitenende, Panels nicht mitten
       auseinanderreißen. */
    .section-title {
        break-after: avoid;
        page-break-after: avoid;
    }
    .panel {
        break-inside: avoid;
    }

    /* Utility-Klasse: erzwingt einen Seitenumbruch vor dem Element,
       z. B. damit der Reflexionsleitfaden auf einer eigenen Seite beginnt. */
    .print-break-before {
        break-before: page;
        page-break-before: always;
    }
}
