/* Bowling Tracker — estilos aislados dentro de .bt-app */
.bt-app {
  --bt-bg: #f6f4ef;
  --bt-card: #ffffff;
  --bt-ink: #1d2230;
  --bt-muted: #6b7080;
  --bt-line: #dcd8cf;
  --bt-accent: #c2410c;
  --bt-accent-ink: #ffffff;
  --bt-wood: #e9d3ac;
  --bt-wood-2: #e2c799;
  --bt-sel: #c2410c;
  --bt-ok: #15803d;
  --bt-radius: 12px;
  background: var(--bt-bg);
  color: var(--bt-ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px;
  border-radius: var(--bt-radius);
  box-sizing: border-box;
}
.bt-app *, .bt-app *::before, .bt-app *::after { box-sizing: border-box; }
.bt-app h2, .bt-app h3 { margin: 0; line-height: 1.2; color: var(--bt-ink); }
.bt-app h2 { font-size: 22px; }
.bt-app h3 { font-size: 17px; }
.bt-app small { font-size: 12px; color: var(--bt-muted); font-weight: 400; }
.bt-muted { color: var(--bt-muted); font-size: 13px; }

.bt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bt-head-info { display: flex; flex-direction: column; min-width: 0; }
.bt-head-info .bt-muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-section { margin: 18px 0 8px !important; }

.bt-card {
  background: var(--bt-card);
  border: 1px solid var(--bt-line);
  border-radius: var(--bt-radius);
  padding: 14px;
  margin-bottom: 12px;
}

/* Formularios */
.bt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.bt-grid .bt-wide { grid-column: 1 / -1; }
.bt-app label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--bt-muted); }
.bt-app input:not([type=checkbox]):not([type=radio]), .bt-app select {
  font: inherit; color: var(--bt-ink); background: #fff;
  border: 1px solid var(--bt-line); border-radius: 8px; padding: 10px; min-height: 44px; width: 100%;
}

