* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  color: #422006;
}

.app {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(146, 64, 14, 0.15);
  width: 100%;
  max-width: 440px;
  text-align: center;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #92400e;
}

.subtitle {
  font-size: 12px;
  color: #a16207;
  margin-bottom: 20px;
  font-style: italic;
}

.bpm-display {
  font-size: 68px;
  font-weight: 800;
  color: #b45309;
  line-height: 1;
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.bpm-label {
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}

.section {
  margin-bottom: 22px;
}

.section-label {
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #fde68a;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #b45309;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(146, 64, 14, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #b45309;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(146, 64, 14, 0.3);
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #a16207;
  margin-top: 6px;
}

.bpm-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}

.bpm-input-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #fde68a;
  background: #ffffff;
  color: #92400e;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bpm-input-btn:hover {
  border-color: #b45309;
  background: #fef3c7;
}

.button-group {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.chip-btn {
  flex: 1;
  padding: 10px 0;
  border: 2px solid #fde68a;
  background: #ffffff;
  color: #92400e;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: #b45309;
}

.chip-btn.active {
  background: #b45309;
  border-color: #b45309;
  color: #ffffff;
}

.beat-indicator {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  min-height: 20px;
}

.beat-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fde68a;
  transition: all 0.1s ease;
}

.beat-dot.active {
  background: #b45309;
  transform: scale(1.3);
}

.beat-dot.active.accent {
  background: #dc2626;
  transform: scale(1.4);
}

.toggle-btn {
  width: 100%;
  padding: 16px;
  background: #b45309;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toggle-btn:hover:not(:disabled) {
  background: #92400e;
  transform: translateY(-1px);
}

.toggle-btn:active:not(:disabled) {
  transform: translateY(0);
}

.toggle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-btn.playing {
  background: #dc2626;
}

.toggle-btn.playing:hover {
  background: #b91c1c;
}

.sound-source-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.record-panel {
  background: #fef3c7;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.record-status {
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
  text-align: center;
}

.record-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.record-btn.primary {
  background: #dc2626;
  color: #ffffff;
}

.record-btn.primary:hover:not(:disabled) {
  background: #b91c1c;
}

.record-btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.record-btn.recording {
  background: #dc2626;
  color: #ffffff;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.record-btn.secondary {
  background: #ffffff;
  color: #92400e;
  border: 2px solid #b45309;
}

.record-btn.secondary:hover {
  background: #fef3c7;
}

.record-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.record-actions .record-btn {
  flex: 1;
}

.message {
  font-size: 12px;
  padding: 8px;
  border-radius: 6px;
  text-align: center;
  line-height: 1.4;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
}

.message.info {
  background: #dbeafe;
  color: #1e40af;
}

.hidden {
  display: none !important;
}
