/* Caterpillars rules.css - Theme for Yucata Rules */

.caterpillars-rules-theme {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 36px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #2c3e50;
    line-height: 1.8;
    background: linear-gradient(180deg, #f8fbf8 0%, #f1f8f3 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.1);
    border: 1px solid #d7ecd9;
    box-sizing: border-box;
}

.caterpillars-rules-theme p {
    margin: 12px 0 16px 0;
    line-height: 1.8;
}

.caterpillars-rules-theme ul,
.caterpillars-rules-theme ol {
    margin: 12px 0 18px 0;
    padding-left: 26px;
}

.caterpillars-rules-theme li {
    margin-bottom: 10px;
    line-height: 1.75;
}

.caterpillars-rules-theme li > ul,
.caterpillars-rules-theme li > ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Header & Titles */
.caterpillars-rules-theme .gameTitle {
    font-family: 'Fredoka', 'Quicksand', 'Nunito', 'Segoe UI', sans-serif;
    font-size: 2.5em;
    text-align: center;
    margin: 12px 0 22px 0;
    font-weight: 800;
    background: linear-gradient(135deg, #2e7d32 0%, #0288d1 50%, #8e24aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    border-bottom: 2px dashed #a5d6a7;
    padding-bottom: 16px;
    letter-spacing: 0.5px;
}

.caterpillars-rules-theme h1,
.caterpillars-rules-theme h2,
.caterpillars-rules-theme h3,
.caterpillars-rules-theme h4 {
    font-family: 'Fredoka', 'Quicksand', 'Nunito', 'Segoe UI', sans-serif;
    color: #1b5e20;
    font-weight: 700;
    line-height: 1.4;
}

.caterpillars-rules-theme h3 {
    margin: 20px 0 12px 0;
}

.caterpillars-rules-theme h4 {
    font-size: 1.15em;
    margin: 18px 0 10px 0;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 8px;
}

.caterpillars-rules-theme .summaryInfo {
    background: #e8f5e9;
    border-left: 5px solid #43a047;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 0.96em;
    line-height: 1.7;
    margin-bottom: 18px;
    color: #1b5e20;
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.06);
}

.caterpillars-rules-theme .rules-view-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #c8e6c9;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.94em;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.caterpillars-rules-theme .rules-view-toggle a {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.caterpillars-rules-theme .rules-view-toggle a:hover {
    background: #e8f5e9;
    color: #1b5e20;
}

.caterpillars-rules-theme .cover-box {
    text-align: center;
    margin: 22px 0 28px 0;
}

.caterpillars-rules-theme .cover-img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 3px solid #ffffff;
}

.caterpillars-rules-theme .description {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 26px;
    border-left: 5px solid #0288d1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    font-size: 1.05em;
    line-height: 1.8;
    margin-bottom: 26px;
}

/* Chapters */
.caterpillars-rules-theme .chapter {
    background: #ffffff;
    border: 1px solid #e0f2f1;
    border-radius: 12px;
    padding: 24px 30px;
    margin: 28px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    line-height: 1.8;
}

.caterpillars-rules-theme .chapter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, #43a047 0%, #00acc1 50%, #8e24aa 100%);
    border-radius: 4px 0 0 4px;
}

.caterpillars-rules-theme .chapter .title {
    font-family: 'Fredoka', 'Quicksand', 'Nunito', 'Segoe UI', sans-serif;
    font-size: 1.45em;
    color: #1b5e20;
    font-weight: 700;
    border-bottom: 2px solid #e8f5e9;
    padding-bottom: 10px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.caterpillars-rules-theme .summary {
    background: #f1f8e9;
    border-left: 4px solid #7cb342;
    padding: 12px 18px;
    font-style: italic;
    font-size: 0.96em;
    line-height: 1.7;
    margin: 12px 0 20px 0;
    border-radius: 0 8px 8px 0;
    color: #33691e;
}

/* Caterpillar Character Badges */
.caterpillars-rules-theme .cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.9em;
}

