/* ============================================================
   PICK'EM — Design system 2026 (dark / NFL)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg:        #070b16;
    --bg-2:      #0c1222;
    --surface:   rgba(255, 255, 255, 0.045);
    --surface-2: rgba(255, 255, 255, 0.07);
    --border:    rgba(255, 255, 255, 0.10);
    --border-2:  rgba(255, 255, 255, 0.16);

    --text:      #eef2f9;
    --muted:     #93a0b8;
    --faint:     #61708c;

    --red:       #e5182a;
    --red-2:     #b3111f;
    --blue:      #2f7dff;
    --green:     #22c55e;
    --amber:     #f5a524;

    --radius:    16px;
    --radius-sm: 10px;
    --shadow:    0 18px 40px -18px rgba(0, 0, 0, 0.75);
    --ring:      0 0 0 3px rgba(47, 125, 255, 0.35);

    --display: 'Oswald', 'Arial Narrow', sans-serif;
    --sans: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* El atributo hidden debe ganar siempre, incluso sobre display:flex/grid. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 82% -8%, rgba(229, 24, 42, 0.16), transparent 60%),
        radial-gradient(900px 560px at 8% 8%, rgba(47, 125, 255, 0.14), transparent 55%),
        linear-gradient(180deg, var(--bg-2), var(--bg) 62%);
    background-attachment: fixed;
}

/* Sutiles lineas de yarda del campo */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: repeating-linear-gradient(90deg,
        transparent 0 118px,
        rgba(255, 255, 255, 0.022) 118px 120px);
    mask-image: linear-gradient(180deg, transparent, #000 30%, #000 85%, transparent);
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   App bar
   ============================================================ */
.appbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(8, 12, 22, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: 0.5px;
}
.brand .mark {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    font-size: 20px;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 8px 20px -6px rgba(229, 24, 42, 0.6);
}
.brand .name { font-size: 22px; text-transform: uppercase; line-height: 1; }
.brand .name b { color: var(--red); }
.brand .name small {
    display: block;
    margin-top: 3px;
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 2.5px;
    font-weight: 600;
    color: var(--faint);
    text-transform: uppercase;
}

.appbar nav {
    display: flex;
    gap: 6px;
    margin-left: 8px;
    flex-wrap: wrap;
}
.appbar nav a {
    padding: 9px 15px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid transparent;
    transition: .18s;
}
.appbar nav a:hover {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.appbar .spacer { flex: 1; }

.userchip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.userchip .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px;
    background: linear-gradient(135deg, var(--blue), #1b3f8a);
}
.userchip .who { font-size: 13px; font-weight: 600; line-height: 1.1; }
.userchip .who small { display: block; color: var(--faint); font-size: 10.5px; font-weight: 600; letter-spacing: .4px; }

.logout {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 600; font-size: 13.5px;
    color: #ffd7db;
    background: rgba(229, 24, 42, 0.12);
    border: 1px solid rgba(229, 24, 42, 0.35);
    transition: .18s;
}
.logout:hover { background: rgba(229, 24, 42, 0.22); color: #fff; }

/* mobile nav toggle */
#menu-toggle { display: none; }

/* ============================================================
   Layout
   ============================================================ */
.container, main {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 72px;
}

h1 {
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: clamp(24px, 4vw, 34px);
    margin: 6px 0 22px;
    color: var(--text);
    text-align: center;
}
h1::after {
    content: "";
    display: block;
    width: 62px; height: 4px;
    margin: 12px auto 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--red), var(--blue));
}
h2 { font-family: var(--display); font-weight: 600; letter-spacing: .5px; }

.subhead {
    text-align: center;
    margin: -12px 0 24px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

/* ============================================================
   Tables → tarjetas tipo scoreboard
   ============================================================ */
#table-container { overflow-x: auto; }

table {
    width: 100%;
    max-width: 960px;
    margin: 0 auto 18px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 14.5px;
}
table[border] { border: 1px solid var(--border); }

table tr > td:first-child, table tr > th:first-child { padding-left: 20px; }
table tr > td:last-child,  table tr > th:last-child  { padding-right: 20px; }

/* Fila de encabezado = la primera fila (el legado usa <td> en la cabecera) */
table tr:first-child td, table th {
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-align: left;
    padding: 15px 14px;
    border-bottom: 1px solid var(--border-2);
    white-space: nowrap;
}
table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text);
    vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:not(:first-child):hover td { background: rgba(47, 125, 255, 0.06); }

/* ============================================================
   Chips de equipo (logo + nombre)
   ============================================================ */
.team {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}
.team--empty { color: var(--faint); font-weight: 500; }

.team-logo {
    position: relative;
    width: 28px; height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.12), rgba(255,255,255,.04));
    border: 1px solid var(--border);
    overflow: hidden;
}
.team-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.team-fallback { font-size: 9.5px; font-weight: 800; letter-spacing: .2px; color: var(--muted); }

.team-name { overflow: hidden; text-overflow: ellipsis; }

.team--sm { gap: 8px; font-size: 13.5px; }
.team--sm .team-logo { width: 23px; height: 23px; flex-basis: 23px; }
.team--sm .team-fallback { font-size: 8.5px; }
.team--lg { gap: 12px; font-size: 16px; font-weight: 700; }
.team--lg .team-logo { width: 56px; height: 56px; flex-basis: 56px; }
.team--lg .team-fallback { font-size: 14px; }

