/* Golfers — estilos compartidos */
:root {
  --navy: #12314A;
  --navy-2: #0C2336;
  --teal: #1E6E78;
  --green: #3F7A2A;
  --green-light: #A9D18E;
  --cream: #F5F2EA;
  --line: #E4DFD3;
  --muted: #4A6275;
  --muted-2: #5A6470;
  --white: #FFFFFF;
  --red: #B3261E;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Montserrat', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--cream); color: var(--navy); -webkit-font-smoothing: antialiased; line-height: 1.4; }
a { color: var(--teal); }
a:hover { color: var(--navy); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Encabezado */
.top { background: var(--navy); color: var(--white); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top .logo { width: 48px; height: 48px; border-radius: 12px; background: var(--cream); object-fit: cover; flex: none; }
.top .titulo { display: flex; flex-direction: column; gap: 1px; flex: 1 1 180px; min-width: 0; }
.top .marca { font-family: var(--display); font-weight: 800; letter-spacing: .05em; font-size: 17px; }
.top .sub { font-size: 13px; color: #C9D6DE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.top nav a { color: var(--white); text-decoration: none; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 999px; border: 1px solid #3A5A72; }
.top nav a[aria-current="page"] { background: var(--teal); border-color: var(--teal); }
.en-vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--green-light); letter-spacing: .08em; }
.en-vivo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green-light); animation: pulso 2s infinite; }
.en-vivo.cerrado { color: #C9D6DE; }
.en-vivo.cerrado::before { background: #C9D6DE; animation: none; }
@keyframes pulso { 50% { opacity: .35; } }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
.wrap-m { max-width: 560px; margin: 0 auto; padding: 16px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--navy); background: var(--white); color: var(--navy); font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #EEF2F4; color: var(--navy); }
.btn.prim { background: var(--teal); border-color: var(--teal); color: var(--white); }
.btn.prim:hover { background: #185A62; }
.btn.verde { background: var(--green); border-color: var(--green); color: var(--white); }
.btn.verde:hover { background: #336422; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn.peligro { border-color: var(--red); color: var(--red); }
.btn.grande { min-height: 54px; font-size: 17px; border-radius: 14px; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icono { width: 48px; height: 48px; padding: 0; border-radius: 12px; }

/* Tarjetas y formularios */
.card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.g3 .campo input, .g3 .campo select { min-width: 0; width: 100%; }
.grupos-lista { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea { min-height: 44px; padding: 8px 12px; border: 1px solid #C9D2D9; border-radius: 8px; background: var(--white); color: var(--navy); font-weight: 400; font-size: 15px; }
.campo small { font-weight: 400; color: var(--muted-2); }
.fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.entre { justify-content: space-between; }
.nota { font-size: 13px; color: var(--muted-2); margin: 8px 0 0; }
.aviso { padding: 12px 14px; border-radius: 10px; background: #FFF4D6; color: #6B4E00; font-size: 14px; }
.aviso.ok { background: #E3F0DC; color: #2E5E1E; }
.aviso.error { background: #FCE4E2; color: #8A1C15; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi span:first-child { font-size: 13px; color: var(--muted); }
.kpi strong { font-family: var(--display); font-size: 28px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #EFEDE7; color: var(--muted-2); }
.chip.si { background: #E3F0DC; color: #2E5E1E; }
.chip.azul { background: #DDEDEF; color: #155159; }

/* Tablas */
.tabla-box { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 10px; white-space: nowrap; }
table.t td { padding: 9px 10px; border-top: 1px solid #ECE8DE; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t input, table.t select { min-height: 38px; padding: 4px 8px; border: 1px solid #C9D2D9; border-radius: 6px; width: 100%; font-size: 14px; background: var(--white); }
table.t input.corto { width: 70px; }

/* Pestañas */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--navy-2); padding: 4px; border-radius: 12px; }
.tabs button { min-height: 44px; border-radius: 9px; border: none; background: transparent; color: #C9D6DE; font-weight: 600; font-size: 15px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--white); color: var(--navy); font-weight: 700; }
.tabs-claro { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tabs-claro button { border: none; background: none; padding: 12px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: 15px; }
.tabs-claro button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--teal); }

/* Tablero */
.lb-head, .lb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 54px 56px 60px; gap: 6px; align-items: center; }
.lb-head { padding: 12px 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-row { background: var(--white); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; text-decoration: none; color: var(--navy); }
.lb-row:hover { color: var(--navy); background: #FBFAF6; }
.lb-row.top3 { box-shadow: inset 0 0 0 2px var(--teal); }
.lb-pos { font-family: var(--display); font-weight: 800; font-size: 17px; }
.lb-nom { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lb-nom b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-nom small { font-size: 12px; color: var(--muted); }
.lb-c { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.lb-g { text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.lb-p { text-align: right; font-family: var(--display); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.bajo { color: var(--red); }
.r-c { text-align: center; }
.r { text-align: right; }

/* Modo TV */
body.tv .wrap { max-width: none; padding: 24px 40px; }
body.tv .top-in { max-width: none; padding: 12px 40px; }
body.tv .lb-head, body.tv .lb-row { grid-template-columns: 90px minmax(0, 1fr) 120px 120px 140px; }
body.tv .lb-row { padding: 16px 20px; }
body.tv .lb-pos, body.tv .lb-p { font-size: 32px; }
body.tv .lb-nom b { font-size: 28px; }
body.tv .lb-nom small { font-size: 16px; }
body.tv .lb-c, body.tv .lb-g { font-size: 24px; }
body.tv .lb-head { font-size: 16px; }
.tv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 32px; }

/* Score del grupo */
.hoyo-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hoyo-num { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hoyo-num .et { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--green-light); font-weight: 600; }
.hoyo-num .n { font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1; }
.hoyo-num .p { font-size: 13px; color: #C9D6DE; }
.btn-nav { width: 52px; height: 52px; border-radius: 12px; border: 1px solid #3A5A72; background: transparent; color: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-nav.sig { background: var(--teal); border-color: var(--teal); }
.jug-score { background: var(--white); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.jug-score .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jug-score .info b { font-weight: 600; font-size: 16px; }
.jug-score .info small { font-size: 13px; color: var(--muted); }
.paso { width: 48px; height: 48px; border-radius: 12px; border: 1px solid #C9D2D9; background: var(--white); font-size: 26px; font-weight: 600; line-height: 1; cursor: pointer; color: var(--navy); }
.paso.mas { background: var(--navy); border-color: var(--navy); color: var(--white); }
.golpes { width: 48px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 32px; font-variant-numeric: tabular-nums; }
.golpes.vacio { color: #B7C2CA; }
.recorrido { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.recorrido button { height: 36px; border-radius: 8px; border: 1px solid #C9D2D9; background: var(--white); color: var(--muted); font-size: 13px; font-weight: 600; padding: 0; cursor: pointer; }
.recorrido button.listo { background: var(--teal); border-color: var(--teal); color: var(--white); }
.recorrido button.parcial { background: #DDEDEF; border-color: #9CC5CA; color: #155159; }
.recorrido button.actual { border: 2px solid var(--navy); background: var(--white); color: var(--navy); }
.estado-sync { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #2E5E1E; min-height: 20px; }
.estado-sync.pend { color: #8A5A00; }
.estado-sync.err { color: var(--red); }

/* Tarjeta hoyo por hoyo */
.scorecard { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { padding: 6px 4px; text-align: center; border-top: 1px solid #ECE8DE; }
.scorecard th { font-size: 12px; color: var(--muted); font-weight: 600; }
.scorecard td.l, .scorecard th.l { text-align: left; }
.sc-b { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; }
.sc-birdie { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--red); color: var(--red); font-weight: 700; }
.sc-eagle { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 4px var(--white), inset 0 0 0 6px var(--red); color: var(--red); font-weight: 700; }
.sc-bogey { box-shadow: inset 0 0 0 1.5px var(--navy); }
.sc-doble { box-shadow: inset 0 0 0 1.5px var(--navy), inset 0 0 0 3.5px var(--white), inset 0 0 0 5px var(--navy); }

/* Polla */
.premio { background: var(--white); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.premio .med { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--white); font-family: var(--display); font-weight: 800; font-size: 17px; flex: none; }
.premio .q { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.premio .q b { font-weight: 600; font-size: 16px; }
.premio .q small { font-size: 13px; color: var(--muted); }
.premio .m { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.premio .m b { font-family: var(--display); font-weight: 800; font-size: 20px; }
.premio .m small { font-size: 12px; color: var(--muted); }

/* Inicio */
.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 28px 16px 8px; }
.hero img { width: 220px; height: 220px; border-radius: 24px; object-fit: cover; }
.acciones { display: flex; flex-direction: column; gap: 12px; max-width: 420px; margin: 18px auto 0; }

/* Diálogo */
dialog { border: none; border-radius: 16px; padding: 0; max-width: min(720px, 94vw); width: 100%; color: var(--navy); }
dialog::backdrop { background: rgba(12, 35, 54, .55); }
dialog .dlg-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
dialog .dlg-b { padding: 16px 20px; max-height: 70vh; overflow: auto; }
dialog .dlg-f { padding: 12px 20px 16px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }

@media (max-width: 520px) {
  .wrap { padding: 14px; }
  .card { padding: 14px; }
  .lb-head, .lb-row { grid-template-columns: 38px minmax(0, 1fr) 44px 46px 50px; }
  .scorecard { font-size: 12.5px; }
  .scorecard th, .scorecard td { padding: 5px 1px; }
  .scorecard td.l, .scorecard th.l { padding-right: 4px; }
  .sc-b { width: 22px; height: 22px; }
}
@media print {
  .top nav, .no-print { display: none !important; }
  body { background: white; }
}
