/* ═══════════════════════════════════════════════════════════════════════════
   TOURNOI DE PÉTANQUE V2 - Premium Styles
   L'Atelier du Bouliste
═══════════════════════════════════════════════════════════════════════════ */

:root {
    --rust: #593c29;
    --rust-light: #7a5a42;
    --rust-dark: #3d2a1c;
    --gold: #fedc57;
    --gold-dark: #e5c64e;
    --gold-darker: #c9a92f;
    --cream: #F9F7F2;
    --cream-dark: #EDE9E0;
    --dark: #2C241E;
    --dark-light: #4a3f35;
    --olive: #808c5c;
    --olive-dark: #5a6340;
    --success: #2E7D32;
    --error: #C62828;

    --font-stencil: 'Stardos Stencil', cursive;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-base: 0.3s cubic-bezier(0.33, 1, 0.68, 1);
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --shadow-sm: 0 2px 8px rgba(44, 36, 30, 0.08);
    --shadow-md: 0 4px 24px rgba(44, 36, 30, 0.12);
    --shadow-lg: 0 8px 40px rgba(44, 36, 30, 0.18);
    --shadow-glow: 0 0 30px rgba(254, 220, 87, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 100px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(180deg, var(--cream) 0%, #f0ece4 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════════════════════ */
.tournoi-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--dark) 0%, var(--rust-dark) 100%);
    box-shadow: var(--shadow-md);
}

.tournoi-header__back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(254, 220, 87, 0.15);
    /* Translucent Gold */
    border: 1px solid var(--gold);
    color: var(--gold);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all var(--transition-base);
    backdrop-filter: blur(4px);
}

.tournoi-header__back-btn:hover {
    background: var(--gold);
    color: var(--dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(254, 220, 87, 0.3);
}

.back-arrow {
    font-size: 1.1rem;
}

.tournoi-header__logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tournoi-header__ball {
    height: 40px;
    width: auto;
    animation: spin-slow 20s linear infinite;
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.tournoi-header__title {
    font-family: var(--font-stencil);
    font-size: 1.1rem;
    color: var(--gold);
    letter-spacing: 0.15em;
}

.tournoi-header__actions {
    display: flex;
    gap: 0.5rem;
}

.tournoi-header__btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--gold);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tournoi-header__btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STEPPER
═══════════════════════════════════════════════════════════════════════════ */
.stepper-container {
    background: white;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stepper-track {
    position: absolute;
    top: 50%;
    left: 15%;
    right: 15%;
    height: 3px;
    background: var(--cream-dark);
    transform: translateY(-50%);
    border-radius: 2px;
    z-index: 0;
}

.stepper-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--rust), var(--gold));
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

.stepper-steps {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    list-style: none;
    margin: 0;
    padding: 0;
}

.stepper-step {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.stepper-dot {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: var(--cream-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-stencil);
    font-size: 0.85rem;
    color: var(--dark-light);
    transition: all var(--transition-bounce);
    border: 3px solid white;
}

.stepper-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    transition: color var(--transition-base);
}

.stepper-step.active .stepper-dot {
    background: var(--rust);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(89, 60, 41, 0.2);
}

.stepper-step.active .stepper-label {
    color: var(--rust);
}

.stepper-step.completed .stepper-dot {
    background: var(--success);
    color: white;
}

.stepper-step.completed .stepper-dot::after {
    content: '✓';
    font-family: var(--font-sans);
    font-weight: bold;
}

.stepper-step.completed .stepper-label {
    color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════════════════════════ */
.tournoi-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem 5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS
═══════════════════════════════════════════════════════════════════════════ */
.view-section {
    display: none;
    animation: slideIn 0.5s ease-out;
}

.view-section.active {
    display: block;
}

.hidden {
    display: none !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--cream-dark);
}

.step-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
    font-family: var(--font-stencil);
    font-size: 1rem;
    border-radius: 50%;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
}

h2 {
    font-family: var(--font-stencil);
    font-size: 1.3rem;
    color: var(--rust);
    letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONFIG FORM
═══════════════════════════════════════════════════════════════════════════ */
.config-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-text {
    padding: 0.75rem 1rem;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: all var(--transition-base);
    background: white;
}

.input-text:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 3px rgba(89, 60, 41, 0.1);
}

/* Counter Control */
.counter-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 0.4rem;
    border-radius: var(--radius-pill);
    width: max-content;
    border: 2px solid var(--cream-dark);
}

.counter-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--cream);
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.2s;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    background: var(--rust);
    color: white;
    transform: scale(1.05);
}

.counter-btn:active {
    transform: scale(0.95);
}

.counter-value {
    font-family: var(--font-stencil);
    font-size: 1.6rem;
    min-width: 50px;
    text-align: center;
    color: var(--rust);
}

