/* 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 */

/* ==========================================================================
   Game-specific styles: At the Gates of Loyang / Vor den Toren von Loyang
   ========================================================================== */

.rules.loyang-rules {
    max-width: 68rem;
    margin: 0 auto;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2e2620;
    box-sizing: border-box;
}

#panelRules .rules.loyang-rules,
#sidebarPanel #rules.loyang-rules {
    padding: 0.5rem;
    max-width: 100%;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* Cover Image */
#rules .cover img {
    max-width: 520px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0.5rem auto 1.5rem;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

/* Sidebar Title */
.rules .gameTitle {
    color: #8c1d18;
    font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 1.4em;
    font-weight: 700;
    text-align: center;
    margin: 0.5rem 0 1rem;
}

/* Headings (h1 - h5) */
.rules.loyang-rules h1 {
    font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(90deg, #8c1d18 0%, #ad281f 65%, #c8533a 100%);
    padding: 0.45rem 1rem;
    border-radius: 5px;
    margin: 2rem 0 1rem;
    clear: both;
    scroll-margin-top: 1.5rem;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#panelRules .rules.loyang-rules h1,
#sidebarPanel #rules.loyang-rules h1 {
    background: #8c1d18;
    font-size: 1.25rem;
    padding: 0.35rem 0.65rem;
    margin: 1.2rem 0 0.6rem;
    border-radius: 4px;
}

.rules.loyang-rules h2 {
    font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #8c1d18;
    border-bottom: 2px solid #decab0;
    padding-bottom: 0.3rem;
    margin: 1.6rem 0 0.8rem;
    clear: both;
    scroll-margin-top: 1.5rem;
}

#panelRules .rules.loyang-rules h2,
#sidebarPanel #rules.loyang-rules h2 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.2rem;
}

.rules.loyang-rules h3 {
    font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #4a2416;
    margin: 1.2rem 0 0.5rem;
    clear: both;
}

#panelRules .rules.loyang-rules h3,
#sidebarPanel #rules.loyang-rules h3 {
    font-size: 1.0rem;
    margin: 0.8rem 0 0.4rem;
}

.rules.loyang-rules h4 {
    font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-size: 1.0rem;
    font-weight: 700;
    color: #5a3825;
    margin: 1rem 0 0.4rem;
}

.rules.loyang-rules p {
    margin: 0.65rem 0;
}

.rules.loyang-rules ul,
.rules.loyang-rules ol {
    margin: 0.65rem 0;
    padding-left: 1.5rem;
}

.rules.loyang-rules li {
    margin-bottom: 0.3rem;
}

/* Table of Contents (content) */
.rules.loyang-rules .content {
    background: #f7f1e4;
    border: 1px solid #e5d8be;
    border-radius: 6px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.6rem;
    font-size: 0.9rem;
}

.rules.loyang-rules .content ul {
    list-style-type: none;
    margin: 0;
    padding-left: 0;
}

.rules.loyang-rules .content ul ul {
    padding-left: 1.2rem;
    font-size: 0.85rem;
    margin: 0.2rem 0 0.4rem;
}

.rules.loyang-rules .content li {
    margin: 0.35rem 0;
}

.rules.loyang-rules .content a {
    color: #533621;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.rules.loyang-rules .content a:hover {
    color: #8c1d18;
    text-decoration: underline;
}

/* Flavor / Introduction Description */
.rules.loyang-rules .description {
    font-style: italic;
    color: #5a4635;
    margin: 1rem 0 1.6rem;
    padding: 0.9rem 1.3rem;
    background: #faf4e8;
    border-radius: 6px;
    border: 1px solid #ebd9bf;
}

/* Rule Deviations / Yucata Implementation Notes */
.rules.loyang-rules .deviation {
    border-left: 5px solid #c0392b;
    border-top: 1px solid #e8c4c0;
    border-right: 1px solid #e8c4c0;
    border-bottom: 1px solid #e8c4c0;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: #fff6f6;
    color: #4a1515;
    font-size: 0.92rem;
    line-height: 1.5;
}

.rules.loyang-rules .deviation::before {
    content: "Yucata \2014  ";
    font-weight: 700;
    color: #c0392b;
}

