:root {
    --pitch-dark: #0b3d2e;
    --pitch: #14532d;
    --pitch-light: #1e7a45;
    --gold: #f2c94c;
    --white: #f8faf9;
    --ink: #0f2419;
    --muted: #9db8ab;
    --card: #ffffff;
    --danger: #e05b5b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at 50% -10%, var(--pitch-light) 0%, var(--pitch) 45%, var(--pitch-dark) 100%);
    min-height: 100vh;
    color: var(--white);
}

.wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 28px 18px 48px;
}

.brand {
    text-align: center;
    margin-bottom: 22px;
}
.brand .ball { font-size: 2.1rem; display: block; margin-bottom: 4px; }
.brand h1 {
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.7rem;
    margin: 0;
}
.brand p { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

.card {
    background: var(--card);
    color: var(--ink);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.28);
    margin-bottom: 16px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: #5b6b62; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input[type=text] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid #dbe6df;
    font-size: 1rem;
    font-family: inherit;
}
.field input[type=text]:focus { outline: none; border-color: var(--pitch-light); }

.btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: var(--gold); color: #3a2c00; }
.btn-primary:active { transform: scale(0.98); }
.btn-outline { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,0.4); }

.progress-row { display: flex; gap: 5px; margin-bottom: 18px; }
.progress-dot { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.2); }
.progress-dot.done { background: var(--gold); }
.progress-dot.current { background: var(--white); }

.slot-header { text-align: center; margin-bottom: 14px; }
.slot-header .step { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.slot-header .position { font-size: 1.4rem; font-weight: 800; margin: 4px 0 8px; }
.team-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--pitch-dark);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
}
.team-chip .year { color: var(--gold); font-weight: 800; }
.type-badge {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
}

.squad-box {
    background: rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 16px;
}
.squad-title {
    color: var(--gold); font-weight: 800; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; padding-left: 2px;
}

/* Pitch: a portrait green rectangle with each formation slot placed by its
   top/left percentage (see engine.FORMATIONS), goalkeeper at the bottom. */
.pitch {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    background:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 12.5%, rgba(0,0,0,0.03) 12.5% 25%),
        linear-gradient(180deg, #1c8a4d 0%, #0f5c33 100%);
    border: 2px solid rgba(255,255,255,0.35);
    overflow: hidden;
}
.pitch::before {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 30%; aspect-ratio: 1;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.pitch::after {
    content: '';
    position: absolute;
    left: 15%; right: 15%; bottom: -1px;
    height: 16%;
    border: 2px solid rgba(255,255,255,0.35);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
.pitch-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 19%;
    text-align: center;
}
.pitch-slot .jersey {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62rem; font-weight: 800;
    background: rgba(255,255,255,0.18);
    border: 1.5px dashed rgba(255,255,255,0.5);
    color: var(--white);
}
.pitch-slot.filled .jersey {
    background: var(--gold);
    border: 1.5px solid #c99f2e;
    color: #3a2c00;
}
.pitch-slot .pname {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.pitch-slot .pname.muted { color: rgba(255,255,255,0.55); font-style: italic; font-weight: 500; }
.pitch-slot .pname.pickable-label { color: #3a2c00; font-weight: 800; }
.pitch-slot form { margin: 0; }
button.jersey {
    font-family: inherit;
    padding: 0;
}
button.jersey.pickable {
    cursor: pointer;
    background: var(--gold);
    border: 2px solid #fff;
    color: #3a2c00;
    box-shadow: 0 0 0 4px rgba(242,201,76,0.35);
    animation: golazo-pulse 1.6s ease-in-out infinite;
}
@keyframes golazo-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(242,201,76,0.35); }
    50% { box-shadow: 0 0 0 8px rgba(242,201,76,0.15); }
}

.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.squad-cell {
    border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
}
.squad-cell.filled { background: rgba(242,201,76,0.16); border-color: rgba(242,201,76,0.4); }
.squad-cell .pos { font-size: 0.62rem; font-weight: 800; color: var(--gold); letter-spacing: 0.04em; }
.squad-cell .pname { font-size: 0.72rem; font-weight: 700; color: var(--white); line-height: 1.2; }
.squad-cell .pname.muted { color: var(--muted); font-weight: 500; font-style: italic; }

.candidate-multi {
    border: 1.5px solid #e4ece7; border-radius: 14px; background: #fbfdfc; padding: 12px 14px;
}
.candidate-multi-name { font-weight: 700; color: var(--ink); font-size: 1rem; margin-bottom: 8px; }
.candidate-multi-hint { display: block; font-weight: 500; font-size: 0.76rem; color: #6b7d72; margin-top: 2px; }
.candidate-multi-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.candidate-multi-slots form { margin: 0; }
.slot-choice-btn {
    padding: 9px 14px; border-radius: 10px; border: 1.5px solid var(--pitch-light);
    background: var(--pitch); color: var(--white); font-family: inherit; font-weight: 700;
    font-size: 0.85rem; cursor: pointer;
}
.slot-choice-btn:active { background: var(--pitch-dark); }

.candidate-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.candidate-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid #e4ece7;
    background: #fbfdfc;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
}
.candidate-btn:active { background: #eef7f1; border-color: var(--pitch-light); }
.candidate-btn .pos-tag {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--pitch);
    background: #e1f2e7;
    padding: 3px 8px;
    border-radius: 6px;
}
.candidate-btn.disabled-candidate {
    background: #d8d8d8;
    border-color: #c4c4c4;
    color: #8c8c8c;
    cursor: not-allowed;
    filter: grayscale(1);
}
.candidate-btn.disabled-candidate span:first-child {
    color: #8c8c8c;
    text-decoration: line-through;
    text-decoration-color: #b0b0b0;
}
.candidate-btn.disabled-candidate .pos-tag.muted {
    color: #7a7a7a;
    background: #c8c8c8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.share-box {
    background: rgba(255,255,255,0.08);
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    margin-top: 6px;
}
.share-box .link-text {
    display: block;
    word-break: break-all;
    font-size: 0.82rem;
    color: var(--gold);
    margin: 8px 0 12px;
    font-family: monospace;
}

.status-line { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 10px 0 4px; }

.result-header { text-align: center; margin-bottom: 18px; }
.result-header .trophy { font-size: 2.2rem; }
.result-header h2 { margin: 6px 0 0; font-weight: 800; }

.score-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; }
.score-card { flex: 1; background: var(--card); color: var(--ink); border-radius: 16px; padding: 16px; text-align: center; }
.score-card.winner { box-shadow: 0 0 0 3px var(--gold); }
.score-card .name { font-weight: 700; font-size: 0.95rem; }
.score-card .pts { font-size: 1.8rem; font-weight: 800; margin-top: 4px; }
.vs { color: var(--muted); font-weight: 800; }

.lineup-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lineup-table th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; padding-bottom: 6px; }
.lineup-table td { padding: 7px 4px; border-top: 1px solid #edf3ef; }
.lineup-table .pos-cell { font-weight: 700; color: var(--pitch); width: 34px; }
.lineup-table .rating-cell { text-align: right; font-weight: 800; }

.footer-note { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 26px; }
.footer-note a { color: var(--gold); }