/* Toggles */
.toggle-group {
    display: flex;
    gap: 0.4rem;
    background: var(--cream);
    padding: 0.3rem;
    border-radius: var(--radius-sm);
}

.toggle-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    color: var(--dark-light);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.6);
}

.toggle-btn.active {
    background: var(--rust);
    color: white;
    box-shadow: var(--shadow-sm);
}

.toggle-group.small .toggle-btn {
    padding: 0.45rem 0.4rem;
    font-size: 0.8rem;
}

/* Rules Grid */
.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.rule-item {
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border: 1px solid var(--cream-dark);
}

.rule-item--full {
    grid-column: span 2;
}

.rule-item__header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rule-icon {
    font-size: 1rem;
}

.rule-item span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-light);
}

/* Time Estimation */
.time-estimation {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(254, 220, 87, 0.15) 0%, rgba(89, 60, 41, 0.05) 100%);
    border-radius: var(--radius-md);
    border: 1px solid rgba(254, 220, 87, 0.3);
}

.time-estimation__icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.time-estimation__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--dark-light);
    letter-spacing: 0.08em;
    font-weight: 600;
}

.time-estimation__value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--rust);
    font-family: var(--font-stencil);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSCRIPTIONS
═══════════════════════════════════════════════════════════════════════════ */
.inscriptions-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.instruction {
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--dark-light);
    font-size: 0.95rem;
}

.instruction span {
    font-weight: bold;
    color: var(--rust);
    font-size: 1.05em;
}

.grid-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.inscription-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.inscription-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rust-light);
}

.inscription-input,
.grid-inputs input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all var(--transition-base);
    background: white;
}

.inscription-input:focus,
.grid-inputs input:focus {
    border-color: var(--rust);
    outline: none;
    box-shadow: 0 0 0 3px rgba(89, 60, 41, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEAMS
═══════════════════════════════════════════════════════════════════════════ */
.teams-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.teams-controls .toggle-group {
    max-width: 360px;
    width: 100%;
}

.btn-regenerate {
    display: block;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--dark);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-bounce);
}

.btn-regenerate:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.btn-regenerate:active {
    transform: scale(0.98);
}

.teams-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Team Card */
.team-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--gold);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.team-card__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.team-card__color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-card__header h3 {
    font-family: var(--font-stencil);
    font-size: 0.95rem;
    margin: 0;
    flex: 1;
}

.team-boules-info {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    color: var(--dark-light);
    font-weight: 600;
    white-space: nowrap;
}

.team-card__members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.team-member-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BRACKET & MATCHES
═══════════════════════════════════════════════════════════════════════════ */
.bracket-display {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0.5rem 2rem;
    -webkit-overflow-scrolling: touch;
}

.round-column {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 1rem;
    min-width: 200px;
    flex-shrink: 0;
}

.round-title {
    text-align: center;
    font-family: var(--font-stencil);
    color: var(--rust-light);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    padding: 0.4rem;
    background: rgba(89, 60, 41, 0.05);
    border-radius: var(--radius-sm);
}

.match-card {
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    border: 2px solid var(--cream-dark);
    position: relative;
}

.match-card.clickable {
    cursor: pointer;
    border-color: var(--gold);
}

.match-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--gold-dark);
}

.match-card.clickable:active {
    transform: translateY(-1px);
}

.match-card.completed {
    border-left: 4px solid var(--success);
}

.match-card.bye {
    opacity: 0.6;
    border-style: dashed;
}

.match-team {
    padding: 0.55rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--cream-dark);
    transition: background 0.2s;
}

.match-team:last-child {
    border-bottom: none;
}

.match-team.winner {
    background: linear-gradient(90deg, rgba(254, 220, 87, 0.2), transparent);
    font-weight: bold;
}

.team-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.team-score-display {
    font-family: var(--font-stencil);
    font-size: 1rem;
    color: var(--rust);
    min-width: 20px;
    text-align: right;
}

.match-badge-bye {
    font-size: 0.7rem;
    background: var(--cream-dark);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    color: var(--dark-light);
    font-weight: 600;
}

.match-action-hint {
    text-align: center;
    padding: 0.35rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

button {
    font-family: var(--font-sans);
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--rust), var(--rust-dark));
    color: var(--cream);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: bold;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-primary.btn-glow {
    animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(89, 60, 41, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(254, 220, 87, 0.5);
    }
}

.btn-secondary {
    background: white;
    color: var(--dark);
    border: 2px solid var(--cream-dark);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    border-color: var(--rust-light);
    background: var(--cream);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--rust);
    color: var(--rust);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn-outline:hover,
.btn-outline.active {
    background: var(--rust);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 36, 30, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 1.75rem;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    transform: translateY(10px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-stencil);
    font-size: 1.3rem;
    color: var(--rust);
}

