/* 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 */


/* add special fonts if wanted */

/* add styles for headers h1-h5 if needed*/

/* cover picture only in main rules */
#rules .cover {    width: 60%;    margin-left: 20%;}
#panelRules .cover {    display: none;}

.rules .content ul {list-style-type: none;}

/* flex style for responsive display */
.rules .flex { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5em; }
@media (max-width: 768px) {
    .rules .flex.mobile { flex-direction: column; /* columns below each other */  }
}
#panelRules .flex.mobile { flex-direction: column; }
.rules .flex .column {    flex: 1; }
.rules .flex .column.wide {    flex: 2; }


/* example variable flex structure putting flexboxes half their wide on wide screen full rules
.rules  .flex.appendix .flexbox { flex: 2 2 23%;  padding:0.5em; padding-right: 1em;}
.rules  .flex.appendix .flexbox img { height:5em; float: left; margin-right: 1em; }
@media (max-width: 1024px) {
    .rules .flex.appendix .flexbox { flex: 2 2 48%; }
}
#panelRules .flex.appendix .flexbox { flex: 2 2 48%; }
*/


/* Examples */
.rules .example { font-style: italic; } /* put your example style here */
#panelRules .example { display: none; } /* examples should not be shown in sidebar */

/* Wildwasser-specific scoped rulebook styles */
.y-card > .card-body,
#rulesPage {
    background-color: #F0D8B0;
    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);
    background-size: 150px 150px;
}

#rulesHtml {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    max-width: none;
}

.rules {
    --ww-river-blue: #2b6cb0;
    --ww-river-light: #ebf8ff;
    --ww-sand: #fdf6e3;
    --ww-wood: #4a3320;
    --ww-text: #2d3748;
    --ww-border: #cbd5e0;
    color: var(--ww-text);
    line-height: 1.7;
}

#rules {
    max-width: 880px;
    margin: 40px auto;
    background-color: #ffffff;
    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(--ww-border);
    border-radius: 4px;
    padding: 4rem 5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
}

#panelRules,
#panelRules #rules,
#panelRules .rules,
#rulesContainer .rules {
    max-width: 100%;
    margin: 0;
    padding: 0.5rem;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background-color: #ffffff;
    background-image: none;
}

.rules .cover {
    width: 100%;
    margin: 0 0 1.25rem 0;
    text-align: center;
}

.rules .cover svg {
    width: 100%;
    max-width: 680px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.rules .gameTitle {
    font-family: 'Arial Black', Impact, sans-serif;
    color: var(--ww-wood);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 3px double var(--ww-border);
}

.rules .content {
    background-color: var(--ww-sand);
    border: 2px solid #e2e8f0;
    border-left: 8px solid var(--ww-river-blue);
    border-radius: 4px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#panelRules .rules .content,
#rulesContainer .rules .content {
    padding: 0.65rem 0.8rem;
    margin-bottom: 1rem;
    border-left-width: 5px;
}

.rules .content ul {
    margin: 0;
    padding-left: 0;
}

.rules .content li {
    margin: 0.25rem 0;
}

.rules .chapter h1 {
    text-align: center;
    color: var(--ww-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);
}

#panelRules .rules .chapter h1,
#rulesContainer .rules .chapter h1 {
    font-size: 1.15rem;
    margin: 1rem 0 0.6rem 0;
    padding: 0.35rem 0.4rem;
    background: var(--ww-river-light);
    letter-spacing: 0.5px;
    text-shadow: none;
}

.rules .chapter h2 {
    color: var(--ww-wood);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.5rem 0 0.65rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--ww-border);
}

#panelRules .rules .chapter h2,
#rulesContainer .rules .chapter h2 {
    font-size: 1.05rem;
    margin: 0.85rem 0 0.4rem 0;
}

.rules p {
    margin: 0 0 1.25rem 0;
    font-size: 1.1rem;
    line-height: 1.65;
}

#panelRules .rules p,
#rulesContainer .rules p {
    margin: 0 0 0.75rem 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.rules ul {
    margin: 0 0 1.5rem 0.5rem;
    padding-left: 1.4rem;
}

#panelRules .rules ul,
#rulesContainer .rules ul {
    margin: 0 0 0.85rem 0.25rem;
    padding-left: 1.05rem;
}

.rules li {
    margin-bottom: 0.7rem;
    font-size: 1.1rem;
    padding-left: 0.35rem;
}

#panelRules .rules li,
#rulesContainer .rules li {
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    padding-left: 0.15rem;
}

.rules .description {
    background-color: var(--ww-sand);
    border: 2px solid #e2e8f0;
    border-left: 8px solid var(--ww-wood);
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#panelRules .rules .description,
#rulesContainer .rules .description {
    border: 1px solid var(--ww-border);
    border-left: 4px solid var(--ww-wood);
    padding: 0.65rem 0.8rem;
    margin-bottom: 1rem;
}

