/* Nebbie and Glitch Mind setup modals: title row, narrator choice, role labels, player list, sticky submit. */

.modal-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    margin: 0 36px 16px 0;
}

.modal-title-row h2 {
    margin: 0;
}

/* "Come si gioca" next to the title reads as a link, not as a second main action. */
.howto-button.howto-link {
    margin: 0;
    padding: 0 4px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #1b1b1b;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.howto-button.howto-link:hover {
    background: rgba(0, 0, 0, 0.06);
}

.narrator-choice {
    border: 0;
    padding: 0;
    margin: 0 0 18px;
}

.narrator-choice legend {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333333;
}

.choice-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
}

.choice-seg label {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    padding: 6px 10px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    background: #ffffff;
}

.choice-seg label:has(input:checked) {
    background: #2a2a2a;
    color: #ffffff;
}

.choice-seg label:has(input:focus-visible) {
    outline: 3px solid #1d1d3a;
    outline-offset: -4px;
}

.field-hint {
    margin-top: 6px;
    font-size: 0.9em;
    color: #444444;
}

.composition-lead {
    display: block;
    margin-bottom: 6px;
}

.composition-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.composition-roles li {
    padding: 4px 10px;
    border: 1px solid #b9c7b9;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.95em;
}

.roster-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.roster-row input {
    flex: 1 1 0;
    min-width: 0;
}

.roster-row .btn-remove-player {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    color: #8a1f14;
    background: #ffffff;
    border: 2px solid #8a1f14;
}

.roster-row .btn-remove-player:hover {
    color: #ffffff;
    background: #8a1f14;
}

.roster-row .btn-remove-player:focus-visible {
    outline: 3px solid #1d1d3a;
    outline-offset: 2px;
}

.roster-row .btn-remove-player:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.roster-row input[aria-invalid="true"] {
    border-color: #c0392b;
}

.field-error {
    margin: -4px 0 10px;
    color: #a5281b;
    font-size: 0.9em;
    font-weight: 600;
}

#narratorName + .field-error {
    margin-top: 6px;
}

.btn-add-player:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.roster-count {
    margin-top: 8px;
    font-size: 0.9em;
    color: #444444;
}

.roster-remembered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #333333;
}

.roster-clear {
    min-height: 44px;
    padding: 0 6px;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* The submit button stays in view while the list scrolls. `clip` keeps the
   horizontal clipping without turning .modal-content into its own scroller,
   so the sticky bar sticks to the scrolling .modal. */
#setupModal .modal-content,
#glitchSetupModal .modal-content {
    overflow-x: clip;
}

.setup-submit {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 16px -30px -30px;
    padding: 4px 30px 18px;
    background: #dce5dc;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0 0 15px 15px;
}

.setup-submit .btn-primary {
    margin-top: 12px;
}