.btn-close-modal {
    background: var(--cream);
    border: none;
    font-size: 1.5rem;
    color: var(--dark-light);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: var(--cream-dark);
    color: var(--dark);
}

.mene-info {
    text-align: center;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(254, 220, 87, 0.1), rgba(89, 60, 41, 0.05));
    border-radius: var(--radius-sm);
}

.mene-info__current {
    font-weight: bold;
    color: var(--rust);
    font-size: 0.9rem;
}

.mene-info__global {
    font-size: 1.1rem;
    font-family: var(--font-stencil);
    color: var(--dark);
    margin-top: 0.25rem;
}

.score-input-group {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.score-input-group .team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    flex: 1;
}

.modal-team-name {
    font-family: var(--font-stencil);
    font-size: 0.85rem;
    color: var(--dark);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-score-adjust {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--cream-dark);
    background: white;
    color: var(--rust);
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.btn-score-adjust:hover {
    background: var(--cream);
    border-color: var(--rust);
    transform: scale(1.1);
}

.btn-score-adjust:active {
    transform: scale(0.95);
    background: var(--rust);
    color: white;
}

.score-input-group input {
    width: 64px;
    height: 64px;
    text-align: center;
    font-family: var(--font-stencil);
    font-size: 1.8rem;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-md);
    background: var(--cream);
    transition: border-color 0.2s;
    -moz-appearance: textfield;
    appearance: textfield;
    color: var(--rust);
}

.score-input-group input::-webkit-outer-spin-button,
.score-input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-input-group input:focus {
    border-color: var(--rust);
    outline: none;
    background: white;
}

.score-input-group .vs {
    font-weight: bold;
    color: var(--gold-dark);
    font-size: 1.2rem;
    font-family: var(--font-stencil);
}

.menes-history-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cream-dark);
}

.mene-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
    border: 1px solid var(--cream-dark);
    font-size: 0.8rem;
}

.mene-badge__label {
    font-weight: bold;
    color: var(--rust);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.mene-badge__score {
    font-family: var(--font-stencil);
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HISTORY
═══════════════════════════════════════════════════════════════════════════ */
.history-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.history-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.7);
    transition: all var(--transition-base);
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.history-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-card__date {
    font-size: 0.75rem;
    color: var(--dark-light);
    font-weight: 500;
}

.history-card__org {
    font-size: 0.75rem;
    color: var(--rust-light);
    font-style: italic;
}

.history-card__winner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.history-card__trophy {
    font-size: 1.3rem;
}

.history-card__winner-name {
    font-family: var(--font-stencil);
    font-size: 1.1rem;
    color: var(--dark);
}

.history-card__details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.history-detail-badge {
    font-size: 0.7rem;
    background: var(--cream);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    color: var(--dark-light);
    font-weight: 500;
}

.history-card__ranking {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--cream-dark);
}

.history-rank-badge {
    font-size: 0.75rem;
    color: var(--dark-light);
}

.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--dark-light);
    font-style: italic;
}

.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--dark-light);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--cream-dark);
    border-top-color: var(--rust);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HINTS
═══════════════════════════════════════════════════════════════════════════ */
.config-hint {
    display: block;
    font-size: 0.75rem;
    color: #888;
    font-weight: normal;
    margin-top: 0.15rem;
    font-style: italic;
    text-transform: none;
    letter-spacing: normal;
}

.config-hint-small {
    display: block;
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 0.4rem;
    font-style: italic;
    font-weight: normal;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MANUAL TEAMS UI
═══════════════════════════════════════════════════════════════════════════ */
.manual-teams-interface {
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

.manual-columns {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.manual-column {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.manual-column h3 {
    margin-top: 0;
    color: var(--rust);
    font-family: var(--font-stencil);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--cream-dark);
}

.manual-column__action {
    margin-top: auto;
    padding-top: 1rem;
    text-align: center;
}

.manual-players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.player-badge {
    padding: 0.45rem 0.85rem;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-pill);
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
    user-select: none;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--dark);
    -webkit-tap-highlight-color: transparent;
}

.player-badge:hover {
    border-color: var(--rust);
    background: var(--cream);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.player-badge.selected {
    background: var(--rust);
    color: white;
    border-color: var(--rust);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.manual-teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.manual-team-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--rust);
    transition: all 0.2s;
    animation: slideIn 0.3s ease;
}

.manual-team-card__info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    overflow: hidden;
}