.rules .deviation {
    border: 2px solid #c53030;
    background-color: #fff5f5;
    color: #742a2a;
    border-radius: 4px;
    padding: 0.55rem 0.75rem;
    margin: 0.65rem 0;
    font-weight: 600;
}

/* Components layout */
.rules .material-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.rules .material-row-top {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.rules .material-row-bottom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.rules .material-col-left,
.rules .material-col-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rules .material-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--ww-border);
    border-radius: 10px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#panelRules .rules .material-card,
#rulesContainer .rules .material-card {
    padding: 0.65rem;
}

.rules .board-cell {
    background: rgba(255, 255, 255, 0.6);
    flex-grow: 1;
    justify-content: flex-start;
}

.rules .item-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ww-wood);
}

.rules .item-note {
    font-weight: 400;
    font-style: italic;
    font-size: 0.9em;
    display: block;
    margin-top: 0.2rem;
}

.rules .material-img {
    max-height: 70px;
    width: auto;
    margin-top: 0.65rem;
}

.rules .board-large {
    width: 100%;
    max-width: 320px;
    height: auto;
    object-fit: contain;
    margin-top: 15px;
    border-radius: 4px;
    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;
}

.rules .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;
}

.rules .token-gallery {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 5px;
    margin-top: 0.75rem;
    justify-items: center;
    width: 100%;
}

.rules .token-img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.2));
    transition: transform 0.2s ease;
}

.rules .token-img:hover {
    transform: translateY(-2px) scale(1.1);
}

.rules .river-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0.75rem;
    justify-items: center;
    width: 100%;
}

.rules .river-img {
    width: 100%;
    max-width: 85px;
    height: auto;
    border-radius: 4px;
    filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.2s ease;
}

.rules .river-img:hover {
    transform: translateY(-2px) scale(1.05);
}

.rules .card-gallery {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-top: 0.75rem;
    justify-items: center;
    width: 100%;
}

.rules .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;
}

.rules .card-img:hover {
    transform: translateY(-4px) scale(1.05);
}

/* Card explanations using semantic flex (R-07, R-08) */
.rules .ww-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.rules .ww-card-row {
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.85rem;
}

.rules .ww-card-row:last-child {
    border-bottom: none;
}

.rules .ww-card-media {
    flex: 0 0 140px;
    text-align: center;
}

.rules .ww-card-media img {
    width: 100%;
    max-width: 130px;
    height: auto;
    border-radius: 6px;
    filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.15));
}

#panelRules .rules .ww-card-media,
#rulesContainer .rules .ww-card-media {
    flex: 0 0 auto;
}

#panelRules .rules .ww-card-media img,
#rulesContainer .rules .ww-card-media img {
    max-width: 88px;
}

/* Setup table & board preview */
.rules .rulesTable {
    width: 100%;
    max-width: 500px;
    margin: 2rem 0;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.rules .rulesTable th {
    background-color: var(--ww-river-blue);
    color: #ffffff;
    font-family: 'Arial Black', Impact, sans-serif;
    font-size: 1.05rem;
    padding: 0.85rem;
    letter-spacing: 0.5px;
}

.rules .rulesTable td {
    color: var(--ww-wood);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.85rem;
    border-bottom: 1px solid var(--ww-border);
}

.rules .rulesTable tr:nth-child(2) td {
    background-color: var(--ww-sand);
    border-bottom: none;
}

.rules .rulesTable th:first-child,
.rules .rulesTable td:first-child {
    text-align: left;
    width: 40%;
}

#panelRules .rules .rulesTable,
#rulesContainer .rules .rulesTable {
    margin: 0.85rem 0;
}

#panelRules .rules .rulesTable th,
#panelRules .rules .rulesTable td,
#rulesContainer .rules .rulesTable th,
#rulesContainer .rules .rulesTable td {
    font-size: 0.82rem;
    padding: 0.4rem 0.35rem;
}

.rules .setup-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    width: 100%;
}

.rules .river-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 685 / 900;
}

.rules .setup-base-board {
    width: 100%;
    height: 100%;
    display: block;
}

.rules .river-overlay-slot {
    position: absolute;
    left: 35%;
    transform: translateX(-50%);
    width: 24%;
}

.rules .river-overlay-slot img {
    width: 94%;
    height: auto;
    display: block;
    filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.3));
}

.rules .card-pos-1 { top: 0.1%; }
.rules .card-pos-2 { top: 19%; }
.rules .card-pos-3 { top: 38%; }
.rules .card-pos-4 { top: 56%; }
.rules .card-pos-5 { top: 76%; }

@media (max-width: 768px) {
    #rules {
        padding: 1.25rem 1rem;
        margin: 0.5rem auto;
    }

    .rules .material-row-top,
    .rules .material-row-bottom {
        grid-template-columns: 1fr;
    }

    .rules .card-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rules .ww-card-media {
        flex: 0 0 auto;
    }
}
