/* ===== CheckBang — tema oscuro táctil para campo de tiro ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #14171c;
  --panel: #1e232b;
  --panel-2: #262c36;
  --line: #333c49;
  --txt: #eceff4;
  --txt-dim: #9aa5b5;
  --accent: #e63946;       /* rojo blanco de tiro */
  --accent-2: #4cc38a;     /* verde OK */
  --amber: #e5b45c;
  --radius: 14px;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100%;
  user-select: none;
}

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: linear-gradient(180deg, var(--bg) 75%, transparent);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px #ffffff22, 0 0 0 6px var(--accent-2), 0 0 0 9px #ffffff18;
}
.topbar h1 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: .4px; }
.bar-extra { font-size: .78rem; color: var(--txt-dim); text-align: right; }

main {
  padding: 8px 14px calc(84px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}

/* Tarjetas */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: .95rem; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 1px; }
.card .big { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }

/* Botones */
button {
  font-family: inherit; border: none; cursor: pointer;
  border-radius: 10px; color: var(--txt);
}
.btn {
  background: var(--panel-2);
  padding: 13px 16px; font-size: 1rem; font-weight: 600;
  border: 1px solid var(--line);
  width: 100%; margin-top: 8px;
}
.btn.accent { background: var(--accent); border-color: transparent; }
.btn.green { background: var(--accent-2); color: #08130c; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.wide-sm { padding: 10px; font-size: .9rem; }
button:active { opacity: .75; }

/* Config */
.field { margin: 12px 0; }
.field label { display: block; font-size: .82rem; color: var(--txt-dim); margin-bottom: 5px; }
.field input[type=number], .field input[type=text], .field select {
  width: 100%; padding: 12px; font-size: 1rem;
  background: var(--panel-2); color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px;
}
.field .hint { font-size: .75rem; color: var(--txt-dim); margin-top: 4px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; }
.toggle-row .label-main { font-size: .95rem; }
.toggle-row .label-sub { font-size: .75rem; color: var(--txt-dim); }
.switch { width: 50px; height: 28px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); position: relative; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--txt-dim); transition: all .15s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { left: 25px; background: #fff; }

/* Grid de blancos */
.blancos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.blanco-card {
  background: var(--panel-2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 10px 4px; text-align: center;
}
.blanco-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px #e6394644; }
.blanco-card.done { opacity: .55; }
.blanco-card .bl-title { font-size: .72rem; color: var(--txt-dim); }
.blanco-card .bl-score { font-size: 1.25rem; font-weight: 800; }
.blanco-card .bl-time { font-size: .65rem; color: var(--amber); margin-top: 2px; }

/* Teclado de margen */
.keypad { margin-top: 12px; }
.kp-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.kp-btn {
  padding: 18px 0; font-size: 1.35rem; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line);
}
.kp-btn:active { background: var(--accent); border-color: transparent; }
.shots-log { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 34px; }
.shot-chip {
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 8px; font-weight: 700; font-size: .95rem;
}
.shot-chip.x { border-color: var(--accent); color: var(--accent); }
.shot-chip.lo { opacity: .6; }

/* Cronómetro */
.chrono { text-align: center; padding: 6px 0; }
.chrono .time { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.chrono .zone { font-size: .8rem; color: var(--txt-dim); margin-top: 4px; }
.chr-btns { display: flex; gap: 8px; margin-top: 10px; }
.chr-btns .btn { flex: 1; margin-top: 0; }

/* Tablas historial */
.ses-item { cursor: pointer; }
.ses-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ses-head .dt { font-size: .85rem; font-weight: 700; }
.ses-head .score { font-size: 1.2rem; font-weight: 800; color: var(--accent-2); }
.ses-meta { font-size: .78rem; color: var(--txt-dim); margin-top: 4px; }
.det-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .85rem; }
.det-table th, .det-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.det-table th { color: var(--txt-dim); font-weight: 600; font-size: .75rem; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; }
.stat-box .v { font-size: 1.4rem; font-weight: 800; }
.stat-box .l { font-size: .7rem; color: var(--txt-dim); margin-top: 2px; }
svg.trend { width: 100%; height: 120px; }

/* Pestañas inferiores */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab { background: none; display: flex; flex-direction: column; align-items: center; padding: 5px 14px; opacity: .55; font-size: 1.15rem; }
.tab small { font-size: .65rem; margin-top: 2px; color: var(--txt); }
.tab.active { opacity: 1; color: var(--accent); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: var(--accent-2); color: #08130c; font-weight: 700;
  padding: 10px 20px; border-radius: 24px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