/* Boton de pick con logo */
.team-btn { padding: 5px 14px 5px 6px; }
.team-btn.is-pick {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.5);
}
.team-btn.is-pick .team-name { color: #8ef0b4; }
.team-btn.is-pick .team-fallback { color: #8ef0b4; }

/* Envoltorio con scroll horizontal suave (tablet/desktop) */
.table-wrap {
    max-width: 100%;
    margin: 0 auto 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.table-wrap > table { margin-bottom: 0; }

/* ============================================================
   Badges de estado
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.is-active   { color: #59e59a; background: rgba(34, 197, 94, 0.12);  border-color: rgba(34, 197, 94, 0.3); }
.badge.is-inactive { color: #98a4ba; background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.28); }
.badge.is-updated  { color: #6fb0ff; background: rgba(47, 125, 255, 0.14);  border-color: rgba(47, 125, 255, 0.32); }
.badge.is-used     { color: #f6bf5e; background: rgba(245, 165, 36, 0.12);  border-color: rgba(245, 165, 36, 0.3); }

.medal { font-size: 16px; }

/* ============================================================
   Tabla de posiciones (lista, no <table>: se ve bien en movil)
   ============================================================ */
.lb { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }

.lb__row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: .15s;
}
.lb__row:hover { border-color: var(--border-2); }
.lb__row.top1 {
    border-color: rgba(245, 165, 36, 0.45);
    background: linear-gradient(90deg, rgba(245, 165, 36, 0.12), var(--surface) 55%);
}
.lb__row.top2 {
    border-color: rgba(200, 208, 222, 0.35);
    background: linear-gradient(90deg, rgba(200, 208, 222, 0.09), var(--surface) 55%);
}
.lb__row.top3 {
    border-color: rgba(205, 127, 50, 0.38);
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.10), var(--surface) 55%);
}

.lb__pos {
    flex: 0 0 40px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--muted);
    line-height: 1;
}
.lb__pos small { font-size: 10px; color: var(--faint); margin-top: 2px; }

.lb__name {
    flex: 1; min-width: 0;
    font-weight: 700; font-size: 14.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lb__stats { display: flex; gap: 6px; flex: 0 0 auto; }
.lb__stat {
    display: grid; place-items: center;
    min-width: 40px; padding: 4px 7px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
}
.lb__stat b { font-size: 14px; font-weight: 700; line-height: 1.1; }
.lb__stat small {
    font-size: 9px; letter-spacing: .6px; font-weight: 700;
    text-transform: uppercase; color: var(--faint);
}
.lb__stat--w b { color: #59e59a; }
.lb__stat--l b { color: #ff8189; }

@media (max-width: 430px) {
    .lb__row { gap: 8px; padding: 9px 10px; }
    .lb__pos { flex-basis: 30px; font-size: 15px; }
    .lb__name { font-size: 13.5px; }
    .lb__stat { min-width: 33px; padding: 3px 5px; }
    .lb__stat b { font-size: 13px; }
}

/* Avatar de usuario (color por nombre + personaje) */
.uavatar {
    position: relative;
    width: 40px; height: 40px; flex: 0 0 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg,
        hsl(var(--h, 210deg) 70% 55%),
        hsl(calc(var(--h, 210deg) + 40deg) 65% 42%));
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.12);
}
.uavatar__ini {
    font-size: 13px; font-weight: 800; letter-spacing: .3px;
    color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.uavatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uavatar--sm { width: 30px; height: 30px; flex-basis: 30px; border-width: 1.5px; }
.uavatar--sm .uavatar__ini { font-size: 11px; }
.uavatar--xl { width: 72px; height: 72px; flex-basis: 72px; }
.uavatar--xl .uavatar__ini { font-size: 24px; }

/* Selector de avatares */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 12px;
}
.avatar-opt {
    position: relative;
    display: grid; place-items: center;
    padding: 14px 8px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: .15s;
}
.avatar-opt:hover { border-color: var(--border-2); transform: translateY(-2px); }
.avatar-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.avatar-opt.sel, .avatar-opt:has(input:checked) {
    border-color: var(--red);
    background: rgba(229, 24, 42, 0.12);
    box-shadow: 0 0 0 3px rgba(229, 24, 42, 0.25);
}
.avatar-opt.sel::after, .avatar-opt:has(input:checked)::after {
    content: "\2713";
    position: absolute; top: 6px; right: 8px;
    font-size: 12px; font-weight: 800; color: #fff;
    width: 18px; height: 18px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--red);
}

/* Celda de usuario con avatar + nombre */
.user-cell { display: inline-flex; align-items: center; gap: 12px; text-align: left; }
.user-cell .u-name { font-weight: 700; }
.user-cell .u-name small { display: block; color: var(--faint); font-weight: 600; font-size: 11.5px; }

/* Pill de rol */

