/* Components — UI v2 (A1) */

/* ---- Top bar ---- */
.seg { display: flex; gap: 8px; }
.pill {
  background: #0e1324; color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 12px; font-size: 12px; white-space: nowrap; font-weight: 700;
}
.pill:hover { border-color: var(--accent); background: #141a2c; }
.seg .pill[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.seg .pill[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); }
.pill.icon { display: inline-flex; align-items: center; gap: 8px; }
.pill.ok { border-color: rgba(48, 209, 88, 0.35); color: #b6ffd1; }
.pressable { transition: transform 0.06s ease; }
.pressable:active { transform: scale(0.97); }
.gearBtn { background: none; border: none; font-size: 20px; padding: 8px; border-radius: var(--r-s); }
.gearBtn:hover { background: #141a2c; }

.tempoBar {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 8px 16px; color: var(--ink);
}
.tempoBar:hover { border-color: var(--accent); }
.tempoBar.dimmed { opacity: .55; }
.tempoBpm { font-size: 22px; font-weight: 800; display: inline-flex; align-items: baseline; gap: 4px; }
.tempoBpm small { font-size: 10px; color: var(--muted); font-weight: 600; }
.tempoMeta { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
.tempoMetro { display: inline; visibility: hidden; }
.tempoMetro.on { visibility: visible; color: var(--accent); }
.tempoCaret { font-size: 10px; color: var(--muted); }

/* ---- Tempo popover ---- */
.tempoPopover {
  position: absolute; z-index: 40; top: 52px; left: 50%; transform: translateX(-50%);
  width: min(320px, calc(100vw - 32px));
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-l);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.tempoPopover[hidden] { display: none; }
.tpClose { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--muted); font-size: 14px; padding: 6px; }
.tpClose:hover { color: var(--ink); }
.tpRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tpRow.tpHead { padding-right: 34px; }
.tpBpmBig { display: flex; align-items: baseline; gap: 8px; }
.tpBpmBig input { font-size: 26px; font-weight: 800; width: 92px; text-align: center; }
.tpBpmBig small { color: var(--muted); }
.tpField { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tpField input[type="number"] { width: 100%; }
.tpVol { flex-direction: row; align-items: center; gap: 8px; }
.tpVol input { flex: 1; }
#bpmSlider { width: 100%; }
.toggle { display: inline-flex; align-items: center; gap: 8px; background: #0e1324; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink); font-size: 12px; }
.toggle:hover { border-color: var(--accent); }
.toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: #3a4258; }
.toggle[aria-pressed="true"] .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ---- Orb ---- */
.orbBlock { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dialStack { position: relative; width: var(--orb, clamp(150px, 20vw, 210px)); height: var(--orb, clamp(150px, 20vw, 210px)); display: grid; place-items: center; }
.ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--ringColor, var(--accent)) calc(var(--p, 0) * 360deg), #232a3d 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
}
.ring.recording { filter: drop-shadow(0 0 14px var(--ringColor, var(--rec))); animation: ringPulse 1.2s ease-in-out infinite; }
.ring.recording-soft { filter: drop-shadow(0 0 8px var(--ringColor, var(--rec))); }
@keyframes ringPulse { 50% { filter: drop-shadow(0 0 26px var(--ringColor, var(--rec))); } }
@media (prefers-reduced-motion: reduce) { .ring.recording { animation: none; } }

.btnMain {
  width: calc(100% - 26px); height: calc(100% - 26px); border-radius: 50%;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 35% 30%, #1a2233, #0e1324);
  border: 3px solid var(--stop); color: var(--ink);
}
.btnMain .icon { font-size: clamp(26px, 3.4vw, 38px); line-height: 1; }
.btnMain .txt { font-size: 14px; font-weight: 800; letter-spacing: 0.06em; }
.btnMain.rec { border-color: var(--rec); box-shadow: var(--glow-rec); }
.btnMain.rec .icon, .btnMain.rec .txt { color: var(--rec); }
.btnMain.play { border-color: var(--play); box-shadow: var(--glow-play); }
.btnMain.play .icon, .btnMain.play .txt { color: var(--play); }
.btnMain.stop { border-color: var(--rec); }
.btnMain.stop .icon, .btnMain.stop .txt { color: var(--ink); }
.btnMain.odub { border-color: var(--odub); box-shadow: var(--glow-odub); }
.btnMain.odub .icon, .btnMain.odub .txt { color: var(--odub); }
.btnMain:hover:not([disabled]) { filter: brightness(1.08); }
.btnMain.breathing { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.02); } }
.countInView {
  position: absolute; inset: 13px; border-radius: 50%; display: none; place-items: center; pointer-events: none;
  font-size: clamp(40px, 6vw, 56px); font-weight: 900; color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.25); user-select: none; text-align: center; line-height: 1.1;
}
.phase { font-size: 13px; color: var(--muted); }

.recBadge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; visibility: hidden; min-height: 18px; pointer-events: none; }
.recBadge.show { visibility: visible; }
.recBadge.rec { color: var(--rec); } .recBadge.odub { color: var(--odub); } .recBadge.set { color: var(--accent); }
.recBadgeDot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: recBadgeBlink 1s steps(2, start) infinite; }
@media (prefers-reduced-motion: reduce) { .recBadgeDot { animation: none; opacity: 1; } }
@keyframes recBadgeBlink { 50% { opacity: 0.15; } }

