*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Lato', sans-serif;
  background: #fff;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
  width: 100%;
}

/* ── Gray header: timer + waveform ── */
.header {
  width: 100%;
  background: #F3F3F3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 3rem 1.5rem;
  gap: 1.75rem;
  box-sizing: border-box;
}

/* ── Timer ── */
.timer {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
  line-height: 1;
  text-align: center;
}

/* ── Waveform ── */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  width: 100%;
  max-width: 360px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.waveform-bar {
  width: 4px;
  min-width: 4px;
  border-radius: 3px;
  background: #ed341d;
  height: 4px;
  transition: height 0.08s ease;
  flex-shrink: 1;
}

/* ── White card ── */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 1.5rem;
  gap: 1.5rem;
  box-sizing: border-box;
}

/* ── Record controls row ── */
.record-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* ── Record button ── */
.record-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: #ed341d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(237,52,29,0.35);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
}

.record-btn:hover {
  background: #c72d1c;
  box-shadow: 0 6px 24px rgba(237,52,29,0.45);
  transform: scale(1.04);
}

.record-btn:active { transform: scale(0.97); }

.record-btn.recording {
  background: #1a1a1a;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.record-btn.recording:hover {
  background: #333;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.icon-mic  { display: block; }
.icon-stop { display: none;  }
.record-btn.recording .icon-mic  { display: none;  }
.record-btn.recording .icon-stop { display: block; }

/* ── Pause button ── */
.pause-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: #555;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.pause-btn.visible { display: flex; }
.pause-btn:hover   { background: #333; transform: scale(1.05); }
.pause-btn:active  { transform: scale(0.96); }

.pause-btn.paused       { background: #ed341d; }
.pause-btn.paused:hover { background: #c72d1c; }

.icon-pause  { display: block; }
.icon-resume { display: none;  }
.pause-btn.paused .icon-pause  { display: none;  }
.pause-btn.paused .icon-resume { display: block; }

/* ── Button label ── */
.btn-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888;
  margin-top: -0.5rem;
}

/* ── Playback panel ── */
.playback-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.playback-panel.visible { display: flex; }

.playback-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
}

audio {
  width: 100%;
  display: block;
}

/* ── Confirmation panel ── */
.confirm-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
  width: 100%;
}

.confirm-panel.visible { display: flex; }

.confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a1a;
}

.confirm-subtitle {
  font-size: 0.9rem;
  color: #888;
  margin-top: -0.5rem;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.btn-yes, .btn-no {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-yes { background: #ed341d; color: #fff; }
.btn-yes:hover { background: #c72d1c; }
.btn-no  { background: #f0f0f0; color: #444; }
.btn-no:hover  { background: #e0e0e0; }

/* ── Status message ── */
.status-msg {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.status-msg.visible { display: flex; }

.status-icon {
  font-size: 2.5rem;
  line-height: 1;
  color: #2f9e44;
}

.status-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
}

.status-sub {
  font-size: 0.85rem;
  color: #888;
}

/* ── Spinner ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #f0f0f0;
  border-top-color: #ed341d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 400px) {
  .header     { min-height: 250px; padding: 2rem 1rem; gap: 1.25rem; }
  .record-btn { width: 76px; height: 76px; }
  .pause-btn  { width: 44px; height: 44px; }
  .waveform   { gap: 5px; }
  .waveform-bar { width: 3px; min-width: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .waveform-bar { transition: none; }
  .spinner      { animation: none; }
}