.custom-stats-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 1rem;
    width: 100%;
    min-width: 0;
    max-width: 700px;
    --custom-stats-name-width: 9.75rem;
    --custom-stats-value-width: 8rem;
    --custom-stats-action-width: 3rem;
    --custom-stats-field-gap: 0.25rem;
}

.custom-stats-section-grid {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
    align-items: flex-start;
}

.custom-stats-section-row {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    max-width: 100%;
    width: auto;
    min-width: 0;
}

.custom-stats-section-saved-row {
    flex-direction: row;
    width: auto;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.custom-stats-section-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.custom-stats-section-name-field {
    width: var(--custom-stats-name-width);
    min-width: var(--custom-stats-name-width);
    max-width: var(--custom-stats-name-width);
}

.custom-stats-section-value-field {
    width: var(--custom-stats-value-width);
    min-width: var(--custom-stats-value-width);
    max-width: var(--custom-stats-value-width);
}

.custom-stats-stat-card {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    max-width: none;
}

.custom-stats-saved-field {
    position: relative;
}

.custom-stats-section[data-locked='true'] .section-remove-x,
.custom-stats-section .section-remove-x:disabled {
    opacity: 0;
    cursor: default;
}

.custom-stats-stat-card .custom-stats-square-field {
    margin-right: 0;
    margin-bottom: 0;
    max-width: none;
}

.custom-stats-section-action-field {
    width: var(--custom-stats-action-width);
    min-width: var(--custom-stats-action-width);
    max-width: var(--custom-stats-action-width);
}


.custom-stats-square-field .custom-stats-section-label,
.custom-stats-square-field .custom-stats-section-input {
    min-width: 0;
    width: var(--custom-stats-value-width);
    text-align: center;
    padding: 0.25rem 0;
    justify-content: center;
    align-items: center;
}

.custom-stats-square-field .custom-stats-section-input {
    font-size: 2.5rem;
    box-sizing: border-box;
    padding: 0.3rem;
    height: auto;
    appearance: textfield;
    -moz-appearance: textfield;
}

.custom-stats-square-field .custom-stats-section-input::-webkit-outer-spin-button,
.custom-stats-square-field .custom-stats-section-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


.custom-stats-section-action-field .custom-stats-section-label {
    min-width: 0;
    text-align: center;
    width: var(--custom-stats-action-width);
    font-size: 0.5rem;
    padding: 0.25rem 0;
}

@media (max-width: 499px) {
    /* Match padding with character-info section */
    .custom-stats-section {
        padding: 0 0.25rem;
    }
}
