body {
    font-family: sans-serif;
    max-width: 100%;
    width: 100%;
    margin: 20px auto;
    padding: 0 16px;
    box-sizing: border-box;
    line-height: 1.6;
    font-size: 16px;
}

.top-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #28a745;
    padding: 10px 0;
    position: relative;
}

.menu-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.menu-link {
    padding: 10px 16px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 15px;
    transition: background-color 0.3s;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.menu-link:hover {
    background-color: #e0e0e0;
}

.menu-link.active {
    background-color: #28a745;
    color: white;
}

h3 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 20px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 8px;
}

.field {
    margin-bottom: 12px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding-left: 24px;
}

.kpi-grid .field {
    margin-bottom: 0;
}

.player-selector select {
    width: 300px;
    max-width: 100%;
}

.kpi-grid input[type="number"] {
    width: 100%;
    max-width: 120px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
}

input,
select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.message {
    padding: 15px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    margin-bottom: 20px;
    border-radius: 4px;
}

button {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    font-size: 16px;
}

button:hover {
    background: #218838;
}

.hint {
    font-size: 13px;
    color: #666;
    margin: 4px 0;
}

.btn-generate {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    font-size: 16px;
    font-weight: 500;
}

.btn-generate:hover {
    background: #218838;
}

.user-selector select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    background-color: white;
    cursor: pointer;
    max-width: 100%;
}

.formation-details {
    background-color: #f8f9fa;
    border: 2px solid #007bff;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.formation-details h3 {
    color: #007bff;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.formation-details h4 {
    color: #333;
    font-size: 16px;
    margin-top: 15px;
    margin-bottom: 8px;
    font-weight: 600;
}

.formation-details ul {
    margin: 8px 0 15px 20px;
    padding-left: 0;
}

.formation-details li {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.formation-details p {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0;
}

.assignments-container {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 25px;
    margin-top: 25px;
}

.loaded-assignments-container {
    background-color: #e8f5e9;
    border: 2px solid #4c91af;
    border-radius: 8px;
    padding: 25px;
    margin-top: 25px;
}

.assignments-container h3 {
    color: #2e7d32;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 3px solid #4caf50;
    padding-bottom: 10px;
}

.assignments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.position-card {
    background-color: white;
    border: 1px solid #81c784;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.position-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.2);
}

.position-name {
    font-weight: bold;
    color: #2e7d32;
    font-size: 14px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-name {
    font-size: 18px;
    font-weight: bold;
    color: #1b5e20;
    margin-bottom: 10px;
}

.reasoning {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    font-style: italic;
}

.choices-container {
    margin-top: 12px;
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.choice {
    background-color: #f5f5f5;
    border-left: 4px solid #4caf50;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.choice:hover {
    background-color: #eeeeee;
}

.choice[data-ranking="1st"] {
    border-left-color: #ffc107;
    background-color: #fffde7;
}

.choice[data-ranking="1st"]:hover {
    background-color: #ffff9c;
}

.choice[data-ranking="2nd"] {
    border-left-color: #9e9e9e;
    background-color: #f9f9f9;
}

.choice[data-ranking="3rd"] {
    border-left-color: #cd7f32;
    background-color: #fef5e7;
}

.choice[data-ranking="3rd"]:hover {
    background-color: #fde8c8;
}

.choice-ranking {
    font-weight: bold;
    color: #2e7d32;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.choice[data-ranking="1st"] .choice-ranking {
    color: #ff8f00;
}

.choice[data-ranking="2nd"] .choice-ranking {
    color: #757575;
}

.choice[data-ranking="3rd"] .choice-ranking {
    color: #cd7f32;
}

.choice-player {
    font-size: 15px;
    font-weight: 600;
    color: #1b5e20;
    margin-bottom: 5px;
}

.choice-reasoning {
    font-size: 12px;
    color: #555;
    line-height: 1.4;
}

.formation-notes {
    background-color: #fff9c4;
    border-left: 4px solid #fbc02d;
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
}

.formation-notes h4 {
    color: #f57f17;
    margin-top: 0;
    margin-bottom: 10px;
}

.formation-notes p {
    color: #333;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.message {
    background-color: #c8e6c9;
    border: 2px solid #4caf50;
    color: #2e7d32;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 500;
}

.error {
    background-color: #ffcdd2;
    border: 2px solid #f44336;
    color: #c62828;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 500;
}

.page-description {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    background-color: #f0f8ff;
    padding: 15px;
    border-left: 4px solid #007bff;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* ============================================
   HAMBURGER MENU BUTTON (mobile only)
   ============================================ */
.nav-team-badge {
    display: none;
}

.hamburger-btn {
    display: none;
    background: none;
    border: 2px solid #28a745;
    color: #28a745;
    font-size: 22px;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    width: auto;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    order: -1;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(40,167,69,0.2);
    -webkit-appearance: none;
    user-select: none;
    -webkit-user-select: none;
}

.hamburger-btn:hover {
    background: #28a745;
    color: white;
}

/* ============================================
   MOBILE RESPONSIVE — max-width: 768px
   ============================================ */
@media (max-width: 768px) {
    body {
        margin: 12px auto;
        padding: 0 12px;
        font-size: 16px;
    }

    .hamburger-btn {
        display: inline-flex;
    }

    .nav-team-badge {
        display: inline-block;
        font-size: 0.95em;
        font-weight: 600;
        color: #1976d2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 100px);
        align-self: center;
    }

    .top-menu {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        padding: 10px 0;
    }

    /* Hide nav sections by default on mobile; shown when .open */
    .nav-drawer {
        display: none;
        flex-basis: 100%;
        width: 100%;
        flex-direction: column;
        gap: 0;
    }

    .top-menu.open .nav-drawer {
        display: flex;
    }

    .top-menu .menu-links,
    .top-menu .user-selector {
        flex-basis: 100%;
        width: 100%;
    }

    .menu-links {
        flex-direction: column;
        gap: 6px;
        margin-top: 4px;
        margin-top: 4px;
    }

    .menu-link {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        padding: 12px 16px;
        min-height: 48px;
        justify-content: flex-start;
    }

    .user-selector {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .user-selector select {
        width: 100%;
        font-size: 16px;
        min-height: 44px;
        max-width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        padding-left: 48px;
    }

    .assignments-grid {
        grid-template-columns: 1fr;
    }

    .player-selector select {
        width: 100%;
    }

    h3 {
        font-size: 19px;
    }

    button {
        min-height: 48px;
        font-size: 16px;
    }

    input, select {
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 44px;
    }

    .position-card {
        padding: 12px;
    }

    .formation-details {
        padding: 15px;
    }

    .assignments-container {
        padding: 15px;
    }
}

/* ============================================
   SMALL PHONES — max-width: 480px
   ============================================ */
@media (max-width: 480px) {
    body {
        padding: 0 10px;
    }

    h3 {
        font-size: 18px;
    }

    .top-menu {
        padding: 8px 0;
    }
}