/* Pill de rol */
.role { font-weight: 700; font-size: 12px; letter-spacing: .3px; }
.role.admin { color: #ff8189; }
.role.user  { color: var(--muted); }

/* ============================================================
   Botones y enlaces de accion
   ============================================================ */
.miboton {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    transition: .16s;
    cursor: pointer;
    margin: 2px;
}
.miboton:hover {
    background: rgba(47, 125, 255, 0.16);
    border-color: rgba(47, 125, 255, 0.45);
    transform: translateY(-1px);
}

/* Enlaces "pick" dentro de tablas: mas prominentes */
td .miboton { min-width: 96px; }

.enlaceboton,
a.enlaceboton {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 18px auto 0;
    padding: 12px 22px;
    border-radius: 999px;
    font-family: var(--sans);
    font-weight: 700; font-size: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 12px 26px -10px rgba(229, 24, 42, 0.7);
    transition: .18s;
}
.enlaceboton::before { content: "+"; font-size: 18px; line-height: 0; }
.enlaceboton:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -10px rgba(229, 24, 42, 0.8); }

/* Contenedor para centrar CTAs */
form > .enlaceboton, form > a.enlaceboton { display: inline-flex; }

/* Total score chip (gamePicks) */
h2[style] {
    all: unset;
    display: inline-flex !important;
    align-items: center; gap: 10px;
    margin: 6px auto 0 !important;
    padding: 12px 22px !important;
    border-radius: 14px;
    font-family: var(--display);
    font-weight: 700; font-size: 20px; letter-spacing: .5px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), #1b3f8a) !important;
    box-shadow: 0 12px 26px -12px rgba(47, 125, 255, 0.8);
}

/* ============================================================
   Formularios
   ============================================================ */
.group {
    max-width: 560px;
    margin: 0 auto;
}
.group table, form table {
    box-shadow: var(--shadow);
    background: var(--surface);
}
.group table td { border-bottom: 1px solid rgba(255,255,255,0.05); }

.group h2 em, form h2 em {
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
}

label { font-weight: 600; color: var(--muted); font-size: 13.5px; }

.form-input,
input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 11px 13px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-family: var(--sans);
    transition: .16s;
}
.form-input:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--ring);
    background: rgba(0, 0, 0, 0.4);
}
input[readonly], .form-input[readonly] { opacity: .7; cursor: not-allowed; }
select option { background: #0c1222; color: var(--text); }

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a0b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    cursor: pointer;
}

input[type="radio"] { accent-color: var(--red); width: auto; margin-right: 4px; }

/* Ojo para mostrar/ocultar contrasena */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; padding: 0;
    display: grid; place-items: center;
    border: none; background: transparent; color: var(--muted);
    border-radius: 8px; cursor: pointer; transition: .15s;
}
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.pw-toggle svg { width: 19px; height: 19px; }

.form-btn,
input[type="submit"], button[type="submit"] {
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-weight: 700; font-size: 15px; letter-spacing: .3px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 12px 26px -12px rgba(229, 24, 42, 0.7);
    transition: .18s;
}
.form-btn:hover, input[type="submit"]:hover, button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px -12px rgba(229, 24, 42, 0.85);
}

/* ============================================================
   Formularios "pro": tarjeta + campos + controles segmentados
   ============================================================ */
.form-card {
    max-width: 580px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.form-card__head {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.form-card__head .icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center; font-size: 20px;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 8px 18px -8px rgba(229, 24, 42, 0.6);
}
.form-card__head h2 {
    margin: 0; font-size: 19px; text-transform: uppercase; letter-spacing: .8px; color: var(--text);
}
.form-card__head .sub { display: block; font-family: var(--sans); font-size: 12px; color: var(--faint); font-weight: 600; }
.form-card__body { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.form-card__foot {
    display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap;
    padding: 18px 24px; border-top: 1px solid var(--border); background: rgba(0,0,0,.14);
}

.form-card .field { display: block; }
.form-card .field > label { display: block; margin-bottom: 8px; font-size: 13px; letter-spacing: .2px; }
.field__row { display: flex; align-items: center; gap: 12px; }
.field__row .form-input, .field__row select { flex: 1; }
.field__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Vista previa de logo (equipo) */
.logo-preview {
    position: relative;
    width: 40px; height: 40px; flex: 0 0 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.14), rgba(255,255,255,.04));
    border: 1px solid var(--border-2);
    overflow: hidden;
}
.logo-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.logo-preview .ph { font-size: 12px; font-weight: 800; color: var(--muted); }
.logo-preview.lg { width: 64px; height: 64px; flex-basis: 64px; }

/* Calendario (datetime-local) en modo oscuro */
input[type="datetime-local"] { color-scheme: dark; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* Combobox de equipo con logo */
.teamselect { position: relative; width: 100%; }
.teamselect__native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.teamselect__btn {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 40px 8px 9px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    color: var(--text);
    font: inherit; text-align: left; cursor: pointer;
    position: relative;
    transition: .15s;
}
.teamselect__btn::after {
    content: ""; position: absolute; right: 13px; top: 50%;
    width: 14px; height: 14px; transform: translateY(-50%);
    background: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a0b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center/contain;
    transition: transform .18s;
}
.teamselect.open .teamselect__btn::after { transform: translateY(-50%) rotate(180deg); }
.teamselect__btn:focus-visible, .teamselect.open .teamselect__btn {
    outline: none; border-color: var(--blue); box-shadow: var(--ring);
}
.teamselect__menu {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
    max-height: 300px; overflow-y: auto;
    padding: 6px;
    background: #0c1222;
    border: 1px solid var(--border-2);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: none;
}
.teamselect.open .teamselect__menu { display: block; }
.teamselect__opt {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 9px; cursor: pointer;
    font-weight: 600;
}
.teamselect__opt:hover, .teamselect__opt.sel { background: rgba(47, 125, 255, 0.16); }
.teamselect__opt.sel { color: #8fc0ff; }

/* Control segmentado (radios tipo pastilla) */
.segmented {
    display: inline-flex; flex-wrap: wrap; gap: 4px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border-2);
    border-radius: 12px;
}
.segmented label { position: relative; margin: 0; cursor: pointer; }
.segmented input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmented span {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 9px;
    font-size: 13.5px; font-weight: 600; color: var(--muted);
    transition: .15s; white-space: nowrap;
}
.segmented span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }
.segmented input:checked + span {
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 6px 14px -6px rgba(229, 24, 42, 0.6);
}
.segmented input:checked + span::before { opacity: 1; background: #fff; }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

/* Botones del pie de formulario */
.form-card__foot .form-btn, .form-card__foot .btn { width: auto; min-width: 150px; }

/* Boton secundario (ghost) */
.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px; border-radius: 999px;
    font-weight: 700; font-size: 14px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    transition: .16s; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }

@media (max-width: 520px) {
    .form-card__foot { justify-content: stretch; }
    .form-card__foot .form-btn, .form-card__foot .btn, .form-card__foot .btn-ghost { flex: 1; justify-content: center; }
    .segmented { width: 100%; }
    .segmented label { flex: 1; }
    .segmented span { justify-content: center; width: 100%; }
}

/* ============================================================
   Gestion de usuarios: toolbar + tarjetas
   ============================================================ */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    max-width: 960px; margin: 0 auto 22px;
}
.toolbar .search { position: relative; flex: 1; min-width: 200px; }
.toolbar .search input { width: 100%; padding-left: 40px; }
.toolbar .search::before {
    content: ""; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px;
    background: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a0b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat center/contain;
}
.filterbar {
    display: inline-flex; gap: 4px; padding: 4px;
    background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-2); border-radius: 12px;
}
.filterbar button {
    padding: 9px 15px; border: none; background: transparent; color: var(--muted);
    font: inherit; font-weight: 600; font-size: 13px; border-radius: 9px; cursor: pointer; transition: .15s;
}
.filterbar button.is-on { background: linear-gradient(135deg, var(--red), var(--red-2)); color: #fff; }

.ugrid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px;
    max-width: 960px; margin: 0 auto;
}
.ucard {
    display: flex; flex-direction: column; gap: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 18px; box-shadow: var(--shadow);
}
.ucard__top { display: flex; align-items: center; gap: 12px; }
.ucard__name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.ucard__name small { display: block; color: var(--faint); font-weight: 600; font-size: 12px; }
.ucard__id { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 700; }
.ucard__meta { display: flex; gap: 8px; align-items: center; }
.ucard__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.ucard__actions .miboton { flex: 1; min-width: 66px; }

