/* Player Setup Styles */
.mode-flow-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-selection,
.turn-flow-selection {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mode-selection label,
.turn-flow-selection label {
    margin-bottom: 0;
}

.mode-selection label,
.turn-flow-selection label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary);
    position: relative;
}

.mode-selection label:hover,
.turn-flow-selection label:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary)15;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mode-selection input[type="radio"],
.turn-flow-selection input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-selection span,
.turn-flow-selection span {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 1rem;
}

.mode-selection span::before,
.turn-flow-selection span::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.mode-selection input[type="radio"]:checked + span::before,
.turn-flow-selection input[type="radio"]:checked + span::before {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: inset 0 0 0 3px var(--bg-primary);
}

.mode-selection input[type="radio"]:checked + span,
.turn-flow-selection input[type="radio"]:checked + span {
    color: var(--accent-primary);
    font-weight: 600;
}

.mode-selection label:has(input:checked),
.turn-flow-selection label:has(input:checked) {
    border-color: var(--accent-primary);
    background: var(--accent-primary)20;
    box-shadow: 0 0 0 1px var(--accent-primary)40;
}

.mode-selection h3,
.turn-flow-selection h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-top: 0;
}

.template-selection {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.player-setup {
    flex: 1;
    margin-bottom: 1rem;
}

#players-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.player-item {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid;
    transition: all 0.2s ease;
    cursor: move;
    min-height: 4rem;
    touch-action: none;
}

.player-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.player-item.drag-over {
    border-top: 3px solid var(--accent-primary);
    background: var(--accent-primary)20;
}

.drag-handle {
    color: var(--text-muted);
    font-size: 1rem;
    cursor: grab;
    padding: 0.25rem;
    user-select: none;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.player-number {
    font-weight: bold;
    min-width: 20px;
}

.player-name {
    flex: 1;
    background: transparent;
    border: 1px solid #555;
    color: var(--text);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
}

.player-name:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-picker {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 50%;
}

.color-picker::-webkit-color-swatch {
    border: 2px solid #fff;
    border-radius: 50%;
}

.remove-player {
    background: var(--error);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
    padding: 0;
}

.error-message {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

.player-item.error {
    border-left-color: var(--error);
}

.player-item.error .player-name {
    border-color: var(--error);
}

/* Template Selection */
.template-selection {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.template-selection h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.template-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.template-options label {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative;
    font-size: 0.85rem;
}

.template-options label:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary)15;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.template-options input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.template-options span {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.template-options span::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.template-options input[type="radio"]:checked + span::before {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: inset 0 0 0 2px var(--bg-primary);
}

.template-options input[type="radio"]:checked + span {
    color: var(--accent-primary);
    font-weight: 600;
}

.template-options label:has(input:checked) {
    border-color: var(--accent-primary);
    background: var(--accent-primary)20;
    box-shadow: 0 0 0 1px var(--accent-primary)40;
}

/* Default Colors */
.default-colors {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

.color-option:hover {
    border-color: #fff;
}

.color-option.used {
    opacity: 0.3;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .drag-handle {
        font-size: 1.5rem;
        padding: 0.75rem;
        min-width: 3rem;
        text-align: center;
    }
    
    .player-item {
        padding: 1rem;
        gap: 0.75rem;
        min-height: 5rem;
    }
    
    .player-item.drag-over {
        border-top: 4px solid var(--accent-primary);
    }
    
    .mode-flow-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .template-options {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mode-selection label,
    .turn-flow-selection label {
        margin-bottom: 0.75rem;
    }
}

/* Ensure Start button is always accessible */
.btn-primary {
    margin-top: 1rem;
    margin-bottom: 2rem;
    position: sticky;
    bottom: 1rem;
    z-index: 100;
}

/* Mobile adjustments for browser banners */
@media (max-width: 480px) {
    .screen {
        padding-bottom: 3rem;
    }
    
    .btn-primary {
        margin-bottom: 3rem;
        bottom: 0.5rem;
    }
}