.dnd-build-accordion {
    background: rgba(12, 21, 26, 0.72);
    border: 1px solid rgba(244, 198, 132, 0.32);
    border-radius: 8px;
    margin: 18px 0;
    max-width: 100%;
    min-width: 0;
    padding: 0;
}

.dnd-build-accordion > summary {
    align-items: center;
    color: #f4c684;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    list-style-position: inside;
    min-width: 0;
    padding: 12px 14px;
}

.dnd-build-accordion > summary span {
    flex: 0 1 auto;
    font-weight: 700;
}

.dnd-build-accordion > summary small {
    color: rgba(216, 237, 240, 0.72);
    flex: 1 1 260px;
    line-height: 1.3;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
    white-space: normal;
}

.dnd-build-fields {
    display: grid;
    gap: 20px;
    margin: 0;
    min-width: 0;
    padding: 14px;
}

.dnd-character-prompt {
    background-color: #101b21;
    border: 1px solid rgba(244, 198, 132, 0.58);
    box-sizing: border-box;
    color: #d8edf0;
    max-width: 100%;
    min-width: 0;
}

.dnd-character-prompt::placeholder {
    color: rgba(216, 237, 240, 0.62);
    opacity: 1;
}

.dnd-character-prompt:focus {
    background-color: #101b21;
    border-color: #00c99a;
    box-shadow: 0 0 0 0.18rem rgba(0, 201, 154, 0.18);
    color: #f8ddb2;
}

.dnd-character-help {
    line-height: 1.55;
    max-width: min(100%, 72ch);
    overflow-wrap: anywhere;
    white-space: normal;
}

.dnd-build-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dnd-build-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.dnd-build-field--wide {
    grid-column: span 2;
}

.dnd-build-field > span,
.dnd-build-section h3 {
    color: #f4c684;
    font-size: 0.9rem;
    letter-spacing: 0;
    margin: 0;
}

.dnd-build-fields .form-control,
.dnd-build-fields .form-select {
    background-color: #101b21;
    border: 1px solid rgba(244, 198, 132, 0.58);
    color: #f4c684;
}

.dnd-build-fields .form-control::placeholder {
    color: rgba(216, 237, 240, 0.58);
    opacity: 1;
}

.dnd-build-fields .form-control:focus,
.dnd-build-fields .form-select:focus {
    background-color: #101b21;
    border-color: #00c99a;
    box-shadow: 0 0 0 0.18rem rgba(0, 201, 154, 0.18);
    color: #f8ddb2;
}

.dnd-build-fields .form-select option {
    background-color: #101b21;
    color: #f4c684;
}

.dnd-build-fields .form-select option:checked,
.dnd-build-fields .form-select option:hover,
.dnd-build-fields .form-select option:focus {
    background-color: #e9be8b;
    color: #0b1316;
}

.dnd-build-fields .form-select option:disabled {
    color: rgba(244, 198, 132, 0.42);
}

.dnd-build-fields .form-select option:checked:disabled {
    background-color: #e9be8b;
    color: #0b1316;
}

.dnd-option-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    min-width: 0;
}

.dnd-option-card {
    align-items: center;
    background: #101b21;
    border: 1px solid rgba(244, 198, 132, 0.35);
    border-radius: 8px;
    color: #f8ddb2;
    cursor: pointer;
    display: grid;
    gap: 8px;
    min-height: 126px;
    min-width: 0;
    padding: 10px;
    position: relative;
    text-align: center;
}

.dnd-option-card input {
    position: absolute;
    opacity: 0;
}

.dnd-option-card:has(input:checked) {
    border-color: #00c99a;
    box-shadow: 0 0 0 2px rgba(0, 201, 154, 0.22);
}

.dnd-option-card--locked {
    cursor: not-allowed;
    filter: grayscale(0.8);
    opacity: 0.55;
}

.dnd-option-card--unavailable {
    cursor: not-allowed;
}

.dnd-option-card--unavailable .dnd-option-icon {
    filter: grayscale(1);
    opacity: 0.45;
}

.dnd-option-card--unavailable .dnd-option-badge {
    border-color: rgba(216, 237, 240, 0.28);
    color: rgba(216, 237, 240, 0.68);
}

.dnd-option-icon {
    align-items: center;
    background: #18272e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    height: 54px;
    justify-content: center;
    margin: 0 auto;
    overflow: hidden;
    width: 54px;
}

.dnd-option-icon img {
    border-radius: 50%;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.dnd-option-initial {
    color: #f4c684;
    font-family: Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
}

.dnd-option-name {
    font-weight: 700;
    line-height: 1.15;
}

.dnd-option-badge {
    border: 1px solid rgba(244, 198, 132, 0.45);
    border-radius: 6px;
    color: #f4c684;
    font-size: 0.72rem;
    padding: 2px 5px;
}

.dnd-custom-option-search {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.dnd-custom-option-status {
    color: rgba(216, 237, 240, 0.75);
    font-size: 0.85rem;
    min-height: 1.2em;
}

.dnd-custom-option-search.is-loading .dnd-custom-option-status::before {
    animation: dnd-option-spin 0.9s linear infinite;
    border: 2px solid rgba(244, 198, 132, 0.24);
    border-top-color: #00c99a;
    border-radius: 50%;
    content: "";
    display: inline-block;
    height: 0.85rem;
    margin-right: 7px;
    vertical-align: -0.12rem;
    width: 0.85rem;
}

@keyframes dnd-option-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    .dnd-build-accordion > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .dnd-build-accordion > summary small {
        text-align: left;
    }

    .dnd-build-row {
        grid-template-columns: 1fr;
    }

    .dnd-build-field--wide {
        grid-column: span 1;
    }

    .dnd-option-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dnd-option-detail {
        position: static;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .dnd-character-help {
        max-width: calc(100vw - 64px);
        width: calc(100vw - 64px);
    }

    .dnd-option-grid {
        grid-template-columns: 1fr;
    }

    .dnd-option-card {
        grid-template-columns: auto minmax(0, 1fr);
        min-height: 86px;
        text-align: left;
    }

    .dnd-option-icon {
        grid-row: span 2;
        margin: 0;
    }

    .dnd-option-badge {
        grid-column: 1 / -1;
    }
}