.miboton--ok   { background: rgba(34, 197, 94, 0.14);  border-color: rgba(34, 197, 94, 0.4);  color: #8ef0b4; }
.miboton--ok:hover   { background: rgba(34, 197, 94, 0.24); border-color: rgba(34, 197, 94, 0.6); }
.miboton--warn { background: rgba(245, 165, 36, 0.14); border-color: rgba(245, 165, 36, 0.4); color: #f6bf5e; }
.miboton--warn:hover { background: rgba(245, 165, 36, 0.24); border-color: rgba(245, 165, 36, 0.6); }

/* Tarjetas de partido (matchup) */
.ggrid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px;
    max-width: 1000px; margin: 0 auto;
}
.gcard {
    display: flex; flex-direction: column; gap: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 16px 18px; box-shadow: var(--shadow);
}
.gcard__head {
    display: flex; align-items: center; justify-content: space-between;
    color: var(--muted); font-size: 13px; font-weight: 600;
}
.gcard__date { display: inline-flex; align-items: center; gap: 7px; }
.gcard__match {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
}
.gcard__match .team-btn { width: 100%; }
.gcard__match .team-btn .team-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gcard__vs {
    font-family: var(--display); font-weight: 700; font-size: 12px;
    color: var(--faint); letter-spacing: 1px;
}
.gcard__foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    border-top: 1px solid var(--border); padding-top: 12px;
}
.gcard__foot .spacer { flex: 1; }
.gcard__win { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* Slot de equipo no clickeable (pick cerrado) */
.gcard__team {
    display: flex; align-items: center; width: 100%;
    padding: 8px 10px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
}

/* Trofeo inline sobre el equipo ganador (evita repetir el equipo abajo) */
.win-ico { margin-left: auto; padding-left: 6px; font-size: 13px; line-height: 1; }
.gcard__match .team-btn,
.gcard__match .gcard__team { justify-content: flex-start; }
.gcard__team.is-pick { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.4); }
.gcard__team.is-pick .team-name { color: #8ef0b4; }

/* Pastilla de puntos y candado */
.pts-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
    background: rgba(47, 125, 255, 0.14); border: 1px solid rgba(47, 125, 255, 0.3); color: #8fc0ff;
}
.pts-pill.win { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.35); color: #8ef0b4; }
.gcard__lock { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.gcard__pick { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.gcard__pick .muted { color: var(--faint); }

/* Icono para tarjetas de semana */
.wk-ico {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 13px;
    display: grid; place-items: center; font-size: 21px;
    background: linear-gradient(135deg, var(--blue), #1b3f8a);
    box-shadow: 0 8px 18px -8px rgba(47, 125, 255, 0.6);
}

.empty-msg { text-align: center; color: var(--muted); padding: 40px 0; grid-column: 1 / -1; }

/* Mensajes flash */
.flash {
    max-width: 560px;
    margin: 0 auto 18px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600; font-size: 14px;
    background: rgba(47, 125, 255, 0.12);
    border: 1px solid rgba(47, 125, 255, 0.3);
    color: #bcd4ff;
    text-align: center;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    /* El wrap se conserva por si no hay JavaScript: en ese caso el menu sigue
       en la barra y necesita poder bajar a una segunda fila. Con JS el menu es
       un panel fijo, no ocupa sitio, y la barra se queda en una sola linea. */
    .appbar { flex-wrap: wrap; gap: 12px; }
    .userchip { margin-left: auto; }
}

/* ============================================================
   Menu lateral (movil)
   ------------------------------------------------------------
   Antes el menu se desplegaba hacia abajo y empujaba el contenido, dejando
   la barra en dos filas. Ahora entra como un panel desde la derecha, que es
   de donde sale el boton, y no mueve nada de la pagina.

   El panel (.nav-drawer) vive FUERA de <header class="appbar">, y es a
   proposito: la barra usa backdrop-filter, y un elemento con filtro pasa a
   ser el marco de referencia de sus hijos position:fixed. Metido dentro, el
   panel quedaba encerrado en los 73px de alto de la barra. Ademas la barra
   es sticky con z-index, o sea su propio contexto de apilado, asi que el
   panel tampoco habria podido taparla.

   Los enlaces se declaran una sola vez en menu.php ($navLinks) y se pintan
   en los dos sitios, para que no se desincronicen.
   ============================================================ */

/* Por defecto (pantalla ancha) manda la fila de la barra: ni panel ni capa. */
.nav-drawer,
#nav-backdrop { display: none; }

@media (max-width: 900px) {
    /* Sin JavaScript el boton no puede abrir nada, asi que el menu se queda
       como la fila de siempre: se ve feo pero se puede navegar. */
    .js .nav-top { display: none; }

    .js #menu-toggle {
        display: inline-grid;
        place-items: center;
        width: 42px; height: 42px;
        border-radius: 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        color: #fff;
        font-size: 20px;
        cursor: pointer;
    }

    .js .nav-drawer {
        display: flex;
        flex-direction: column;
        gap: 4px;
        position: fixed;
        top: 0; right: 0; bottom: 0;
        z-index: 120;
        width: min(84vw, 320px);
        margin: 0;
        padding: calc(14px + env(safe-area-inset-top, 0px)) 14px
                 calc(20px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #0d1420;
        border-left: 1px solid var(--border);
        box-shadow: -28px 0 70px -24px rgba(0, 0, 0, 0.8);
        /* visibility (y no display) para poder animar la entrada; de paso saca
           los enlaces del recorrido del teclado mientras esta cerrado. */
        visibility: hidden;
        transform: translateX(100%);
        transition: transform .26s cubic-bezier(.4, 0, .2, 1), visibility .26s;
    }
    .js .nav-drawer.open {
        visibility: visible;
        transform: none;
    }

    .js .nav-drawer a {
        display: block;
        padding: 13px 14px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid transparent;
    }
    .js .nav-drawer a:hover { background: var(--surface); border-color: var(--border); }

    /* "Salir" va al final y separado: es la accion que no se deshace. */
    .js .nav-drawer__salir {
        margin-top: auto;
        color: var(--muted) !important;
        text-align: center;
    }

    .js .nav-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        padding: 4px 4px 12px 10px;
        border-bottom: 1px solid var(--border);
    }
    .nav-head__title {
        font-family: var(--display);
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 2.5px;
        text-transform: uppercase;
        color: var(--faint);
    }
    .nav-close {
        display: grid;
        place-items: center;
        width: 36px; height: 36px;
        border-radius: 10px;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--muted);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }
    .nav-close:hover { color: #fff; }

    .js #nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 110;
        background: rgba(4, 7, 14, 0.62);
        opacity: 0;
        visibility: hidden;
        transition: opacity .26s, visibility .26s;
    }
    .js #nav-backdrop.open { opacity: 1; visibility: visible; }
}

/* Mientras el menu esta abierto no se desplaza el contenido de atras. */
body.nav-abierto { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .js .nav-drawer,
    .js #nav-backdrop { transition: none; }
}

/* --- Móvil: cada fila de la tabla se vuelve una tarjeta --- */
@media (max-width: 680px) {
    .brand .name { font-size: 18px; }
    .userchip .who { display: none; }

    .table-wrap { overflow: visible; }

    table.js-cards {
        display: block;
        width: 100%;
        max-width: 100%;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    table.js-cards tbody { display: block; }
    /* Oculta la fila de encabezado (las etiquetas van en cada celda) */
    table.js-cards tr:first-child { display: none; }

    table.js-cards tr {
        display: block;
        margin: 0 0 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        box-shadow: var(--shadow);
    }

    table.js-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 12px 16px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        text-align: right;
    }
    table.js-cards tr td:last-child { border-bottom: none; }
    table.js-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .6px;
        text-transform: uppercase;
        color: var(--faint);
        text-align: left;
    }
    /* Oculta celdas vacías (pick/ganador sin definir) */
    table.js-cards td:empty { display: none; }

    /* La primera celda (nombre/equipo) como cabecera de la tarjeta */
    table.js-cards td:first-child {
        background: rgba(255, 255, 255, 0.03);
        font-weight: 700;
    }

    /* Botones y chips se alinean a la derecha dentro de la tarjeta */
    table.js-cards td .miboton { margin: 2px 0 2px 4px; }
    table.js-cards td .team { justify-content: flex-end; }

    .enlaceboton, a.enlaceboton { width: calc(100% - 8px); justify-content: center; }
}