.manual-team-card__info strong {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manual-team-count {
    font-size: 0.75rem;
    color: #888;
    flex-shrink: 0;
}

.btn-remove-team {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.btn-remove-team:hover {
    color: var(--error);
}

.btn-create-team {
    background: linear-gradient(135deg, var(--rust), var(--rust-dark));
    color: white;
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-bounce);
    width: 100%;
    max-width: 250px;
}

.btn-create-team:hover:not(:disabled) {
    transform: scale(1.03) translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-create-team:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-create-team:disabled {
    background: var(--cream-dark);
    color: #999;
    box-shadow: none;
    cursor: not-allowed;
}

.empty-state-text {
    color: var(--success);
    font-style: italic;
    text-align: center;
    padding: 1rem;
    background: rgba(46, 125, 50, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VICTORY OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
.victory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 36, 30, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.victory-overlay.show {
    opacity: 1;
}

.victory-container {
    background: linear-gradient(180deg, white 0%, var(--cream) 100%);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    max-width: 550px;
    width: 100%;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(254, 220, 87, 0.3);
    border: 2px solid var(--gold);
    text-align: center;
    transform: scale(0.85) translateY(20px);
    transition: transform 0.5s var(--transition-bounce);
    animation: victoryPop 0.6s var(--transition-bounce) forwards;
}

@keyframes victoryPop {
    0% {
        transform: scale(0.85) translateY(20px);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

.victory-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.victory-trophy {
    font-size: 4rem;
    animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-8px) rotate(-5deg);
    }

    75% {
        transform: translateY(-4px) rotate(5deg);
    }
}

.victory-confetti-left,
.victory-confetti-right {
    font-size: 2rem;
    animation: confettiSway 1.5s ease-in-out infinite;
}

.victory-confetti-right {
    animation-delay: 0.5s;
}

@keyframes confettiSway {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.victory-title {
    font-family: var(--font-stencil) !important;
    font-size: 1.8rem !important;
    color: var(--rust) !important;
    margin-bottom: 0.5rem;
    letter-spacing: 0.08em;
}

.victory-winner-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0.5rem 0;
    display: block;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-serif);
}

.victory-score-final {
    font-size: 0.9rem;
    color: var(--dark-light);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.victory-section {
    text-align: left;
    margin-bottom: 1.25rem;
}

.victory-section h3 {
    font-family: var(--font-stencil);
    font-size: 1rem;
    color: var(--rust);
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--cream-dark);
}

.victory-ranking {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--cream-dark);
    font-size: 0.85rem;
}

.ranking-item.gold {
    background: linear-gradient(135deg, rgba(254, 220, 87, 0.2), rgba(254, 220, 87, 0.05));
    border-color: var(--gold);
}

.ranking-item.silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), transparent);
    border-color: #c0c0c0;
}

.ranking-pos {
    font-size: 1.1rem;
    min-width: 28px;
}

.ranking-name {
    flex: 1;
    font-weight: 600;
}

.ranking-detail {
    font-size: 0.75rem;
    color: var(--dark-light);
    font-style: italic;
}

.victory-matches {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-summary-round {
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--cream-dark);
}

.match-summary-round-title {
    padding: 0.35rem 0.75rem;
    background: var(--cream);
    font-family: var(--font-stencil);
    font-size: 0.75rem;
    color: var(--rust-light);
    letter-spacing: 0.05em;
}

.match-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--cream-dark);
}

.match-summary-item:last-child {
    border-bottom: none;
}

.match-summary-item .winner {
    font-weight: bold;
    color: var(--rust);
}

.match-summary-score {
    font-family: var(--font-stencil);
    font-size: 0.85rem;
    color: var(--dark-light);
    padding: 0 0.5rem;
    flex-shrink: 0;
}

.victory-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.victory-actions button {
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .tournoi-header {
        padding: 0.6rem 0.75rem;
    }

    .tournoi-header__ball {
        height: 30px;
    }

    .tournoi-header__title {
        font-size: 0.9rem;
    }

    .btn-label {
        display: none;
    }

    .tournoi-header__btn {
        padding: 0.4rem 0.5rem;
    }

    .stepper-label {
        font-size: 0.6rem;
    }

    .stepper-dot {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .tournoi-main {
        padding: 1rem 0.75rem 4rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .rule-item--full {
        grid-column: span 1;
    }

    .action-bar {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline {
        width: 100%;
        text-align: center;
    }

    .team-card {
        padding: 0.75rem;
    }

    .teams-list {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .manual-columns {
        flex-direction: column;
    }

    .manual-column {
        min-width: auto;
    }

    .bracket-display {
        gap: 1rem;
    }

    .round-column {
        min-width: 170px;
    }

    .score-input-group input {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .btn-score-adjust {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .modal-content {
        padding: 1.25rem;
    }

    .victory-container {
        padding: 1.5rem 1rem;
    }

    .victory-title {
        font-size: 1.4rem !important;
    }

    .victory-winner-name {
        font-size: 1.3rem;
    }

    .victory-trophy {
        font-size: 3rem;
    }
}

@media (max-width: 380px) {
    .teams-list {
        grid-template-columns: 1fr;
    }

    .counter-control {
        width: 100%;
        justify-content: space-between;
    }
}