/* Add all special styles used for displaying the rules */
/* .rules: used for all elements loading rules (rules at main site, rules ingame, popup with rules extract 
   #rules: div with complete rules used at main site 
   #rulesPage: ingame rules page display 
   #panelRules: ingame rules sidepanel display 
   #popup.rules: popup with rules extract only */
/* Base styles for the savanna background */

/* 
   WILDWASSER - DER GROSSE FLUSSLAUF 
   Premium Rulebook Stylesheet (Robust Layout)
*/

/* 1. CORE VARIABLES & PALETTE */
:root {
    --river-blue: #2b6cb0;
    --river-light: #ebf8ff;
    --savanna-sand: #fdf6e3;
    --wood-dark: #4a3320;
    --accent-red: #c53030;
    --text-main: #2d3748;
    --border-subtle: #cbd5e0;
}

/* 2. THEMATIC BACKGROUND (Savanna / Jungle vibe, pure CSS) */
body {
    background-color: #8f9e7a;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 0%, transparent 50%), radial-gradient(circle at 80% 80%, rgba(0,0,0,0.1) 0%, transparent 50%);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    line-height: 1.7;
    margin: 0;
    padding: 3rem 1rem;
}

.card-body {
    /* Existing background color from your framework/wrapper */
    background-color: #F0D8B0;
    /* Elegant, subtle cheetah dot pattern */
    background-image: radial-gradient(circle at 10% 10%, rgba(74, 51, 32, 0.2) 2px, transparent 2.5px), radial-gradient(circle at 30% 25%, rgba(74, 51, 32, 0.15) 1.5px, transparent 2px), radial-gradient(circle at 50% 40%, rgba(74, 51, 32, 0.2) 2.5px, transparent 3px), radial-gradient(circle at 70% 15%, rgba(74, 51, 32, 0.15) 2px, transparent 2.5px), radial-gradient(circle at 90% 30%, rgba(74, 51, 32, 0.2) 2px, transparent 2.5px), radial-gradient(circle at 20% 60%, rgba(74, 51, 32, 0.15) 1.5px, transparent 2px), radial-gradient(circle at 40% 80%, rgba(74, 51, 32, 0.2) 2.5px, transparent 3px), radial-gradient(circle at 60% 90%, rgba(74, 51, 32, 0.15) 2px, transparent 2.5px), radial-gradient(circle at 80% 70%, rgba(74, 51, 32, 0.2) 2px, transparent 2.5px);
    /* Tile size for the pattern to repeat naturally */
    background-size: 150px 150px;
}

/* 3. MAIN CONTAINER (The Rulebook Page) */
.rules {
    max-width: 880px;
    margin: 40px auto;
    background-color: #ffffff;
    /* Restore the subtle aquatic blue gradient */
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, transparent 30%, rgba(186, 230, 253, 0.3) 60%);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 4rem 5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    position: relative;
}


/* 4. MAIN TITLE */
.gameTitle, h1 {
    font-family: 'Arial Black', Impact, sans-serif;
    color: var(--wood-dark);
    font-size: 3rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 4px double var(--border-subtle);
}

/* 5. THE APPROVED HEADERS */
.chapter .title, h2, h3 {
    text-align: center;
    color: var(--river-blue);
    font-family: 'Arial Black', Impact, sans-serif;
    text-transform: uppercase;
    font-size: 1.8rem;
    letter-spacing: 1.5px;
    padding: 15px 0;
    margin: 3.5rem 0 2rem 0;
    border-top: 1px solid #1a202c;
    border-bottom: 1px solid #1a202c;
    background: linear-gradient(90deg, transparent 0%, rgba(226, 241, 248, 0.7) 20%, rgba(226, 241, 248, 0.7) 80%, transparent 100%);
    text-shadow: 1px 1px 0px rgba(255,255,255,0.8);
    display: block;
}

/* 6. SUMMARY & INFO BOXES */

/* Break Yucata's flex/table layout on the parent container */
.chapter {
    display: block !important;
    width: 100% !important;
}