@media (max-width: 420px) {
    .container, main { padding-left: 12px; padding-right: 12px; }
    .team-name { max-width: 120px; }
}

/* ============================================================
   HOME — portada estilo app deportiva
   ============================================================ */
.home { display: flex; flex-direction: column; gap: 30px; }

/* --- Encabezado de seccion --- */
.sec__head {
    display: flex; align-items: baseline; gap: 12px;
    margin: 0 0 14px;
}
.sec__head h2 {
    margin: 0; font-size: 17px; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text);
}
.sec__head h2::before {
    content: ""; display: inline-block; width: 4px; height: 15px;
    margin-right: 9px; border-radius: 3px; vertical-align: -2px;
    background: linear-gradient(180deg, var(--red), var(--blue));
}
.sec__head .link {
    margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--muted);
    letter-spacing: .3px;
}
.sec__head .link:hover { color: var(--text); }

/* --- Hero: partido destacado --- */
.hero {
    position: relative; overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--border-2);
    background:
        radial-gradient(700px 320px at 15% 0%, rgba(229,24,42,.20), transparent 62%),
        radial-gradient(700px 320px at 85% 100%, rgba(47,125,255,.20), transparent 62%),
        linear-gradient(160deg, #131b2e, #0b1120);
    box-shadow: var(--shadow);
    padding: clamp(20px, 4vw, 30px);
}
.hero::after {
    content: "\1F3C8"; position: absolute; right: -14px; bottom: -26px;
    font-size: 128px; opacity: .05; transform: rotate(-18deg); pointer-events: none;
}
.hero__kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--sans); font-size: 11px; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase; color: #ff8189;
}
.hero__kicker::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--red); box-shadow: 0 0 0 4px rgba(229,24,42,.2);
}
.hero__teams {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: clamp(10px, 3vw, 26px);
    margin: 20px 0 18px;
}
.hero__team { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.hero__team .team-logo {
    width: clamp(56px, 13vw, 84px); height: clamp(56px, 13vw, 84px);
    flex-basis: auto; border-width: 2px;
}
.hero__team .team-fallback { font-size: 16px; }
.hero__team .nom {
    font-family: var(--display); font-weight: 700; letter-spacing: .5px;
    font-size: clamp(14px, 3.2vw, 20px); text-transform: uppercase; line-height: 1.1;
}
.hero__team .rol { font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; color: var(--faint); text-transform: uppercase; }
.hero__vs {
    font-family: var(--display); font-weight: 700; font-size: clamp(15px, 3.4vw, 22px);
    color: var(--faint); letter-spacing: 1px;
}
.hero__meta {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
    padding-top: 16px; border-top: 1px solid var(--border);
}
.hero__chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
    background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--muted);
}
.hero__cta { margin-left: auto; }
@media (max-width: 560px) { .hero__cta { margin: 6px auto 0; } }

/* --- Rejillas del home --- */
.home-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.home-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .home-2, .home-3 { grid-template-columns: 1fr; } }

