/* Passaggio — metronome-face theme.
   Colors: #252a34 primary (charcoal), #f1e9da secondary (cream), #d07a3e accent (brass). */

:root {
  --primary: #252a34;
  --primary-raised: #2e3440;
  --primary-deep: #1d2129;
  --secondary: #f1e9da;
  --secondary-dim: rgba(241, 233, 218, 0.62);
  --secondary-faint: rgba(241, 233, 218, 0.12);
  --accent: #d07a3e;
  --accent-soft: rgba(208, 122, 62, 0.18);
  --danger: #c65b4e;
  --radius: 18px;
  --tap: 44px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--primary-deep);
  color: var(--secondary);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 18px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
  background: var(--primary);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
}

/* ---------- Tab panels & headers ---------- */

.tab-panel { padding-top: calc(env(safe-area-inset-top, 0px) + 18px); }

.tab-head { margin-bottom: 20px; }

.display-title {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--secondary);
}

.head-sub {
  margin: 4px 0 0;
  color: var(--secondary-dim);
  font-size: 0.95rem;
}

.section-label {
  margin: 26px 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

/* ---------- Focus: metronome dial ---------- */

.dial-wrap { text-align: center; }

.met-dial {
  position: relative;
  width: min(72vw, 240px);
  aspect-ratio: 1 / 1.18;
  margin: 8px auto 14px;
  border: 3px solid var(--secondary-faint);
  border-radius: 48% 48% 44% 44% / 62% 62% 34% 34%;
  background: linear-gradient(180deg, var(--primary-raised) 0%, var(--primary-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dial-arc {
  position: absolute;
  top: 9%;
  left: 10%;
  right: 10%;
  height: 34%;
  border-top: 2px solid var(--accent);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  opacity: 0.85;
}

.dial-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 14%;
}

.dial-count {
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

.dial-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.dial-pendulum {
  position: absolute;
  top: 12%;
  bottom: 30%;
  left: 50%;
  width: 3px;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: top center;
  animation: sway 2.4s ease-in-out infinite alternate;
}

.pendulum-arm {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--secondary-dim), var(--secondary-faint));
  border-radius: 2px;
}

.pendulum-weight {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

@keyframes sway {
  from { transform: translateX(-50%) rotate(-16deg); }
  to   { transform: translateX(-50%) rotate(16deg); }
}

@media (prefers-reduced-motion: reduce) {
  .dial-pendulum { animation: none; transform: translateX(-50%) rotate(8deg); }
}

.dial-caption {
  margin: 0 0 20px;
  color: var(--secondary-dim);
  font-size: 0.92rem;
}

/* Wide Add Loop strip */

.add-strip {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--primary-deep);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
}

.add-strip:active { transform: scale(0.985); }

.add-strip-plus {
  position: relative;
  width: 20px;
  height: 20px;
}

.add-strip-plus::before,
.add-strip-plus::after {
  content: "";
  position: absolute;
  background: var(--primary-deep);
  border-radius: 2px;
}

.add-strip-plus::before { left: 9px; top: 0; width: 2px; height: 20px; }
.add-strip-plus::after  { left: 0; top: 9px; width: 20px; height: 2px; }

/* ---------- Tempo-slip cards ---------- */

.slip-latest { text-align: left; }

.loop-list,
.find-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slip-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: var(--tap);
  padding: 18px 16px 16px;
  border: 1px solid var(--secondary-faint);
  border-radius: var(--radius);
  background: var(--primary-raised);
  color: var(--secondary);
  text-align: left;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
}

/* Thin pendulum-arc line across the top of every card */
.slip-card::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 14px;
  right: 14px;
  height: 10px;
  border-top: 2px solid var(--accent);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  opacity: 0.75;
}

.slip-card:active { transform: scale(0.99); border-color: var(--accent); }

.slip-pinned { border-color: var(--accent-soft); }