.hasSummary {
    float: none !important;
    width: auto !important;
    display: block !important;
    /* Prevent Block Formatting Context from restricting the text to a column */
    overflow: visible !important;
    /* Reset margins that might force column gaps */
    margin: 0 !important;
    padding: 0 !important;
}

    /* Compact lists inside summary paragraphs */
    .hasSummary ul {
        margin: 1rem 0;
        list-style-type: none; /* Clean look without standard bullets */
        padding-left: 1rem;
    }

    .hasSummary li::before {
        content: "»"; /* Subtle thematic bullet */
        color: var(--river-blue);
        margin-right: 8px;
        font-weight: bold;
    }

    .hasSummary li strong {
        color: var(--wood-dark);
    }

/* Introduction box at the top: Full width, no float */
.summaryInfo {
    float: none !important;
    width: auto !important;
    margin: 0 0 2.5rem 0 !important;
    background-color: var(--savanna-sand);
    border: 2px solid #e2e8f0;
    border-left: 8px solid var(--river-blue);
    padding: 1.2rem 1.5rem;
    border-radius: 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--wood-dark);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: block !important;
}

/* Chapter summary boxes: Float right to push into the text */
.summary {
    float: right !important;
    width: 35% !important;
    min-width: 240px;
    margin: 0.5rem 0 1.5rem 2.5rem !important;
    background-color: var(--savanna-sand);
    border: 2px solid #e2e8f0;
    border-left: 8px solid var(--river-blue);
    padding: 1.2rem 1.5rem;
    border-radius: 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--wood-dark);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: block !important;
}

    /* Highlight text inside summary */
    .summary strong, .summaryInfo strong {
        color: var(--accent-red);
    }

/* Crucial clearfix so subsequent chapters don't wrap around the box */
.chapter::after {
    content: "";
    display: block !important;
    clear: both !important;
}

/* 7. ANIMAL / ACTION ITEMS */
.itemisation {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    background: #f7fafc;
    border: 1px solid var(--border-subtle);
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .itemisation:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

/* 7b. MATERIAL LAYOUT - Specific Row Constraints */
.material-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Top Row: Exactly 3 equal-width columns */
.material-row-top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Bottom Row: Exactly 2 equal-width columns */
.material-row-bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Flex containers for the bottom columns to stack their cards */
.material-col-left,
.material-col-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* General styling for the item cards */
.material-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.item-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--wood-dark);
}

/* Note for items not used on the digital platform */
.item-note {
    font-weight: normal;
    font-style: italic;
    font-size: 0.9rem;
    display: block; /* Ensures it stays on its own line if needed */
    margin-top: 4px; /* Optional: a little breathing room */
}

.material-img {
    max-height: 70px;
    margin-top: 10px;
}

/* Board Sizing and Zoom Interaction */
.board-cell {
    background: rgba(255, 255, 255, 0.6);
    /* Allows the board container to stretch to the full height of the left column */
    flex-grow: 1;
    justify-content: flex-start;
}

.board-large {
    width: 100%;
    max-width: 320px;
    height: auto;
    object-fit: contain;
    margin-top: 15px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
    cursor: zoom-in;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

    /* Enlarged state when clicked */
    .board-large.zoomed {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 50vw !important;
        max-width: 900px !important;
        max-height: 90vh !important;
        z-index: 9999;
        background: #ffffff;
        padding: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5), 0 25px 50px rgba(0, 0, 0, 0.25);
        cursor: zoom-out;
    }

/* Galleries */
.token-gallery {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    margin-top: 15px;
    justify-items: center;
    width: 100%;
}

.token-img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.2));
}

.river-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
    justify-items: center;
    width: 100%;
}

.river-img {
    width: 100%;
    max-width: 80px;
    height: auto;
    border-radius: 4px;
    filter: drop-shadow(1px 3px 4px rgba(0,0,0,0.15));
    transition: transform 0.2s ease;
}

    .river-img:hover {
        transform: translateY(-2px) scale(1.05);
    }

/* Full-width bottom row */
.material-row-full {
    display: block;
    width: 100%;
}

/* Card Gallery: 6 columns layout */
.card-gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-top: 15px;
    justify-items: center;
    width: 100%;
}

