/* ===== Reverse Voice — dark, mobile-first ===== */
:root {
  --bg: #12141c;
  --card: #1f2230;
  --card-2: #252836;
  --coral: #ff6b6b;
  --text: #e6e4ef;
  --muted: #6b7084;
  --radius: 26px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  user-select: none;
}

.app {
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Status + timer ---- */
.top { text-align: center; }
.status { margin: 0 0 4px; font-size: 1.05rem; color: #c9c7d4; min-height: 1.3em; }
.timer {
  font-size: clamp(3.2rem, 17vw, 4.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  line-height: 1.1;
}
.timer .cs { font-size: .45em; color: #a9a7b6; }

/* ---- Cards ---- */
.card { background: var(--card); border-radius: var(--radius); border: none; }

.wave-card { height: 110px; padding: 18px 16px; flex-shrink: 0; }
#wave { width: 100%; height: 100%; display: block; }

/* ---- Record button ---- */
.record-btn {
  flex: 1.2;
  min-height: 150px;
  border: none;
  border-radius: var(--radius);
  background: var(--coral);
  color: #fff;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 0 28px rgba(255, 107, 107, .35);
  transition: transform .12s, filter .12s;
}
.record-btn:active { transform: scale(.98); }
.record-btn svg { width: 64px; height: 64px; }
.record-btn .ico-stop { display: none; }
.record-btn.recording { animation: pulse 1.2s ease-in-out infinite; }
.record-btn.recording .ico-mic { display: none; }
.record-btn.recording .ico-stop { display: block; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 107, 107, .35); }
  50% { box-shadow: 0 0 48px rgba(255, 107, 107, .75); }
}

/* ---- Play / Reverse Play ---- */
.play-row { flex: 1; min-height: 120px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.play-btn {
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform .12s, background .2s;
}
.play-btn:active:not(:disabled) { transform: scale(.97); }
.play-btn svg { width: 38px; height: 38px; }
.play-btn .ico-stop { display: none; }
.play-btn.active { background: #2f3350; color: var(--coral); }
.play-btn.active .ico-play { display: none; }
.play-btn.active .ico-stop { display: block; }
.play-btn:disabled { color: var(--muted); }

/* ---- Bottom actions ---- */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action {
  background: var(--card);
  border: none;
  border-radius: 18px;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.action svg { width: 24px; height: 24px; }
.action:disabled { color: var(--muted); }
.action:active:not(:disabled) { background: var(--card-2); }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 10;
}
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 22px; padding: 24px; width: 100%; max-width: 340px; }
.modal-box h2 { margin: 0 0 8px; font-size: 1.3rem; }
.modal-box p { margin: 0 0 20px; color: #b4b2c0; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns button { flex: 1; border: none; border-radius: 14px; padding: 14px; font: inherit; font-weight: 700; font-size: 1rem; }
.btn-ghost { background: var(--card-2); color: var(--text); }
.btn-danger { background: var(--coral); color: #fff; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 100px);
  transform: translateX(-50%);
  background: #33374a; color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: .95rem;
  z-index: 20; max-width: 90vw; text-align: center;
}
.toast[hidden] { display: none; }
