/* ============================================================
   TIRARCO — app.css
   Componentes específicos de la aplicación (dashboard, tanteo,
   diana virtual, agrupación, actas, estadísticas).
   ============================================================ */

/* ---------- Cabeceras de vista ---------- */
.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-title { font-weight: 800; letter-spacing: -.3px; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Lista de tiradas (dashboard) ---------- */
.session-list { display: flex; flex-direction: column; gap: 12px; }
.session-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
/* Con la letra del móvil ampliada no caben los datos y la puntuación en una
   fila: la puntuación baja a su propia línea (y no los datos a una palabra
   por línea). El ancho mínimo va en em para que crezca con la letra. */
.session-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.session-icon {
    width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%;
    background: #b3de00; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.session-main { flex: 1 1 13em; min-width: 0; }
.session-name-row { display: flex; align-items: center; gap: 6px; }
.session-name { font-weight: 700; font-size: 1.05rem; }
.btn-ghost { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; opacity: .6; }
.btn-ghost:hover { opacity: 1; color: var(--primary); background: var(--bg-alt); }
.session-date { color: var(--primary); font-weight: 600; font-size: .85rem; }
.session-meta { color: var(--muted); font-size: .83rem; }
.session-score { text-align: right; flex-shrink: 0; margin-left: auto; }
/* Etiqueta de estado y «Mejor» en la misma línea, con la etiqueta a la izquierda */
.session-score .score-head { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.session-score .big { font-size: 1.5rem; font-weight: 800; }
.session-score .solo-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.session-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.session-actions .btn { width: 40px; height: 40px; padding: 0; }

/* ---------- Formulario nueva tirada ---------- */
.players-list { display: flex; flex-direction: column; gap: 8px; }
/* Rejilla de arqueros: misma plantilla para cabecera y filas para que
   los títulos queden encolumnados con los campos. */
.archer-grid {
    display: grid; gap: 8px; align-items: center;
    grid-template-columns: 28px minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}
.archer-row-header { display: none; }
.archer-row-header > span { font-size: .75rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.archer-row .drag-handle {
    color: var(--muted); cursor: grab; font-size: 1rem; touch-action: none;
    display: inline-flex; justify-content: center; align-items: center;
}
.archer-row.dragging { opacity: .55; box-shadow: var(--shadow); border-radius: 10px; }
.archer-row .p-extra { min-width: 0; }
/* Icono de selección dentro del campo Nombre */
.pick-name { position: relative; }
.pick-name .form-control { padding-right: 42px; }
.pick-ico {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    border: 0; background: none; color: var(--muted); cursor: pointer;
    padding: 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
}
.pick-ico:hover { color: var(--primary); background: var(--primary-soft); }
.sort-hint { display: inline-flex; align-items: center; gap: 6px; }

@media (min-width: 768px) {
    .archer-row-header { display: grid; }
}

@media (max-width: 767px) {
    /* En móvil: nombre a lo ancho y los demás campos apilados debajo. */
    .archer-grid { grid-template-columns: 28px 1fr; }
    .archer-row .p-extra { grid-column: 2; }
    .sort-hint { display: none; }
}

/* ---------- Tanteo (scorepad) ---------- */
.scorepad-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.participants-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* Franja de tiradores. En el móvil sustituye a las tarjetas: una píldora por
   arquero (puesto, nombre y total) en una sola fila que se desliza de lado,
   para que la serie en curso y el teclado tengan sitio. En tableta y
   ordenador se quedan las tarjetas, que allí sí caben. */
.p-strip { display: none; gap: 8px; overflow-x: auto; padding: 3px 3px 6px; margin: 0 -3px; scrollbar-width: none; }
.p-strip::-webkit-scrollbar { display: none; }
.p-chip {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 999px;
    padding: 5px 12px 5px 6px; font: inherit; font-size: .85rem; color: var(--ink); cursor: pointer;
}
.p-chip .p-rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); color: var(--muted); font-weight: 700; font-size: .72rem; }
.p-chip.top .p-rank { background: var(--accent); color: var(--ink); }
.p-chip .p-name { font-weight: 700; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-chip .p-total { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.p-chip.active-participant { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,96,222,.14); }
@media (max-width: 767px) {
    .p-strip { display: flex; }
    .participants-grid { display: none; }
}
.stat-box {
    background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.stat-box:hover { border-color: var(--border-strong); }
.stat-box.active-participant { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,96,222,.14); }
.stat-box .p-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Puesto en el tablero. El tablero se ordena por total descendente, así que
   el número es lo que deja claro por qué un arquero está donde está. */
.stat-box .p-rank { display: inline-block; min-width: 1.4em; margin-right: 5px; color: var(--muted); font-weight: 600; font-size: .72rem; text-align: right; }
.stat-box .p-rank.top { color: var(--primary); }
.stat-box .stat-line { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.stat-box .stat-line strong { color: var(--primary); }
.stat-badge { display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 999px; background: var(--target-yellow); color: var(--ink); font-weight: 700; font-size: .72rem; }

/* Línea del arquero en turno: nombre a la izquierda y, a la derecha, tanda,
   suma de la tanda y total de la serie en curso. */
.scorepad-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.player-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.player-name { font-weight: 800; color: var(--primary); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorepad-meta { display: flex; gap: 14px; text-align: center; flex: 0 0 auto; }
.scorepad-meta small { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.scorepad-meta b { font-size: 1.3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scorepad-meta .meta-sum b { color: var(--primary); }
@media (max-width: 640px) {
    .scorepad-header .player-name { font-size: 1.25rem; }
}

/* Rejilla de puntuaciones en vivo */
/* Sin tope de altura: la serie en curso se ve entera. La otra serie queda
   plegada en una línea (.series-collapsed) y se abre tocándola. */
.score-grid { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.score-grid table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .85rem; }
.score-grid td, .score-grid th { padding: 7px 4px; text-align: center; border: 1px solid var(--border); }
.score-grid th { background: var(--bg-alt); font-size: .72rem; text-transform: uppercase; color: var(--muted); }
.score-grid td.end-col, .score-grid td.sub-col { background: var(--bg-alt); font-weight: 700; font-size: .78rem; }
.score-grid td.total-col { color: var(--primary); font-weight: 700; }
.score-grid tr.is-current { outline: 2px solid var(--primary); outline-offset: -2px; background: #eef4ff; }
.cell-x, .cell-10 { background: var(--target-yellow); color: var(--ink); font-weight: 700; }
.cell-9 { background: var(--target-yellow); color: var(--ink); font-weight: 700; }
.cell-8, .cell-7 { background: var(--target-red); color: #fff; font-weight: 700; }
.cell-6, .cell-5 { background: var(--target-blue); color: #fff; font-weight: 700; }
.cell-4, .cell-3 { background: var(--target-black); color: #fff; font-weight: 700; }
.cell-2, .cell-1 { background: var(--target-white); color: var(--ink); font-weight: 700; }
.cell-m, .cell-M { background: #9ca3af; color: #fff; font-weight: 700; }
.series-header { background: var(--ink); color: #fff; font-size: .82rem; padding: 8px 14px; border-radius: 10px 10px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.series-header .total { color: #9fd0ff; }
.series-footer { background: var(--bg-alt); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 10px 10px; padding: 8px; display: flex; justify-content: center; gap: 14px; font-size: .8rem; margin-bottom: 10px; }
.series-footer .badge { min-width: 20px; }
.series-collapsed {
    display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px;
    background: var(--bg-alt); border: 0; border-bottom: 1px solid var(--border); padding: 9px 14px;
    font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; text-align: left;
}
.series-collapsed:last-child { border-bottom: 0; }
.series-collapsed b { color: var(--ink); }
.series-collapsed:hover { color: var(--primary); }

/* Flechas actuales */
.arrow-slots { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.arrow-slot {
    width: 55px; height: 55px; border-radius: 12px; border: 1.5px solid var(--border);
    background: var(--bg-alt); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.35rem; color: var(--muted);
}
.arrow-slot.filled { background: #fff; color: var(--ink); }
.arrow-slot.current { border: 2.5px solid var(--primary); background: #fff; color: var(--primary); box-shadow: 0 0 0 3px rgba(1,96,222,.14); }
.arrow-slot.clickable { cursor: pointer; }
.arrow-slot.slot-yellow { background: var(--target-yellow); color: var(--ink); }
.arrow-slot.slot-red { background: var(--target-red); color: #fff; }
.arrow-slot.slot-blue { background: var(--target-blue); color: #fff; }
.arrow-slot.slot-black { background: var(--target-black); color: #fff; }
.arrow-slot.slot-white { background: var(--target-white); color: var(--ink); }
.arrow-slot.slot-miss { background: #9ca3af; color: #fff; }

/* Teclado numérico */
.keypad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.key {
    border: 0; border-radius: 12px; padding: 14px 0; font-size: 1.4rem; font-weight: 800;
    cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); color: var(--ink);
    transition: transform .08s ease, filter .1s ease;
}
.key:active { transform: translateY(1px); box-shadow: none; }
.btn-key-yellow { background: var(--target-yellow); }
.btn-key-red { background: var(--target-red); color: #fff; }
.btn-key-blue { background: var(--target-blue); color: #fff; }
.btn-key-black { background: var(--target-black); color: #fff; }
.btn-key-white { background: var(--target-white); }
.btn-key-miss { background: #6b7280; color: #fff; }
.key.indoor-hide.disabled { opacity: .22; pointer-events: none; }
.keypad.disabled { opacity: .4; pointer-events: none; }

.scoring-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.scoring-actions .btn:nth-child(2) { margin-left: auto; }

/* Aviso de tirada terminada: sustituye al teclado cuando la tirada se cierra. */
.finished-banner {
    display: flex; flex-direction: column; gap: 12px; padding: 14px;
    background: #ecfdf3; border: 1.5px solid #a7e3bf; border-radius: var(--radius-sm);
}
.finished-banner.d-none { display: none; }
.finished-text { display: flex; align-items: flex-start; gap: 10px; }
.finished-text strong { display: block; color: var(--success-dark); }
.finished-ico { color: var(--success); font-size: 1.4rem; line-height: 1; }
.finished-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.finished-actions .btn { flex: 1 1 auto; justify-content: center; }

/* ---------- Diana virtual (SVG) ---------- */
#virtual-target-container {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1/1;
    margin: 65px auto 20px auto;
    touch-action: none;
    overflow: visible;
    user-select: none;
}
#virtual-target-container .target-svg {
    cursor: crosshair;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}
/* Colores oficiales WA (del centro hacia fuera): 9-10 oro, 7-8 rojo,
   5-6 azul, 3-4 negro, 1-2 blanco; X dorado oscuro. */
.ring-1 { fill: var(--target-white); }
.ring-2 { fill: var(--target-white); }
.ring-3 { fill: var(--target-black); }
.ring-4 { fill: var(--target-black); }
.ring-5 { fill: var(--target-blue); }
.ring-6 { fill: var(--target-blue); }
.ring-7 { fill: var(--target-red); }
.ring-8 { fill: var(--target-red); }
.ring-9 { fill: var(--target-yellow); }
.ring-10 { fill: var(--target-yellow); }
.ring-x { fill: #e6b800; }
/* Cara indoor (captura original): oro 0–0,40, rojo 0,40–0,80, azul 0,80–1,0 */
.face-gold { fill: var(--target-yellow); }
.face-red { fill: var(--target-red); }
.face-blue { fill: var(--target-blue); }

/* Lupa (Target Magnifier) idéntica al proyecto original:
   Fija en la parte superior (top: -60px, left: 50%), zoom 4x centrado en el
   punto de impacto y cruz blanca con reborde negro de alto contraste en el centro. */
.target-magnifier {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid #0160de;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
    background-color: #f8f9fa;
    overflow: hidden;
    z-index: 200;
    pointer-events: none;
    display: none;
}
.target-magnifier svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: block;
}
/* Retícula / Cruz central de la lupa con contraste universal */
.target-magnifier::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    z-index: 201;
    line-height: 1;
    pointer-events: none;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 10px rgba(0, 0, 0, 0.85);
}
.target-magnifier.magnifier-visible {
    display: block;
    animation: magnifierIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes magnifierIn {
    from {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Indicador táctil y línea guía de despeje */
.drag-guide-line {
    position: absolute;
    width: 2px;
    background: linear-gradient(to top, rgba(1, 96, 222, 0.2), #0160de);
    z-index: 95;
    pointer-events: none;
    display: none;
}
.touch-target-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(1, 96, 222, 0.6);
    background: rgba(1, 96, 222, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 94;
    pointer-events: none;
    display: none;
}

/* Puntero en forma de gota alargada (SVG) */
.marker-drop {
    position: absolute;
    width: 30px;
    height: 42px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transform: translate(-50%, -2px);
    z-index: 100;
    pointer-events: none;
    transition: transform 0.05s linear;
}
.marker-drop svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
    width: 100%;
    height: 100%;
}
.drag-score-label {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #212529;
    color: #fff;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 16px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 101;
}

/* Marcadores de impacto previos */
.impact-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0160de;
    border: 2px solid #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 5;
}
.impact-marker.current {
    background: #ff007a;
}

/* ---------- Análisis de agrupación ---------- */
.zoom-viewport { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: #eef1f7; }
#grouping-target-container { position: relative; aspect-ratio: 1/1; transform-origin: center; transition: transform .08s ease; }
#grouping-target-container svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.zoom-controls { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.range { flex: 1; accent-color: var(--primary); }
.grouping-marker {
    position: absolute; transform: translate(-50%, -50%);
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,.3); pointer-events: none;
}
.grouping-marker.serie-1 { background: #0160de; }
.grouping-marker.serie-2 { background: #ff007a; }
.grouping-center {
    position: absolute; transform: translate(-50%, -50%);
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(1,96,222,.2); border: 2px dashed var(--primary); pointer-events: none;
}
.grouping-center-label {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    font-size: .6rem; font-weight: 800; color: var(--primary); letter-spacing: .4px; text-transform: uppercase;
    white-space: nowrap;
}
.precision-pill { display: block; width: 100%; background: var(--primary); color: #fff; border-radius: 10px; padding: 10px; font-size: 1rem; font-weight: 700; text-align: center; }

/* ---------- Actas y reportes ---------- */
.print-sheet { background: #fff; color: var(--ink); }

/* Hoja del acta: DINA4 (210 x 330 mm) con la medida exacta que se usa al
   imprimir y al generar el PDF. Al ser un tamaño fijo, la vista previa y el
   papel llevan siempre el mismo maquetado. */
#scorecard-content { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 14px 0 26px; }
/* Vista previa reducida al ancho de la pantalla (reports.js → ajustarActa). */
#scorecard-content .acta-sheet { zoom: var(--acta-escala, 1); }
#scorecard-content.acta-a-tamano .acta-sheet { zoom: 1; }
#scorecard-content.acta-a-tamano { align-items: flex-start; }   /* al dibujar el PDF: la hoja desde el borde, no centrada */
@media print { #scorecard-content .acta-sheet { zoom: 1 !important; } }
.acta-sheet {
    --sheet-pad: 10mm;
    width: 210mm;
    height: 330mm;
    padding: var(--sheet-pad);
    background: #fff;
    color: var(--ink);
    box-shadow: 0 3px 14px rgba(15, 23, 42, .22);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 5mm;
    overflow: hidden;
}
.acta-sheet-grid {
    flex: 1; min-height: 0; display: grid; gap: 5mm;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: max-content; align-content: start;
}
.acta-sheet-foot {
    display: flex; justify-content: space-between; gap: 10mm;
    border-top: 1px solid #dee2e6; padding-top: 2mm;
    font-size: 7pt; line-height: 1.2; color: #6c757d;
}
.acta-sheet-foot > * { min-width: 0; overflow-wrap: anywhere; }

/* Acta con el formato de la app original: cabecera TIRARCO, franja «Serie N»
   y, por arquero, una ficha con sus datos, la tabla de tandas (flechas de
   mayor a menor, suma, total acumulado, 10 y 9), el subtotal y las firmas.
   Las celdas van sin color: solo el valor.
   html2canvas coloca el texto más abajo que el navegador con la altura de
   línea general (1.55): todo el acta va con alturas de línea ajustadas y
   centrado vertical para que el PDF salga igual que la vista previa. */
.acta-sheet, .acta-sheet * { line-height: 1.2; }
.acta-logo { display: flex; align-items: center; justify-content: center; gap: 2mm; font-size: 13pt; font-weight: 800; letter-spacing: .3px; color: #212529; }
.acta-logo img { width: 8mm; height: 8mm; display: inline-block; }
.acta-serie { background: #212529; color: #fff; text-align: center; font-size: 13pt; font-weight: 700; padding: 2mm; border-radius: 1.5mm; }
.acta-ficha { border: 1px solid #ddd; background: #fff; color: #212529; min-width: 0; display: flex; flex-direction: column; }
.acta-ficha-titulo { text-align: center; font-size: 10.5pt; font-weight: 700; text-transform: uppercase; padding: 2mm; border-bottom: 1px solid #dee2e6; overflow-wrap: anywhere; }
.acta-ficha-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 1mm 3mm; padding: 2mm 3mm 1.5mm; font-size: 7.5pt; text-transform: uppercase; }
.acta-ficha-datos > div { min-width: 0; overflow-wrap: anywhere; }
.acta-ficha-datos .todo { grid-column: 1 / -1; }
.acta-ficha-datos .todo:first-child { border-bottom: 1px solid #dee2e6; padding-bottom: 1mm; }
.acta-ficha-datos .et { color: #6c757d; font-size: 6.5pt; }
.acta-ficha-datos strong { color: #000; }
.acta-ficha-datos .arquero { color: #0160de; }
.acta-serie-cab { margin: 0 3mm; background: #6c757d; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 1mm 2mm; font-size: 7.5pt; font-weight: 700; }
.acta-tabla { width: calc(100% - 6mm); margin: 0 3mm; border-collapse: collapse; table-layout: fixed; font-size: 9pt; }
.acta-tabla th, .acta-tabla td { border: 1px solid #dee2e6; text-align: center; vertical-align: middle; padding: 1mm .3mm; overflow: hidden; }
.acta-tabla thead th { background: #f8f9fa; font-size: 7.5pt; font-weight: 700; }
.acta-tabla .num { width: 7%; font-weight: 700; background: #f8f9fa; }
.acta-tabla .fuerte { font-weight: 700; }
.acta-tabla tr.subtotal td { background: #f8f9fa; font-weight: 700; }
.acta-tabla tr.subtotal td.izq { text-align: right; padding-right: 2mm; }
.acta-totales { display: flex; justify-content: center; gap: 3mm; margin: 3mm 3mm 0; padding-top: 2mm; border-top: 1px solid #dee2e6; font-size: 8pt; font-weight: 700; }
.acta-totales .global { color: #0160de; border-left: 1px solid #dee2e6; padding-left: 3mm; }
.acta-firmas { display: flex; gap: 6mm; padding: 9mm 4mm 2mm; margin-top: auto; }
.acta-firmas span { flex: 1; border-top: 1px solid #212529; padding-top: 1mm; text-align: center; font-size: 6.5pt; color: #6c757d; }

.scorecard-block { margin-bottom: 14px; }
.scorecard-header { background: #6b7280; color: #fff; font-size: .8rem; font-weight: 700; padding: 5px 10px; border-radius: 8px 8px 0 0; display: flex; justify-content: space-between; }
.scorecard-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.scorecard-table th, .scorecard-table td { border: 1px solid var(--border-strong); padding: 6px 4px; text-align: center; }
.scorecard-table th { background: var(--bg-alt); font-size: .7rem; }
.scorecard-table td.lbl { background: var(--bg-alt); font-weight: 700; text-align: center; }
/* Pie de cada serie: cuántas X, 10 y 9 lleva esa serie */
.scorecard-table td.serie-cuenta { background: var(--bg-alt); font-weight: 700; }
.scorecard-player-card { border: 1px solid #cdd8e8; border-radius: 10px; overflow: hidden; margin-bottom: 16px; background: #fff; }
.scorecard-player-head { padding: 8px 12px; text-align: center; font-weight: 800; text-transform: uppercase; border-bottom: 1px solid #e5eaf2; font-size: .95rem; }
.scorecard-total-line { display: flex; justify-content: center; gap: 14px; font-weight: 700; font-size: .8rem; padding: 8px 0; border-top: 1px solid var(--border); }

/* Reporte visual */
.report-header { text-align: center; border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 26px; }
.report-target-box { max-width: 560px; margin: 0 auto 30px; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff; }
.report-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 700px) { .report-grid { grid-template-columns: 1fr 1fr; } }
.report-target-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: #fff; text-align: center; }
.report-target-svg-container svg, .report-target-box svg { width: 100%; height: auto; display: block; }
.page-break-after { page-break-after: always; }

/* ---------- Estadísticas ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { padding: 18px; text-align: center; }
.stat-card h6 { text-transform: uppercase; font-size: .72rem; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.stat-card h3 { font-size: 1.7rem; font-weight: 800; margin: 0; }
.chart-box { height: 320px; position: relative; }
/* El canvas debe ocupar la caja: sin tamaño propio mide 300x150 y la
   gráfica sale diminuta dentro del hueco. */
.chart-box canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 640px) {
    .chart-box { height: 240px; }
}

/* Botón flotante de instalación PWA en la app */
.pwa-hint {
    position: fixed; right: 16px; bottom: calc(16px + var(--safe-bottom)); z-index: 1500;
    background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; font-size: .85rem;
    cursor: pointer; border: 0;
}
.pwa-hint:hover { filter: brightness(1.15); }

/* Copia en la nube (views/cloud.js) */
.cloud-body p { margin: 0 0 12px; }
.cloud-state { display: flex; align-items: center; gap: 8px; }
.cloud-state svg { color: var(--primary); flex: 0 0 auto; }
.cloud-auto { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 16px; cursor: pointer; font-size: .92rem; }
.cloud-auto input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-login { margin: 4px 0 12px; }
.cloud-login .form-control { margin-bottom: 12px; }
.update-bar .btn-outline { background: transparent; }

/* Aviso de versión nueva en la app instalada (update.js). */
.update-bar {
    position: fixed; z-index: 1500; left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-width: 520px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
    background: var(--ink); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .88rem;
}
.update-bar .update-text { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.update-bar .btn { flex: 0 0 auto; }

/* Enlace a la web de presentación */
.footer-site-link { display: block; text-align: center; margin-top: 28px; font-size: .82rem; color: var(--muted); }
.footer-site-link a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.footer-site-link a:hover { color: var(--primary); }

@media (max-width: 640px) {
    .keypad { grid-template-columns: repeat(6, 1fr); gap: 6px; }
    .key { padding: 12px 0; font-size: 1.2rem; border-radius: 10px; }
    .session-score .big { font-size: 1.25rem; }
    /* Móvil: la puntuación bajo los datos, a todo el ancho, en vez de una
       columna a la derecha que deja los datos estrujados:
         [Finalizada]                MEJOR 522
                          Nombre del arquero          */
    .session-score {
        flex: 1 1 100%; display: grid; grid-template-columns: auto 1fr auto;
        align-items: center; column-gap: 8px; text-align: right;
    }
    .session-score .score-head { display: contents; }
    .session-score .badge { grid-column: 1; grid-row: 1; justify-self: start; }
    .session-score .solo-label, .session-score .score-head > .muted { grid-column: 2; grid-row: 1; justify-self: end; }
    .session-score .big { grid-column: 3; grid-row: 1; line-height: 1.1; }
    .session-score .small { grid-column: 1 / -1; grid-row: 2; }
    .score-grid td, .score-grid th { padding: 4px; }
    .score-grid th { font-size: .66rem; }
}

/* Marca de líder en la clasificación de tanteo (trofeo dorado) */
.leader-mark .icon-inline { color: var(--warning); vertical-align: -0.14em; margin-right: 2px; }

/* Listado de tiradores en el móvil: una ficha por tirador (nombre, datos en
   una línea y los botones debajo) en vez de una tabla que no cabe. */
@media (max-width: 640px) {
    .shooters-table thead { display: none; }
    .shooters-table, .shooters-table tbody, .shooters-table tr { display: block; width: 100%; }
    .shooters-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
    .shooters-table tr:last-child { border-bottom: 0; }
    .shooters-table td { display: block; padding: 0; border: 0; }
    .shooters-table td.sh-name { font-size: 1.05rem; margin-bottom: 2px; }
    .shooters-table td.sh-meta { display: inline; color: var(--muted); font-size: .88rem; }
    .shooters-table td.sh-meta::before { content: attr(data-label) ': '; }
    .shooters-table td.sh-meta + td.sh-meta::before { content: ' · ' attr(data-label) ': '; }
    .shooters-table td.sh-acts { margin-top: 10px; }
    .shooters-table td.sh-acts .d-flex { justify-content: flex-start; }
}

/* Estadísticas del tirador en el móvil: resumen en una fila y cada tirada en
   dos líneas (sesión y puntos; debajo fecha, modalidad, 10 y 9). */
@media (max-width: 640px) {
    #shooterStatsModal .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    #shooterStatsModal .stat-card { padding: 10px 6px; }
    #shooterStatsModal .stat-card h6 { font-size: .68rem; }
    #shooterStatsModal .stat-card h3 { font-size: 1.3rem; }
    .history-table thead { display: none; }
    .history-table, .history-table tbody { display: block; }
    .history-table tr { display: flex; flex-wrap: wrap; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--border); }
    .history-table tr:last-child { border-bottom: 0; }
    .history-table td { display: block; padding: 0; border: 0; text-align: left; }
    .history-table .h-ses { order: 1; flex: 0 0 calc(100% - 64px); font-weight: 700; }
    .history-table .h-total { order: 2; flex: 0 0 64px; text-align: right; font-size: 1.05rem; }
    .history-table .h-date, .history-table .h-dist, .history-table .h-n { order: 3; color: var(--muted); font-size: .8rem; }
    .history-table .h-date::after, .history-table .h-dist::after { content: ' · '; white-space: pre; }
    .history-table .h-n::before { content: attr(data-label) 's: '; }
    .history-table .h-n + .h-n::before { content: ' · ' attr(data-label) 's: '; white-space: pre; }
}
