/* SHRED UP — metronome, design V3 (runs inside the Pratique side panel) */

@font-face {
  font-family: 'Conthrax';
  src: url('/static/fonts/Conthrax-SemiBold.otf') format('opentype');
  font-weight: 600;
}

:root {
  --surface: #24262c;
  --surface-2: #2b2d33;
  --surface-3: #33363d;
  --well: #202227;
  --outline: rgba(255, 255, 255, 0.22);
  --text: #e8e9ec;
  --text-2: #9a9ea6;
  --text-3: #60646c;
  --text-4: #43464d;
  --ember: #ff7a2e;
  --ember-glow: rgba(255, 122, 46, 0.38);
  --shadow-tile: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 18px rgba(0, 0, 0, 0.22);
  --shadow-well: inset 0 2px 8px rgba(0, 0, 0, 0.35);
  --ui: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --num: 'Conthrax', var(--ui);
}
body.light-theme {
  --surface: #f3f4f6;
  --surface-2: #ffffff;
  --surface-3: #ffffff;
  --well: #eceef1;
  --outline: rgba(0, 0, 0, 0.2);
  --text: #1f2126;
  --text-2: #5d616a;
  --text-3: #8b8f97;
  --text-4: #b4b7bd;
  --shadow-tile: 0 6px 14px rgba(30, 34, 45, 0.08);
  --shadow-well: inset 0 2px 6px rgba(30, 34, 45, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button { font-family: inherit; }

.v3m {
  width: 400px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ------------------------------------------------ header */
.v3m-head { width: 100%; display: flex; align-items: center; gap: 10px; }
.v3m-title { font: 600 17px var(--ui); letter-spacing: -0.01em; }
.v3m-sub { font: 400 13px var(--ui); color: var(--text-3); }
.volume-slider-section { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.v3m-vol-icon { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.volume-track { position: relative; width: 84px; height: 4px; border-radius: 2px; background: var(--well); box-shadow: var(--shadow-well); cursor: pointer; }
.volume-track::before { content: ''; position: absolute; inset: -10px 0; }
.volume-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--text-2); }
.volume-thumb { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }

/* ------------------------------------------------ ring */
.v3m-ring { position: relative; width: 300px; height: 300px; flex-shrink: 0; }
.v3m-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.v3m-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.bpm-box { display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
.bpm-display {
  font-family: var(--num) !important;
  font-size: 76px !important;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--text) !important;
  transform: none !important;
  cursor: pointer;
}
.bpm-box input {
  width: 150px !important;
  font-family: var(--num) !important;
  font-size: 56px !important;
  color: var(--text) !important;
  background: var(--well) !important;
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-well), inset 0 0 0 1px var(--outline) !important;
  padding: 6px !important;
  outline: none;
}
.bpm-box { position: relative; padding-top: 4px; } /* optical: Conthrax digits sit 2px high */
/* only the number sits on the ring's centre; label and goal hang below it */
.bpm-label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 10px; padding-left: 0.22em; font: 500 12px var(--ui); letter-spacing: 0.22em; color: var(--text-3); white-space: nowrap; }
.v3m-goal { position: absolute; top: calc(50% + 66px); left: 0; right: 0; text-align: center; font: 500 12px var(--ui); color: var(--text-3); min-height: 14px; }
.v3m-goal b { color: var(--text); }

/* ------------------------------------------------ controls */
.v3m-controls { display: flex; align-items: center; gap: 14px; }
.tempo-btn,
.tap-btn {
  height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 14px rgba(0, 0, 0, 0.22);
  font: 400 22px var(--ui);
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
}
.tap-btn { font: 600 13px var(--ui); letter-spacing: 0.12em; }
.tempo-btn:hover, .tap-btn:hover { color: var(--text); }
.tempo-btn.clicking, .tap-btn.tapping { transform: scale(0.95); color: var(--text); }

/* porcelain: the primary action */
.play-btn {
  position: relative;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 40% 30%, #ffffff, #eceef0 45%, #c9ccd1 100%);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.15), 0 10px 24px rgba(0, 0, 0, 0.45), 12px -10px 34px -6px var(--ember-glow);
}
.play-btn::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(0, 0, 0, 0.16) 0 1.2deg, rgba(0, 0, 0, 0) 1.2deg 4deg);
  -webkit-mask: radial-gradient(circle, transparent 0 calc(100% - 7px), #000 calc(100% - 6px));
          mask: radial-gradient(circle, transparent 0 calc(100% - 7px), #000 calc(100% - 6px));
}
.play-btn::after { content: ''; position: absolute; inset: 13px; border-radius: 50%; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 1px 0 rgba(255, 255, 255, 0.8); }
.play-btn svg { position: relative; z-index: 1; width: 24px; height: 24px; fill: none; stroke: #24262b; stroke-width: 1.8; stroke-linejoin: round; }
.play-btn .v3m-stop-icon { display: none; }
.play-btn.active .v3m-play-icon { display: none; }
.play-btn.active .v3m-stop-icon { display: block; }
.play-btn.active { box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.15), 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 34px -2px var(--ember-glow); }

/* ------------------------------------------------ settings tiles */
.v3m-tiles { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.control-wrapper {
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow-tile);
  cursor: pointer;
}
.control-wrapper:hover { background: var(--surface-3); }
.section-label { font: 500 12px var(--ui); color: var(--text-3); }
.control-value, .masking-field { margin-top: 4px; font: 600 14px var(--ui); color: var(--text); cursor: pointer; }
.masking-field.active { color: var(--ember); }
.masking-field.clicking { opacity: 0.7; }

/* ------------------------------------------------ timers */
.v3m-timers { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v3m-timer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow-tile);
}
.timer-fields { display: flex; align-items: center; cursor: pointer; }
.timer-field, .duration-field { font-family: var(--num); font-size: 17px; font-variant-numeric: tabular-nums; }
.timer-field { color: var(--ember); }
.time-separator { margin: 0 1px; }
.timer-fields .time-separator { color: var(--ember); font-family: var(--num); font-size: 17px; }
.duration-field { display: flex; }