/* Examples */
.rules.loyang-rules .example {
    display: block;
    clear: both;
    font-style: italic;
    background: #faf6ee;
    border-left: 4px solid #decab0;
    padding: 0.65rem 1rem;
    margin: 0.8rem 0;
    border-radius: 0 4px 4px 0;
    color: #4a3828;
    box-sizing: border-box;
}

.rules.loyang-rules .helper-table .example {
    margin: 0.5rem 0 0;
    padding: 0.4rem 0.65rem;
    background: #faf6ee;
    border-left: 3px solid #decab0;
    border-radius: 0 3px 3px 0;
    font-size: 0.85rem;
}

/* Components & Galleries */
.rules.loyang-rules .component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
    margin: 0.8rem 0 1.2rem;
}

.rules.loyang-rules .component-card {
    background: #fcf9f2;
    border: 1px solid #e2d4be;
    border-radius: 6px;
    padding: 0.6rem 0.5rem;
    text-align: center;
}

.rules.loyang-rules .component-card img {
    max-height: 44px;
    width: auto;
    margin: 0 auto 0.35rem;
    display: block;
}

.rules.loyang-rules .component-card .comp-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #3b281a;
}

.rules.loyang-rules .component-card .comp-count {
    font-size: 0.8rem;
    color: #725944;
}

.rules.loyang-rules .comp-inline-img {
    height: 1.4em;
    width: auto;
    vertical-align: middle;
    margin: 0 0.2rem;
}

.rules.loyang-rules .img-framed {
    border: 1px solid #decab0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rules.loyang-rules .board-img {
    max-width: 100%;
    height: auto;
    margin: 0.5rem 0;
    border-radius: 6px;
}

.rules.loyang-rules .card-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1.2rem;
    align-items: flex-start;
}

.rules.loyang-rules .card-gallery img {
    width: 84px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease-in-out;
}

.rules.loyang-rules .card-gallery img:hover {
    transform: scale(1.06);
    z-index: 2;
}

.rules.loyang-rules .card-gallery.fields img {
    width: 110px;
}

.rules.loyang-rules .card-gallery.horizontal img {
    width: 135px;
}

/* Helper Reference Table */
.rules.loyang-rules .table-responsive {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 6px;
    border: 1px solid #decab0;
}

.rules.loyang-rules .helper-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fffdf9;
}

.rules.loyang-rules .helper-table th,
.rules.loyang-rules .helper-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #decab0;
    text-align: left;
    vertical-align: top;
}

.rules.loyang-rules .helper-table th {
    background: #f4ecdf;
    color: #8c1d18;
    font-weight: 700;
    border-bottom: 2px solid #8c1d18;
    font-size: 0.95rem;
}

.rules.loyang-rules .helper-table td:nth-child(1) {
    width: 110px;
    text-align: center;
}

.rules.loyang-rules .helper-table td:nth-child(1) img {
    max-width: 100px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.rules.loyang-rules h4.helper-name {
    font-family: inherit;
    font-weight: 700;
    color: #8c1d18;
    font-size: 1.0rem;
    margin: 0 0 0.3rem 0;
}

.rules.loyang-rules .helper-phase {
    display: inline-block;
    background: #8c1d18;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.rules.loyang-rules .helper-lantern {
    font-size: 1.15rem;
    vertical-align: middle;
    margin-left: 0.2rem;
}

/* Responsive helper table collapse for narrow screens and 300px sidebar */
@media (max-width: 650px) {
    .rules.loyang-rules .helper-table,
    .rules.loyang-rules .helper-table tbody,
    .rules.loyang-rules .helper-table tr,
    .rules.loyang-rules .helper-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .rules.loyang-rules .helper-table thead {
        display: none;
    }
    .rules.loyang-rules .helper-table tr {
        margin-bottom: 1.2rem;
        border-bottom: 2px solid #decab0;
        padding-bottom: 0.6rem;
    }
    .rules.loyang-rules .helper-table td {
        padding: 0.3rem 0.5rem;
        border: none;
    }
    .rules.loyang-rules .helper-table td:first-child {
        width: 100%;
        text-align: left;
    }
    .rules.loyang-rules .helper-table td:first-child img {
        max-width: 75px;
        float: left;
        margin-right: 0.8rem;
        margin-bottom: 0.4rem;
    }
}

#panelRules .rules.loyang-rules .helper-table,
#panelRules .rules.loyang-rules .helper-table tbody,
#panelRules .rules.loyang-rules .helper-table tr,
#panelRules .rules.loyang-rules .helper-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

#panelRules .rules.loyang-rules .helper-table thead {
    display: none;
}

