:root {
    --serie-a-blue: #00419B;
    --serie-a-cyan: #00D7C9;
    --bg-color: #F0F4F8;
    --card-bg: #FFFFFF;
    --text-color: #172B4D;
    --danger-color: #FF4B4B;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 15px;
    padding-bottom: 80px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

ul, ol {
  padding-left: 0;
  margin-left: 0;
  list-style: none;
}

h1 {
    color: var(--serie-a-blue);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 1.8rem;
    margin: 0;
}

.subtitle {
    color: #666;
    margin-top: 5px;
    font-size: 0.9rem;
}

#loading {
    text-align: center;
    padding: 50px;
    font-weight: bold;
    color: var(--serie-a-blue);
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: #ddd;
    margin: 10px auto;
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: var(--serie-a-cyan);
    transition: width 0.3s;
}

details.pre-selection {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid #e0e4e8;
}

details.pre-selection summary {
    padding: 15px;
    font-weight: 700;
    color: var(--serie-a-blue);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    outline: none;
}

details.pre-selection summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
}

details.pre-selection[open] summary::after {
    content: '-';
}

.pre-selection-content {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    background-color: #fafbfc;
}

.pre-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.btn-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-mini.burned {
    background-color: #ffecec;
    border-color: var(--danger-color);
    color: var(--danger-color);
    text-decoration: line-through;
    opacity: 0.6;
}

.btn-mini img,
.btn-mini .fallback-avatar {
    width: 30px;
    height: 30px;
}

.giornata-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 65, 155, 0.08);
    margin-bottom: 25px;
    padding: 15px;
    max-width: 700px;
    margin: 0 auto 25px auto;
}

.giornata-header {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.giornata-badge {
    background: linear-gradient(135deg, var(--serie-a-blue), #022c66);
    color: white;
    padding: 6px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.match-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.match-row:last-child {
    border-bottom: none;
}

.vs-separator {
    color: #ccc;
    font-weight: 800;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.btn-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid transparent;
    background-color: #f7f9fc;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-color);
    text-align: left;
    min-width: 0;
    overflow: hidden;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-team:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-team span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}

.btn-team img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.fallback-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background-color: #e0e4e8;
    color: #555;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    border: 1px solid #ccc;
}

.btn-team:hover:not(:disabled):not(.selected) {
    background-color: #eef2f7;
    border-color: #d0d7de;
}

.btn-team.selected {
    background-color: var(--serie-a-blue) !important;
    color: white !important;
    border-color: var(--serie-a-blue) !important;
    box-shadow: 0 4px 12px rgba(0, 65, 155, 0.3);
}

.btn-team.selected .fallback-avatar {
    background-color: white;
    color: var(--serie-a-blue);
    border-color: white;
}

.btn-team.selected img {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.9));
}

.btn-team.disabled {
    background-color: #fbfbfb;
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    border: 1px dashed #e0e0e0;
}

.load-more-container {
    text-align: center;
    margin: 20px 0;
}

.btn-load-more {
    background: white;
    border: 2px solid var(--serie-a-blue);
    color: var(--serie-a-blue);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.summary-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    padding: 10px;
    max-width: 700px;
    margin: 30px auto 0 auto;
    border: 1px solid #e0e4e8;
    text-align: center;
}

.summary-title {
    color: var(--serie-a-blue);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 1.2rem;
    margin-bottom: 25px;
    border-bottom: 3px solid var(--serie-a-cyan);
    display: inline-block;
    padding-bottom: 5px;
}

.summary-item {
    display: grid;
    grid-template-columns: 50px 1fr 20px 1fr 50px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.summary-spacer {
    background: #eee;
    color: #666;
    padding: 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}


.summary-badge {
    background: #eee;
    color: #666;
    padding: 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.summary-sep {
    color: #ccc;
    font-weight: bold;
    text-align: center;
}

.summary-home {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    text-align: right;
    color: #666;
}

.summary-away {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: left;
    color: #666;
}

.summary-logo,
.summary-fallback {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.summary-fallback {
    background: #ddd;
    color: #555;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
}

.picked {
    color: var(--serie-a-blue);
    font-weight: 800;
}

.watermark {
    margin: 25px;
    text-align: center;
    font-size: 0.55rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.watermark span {
    color: var(--serie-a-cyan);
    font-weight: bold;
}

.btn-download {
    background-color: var(--serie-a-blue);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

@media (max-width: 480px) {
    .summary-item {
        font-size: 0.8rem;
        gap: 5px;
    }

    .summary-logo {
        width: 20px;
        height: 20px;
    }
}