.slip-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.slip-title {
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slip-meta {
  color: var(--secondary-dim);
  font-size: 0.83rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slip-cue {
  color: var(--accent);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small circular BPM badge on the left */
.bpm-badge {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-deep);
  border: 2px solid var(--accent);
  color: var(--secondary);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.slip-compact { min-height: 64px; padding-top: 16px; }
.slip-compact .bpm-badge { width: 44px; height: 44px; font-size: 0.85rem; }

/* Row = card + inline delete, no overlays */
.slip-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.slip-row .slip-card { flex: 1; min-width: 0; }

.row-del {
  flex: 0 0 auto;
  width: 48px;
  border: 1px solid var(--secondary-faint);
  border-radius: var(--radius);
  background: var(--primary-raised);
  color: var(--danger);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.row-del:active { border-color: var(--danger); opacity: 0.85; }

/* ---------- Empty states (left-aligned, quiet) ---------- */

.empty-state {
  margin-top: 18px;
  padding: 18px 4px;
  border-left: 3px solid var(--accent-soft);
  color: var(--secondary-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.empty-state p { margin: 0 0 12px; }
.empty-state p:last-child { margin-bottom: 0; }

/* ---------- Buttons ---------- */

button { touch-action: manipulation; }

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: var(--tap);
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: var(--primary-deep);
  border-color: var(--accent);
}

.ghost-btn {
  background: transparent;
  color: var(--secondary);
  border-color: var(--secondary-faint);
}

.danger-btn {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.small { padding: 8px 14px; min-height: 40px; font-size: 0.85rem; }

.ghost-btn:active,
.primary-btn:active,
.danger-btn:active { opacity: 0.85; }

/* ---------- Log form ---------- */

#log-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary-dim);
}

.field .req { color: var(--accent); }
.field .opt { color: var(--secondary-faint); font-weight: 400; text-transform: none; }

.field input {
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--secondary-faint);
  background: var(--primary-deep);
  color: var(--secondary);
  font: inherit;
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
}

.field input::placeholder { color: rgba(241, 233, 218, 0.35); }

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.field input.invalid { border-color: var(--danger); }

.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.form-actions > button { flex: 1; }

.form-empty { margin-top: 8px; }

/* ---------- Find ---------- */

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.search-row input[type="search"] {
  flex: 1;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--secondary-faint);
  background: var(--primary-deep);
  color: var(--secondary);
  font: inherit;
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
}

.search-row input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.search-row input[type="search"]::placeholder { color: rgba(241, 233, 218, 0.35); }

/* ---------- About footer ---------- */

.about-foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--secondary-faint);
}

.about-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.about-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--secondary);
}

.about-ver { color: var(--secondary-dim); font-size: 0.82rem; }

.about-desc {
  color: var(--secondary-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 8px 0 14px;
}

.about-actions { justify-content: flex-start; flex-wrap: wrap; }

.about-note {
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 0.85rem;
}

/* ---------- Bottom navigation: metronome weights ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 8px env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--primary-deep);
  border-top: 1px solid var(--secondary-faint);
  z-index: 20;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--secondary-dim);
  cursor: pointer;
  min-height: var(--tap);
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Flat metronome-weight silhouette */
.weight {
  position: relative;
  width: 22px;
  height: 26px;
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* Trapezoid body of the weight */
.weight::before {
  content: "";
  position: absolute;
  inset: 4px 0 0;
  border: 2px solid currentColor;
  border-radius: 4px 4px 2px 2px;
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  background: transparent;
}

/* The small round weight bob on the pendulum */
.weight::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 11px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  background: currentColor;
  border-radius: 50%;
}

/* Active weight tilts with a soft shadow; inactive stays matte */
.nav-tab.is-active {
  color: var(--accent);
}

.nav-tab.is-active .weight {
  transform: rotate(-14deg);
  filter: drop-shadow(0 4px 5px rgba(208, 122, 62, 0.4));
}


