#craftingSection {
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    overflow: hidden;

    background-image: url('../../assets/images/craftingbackground.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#craftingSection .crafting-campresources {
    width: 100%;
    margin-bottom: 12px;
}

#craftingSection > .content-panel {
    flex: 1;
    width: 100%;
    align-self: stretch;
    display: flex;
    min-height: 0;

    /* Match Crash Site/Campsite panel inset (tighter than global content-panel padding). */
    padding: 12px;
    scrollbar-gutter: auto;

    /* Tabs sit above the panel (journal-style). */
    border-top-width: 0 !important;
    border-top-style: none !important;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#craftingSection .section-inner.crafting-section {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.crafting-tabpanes {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.crafting-pane {
    display: none;
    flex: 1;
    min-height: 0;
    width: 100%;
    flex-direction: column;
}

.crafting-pane.active {
    display: flex;
}

.crafting-actions {
    width: 100%;
    min-height: 0;
    overflow: auto;
}

/* Crafting panel should consume remaining space between Camp Resources and Actions. */
#craftingSection .campsite-card--crafting {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#craftingSection .campsite-card--crafting .localmap-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.crafting-category {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.crafting-category-title {
    margin: 0;
    padding: 0;
    font-size: 14px;
    letter-spacing: 0.6px;
    color: rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.92);
    text-shadow: 0 0 6px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.12);
}

.crafting-category-empty {
    font-size: 12px;
    line-height: 1.2;
}

/* Compact mode: hide in-section tabs; switching is via left icon rail popover. */
html.is-compact #craftingSection .journal-tabs {
    display: none;
}

/* Phone-landscape: mirror the forced compact layout so Crafting doesn't overflow under rails. */
@media (max-width: 600px),
       (max-width: 900px) and (max-height: 450px),
       (hover: none) and (pointer: coarse) and (max-width: 900px) and (max-height: 600px) {
    #craftingSection {
        padding: 1px;
    }

    #craftingSection > .content-panel {
        width: auto;
        padding: 1px;
    }

    #craftingSection .crafting-category {
        gap: 6px;
        margin-bottom: 10px;
    }

    #craftingSection .crafting-category-title {
        font-size: 12px;
    }

    #craftingSection .crafting-actions .button-group {
        gap: 4px;
    }

    #craftingSection .crafting-actions .button-group .image-button {
        width: 104px;
        height: 32px;
        padding: 0 7px;
        gap: 5px;
        font-size: 10px;
        border-radius: 999px;
    }

    #craftingSection .crafting-actions .button-group .image-button .building-name {
        font-size: 10px;
        line-height: 1.05;
        white-space: normal;
        text-align: center;
        overflow: hidden;
        display: -webkit-box;
        line-clamp: 2;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}