.caterpillars-rules-theme .cat-alex {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.caterpillars-rules-theme .cat-bobby {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.caterpillars-rules-theme .cat-charlie {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

    .caterpillars-rules-theme .cat-black {
        background: #2c3e50;
        color: #ffffff;
        border: 1px solid #000000;
    }

/* Material list */
.caterpillars-rules-theme .itemisation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    background: transparent;
    padding: 6px 0;
    border: none;
}

.caterpillars-rules-theme .component-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #e0e4e0;
    border-radius: 12px;
    padding: 16px 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.caterpillars-rules-theme .component-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.caterpillars-rules-theme .component-card-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 90px;
    margin-bottom: 12px;
    gap: 8px;
}

.caterpillars-rules-theme .component-card-text {
    font-size: 0.95em;
    color: #2c3e50;
    line-height: 1.35;
}

.caterpillars-rules-theme .component-card-count {
    font-weight: 800;
    color: #2e7d32;
    margin-right: 4px;
}

.caterpillars-rules-theme .component-svg-die {
    width: 38px;
    height: 38px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
}

.caterpillars-rules-theme .component-scorepad-thumb {
    max-height: 88px;
    width: auto;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Level Cards / Feature Cards */
.caterpillars-rules-theme .level-box {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    line-height: 1.8;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.caterpillars-rules-theme .level-box:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

.caterpillars-rules-theme .level-1 { border-left: 6px solid #4caf50; background: #fafdfa; }
.caterpillars-rules-theme .level-2 { border-left: 6px solid #2196f3; background: #fafcff; }
.caterpillars-rules-theme .level-3 { border-left: 6px solid #9c27b0; background: #fdfaff; }
.caterpillars-rules-theme .level-4 { border-left: 6px solid #ff9800; background: #fffefa; }

/* Die Badges in Rules */
.caterpillars-rules-theme .die-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 26px;
    height: 26px;
    background: #ffffff;
    border: 1.5px solid #424242;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    color: #212121;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    margin: 0 4px;
    vertical-align: middle;
}

.caterpillars-rules-theme .die-action-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 3px 9px;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    border: 1.5px solid #f57f17;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    color: #3e2723;
    box-shadow: 0 2px 4px rgba(255, 179, 0, 0.3);
    margin: 0 4px;
    vertical-align: middle;
}

.caterpillars-rules-theme .svg-action-die {
    display: inline-block;
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin: 0 4px;
    filter: drop-shadow(0 2px 3px rgba(255, 179, 0, 0.4));
}

/* UI Guide Highlights */
.caterpillars-rules-theme .ui-feature {
    background: #f3f9f4;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 14px 20px;
    margin: 14px 0;
    line-height: 1.75;
}

.caterpillars-rules-theme .tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.88em;
    font-weight: 700;
    margin: 3px 6px 3px 0;
}

.caterpillars-rules-theme .tag-blue { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.caterpillars-rules-theme .tag-green { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.caterpillars-rules-theme .tag-purple { background: #f3e5f5; color: #7b1fa2; border: 1px solid #ce93d8; }
.caterpillars-rules-theme .tag-orange { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }

/* Scoresheet Overview Section in Rules */
.caterpillars-rules-theme .scoresheet-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    margin-top: 14px;
}

.caterpillars-rules-theme .scoresheet-visual-wrapper {
    position: relative;
    width: 360px;
    height: 507px;
    background-image: url('/game-plugins/caterpillars/1.1.2/images/scorepad.webp');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    user-select: none;
}

/* Callout Pointers (1, 2, 3, 4, 5) with directional arrows matching screenshot */
.caterpillars-rules-theme .callout-tag {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-weight: 900;
    font-size: 15px;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    z-index: 10;
    line-height: 1;
    border: 2px solid #ffffff;
    box-sizing: border-box;
}

/* Arrow points: Outer white arrow (:before) + inner colored arrow (:after) */
.caterpillars-rules-theme .callout-tag.point-right::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 10px solid #ffffff;
    z-index: 1;
}

.caterpillars-rules-theme .callout-tag.point-right::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 8px solid currentColor;
    z-index: 2;
}

.caterpillars-rules-theme .callout-tag.point-left::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-right: 10px solid #ffffff;
    z-index: 1;
}

.caterpillars-rules-theme .callout-tag.point-left::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid currentColor;
    z-index: 2;
}

/* Colors matching screenshot */
.caterpillars-rules-theme .callout-1 {
    background-color: #556b2f; /* Olive green */
    color: #ffffff;
}
.caterpillars-rules-theme .callout-1.point-right::after {
    border-left-color: #556b2f;
}

.caterpillars-rules-theme .callout-2 {
    background-color: #ab47bc; /* Purple */
    color: #ffffff;
}
.caterpillars-rules-theme .callout-2.point-left::after {
    border-right-color: #ab47bc;
}

.caterpillars-rules-theme .callout-3 {
    background-color: #1976d2; /* Blue */
    color: #ffffff;
}
.caterpillars-rules-theme .callout-3.point-left::after {
    border-right-color: #1976d2;
}

.caterpillars-rules-theme .callout-4 {
    background-color: #111111; /* Black */
    color: #ffffff;
}
.caterpillars-rules-theme .callout-4.point-right::after {
    border-left-color: #111111;
}

.caterpillars-rules-theme .callout-5 {
    background-color: #5d4037; /* Brown */
    color: #ffffff;
}
.caterpillars-rules-theme .callout-5.point-left::after {
    border-right-color: #5d4037;
}

.caterpillars-rules-theme .callout-pos-1-top {
    left: 8px;
    top: 41.7%;
    transform: translateY(-50%);
}

.caterpillars-rules-theme .callout-pos-1-bottom {
    left: 8px;
    top: 63.5%;
    transform: translateY(-50%);
}

.caterpillars-rules-theme .callout-pos-2 {
    right: 8px;
    top: 54.0%;
    transform: translateY(-50%);
}

.caterpillars-rules-theme .callout-pos-3 {
    right: 8px;
    top: 72.8%;
    transform: translateY(-50%);
}

.caterpillars-rules-theme .callout-pos-4 {
    left: 8px;
    top: 81.8%;
    transform: translateY(-50%);
}

.caterpillars-rules-theme .callout-pos-5 {
    right: 8px;
    top: 93.8%;
    transform: translateY(-50%);
}

/* Scoresheet Explanations Legend List */
.caterpillars-rules-theme .scoresheet-legend {
    flex: 1 1 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.caterpillars-rules-theme .legend-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.caterpillars-rules-theme .legend-item .legend-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 15px;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.caterpillars-rules-theme .legend-item-content {
    flex: 1;
    font-size: 0.98em;
    line-height: 1.65;
}

.caterpillars-rules-theme .legend-item-title {
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 5px;
    font-size: 1.05em;
}

/* Setup Variation Box */
.caterpillars-rules-theme .setup-variation {
    margin-top: 18px;
}

.caterpillars-rules-theme .setup-variation h4 {
    margin: 0 0 8px 0;
    color: #2e7d32;
}

.caterpillars-rules-theme .setup-variation-body {
    margin-top: 8px;
    line-height: 1.8;
}

.caterpillars-rules-theme .setup-variation-hint {
    margin-top: 10px;
    font-weight: bold;
    color: #1b5e20;
    line-height: 1.7;
}

.caterpillars-rules-theme .help-icon {
    color: #1976d2;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .caterpillars-rules-theme {
        padding: 12px 14px;
        border-radius: 8px;
    }
    .caterpillars-rules-theme .gameTitle {
        font-size: 1.9em;
    }
}