/* Botones */
.bt-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--bt-line); background: #fff; color: var(--bt-ink);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bt-btn:disabled { opacity: .55; cursor: default; }
.bt-btn.bt-primary { background: var(--bt-accent); border-color: var(--bt-accent); color: var(--bt-accent-ink); }
.bt-btn.bt-ghost { background: transparent; }
.bt-btn.bt-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.bt-btn.bt-on { background: var(--bt-ink); color: #fff; border-color: var(--bt-ink); }
.bt-new .bt-primary { width: 100%; }
.bt-link { background: none; border: 0; color: var(--bt-muted); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 8px; }
.bt-del-game { text-align: center; margin: 4px 0 0; }

.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bt-chip {
  font: inherit; font-size: 14px; cursor: pointer; min-height: 38px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--bt-line); background: #fff; color: var(--bt-ink);
  touch-action: manipulation;
}
.bt-chip.bt-on { background: var(--bt-sel); border-color: var(--bt-sel); color: #fff; }
.bt-chip.bt-pocket:not(.bt-on) { border-color: var(--bt-sel); color: var(--bt-sel); font-weight: 600; }
.bt-chip.bt-open { border-style: dashed; }
.bt-chip.bt-add { color: var(--bt-accent); border-color: var(--bt-accent); }
.bt-chip.bt-del { color: var(--bt-muted); margin-left: auto; }

/* Sesiones */
.bt-sesion-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.bt-prom { text-align: right; font-size: 12px; color: var(--bt-muted); line-height: 1.1; }
.bt-prom span { display: block; font-size: 24px; font-weight: 700; color: var(--bt-ink); }

/* Tarjeta de puntaje */
.bt-score {
  display: grid; grid-template-columns: repeat(9, 1fr) 1.45fr; gap: 0;
  background: var(--bt-card); border: 1px solid var(--bt-ink); border-radius: 8px; overflow: hidden; margin-bottom: 12px;
}
.bt-frame { border-right: 1px solid var(--bt-line); text-align: center; min-width: 0; }
.bt-frame.bt-f10 { border-right: 0; }
.bt-frame.bt-cur { background: #fff3e6; }
.bt-fn { font-size: 11px; color: var(--bt-muted); border-bottom: 1px solid var(--bt-line); padding: 2px 0; }
.bt-balls { display: flex; justify-content: flex-end; height: 22px; }
.bt-balls span {
  width: 50%; max-width: 22px; border-left: 1px solid var(--bt-line); border-bottom: 1px solid var(--bt-line);
  font-size: 13px; font-weight: 700; line-height: 21px;
}
.bt-f10 .bt-balls span { width: 33.3%; }
.bt-f10 .bt-balls span:first-child { border-left: 0; }
.bt-balls span:empty::after { content: "\00a0"; }
.bt-ft { font-size: 15px; font-weight: 700; height: 26px; line-height: 26px; }
.bt-total {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-top: 1px solid var(--bt-ink); background: var(--bt-ink); color: #fff;
}
.bt-total strong { font-size: 20px; }
.bt-split {
  font-style: normal; display: inline-block; width: 18px; height: 18px; line-height: 16px;
  border: 1.5px solid var(--bt-accent); border-radius: 50%; font-size: 11px;
}
.bt-split-tag { font-style: normal; font-size: 11px; font-weight: 700; color: var(--bt-accent); border: 1px solid var(--bt-accent); border-radius: 4px; padding: 0 4px; }

/* Captura */
.bt-capture-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.bt-app .bt-switch { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--bt-ink); cursor: pointer; }
.bt-switch input { width: 18px; height: 18px; }
.bt-field { padding: 12px 0; border-top: 1px solid var(--bt-line); }
.bt-field:first-of-type { border-top: 0; }
.bt-field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.bt-label { font-weight: 600; font-size: 14px; }
.bt-value { font-size: 13px; color: var(--bt-accent); font-weight: 600; text-align: right; }

.bt-lane { display: block; width: 100%; height: auto; border-radius: 6px; cursor: pointer; touch-action: manipulation; }
.bt-board { fill: var(--bt-wood); }
.bt-board.bt-alt { fill: var(--bt-wood-2); }
.bt-board.bt-sel { fill: var(--bt-sel); }
.bt-mark { fill: #3d2a12; }
.bt-lane-frame { fill: none; stroke: #8a6a3a; stroke-width: 2; }
.bt-lane-btns { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }

.bt-pins { display: block; width: 100%; max-width: 280px; margin: 0 auto; height: auto; }
.bt-pin circle { stroke-width: 2.5; transition: fill .12s; }
.bt-pin text { text-anchor: middle; font-size: 17px; font-weight: 700; pointer-events: none; font-family: system-ui, sans-serif; }
.bt-pin[data-act] { cursor: pointer; outline: none; }
.bt-pie circle { fill: #fff; stroke: var(--bt-ink); }
.bt-pie text { fill: var(--bt-ink); }
.bt-caido circle { fill: #ece9e2; stroke: #c9c4b8; stroke-dasharray: 4 3; }
.bt-caido text { fill: #b0aa9c; }
.bt-ausente circle { fill: none; stroke: #e4e0d8; }
.bt-ausente text { fill: #e0dcd3; }
.bt-pin[data-act]:focus-visible circle { stroke: var(--bt-accent); stroke-width: 4; }

.bt-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.bt-resumen { margin: 10px 0 0; text-align: center; font-size: 14px; }

.bt-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.bt-actions .bt-primary { flex: 1; }
.bt-error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; font-size: 14px; }

/* Estadísticas */
.bt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.bt-stats div { background: var(--bt-card); border: 1px solid var(--bt-line); border-radius: 10px; padding: 8px; text-align: center; }
.bt-stats span { display: block; font-size: 11px; color: var(--bt-muted); text-transform: uppercase; letter-spacing: .04em; }
.bt-stats strong { font-size: 17px; }
.bt-fin { text-align: center; }
.bt-fin .bt-stats { margin-top: 12px; }
.bt-fin-score { font-size: 56px; font-weight: 800; margin: 0; line-height: 1; color: var(--bt-accent); }

/* Detalle */
.bt-detalle summary { cursor: pointer; font-weight: 600; }
.bt-table-wrap { overflow-x: auto; margin-top: 10px; }
.bt-detalle table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bt-detalle th, .bt-detalle td { padding: 6px 4px; border-bottom: 1px solid var(--bt-line); text-align: center; white-space: nowrap; }
.bt-detalle th { font-size: 11px; color: var(--bt-muted); text-transform: uppercase; font-weight: 600; }

@media (max-width: 420px) {
  .bt-app { padding: 8px; border-radius: 0; }
  .bt-balls span { font-size: 11px; }
  .bt-ft { font-size: 13px; }
  .bt-stats strong { font-size: 15px; }
}

/* Notación de taches/flechas en el selector */
.bt-lane-num { font: 700 12px system-ui, sans-serif; fill: var(--bt-ink); text-anchor: middle; }
.bt-lane-side { font: 10px system-ui, sans-serif; fill: var(--bt-muted); }
.bt-value.bt-warn { color: #b45309; }

/* Trayectorias */
.bt-tray { display: block; width: 100%; max-width: 234px; height: auto; border-radius: 6px; }
.bt-tray-sm { max-width: 170px; margin: 0 auto; }
.bt-t-lane { fill: var(--bt-wood); }
.bt-t-approach { fill: #efe3cc; }
.bt-t-grid { stroke: #cdb084; stroke-width: .6; }
.bt-t-foul { stroke: #3d2a12; stroke-width: 2; }
.bt-t-mark { fill: #3d2a12; }
.bt-t-pin { fill: #fff; stroke: #3d2a12; stroke-width: 1.2; }
.bt-t-walk { stroke-width: 1.5; stroke-dasharray: 3 3; }
.bt-t-path { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.bt-t-path.bt-t-sel { stroke-width: 4; }
.bt-t-path.bt-t-bad { stroke-dasharray: 6 4; }
.bt-tray-wrap { display: grid; grid-template-columns: minmax(0, 234px) 1fr; gap: 14px; align-items: start; margin-top: 10px; }
.bt-tray-side p { margin: 0 0 6px; font-size: 14px; }
.bt-legend { list-style: none; padding: 0; margin: 10px 0; font-size: 13px; }
.bt-legend li { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.bt-legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.bt-desfase { border-top: 1px solid var(--bt-line); padding-top: 10px; font-size: 13px; }
.bt-desfase div { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bt-desfase strong { font-size: 18px; min-width: 22px; text-align: center; }
.bt-nota { margin: 10px 0 0; }
.bt-detalle tr[data-act] { cursor: pointer; }
.bt-detalle tr.bt-row-sel td { background: #fff3e6; font-weight: 700; }
.bt-detalle tr.bt-row-tray td:first-child { box-shadow: inset 3px 0 0 var(--bt-accent); }
@media (max-width: 420px) {
  .bt-tray-wrap { grid-template-columns: 1fr; }
  .bt-tray { margin: 0 auto; }
}

/* Acceso por cédula (v1.2.0) */
.bt-acceso { max-width: 420px; margin: 24px auto; display: flex; flex-direction: column; gap: 12px; }
.bt-acceso input { font-size: 22px !important; letter-spacing: .06em; text-align: center; }
.bt-acceso .bt-primary { width: 100%; }
.bt-acceso .bt-muted { margin: 0; }
.bt-head-home { justify-content: space-between; }
.bt-jugador { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.bt-loading { text-align: center; color: var(--bt-muted); padding: 24px 0; }

/* Torneo · solo puntajes (v1.3.0) */
.bt-modo { border: 1px solid var(--bt-line); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 12px; }
.bt-modo legend { font-size: 13px; color: var(--bt-muted); padding: 0 4px; }
.bt-app .bt-radio { flex-direction: row; align-items: flex-start; gap: 10px; padding: 8px 0; color: var(--bt-ink); cursor: pointer; }
.bt-radio input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--bt-accent); }
.bt-radio span { display: flex; flex-direction: column; font-size: 15px; }
.bt-radio small { font-size: 12px; }
.bt-badge { font-size: 11px; font-weight: 600; color: var(--bt-accent); border: 1px solid var(--bt-accent); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.bt-serie { text-align: center; }
.bt-serie > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--bt-muted); }
.bt-serie > strong { display: block; font-size: 56px; line-height: 1.05; font-weight: 800; color: var(--bt-accent); margin-bottom: 10px; }
.bt-serie .bt-stats { margin: 0; }
.bt-linea-nueva { display: flex; gap: 10px; align-items: flex-end; }
.bt-linea-nueva label { flex: 1; font-weight: 600; color: var(--bt-ink); font-size: 15px; }
.bt-linea-nueva input { font-size: 28px !important; font-weight: 700; text-align: center; letter-spacing: .04em; }
.bt-linea-nueva .bt-primary { min-height: 56px; }
.bt-lineas table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bt-lineas th { font-size: 11px; text-transform: uppercase; color: var(--bt-muted); font-weight: 600; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--bt-line); }
.bt-lineas td { padding: 10px 6px; border-bottom: 1px solid var(--bt-line); }
.bt-lineas td:last-child { text-align: right; }
.bt-lineas .bt-pts { font-weight: 800; font-size: 18px; }
.bt-edit-linea { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bt-edit-linea input { width: 80px !important; min-height: 38px !important; font-size: 18px; font-weight: 700; text-align: center; padding: 4px !important; }

/* Estadísticas (v1.4.0) */
.bt-stats-btn { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; margin-bottom: 12px; background: var(--bt-ink); color: #fff; border-color: var(--bt-ink); padding: 12px 14px; }
.bt-stats-btn small { color: #c9ccd6; font-weight: 400; font-size: 13px; }
.bt-filtros { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bt-periodos { margin-top: 0; }
.bt-filtros-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-stats-8 { grid-template-columns: repeat(4, 1fr); }
.bt-stats small { font-size: 11px; color: var(--bt-muted); font-weight: 400; }
.bt-card > h3 { margin-bottom: 10px !important; }
.bt-evo { display: block; width: 100%; height: auto; }
.bt-grid-l { stroke: #ebe7df; stroke-width: 1; }
.bt-ax { font: 11px system-ui, sans-serif; fill: var(--bt-muted); }
.bt-ref { stroke: var(--bt-muted); stroke-width: 1.2; stroke-dasharray: 4 4; }
.bt-evo-line { fill: none; stroke: #b9b4a8; stroke-width: 2; stroke-linejoin: round; }
.bt-evo-pt { cursor: pointer; }
.bt-legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; }
.bt-legend .bt-dot { width: 10px; height: 10px; border-radius: 50%; }
.bt-legend .bt-dash { width: 16px; height: 0; border-top: 2px dashed var(--bt-muted); border-radius: 0; background: none; }
.bt-detalle-pt { font-size: 13px; color: var(--bt-ink); background: #f6f4ef; border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.bt-mejor { font-size: 14px; margin: 0 0 10px; }
.bt-toggle { display: inline-flex; border: 1px solid var(--bt-line); border-radius: 999px; overflow: hidden; }
.bt-toggle button { font: inherit; font-size: 13px; border: 0; background: #fff; color: var(--bt-ink); padding: 6px 10px; min-height: 34px; cursor: pointer; }
.bt-toggle button.bt-on { background: var(--bt-ink); color: #fff; }
.bt-heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bt-heat { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.bt-heat th { font-weight: 400; color: var(--bt-muted); padding: 2px 4px; white-space: nowrap; text-align: center; }
.bt-heat th b { display: block; color: var(--bt-ink); font-size: 13px; }
.bt-heat th small { font-size: 10px; }
.bt-heat thead th { vertical-align: bottom; }
.bt-heat tbody th { text-align: right; }
.bt-heat .bt-heat-corner { font-size: 10px; text-align: left; vertical-align: bottom; }
.bt-heat td { width: 46px; min-width: 46px; height: 44px; text-align: center; border-radius: 4px; cursor: pointer; line-height: 1.1; }
.bt-heat td b { display: block; font-size: 14px; }
.bt-heat td small { font-size: 10px; opacity: .85; }
.bt-heat td.bt-heat-vacia { background: transparent; cursor: default; }
.bt-heat td.bt-heat-poca { background: #f6f4ef; color: var(--bt-muted); border: 1px dashed var(--bt-line); }
.bt-heat td.bt-heat-mejor { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--bt-accent); }
.bt-heat-ayuda { font-size: 11px; color: var(--bt-muted); margin: 6px 0 0; }
.bt-escala { display: flex; align-items: center; gap: 2px; margin-top: 8px; font-size: 11px; color: var(--bt-muted); }
.bt-escala i { width: 26px; height: 8px; border-radius: 2px; display: inline-block; }
.bt-escala span { margin: 0 4px; }
.bt-leaves { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
.bt-leaves th { font-size: 11px; text-transform: uppercase; color: var(--bt-muted); font-weight: 600; text-align: left; padding: 4px; border-bottom: 1px solid var(--bt-line); }
.bt-leaves td { padding: 8px 4px; border-bottom: 1px solid var(--bt-line); vertical-align: middle; }
.bt-leaves td:nth-child(2) { text-align: center; width: 48px; }
.bt-mini { display: flex; align-items: center; gap: 8px; }
.bt-mini .bt-barra-bg { flex: 1; min-width: 50px; }
.bt-mini span { font-size: 12px; white-space: nowrap; }
.bt-barra { margin-bottom: 10px; }
.bt-barra-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.bt-barra-top span:last-child { color: var(--bt-muted); }
.bt-barra-top b { color: var(--bt-ink); }
.bt-barra-bg { height: 8px; background: #efece5; border-radius: 4px; overflow: hidden; }
.bt-barra-bg i { display: block; height: 100%; background: #2a78d6; border-radius: 4px; }
@media (max-width: 420px) {
  .bt-stats-8 .bt-stats div, .bt-stats-8 > div { padding: 6px 4px; }
  .bt-stats-8 span { font-size: 10px; }
}

/* Guardado sin señal y exportar (v1.5.0) */
.bt-sync { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #eef4fc; color: #1d2230; border: 1px solid #cde2fb; }
.bt-sync .bt-btn { flex-shrink: 0; }
.bt-sync-off { background: #fff7e6; border-color: #f5d48a; }
.bt-sync-error { background: #fef2f2; border-color: #fecaca; }
.bt-sync-ok { background: #ecfdf3; border-color: #a7e3bd; color: #14532d; }
.bt-badge-pend { color: #92400e; border-color: #d97706; }
.bt-export-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-export-btns .bt-btn { text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