/* ---- Overdub button ---- */
.odubBlock { display: flex; justify-content: center; }
.odubBtn {
  width: clamp(96px, 11vw, 120px); height: clamp(96px, 11vw, 120px); border-radius: 50%;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #0e1324; border: 3px solid var(--odub); color: var(--odub);
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
}
.odubBtn .ico { font-size: 20px; }
.odubBtn:hover:not(.disabled) { filter: brightness(1.08); }
.odubBtn.disabled { border-color: #2a3040; color: var(--muted); }
.odubBtn.queued { animation: breathe 1s ease-in-out infinite; box-shadow: var(--glow-odub); }

/* ---- Meter + warning ---- */
.inputRow { display: flex; align-items: center; gap: 8px; width: min(420px, 90%); }
.meter { flex: 1; height: 6px; background: #232a3d; border-radius: 3px; overflow: hidden; }
.meter .fill { height: 100%; width: 0%; background: var(--play); border-radius: 3px; }
.inputWarning {
  margin: 4px 0 0; padding: 8px 12px; border: 1px solid #b58900; border-radius: var(--r-m);
  background: #2a2410; color: #ffd75e; font-size: 13px; max-width: min(480px, 95%);
}

/* ---- Layers ---- */
.layersHead { display: flex; align-items: baseline; justify-content: space-between; }
.layersHead h3 { margin: 0; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }
.layersHint { font-size: 11px; color: var(--muted); }
.layersList { display: flex; flex-direction: column; gap: 8px; }
.layerRow {
  display: flex; align-items: center; gap: 8px;
  background: #0e1324; border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 12px;
}
.layerRow.main { border-color: rgba(139, 233, 253, 0.25); }
.layerName { font-size: 13px; font-weight: 700; min-width: 52px; }
.layerSlider { flex: 1; min-width: 60px; }
.layerBtn { background: none; border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px; font-size: 13px; }
.layerBtn:hover { border-color: var(--accent); background: #141a2c; }
.layerBtn.danger { border-color: rgba(255, 77, 79, 0.35); }
.layerBtn.danger:hover { border-color: #ff4d4f; background: rgba(255, 77, 79, 0.12); }
.layersEmpty { font-size: 12px; color: var(--muted); padding: 8px 4px; }
.shortcutsHint { margin: auto 0 0; padding-top: 10px; font-size: 11px; color: var(--muted); }
.sheetHandle { display: none; }

/* ---- Modales (onboard + settings), estructura previa con tokens ---- */
.onboard, .modal {
  position: fixed; inset: 0; z-index: 50; display: none; place-items: center;
  background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(4px); padding: 16px;
}
.onboard { display: grid; }
.onboard.hidden { display: none; }
.modal.show { display: grid; }
.onboard .panel, .modal .panel {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-xl);
  padding: 18px; width: min(560px, 100%); max-height: 90vh; overflow: auto;
}
.hint { font-size: 13px; color: var(--muted); }
.hintSpaced { margin-top: 10px; }
.col { display: grid; gap: 8px; margin-top: 12px; }
.colLabel { justify-self: start; }
.armBtn { justify-self: center; min-width: 120px; }
.settingsCard { padding: 12px; margin: 0 0 12px; }
.settingsCard h4 { margin: 0 0 8px; }
.settingsRowWide { gap: 12px; }
.settingsField { display: flex; flex-direction: column; gap: 4px; }
.settingsField:not(.grow) { width: 180px; }
.settingsRow { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.settingsRow small { color: var(--muted); }
.shortcutsLegend { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.shortcutsLegend h3 { font-size: 13px; margin: 0 0 8px; }
.shortcutsLegend ul { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modalFooter { margin-top: 12px; font-size: 12px; color: var(--muted); }
.footerLink { color: #d83a32; text-decoration: none; }
.mailto { color: var(--accent); }