/* ------------------------------------------------ modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 13, 0.6);
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-content {
  width: 340px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 30px 60px rgba(0, 0, 0, 0.45);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font: 600 15px var(--ui); }
.modal-close { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-2); cursor: pointer; font-size: 18px; }
.option-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow-tile);
  text-align: center;
  font: 600 14px var(--ui);
  color: var(--text-2);
  cursor: pointer;
}
.option-item:hover { color: var(--text); }
.option-item.selected { color: var(--text); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--outline), var(--shadow-tile); }
.timer-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.timer-presets::after { content: 'Perso'; grid-column: 1 / -1; margin-top: 8px; font: 500 12px var(--ui); color: var(--text-3); }
.preset-btn {
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-tile);
  font: 600 13px var(--ui);
  cursor: pointer;
}
.timer-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.timer-input-group { display: flex; flex-direction: column; gap: 6px; }
.timer-input-group label { font: 500 12px var(--ui); color: var(--text-3); }
.timer-input-group input {
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--well);
  box-shadow: var(--shadow-well);
  color: var(--text);
  text-align: center;
  font: 600 16px var(--ui);
  outline: none;
}
.modal-actions { display: flex; gap: 10px; }
.modal-btn {
  flex: 1;
  height: 44px;
  border: 0;
  border-radius: 13px;
  font: 600 13px var(--ui);
  cursor: pointer;
}
.modal-btn-primary { color: #24262b; background: radial-gradient(circle at 40% 30%, #ffffff, #eceef0 45%, #c9ccd1 100%); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }
.modal-btn-secondary { color: var(--text-2); background: var(--surface-2); box-shadow: var(--shadow-tile); }