/* --- Panel generico --- */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
}
.panel__row {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.panel__row:last-child { border-bottom: none; }
.panel__row:hover { background: rgba(47,125,255,.05); }

/* Fila de partido compacta (proximos / recientes) */
.mini__when {
    flex: 0 0 62px; text-align: center; line-height: 1.15;
    font-size: 11px; font-weight: 700; color: var(--muted);
}
.mini__when b { display: block; font-size: 13px; color: var(--text); }
.mini__teams { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mini__side { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.mini__side .team-logo { width: 22px; height: 22px; flex-basis: 22px; }
.mini__side .pts { margin-left: auto; font-weight: 800; font-size: 14px; color: var(--muted); }
.mini__side.win .pts, .mini__side.win .team-name { color: #8ef0b4; }
.mini__tag {
    flex: 0 0 auto; font-size: 10px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--faint);
}

/* --- Lideres --- */
.lead__head {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 14px; border-bottom: 1px solid var(--border-2);
    background: rgba(255,255,255,.03);
}
.lead__head .ico {
    width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
    font-size: 15px; background: linear-gradient(135deg, var(--blue), #1b3f8a);
}
.lead__head h3 {
    margin: 0; font-family: var(--display); font-size: 15px; letter-spacing: .8px;
    text-transform: uppercase; font-weight: 600;
}
.lead__rank {
    flex: 0 0 18px; font-family: var(--display); font-weight: 700;
    font-size: 14px; color: var(--faint); text-align: center;
}
.lead__who { flex: 1; min-width: 0; }
.lead__who b { display: block; font-size: 13.5px; font-weight: 700; }
.lead__who small { color: var(--faint); font-size: 11px; font-weight: 600; }
.lead__val { text-align: right; }
.lead__val b { display: block; font-size: 15px; font-weight: 800; color: #8fc0ff; line-height: 1.1; }
.lead__val small { font-size: 10px; color: var(--faint); font-weight: 700; letter-spacing: .4px; }
.panel__row.is-first .lead__rank { color: #f6bf5e; }

/* --- Standings --- */
.conf__head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-bottom: 1px solid var(--border-2);
    font-family: var(--display); font-size: 15px; letter-spacing: 1.2px; text-transform: uppercase;
}
.conf__head .tag {
    padding: 3px 10px; border-radius: 999px; font-family: var(--sans);
    font-size: 10.5px; font-weight: 800; letter-spacing: 1px;
}
.conf--afc .tag { background: rgba(229,24,42,.16); color: #ff8189; border: 1px solid rgba(229,24,42,.35); }
.conf--nfc .tag { background: rgba(47,125,255,.16); color: #8fc0ff; border: 1px solid rgba(47,125,255,.35); }
.stand__pos { flex: 0 0 18px; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--faint); text-align: center; }
.stand__rec { display: flex; gap: 5px; margin-left: auto; }
.stand__rec span {
    min-width: 26px; text-align: center; padding: 2px 5px; border-radius: 7px;
    font-size: 12.5px; font-weight: 700;
    background: rgba(255,255,255,.05); border: 1px solid var(--border);
}
.stand__pct { min-width: 42px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--muted); }

/* ============================================================
   Aviso para instalar la app (PWA)
   ============================================================ */
.pwa-prompt {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 140%);
    z-index: 200;
    width: min(440px, calc(100% - 24px));
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(12, 18, 34, 0.94);
    border: 1px solid var(--border-2);
    box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.pwa-prompt.show { transform: translate(-50%, 0); }

.pwa-prompt__ico {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 13px; overflow: hidden;
    box-shadow: 0 8px 18px -8px rgba(229, 24, 42, .6);
}
.pwa-prompt__ico img { width: 100%; height: 100%; display: block; }

.pwa-prompt__txt { flex: 1; min-width: 0; }
.pwa-prompt__txt b {
    display: block; font-size: 14.5px; font-weight: 700; line-height: 1.2;
}
.pwa-prompt__txt small {
    display: block; margin-top: 3px;
    font-size: 12.5px; color: var(--muted); line-height: 1.4;
}

.pwa-prompt__acc { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pwa-prompt__no {
    background: none; border: none; cursor: pointer;
    color: var(--faint); font: inherit; font-size: 12.5px; font-weight: 600;
    padding: 8px 4px;
}
.pwa-prompt__no:hover { color: var(--muted); }
.pwa-prompt__si {
    padding: 9px 16px; border: none; border-radius: 999px; cursor: pointer;
    font: inherit; font-size: 13.5px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 8px 18px -8px rgba(229, 24, 42, .7);
}
.pwa-prompt__si:hover { transform: translateY(-1px); }

/* Variante con instrucciones (iPhone/iPad, que no permite instalar por boton) */
.pwa-prompt--ios { flex-wrap: wrap; }
.pwa-prompt--ios .pwa-prompt__acc { margin-left: auto; }

@media (max-width: 420px) {
    .pwa-prompt { gap: 11px; padding: 12px 13px; }
    .pwa-prompt__ico { width: 40px; height: 40px; flex-basis: 40px; }
    .pwa-prompt__txt b { font-size: 13.5px; }
    .pwa-prompt__txt small { font-size: 11.5px; }
    .pwa-prompt__si { padding: 8px 13px; font-size: 12.5px; }
}

/* ============================================================
   Manual de usuario (dentro de la app)
   ============================================================ */
.man { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

/* Índice de secciones */
.man-idx { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 6px; }
.man-idx a {
    padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    color: var(--muted); background: var(--surface); border: 1px solid var(--border);
    transition: .15s;
}
.man-idx a:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }

/* Bloque de sección */
.man-sec {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; scroll-margin-top: 80px;
}
.man-sec__head {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 18px; border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.man-sec__head .ico {
    width: 34px; height: 34px; flex: none; border-radius: 10px;
    display: grid; place-items: center; font-size: 16px;
    background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border);
}
.man-sec__head h2 {
    margin: 0; font-size: 16px; letter-spacing: .8px; text-transform: uppercase;
}
.man-sec__body { padding: 18px; }
.man-sec__body > *:first-child { margin-top: 0; }
.man-sec__body > *:last-child { margin-bottom: 0; }
.man-sec p { color: var(--muted); font-size: 14.5px; line-height: 1.65; margin: 0 0 12px; }
.man-sec strong { color: var(--text); }
.man-sec h3 {
    font-family: var(--sans); font-size: 14px; font-weight: 700;
    color: var(--text); margin: 20px 0 8px;
}

/* Pasos numerados */
.man-pasos { counter-reset: p; list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.man-pasos li { counter-increment: p; position: relative; padding-left: 38px; }
.man-pasos li::before {
    content: counter(p); position: absolute; left: 0; top: 0;
    width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--red), var(--red-2)); color: #fff;
    font-size: 12px; font-weight: 700;
}
.man-pasos b { display: block; color: var(--text); font-size: 14.5px; }
.man-pasos span { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Aviso destacado */
.man-tip {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55;
    background: rgba(47, 125, 255, .10); border: 1px solid rgba(47, 125, 255, .3);
    color: var(--muted); margin: 14px 0;
}
.man-tip.warn { background: rgba(245, 165, 36, .10); border-color: rgba(245, 165, 36, .32); }
.man-tip.ok   { background: rgba(34, 197, 94, .10);  border-color: rgba(34, 197, 94, .32); }
.man-tip .i { font-size: 16px; line-height: 1.3; flex: none; }
.man-tip b { display: block; color: var(--text); margin-bottom: 2px; }

/* Lista de referencia (señal -> significado) */
.man-ref { display: grid; gap: 0; }
.man-ref > div {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.man-ref > div:last-child { border-bottom: none; }
.man-ref .k { flex: 0 0 132px; }
.man-ref .v { color: var(--muted); font-size: 14px; }

/* Etiqueta de a quién aplica la sección */
.man-who {
    margin-left: auto; flex: none;
    font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(229, 24, 42, .14); border: 1px solid rgba(229, 24, 42, .32); color: #ff8189;
}

/* ============================================================
   Código de invitación con botón de copiar
   ============================================================ */
.codebox {
    display: inline-flex; align-items: stretch; gap: 0;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--border-2); background: rgba(0, 0, 0, 0.28);
    vertical-align: middle;
}
.codebox code {
    display: flex; align-items: center;
    padding: 7px 13px;
    font-family: var(--sans); font-size: 14px; font-weight: 800;
    letter-spacing: 3px; color: var(--text);
    background: none;
}
.copy-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border: none; cursor: pointer;
    border-left: 1px solid var(--border-2);
    background: var(--surface-2); color: var(--muted);
    font: inherit; font-size: 12px; font-weight: 700;
    transition: .15s; white-space: nowrap;
}
.copy-btn:hover { background: rgba(47, 125, 255, 0.18); color: var(--text); }
.copy-btn:focus-visible { outline: none; box-shadow: inset var(--ring); }
.copy-btn svg { width: 14px; height: 14px; flex: none; }
.copy-btn.ok  { background: rgba(34, 197, 94, 0.22);  color: #8ef0b4; }
.copy-btn.err { background: rgba(229, 24, 42, 0.22);  color: #ffb3ba; }

/* Variante grande, para la cabecera del grupo */
.codebox--lg code { font-size: 19px; padding: 10px 18px; letter-spacing: 5px; }
.codebox--lg .copy-btn { padding: 10px 16px; font-size: 13px; }

/* ============================================================
   Botones .miboton dentro de formularios
   La regla global de button[type="submit"] tiene mayor especificidad que
   .miboton, asi que los pintaba rojos y a todo el ancho. Estas reglas van
   al final y con la misma especificidad para devolverles su forma de pastilla.
   ============================================================ */
button.miboton {
    width: auto;
    padding: 7px 14px;
    font-size: 13px; font-weight: 600;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--text);
    box-shadow: none;
}
button.miboton:hover {
    background: rgba(47, 125, 255, 0.16);
    border-color: rgba(47, 125, 255, 0.45);
    transform: translateY(-1px);
}
button.miboton--ok {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.4);
    color: #8ef0b4;
}
button.miboton--ok:hover { background: rgba(34, 197, 94, 0.24); border-color: rgba(34, 197, 94, 0.6); }
button.miboton--warn {
    background: rgba(245, 165, 36, 0.14);
    border-color: rgba(245, 165, 36, 0.4);
    color: #f6bf5e;
}
button.miboton--warn:hover { background: rgba(245, 165, 36, 0.24); border-color: rgba(245, 165, 36, 0.6); }

/* ============================================================
   Grupos a los que pertenece un usuario (tarjeta de Usuarios)
   ============================================================ */
.ucard__grupos { display: flex; flex-wrap: wrap; gap: 6px; }

.gchip {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 3px 4px 3px 10px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    background: rgba(47, 125, 255, 0.13);
    border: 1px solid rgba(47, 125, 255, 0.3);
    color: #8fc0ff;
}
.gchip--none {
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--faint);
}

/* La "x" es un submit, asi que hay que neutralizar el estilo global de boton */
button.gchip__x {
    width: 18px; height: 18px; padding: 0; margin: 0;
    display: grid; place-items: center;
    border: none; border-radius: 50%;
    background: transparent; box-shadow: none;
    color: inherit; opacity: .6;
    font: inherit; font-size: 14px; line-height: 1;
    cursor: pointer;
}
button.gchip__x:hover {
    opacity: 1; transform: none;
    background: rgba(229, 24, 42, 0.35); color: #fff;
}

/* Mientras se guarda un pick en segundo plano: se atenua sin mover nada.
   Solo se activa si la respuesta tarda mas de 400 ms; en una red normal
   no llega a verse nunca, para que no parezca un parpadeo. */
#picksGrid.is-saving { opacity: .55; pointer-events: none; transition: opacity .2s; }

/* El cambio de equipo elegido se hace con una transicion corta en lugar de un
   salto seco, que es lo que se percibia como parpadeo al marcar un pick. */
#picksGrid .team-btn { transition: background-color .18s ease, border-color .18s ease; }
#picksGrid .team-btn .team-name,
#picksGrid .team-btn .team-fallback { transition: color .18s ease; }

@media (prefers-reduced-motion: reduce) {
    #picksGrid.is-saving,
    #picksGrid .team-btn,
    #picksGrid .team-btn .team-name,
    #picksGrid .team-btn .team-fallback { transition: none; }
}