/* Specific styling for the animal cards */
.card-img {
    width: 100%;
    max-width: 100px;
    height: auto;
    border-radius: 6px;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.15));
    transition: transform 0.2s ease;
}

    .card-img:hover {
        transform: translateY(-4px) scale(1.05);
    }

/* Mobile Responsiveness: Stack columns and break galleries on small screens */
@media (max-width: 768px) {
    .material-row-top,
    .material-row-bottom {
        grid-template-columns: 1fr;
    }

    /* Break the 6-card gallery into 3 columns / 2 rows on mobile */
    .card-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 8. TYPOGRAPHY & LISTS */
p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

ul {
    padding-left: 1.5rem;
    margin-bottom: 2rem;
}

li {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    padding-left: 0.5rem;
}

    li strong {
        color: var(--wood-dark);
    }

/* 9. VISIBILITY LOGIC */
.rules[showrules="summary"] .fullOnly,
.rules[showrules="summary"] .hasSummary {
    display: none;
}

.rules[showrules="full"] .summaryInfo,
.rules[showrules="full"] .summary {
    display: none;
}

.rules[showrules="both"] .onShowRulesBoth {
    display: inline;
}

.rules:not([showrules="both"]) .onShowRulesBoth {
    display: none;
}

/* Table formatting for player count setup */
.rulesTable {
    width: 100%;
    max-width: 500px;
    margin: 2rem 0;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 8px;
    /* Prevent table cells from overriding the border radius */
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

    /* Header row styling */
    .rulesTable th {
        background-color: var(--river-blue);
        color: #ffffff;
        font-family: 'Arial Black', Impact, sans-serif;
        font-size: 1.1rem;
        padding: 1rem;
        letter-spacing: 0.5px;
    }

    /* Data cell styling */
    .rulesTable td {
        color: var(--wood-dark);
        font-weight: 700;
        font-size: 1.1rem;
        padding: 1rem;
        border-bottom: 1px solid var(--border-subtle);
    }

        /* Make the first column text left-aligned */
        .rulesTable th:first-child,
        .rulesTable td:first-child {
            text-align: left;
            width: 40%;
        }

    /* Highlight the data row with the sand color */
    .rulesTable tr:nth-child(2) td {
        background-color: var(--savanna-sand);
        border-bottom: none;
    }

.setup-container {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
    width: 100%;
}

.river-board-wrapper {
    position: relative;
    height: 40vh;
    display: inline-block;
}

.setup-base-board {
    height: 100%;
    width: auto;
    display: block;
}

/* Base style for the cards on the river */
.river-overlay-slot {
    position: absolute;
    left: 35%; 
    transform: translateX(-50%);
    width: 24%;
    height: auto;
}

    .river-overlay-slot img {
        width: 94%;
        height: auto;
        display: block;
        filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.3));
    }

/* Vertikale Positionen der 5 Karten im Fluss (Beispielwerte, ggf. leicht anpassen) */
.card-pos-1 {
    top: 0.1%;
}

.card-pos-2 {
    top: 19%;
}

.card-pos-3 {
    top: 38%;
}

.card-pos-4 {
    top: 56%;
}

.card-pos-5 {
    top: 76%;
}

/* Styling for the entire table */
.card-explanation-table {
    width: 100%;
    max-width: 800px;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
}

    /* Base styling for all table cells */
    .card-explanation-table td {
        padding: 15px 10px;
        vertical-align: middle;
        border-bottom: 1px solid #e0e0e0;
        /* Inherit font size and family from the parent container */
        font-size: 1em;
        font-family: inherit;
        line-height: 1.5;
    }

    /* Remove the border from the very last row */
    .card-explanation-table tr:last-child td {
        border-bottom: none;
    }

    /* Specific styling for the first column containing the images */
    .card-explanation-table td:first-child {
        /* Increased width to make the images larger */
        width: 150px;
        padding-right: 20px;
        text-align: center;
    }

    /* Ensure images fit nicely within their column */
    .card-explanation-table img {
        max-width: 100%;
        height: auto;
        display: block;
        border-radius: 4px;
    }

    /* Remove default paragraph margins inside the table to keep it compact */
    .card-explanation-table td p {
        margin: 0;
    }