body { font-family: Inter, sans-serif; }

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

.mode-btn {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.mode-btn.active {
  background: #fff;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Tap area ── */
.tap-area {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.tap-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(145deg, #065f46 0%, #047857 60%, #059669 100%);
  border: none;
  cursor: pointer;
  color: #fff;
  box-shadow:
    0 8px 32px rgba(6,95,70,0.35),
    0 2px 8px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.06s cubic-bezier(0.2,0.8,0.3,1), box-shadow 0.06s, background 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}
.tap-btn::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  pointer-events: none;
}
.tap-btn:hover {
  background: linear-gradient(145deg, #047857 0%, #059669 60%, #10b981 100%);
  box-shadow: 0 12px 40px rgba(6,95,70,0.4), 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15);
}
.tap-btn:active, .tap-btn.tapped {
  transform: scale(0.94);
  box-shadow: 0 4px 16px rgba(6,95,70,0.3), inset 0 2px 6px rgba(0,0,0,0.2);
  background: linear-gradient(145deg, #034d38 0%, #065f46 60%, #047857 100%);
}
.tap-btn-label {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
}
.tap-btn-hint {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* ── BPM display ── */
.bpm-display-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 16px;
}
.bpm-main-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bpm-number {
  font-size: 5rem;
  font-weight: 700;
  color: #065f46;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 180px;
  text-align: center;
  transition: color 0.2s;
}
.bpm-number.flash {
  color: #10b981;
}
.bpm-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9ca3af;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}
.bpm-meta-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bpm-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bpm-meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 54px;
  flex-shrink: 0;
}
.bpm-meta-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}

/* ── Confidence bar ── */
.confidence-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 16px;
  max-width: 360px;
}
.confidence-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.confidence-bar-track {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.confidence-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6ee7b7, #065f46);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}
.confidence-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: #065f46;
  min-width: 28px;
  text-align: right;
}

/* ── Controls ── */
.bpm-ctrl-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.bpm-reset-btn {
  background: #f9fafb;
  color: #374151;
}
.bpm-reset-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ── Delay grid ── */
.delay-table-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}
.delay-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 480px) {
  .delay-grid { grid-template-columns: repeat(2, 1fr); }
}
.delay-cell {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}
.delay-cell-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 3px;
}
.delay-cell-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: #065f46;
  font-variant-numeric: tabular-nums;
}
.delay-cell-dotted {
  border-color: #a7f3d0;
  background: #f0fdf4;
}
.delay-cell-dotted .delay-cell-name { color: #047857; }

/* ── Tap history canvas ── */
.tap-history-wrap {
  margin-top: 16px;
}
.tap-history-canvas {
  width: 100%;
  height: 48px;
  display: block;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

tbody tr:nth-child(even) { background: #f9fafb; }

@media (max-width: 480px) {
  .tap-btn { width: 160px; height: 160px; }
  .tap-btn-label { font-size: 1.8rem; }
  .bpm-number { font-size: 3.5rem; min-width: 130px; }
  .bpm-display-row { gap: 18px; }
}
