/* ── Monochrome Organic Voicemail Theme ──────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0a0a0a;
  --text:    #f5f5f5;
  --text-2:  rgba(255, 255, 255, 0.65);
  --text-3:  rgba(255, 255, 255, 0.35);
  --border:  rgba(255, 255, 255, 0.22);
  --red:     #e02424;
  --font:    'Georgia', 'Iowan Old Style', 'Palatino Linotype', serif;
  --mono:    ui-monospace, 'SF Mono', Menlo, monospace;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* ── Segmented Playback Bar ──────────────────────────────── */
.player {
  position: fixed;
  left: 50%;
  bottom: 9vh;
  transform: translateX(-50%);
  width: min(720px, 86vw);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bar {
  flex: 1;
  display: flex;
  gap: 4px;
  height: 14px;
}

.seg {
  flex: 1;
  position: relative;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.25s, transform 0.25s;
}
.seg:hover { background: rgba(255, 255, 255, 0.32); }
.seg.active, .seg.active:hover { background: #ffffff; }

.mute-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, opacity 0.2s;
}
.mute-btn:hover { border-color: var(--text); }
.mute-btn.is-muted { opacity: 0.55; }
.mute-btn svg { width: 17px; height: 17px; }

.stamp {
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-2);
  text-align: center;
}

/* ── Center Prompt & Recorder ────────────────────────────── */
main {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

main > * {
  pointer-events: auto;
}

main h1 {
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.45;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 28px;
}

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.ring-wrap {
  position: relative;
  width: 124px;
  height: 124px;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring circle {
  fill: none;
  stroke-width: 2;
  cx: 70;
  cy: 70;
  r: 62;
}

.timer-ring circle:first-child {
  stroke: rgba(255, 255, 255, 0.14);
}

#timer-ring-progress {
  stroke: var(--text);
  stroke-dasharray: 389.56;
  stroke-dashoffset: 389.56;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}

.record-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 53% 47% 52% 48% / 48% 52% 48% 52%;
  border: none;
  background: var(--red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s, border-radius 0.5s, background 0.25s, box-shadow 0.25s, opacity 0.25s;
}

.record-btn:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.06);
  border-radius: 47% 53% 46% 54% / 54% 46% 54% 46%;
  box-shadow: 0 0 28px rgba(224, 36, 36, 0.45);
}

.record-btn.recording {
  background: var(--red);
  box-shadow: 0 0 34px rgba(224, 36, 36, 0.65);
  animation: breathe 0.9s ease-in-out infinite alternate;
}

@keyframes breathe {
  0%   { transform: translate(-50%, -50%) scale(0.92); border-radius: 55% 45% 50% 50% / 47% 53% 47% 53%; }
  100% { transform: translate(-50%, -50%) scale(1.06); border-radius: 45% 55% 48% 52% / 53% 47% 53% 47%; }
}

.record-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

#waveform {
  width: 220px;
  height: 36px;
  opacity: 0;
  transition: opacity 0.3s;
}
#waveform.active {
  opacity: 0.85;
}

/* ── Preview ─────────────────────────────────────────────── */
.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 18px 22px;
  border-radius: 24px 20px 26px 18px;
  min-width: 250px;
}

.preview-playback {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon svg { width: 15px; height: 15px; }

.preview-bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.preview-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  transition: width 0.1s linear;
}

.preview-time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 7px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { transform: scale(1.04); border-color: var(--text); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn.secondary {
  background: transparent;
  color: var(--text-2);
}

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Slowly Scrolling Marquee ────────────────────────────── */
.marquee {
  position: fixed;
  top: 67vh;
  left: -5vw;
  width: 110vw;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  transform: rotate(-3.5deg);
}

.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: marquee-scroll 165s linear infinite;
}

.marquee-track span {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  letter-spacing: 0.015em;
  color: #ffffff;
  padding-right: 0.75rem;
}

@keyframes marquee-scroll {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* ── Subtle Admin Dot ────────────────────────────────────── */
.admin-link {
  position: fixed;
  bottom: 12px;
  right: 16px;
  z-index: 3;
  color: var(--text-3);
  text-decoration: none;
  font-size: 1.2rem;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.admin-link:hover { opacity: 0.9; }

[hidden] { display: none !important; }