#panelRules .rules.loyang-rules .helper-table tr {
    margin-bottom: 1rem;
    border-bottom: 2px solid #decab0;
    padding-bottom: 0.5rem;
}

#panelRules .rules.loyang-rules .helper-table td {
    padding: 0.2rem 0.2rem;
    border: none;
}

#panelRules .rules.loyang-rules .helper-table td:first-child {
    width: 100%;
    text-align: left;
}

#panelRules .rules.loyang-rules .helper-table td:first-child img {
    max-width: 65px;
    float: left;
    margin-right: 0.6rem;
    margin-bottom: 0.4rem;
}

/* Dark mode support (Bootstrap 5 data-bs-theme) */
[data-bs-theme="dark"] .rules.loyang-rules {
    color: #e8ded4;
}

[data-bs-theme="dark"] .rules.loyang-rules .gameTitle {
    color: #d9625b;
}

[data-bs-theme="dark"] .rules.loyang-rules h1 {
    background: linear-gradient(90deg, #681814 0%, #87201a 65%, #9b3d2c 100%);
    color: #fff;
}

[data-bs-theme="dark"] #panelRules .rules.loyang-rules h1,
[data-bs-theme="dark"] #sidebarPanel #rules.loyang-rules h1 {
    background: #681814;
}

[data-bs-theme="dark"] .rules.loyang-rules h2 {
    color: #d9625b;
    border-bottom-color: #554436;
}

[data-bs-theme="dark"] .rules.loyang-rules h3 {
    color: #e6b896;
}

[data-bs-theme="dark"] .rules.loyang-rules h4 {
    color: #cf9b74;
}

[data-bs-theme="dark"] .rules.loyang-rules .content {
    background: #241d17;
    border-color: #42352a;
}

[data-bs-theme="dark"] .rules.loyang-rules .content a {
    color: #decab0;
}

[data-bs-theme="dark"] .rules.loyang-rules .content a:hover {
    color: #e2756e;
}

[data-bs-theme="dark"] .rules.loyang-rules .description {
    background: #231b15;
    border-color: #3d2f25;
    color: #c9b7a5;
}

[data-bs-theme="dark"] .rules.loyang-rules .deviation {
    background: #281414;
    border-color: #582121;
    border-left-color: #d94336;
    color: #f0c5c1;
}

[data-bs-theme="dark"] .rules.loyang-rules .deviation::before {
    color: #ff6e63;
}

[data-bs-theme="dark"] .rules.loyang-rules .example {
    background: #241f19;
    border-left-color: #554436;
    color: #c9b7a5;
}

[data-bs-theme="dark"] .rules.loyang-rules .component-card {
    background: #251e18;
    border-color: #42362c;
}

[data-bs-theme="dark"] .rules.loyang-rules .component-card .comp-name {
    color: #f0e6d8;
}

[data-bs-theme="dark"] .rules.loyang-rules .component-card .comp-count {
    color: #b5a494;
}

[data-bs-theme="dark"] .rules.loyang-rules .table-responsive {
    border-color: #42362c;
}

[data-bs-theme="dark"] .rules.loyang-rules .helper-table {
    background: #1c1612;
}

[data-bs-theme="dark"] .rules.loyang-rules .helper-table th {
    background: #2c211a;
    color: #e2756e;
    border-bottom-color: #d94336;
}

[data-bs-theme="dark"] .rules.loyang-rules .helper-table td {
    border-bottom-color: #3b2e24;
}

[data-bs-theme="dark"] .rules.loyang-rules h4.helper-name {
    color: #e2756e;
}
