/* Identidad Somax: verde de las hojas, dorado del sol y café de la tierra del logo. */
:root {
  --somax: #038C33;
  --somax-dark: #026B27;
  --somax-deep: #0B3D1E;
  --somax-soft: #E7F4EB;
  --gold: #F2B704;
  --gold-soft: #FFF6D6;
  --earth: #5A3A1B;
  --bg: #F4F6F3;
  --card: #FFFFFF;
  --text: #15201A;
  --sub: #5D6B62;
  --line: #E1E6E2;
  --danger: #C62828;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 40, 24, .08), 0 6px 18px rgba(16, 40, 24, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; padding-bottom: 84px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.grow { flex: 1; }
button { font: inherit; cursor: pointer; }

/* Barra superior */
.topbar { background: var(--somax); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 10px; height: 56px; }
.brand { height: 26px; display: block; }
.brand-sep { width: 1px; height: 22px; background: rgba(255,255,255,.4); }
.brand-app { color: #fff; font-weight: 800; letter-spacing: .5px; font-size: 15px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--earth);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.topbar .link-btn { color: #fff; }
.link-btn { background: none; border: 0; color: var(--somax); font-weight: 700; font-size: 13px; padding: 6px 2px; }
.link-btn.center { display: block; margin: 12px auto 0; }

/* Barra de la demo */
.demo-bar { background: var(--gold-soft); border-bottom: 1px solid #EBD58A; font-size: 12.5px; color: var(--earth); }
.demo-in { display: flex; align-items: center; gap: 8px; min-height: 36px; flex-wrap: wrap; }
.demo-in strong { background: var(--gold); padding: 2px 7px; border-radius: 6px; font-size: 11px; letter-spacing: .5px; }
.demo-in .link-btn { color: var(--earth); margin-left: auto; text-decoration: underline; }
.demo-tools { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; }
.chip {
  background: #fff; border: 1px solid #E2CB7C; color: var(--earth); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
}

/* Portada del partido */
/* Mitad Real Madrid (blanco, azul y dorado) y mitad RB Leipzig (rojo, azul marino y blanco) */
.hero { --rm-navy: #1B1F5E; --rm-gold: #C9A227; --rbl-red: #DD0741; --rbl-navy: #0C2043; color: #fff; text-align: center; }
.split { position: relative; height: clamp(190px, 46vw, 320px); overflow: hidden; background: #fff; }
.half { position: absolute; inset: 0; display: flex; align-items: center; }
.half.home { justify-content: flex-start; padding-left: 4%; clip-path: polygon(0 0, 55% 0, 45% 100%, 0 100%); }
.half.away { justify-content: flex-end; padding-right: 4%; background: var(--rbl-red); clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%); }
.tname {
  width: 37%; font-weight: 900; text-transform: uppercase; line-height: 1.02;
  font-size: clamp(24px, 7.6vw, 64px); letter-spacing: -.5px; text-align: center;
}
.home .tname { color: var(--rm-navy); }
.away .tname { color: #fff; }
/* Franjas diagonales en el corte */
.slash {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right,
    transparent calc(50% - 30px), var(--rm-navy) calc(50% - 30px), var(--rm-navy) calc(50% - 26px),
    #fff calc(50% - 26px), #fff calc(50% - 20px), var(--rm-gold) calc(50% - 20px), var(--rm-gold) calc(50% - 12px),
    transparent calc(50% - 12px), transparent calc(50% + 10px), var(--rbl-navy) calc(50% + 10px),
    var(--rbl-navy) calc(50% + 20px), transparent calc(50% + 20px), transparent calc(50% + 28px),
    #fff calc(50% + 28px), #fff calc(50% + 33px), transparent calc(50% + 33px));
  transform: skewX(-12deg);
}
.vs {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: clamp(64px, 17vw, 104px); aspect-ratio: 1; border-radius: 50%;
  background: var(--rbl-navy); border: 4px solid var(--rm-gold); box-shadow: 0 6px 20px rgba(0,0,0,.3);
  display: grid; place-items: center; font-weight: 900; font-size: clamp(22px, 6vw, 36px); color: #fff;
}
.vs.final { font-size: clamp(18px, 5vw, 30px); white-space: nowrap; }
.hero-bar { background: var(--somax-deep); border-top: 5px solid var(--somax); padding: 14px 16px 4px; }
.comp { font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; opacity: .85; margin-bottom: 4px; }
.when { font-size: 13px; line-height: 1.5; opacity: .92; }
.when b { color: var(--gold); }
.status { margin: 12px auto 14px; display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.status.closed .dot { background: #FF6B6B; }
.status.final .dot { background: #fff; }
.countdown { font-variant-numeric: tabular-nums; }

/* Tarjetas */
main { padding-top: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
.card h2 { font-size: 18px; font-weight: 800; }
.card h3 { font-size: 14px; font-weight: 800; margin: 14px 0 4px; }
.card h3:first-child { margin-top: 0; }
.card p { font-size: 14px; line-height: 1.5; color: var(--sub); }
.card a { color: var(--somax); font-weight: 700; }
.sub { margin: 4px 0 16px; }

/* Formulario */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg-btn { border: 0; background: none; border-radius: 9px; padding: 9px; font-weight: 700; color: var(--sub); font-size: 14px; }
.seg-btn.active { background: #fff; color: var(--somax-dark); box-shadow: var(--shadow); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12.5px; font-weight: 700; color: var(--sub); margin-bottom: 5px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font: inherit; font-size: 16px; background: #fff; color: var(--text);
}
.field input:focus, .goal-input:focus { outline: none; border-color: var(--somax); box-shadow: 0 0 0 3px var(--somax-soft); }
.error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; margin: 4px 0 8px; }

.btn { border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 800; font-size: 15px; }
.btn.block { display: block; width: 100%; }
.btn.primary { background: var(--somax); color: #fff; }
.btn.primary:active { background: var(--somax-dark); }
.btn.primary:disabled { background: #A9C7B3; cursor: not-allowed; }
.btn.ghost { background: var(--bg); color: var(--sub); border: 1px solid var(--line); }
.btn.whatsapp { background: #fff; color: var(--somax-dark); border: 1.5px solid var(--somax); margin-bottom: 14px; }
.row { display: flex; gap: 10px; }

/* Selector de marcador */
.picker { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 6px 0 8px; }
.pk-team { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pk-name { font-weight: 800; font-size: 14px; text-align: center; }
.pk-x { font-size: 20px; color: var(--sub); font-weight: 700; padding-top: 26px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.step {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  font-size: 22px; font-weight: 700; color: var(--somax-dark); display: grid; place-items: center; line-height: 1;
}
.step:active { background: var(--somax-soft); }
.step:disabled { opacity: .35; cursor: not-allowed; }
.goal {
  width: 58px; height: 64px; border-radius: 14px; background: var(--somax-soft); color: var(--somax-deep);
  display: grid; place-items: center; font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums;
}
.locked .goal { background: var(--bg); color: var(--text); }
.goal-input {
  width: 72px; height: 60px; border: 1.5px solid var(--line); border-radius: 14px; text-align: center;
  font: inherit; font-size: 28px; font-weight: 900; color: var(--text);
}
.saved { margin-top: 14px; background: var(--somax-soft); color: var(--somax-deep); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.45; }
.mine-result { margin-top: 12px; border-radius: 12px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--gold-soft); }
.mine-result .pts { font-size: 26px; font-weight: 900; color: var(--earth); }

/* Ranking */
.rank { list-style: none; }
.rank li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 12px 4px; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rank li.me { background: var(--somax-soft); border-radius: 12px; border-top-color: transparent; padding-left: 8px; padding-right: 8px; }
.rank .pos { font-weight: 900; font-size: 15px; color: var(--sub); text-align: center; }
.rank .pos.top { font-size: 20px; }
.rank .who { min-width: 0; }
.rank .name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .det { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.rank .score { text-align: right; }
.rank .score b { font-size: 20px; font-weight: 900; color: var(--somax-dark); display: block; }
.rank .score small { font-size: 11px; color: var(--sub); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 2px 6px; margin-left: 4px; }
.tag.exact { background: var(--gold); color: var(--earth); }
.tag.draw { background: #DCEBFF; color: #1D4E89; }
.tag.winner { background: var(--somax-soft); color: var(--somax-deep); }
.tag.miss { background: var(--bg); color: var(--sub); }
.empty { text-align: center; padding: 18px 8px; color: var(--sub); font-size: 14px; line-height: 1.5; }
.empty .big { font-size: 36px; font-weight: 900; color: var(--somax); display: block; }

/* Reglas */
.rules { display: grid; gap: 10px; }
.rule { display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.rule .p { background: var(--somax); color: #fff; border-radius: 10px; text-align: center; padding: 8px 0; font-weight: 900; font-size: 20px; line-height: 1; }
.rule .p small { display: block; font-size: 10px; font-weight: 700; opacity: .85; margin-top: 2px; }
.rule:nth-child(2) .p { background: var(--gold); color: var(--earth); }
.rule:nth-child(3) .p { background: var(--earth); }
.rule:nth-child(4) .p { background: var(--bg); color: var(--sub); }
.rule b { font-size: 14px; }
.rule span { display: block; font-size: 12.5px; color: var(--sub); margin-top: 2px; }

/* Tabla admin */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--sub); font-weight: 700; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }

/* Navegación inferior */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; max-width: 140px; border: 0; background: none; padding: 9px 4px 10px; color: var(--sub);
  font-size: 11.5px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-btn span { font-size: 20px; filter: grayscale(1); opacity: .6; }
.nav-btn.active { color: var(--somax-dark); }
.nav-btn.active span { filter: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--somax-deep); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 700;
  transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

