:root {
  --bg: #0b0e17;
  --surface: #141927;
  --surface-2: #1c2336;
  --text: #e8ecf5;
  --muted: #8b93a7;
  --accent: #6c7cff;
  --accent-hot: #ff4d6d;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --radius: 16px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- auth / settings pages ---------- */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid #232b42;
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
}

.auth-card.wide { max-width: 440px; text-align: left; }
.auth-card.wide h1, .auth-card.wide .logo-dot { text-align: center; }

.logo-dot { font-size: 40px; margin-bottom: 8px; }

.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }

.sub { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }

.auth-card form { text-align: left; margin-top: 18px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
label.check {
  display: flex; gap: 10px; align-items: flex-start;
  color: var(--text); font-size: 14px; margin-top: 18px; cursor: pointer;
}
label.check input { margin-top: 3px; }

.hint { color: var(--muted); font-size: 12px; }
.hint code { color: var(--text); }

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2a3350;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* prevents iOS zoom-on-focus */
}

input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid #2a3350;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn.primary {
  width: 100%;
  margin-top: 20px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.ghost { background: transparent; color: var(--muted); }
.btn:active { transform: scale(0.98); }

.error   { background: #3a1520; color: var(--err); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 10px; }
.success { background: #10301f; color: var(--ok);  padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 10px; }

.footer-link { margin-top: 18px; font-size: 13px; }
.footer-link a { color: var(--muted); }

/* ---------- app shell ---------- */

.app-page { display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid #1c2336;
}

.brand { font-weight: 700; font-size: 17px; }

.topbar nav a { font-size: 20px; text-decoration: none; margin-left: 16px; }

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.transcript-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.status { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 14px; min-height: 20px; }
.status.error { background: none; color: var(--err); padding: 0; }

.transcript {
  flex: 1;
  background: var(--surface);
  border: 1px solid #232b42;
  border-radius: var(--radius);
  padding: 18px;
  font-size: 17px;
  line-height: 1.6;
  overflow-y: auto;
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.transcript:empty::before {
  content: "Your dictation will appear here.";
  color: var(--muted);
}

.result-actions { display: flex; gap: 10px; margin-top: 12px; }
.result-actions .btn { flex: 1; }
.hidden { display: none !important; }

/* ---------- mic zone ---------- */

.mic-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
}

#meter { opacity: 0.9; }

.mic-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 30%, #7d8cff, var(--accent));
  box-shadow: 0 8px 30px rgba(108, 124, 255, 0.35);
  font-size: 40px;
  cursor: pointer;
  touch-action: none;          /* keeps long-press from scrolling/selecting */
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.1s ease, background 0.2s ease;
}

.mic-btn.recording {
  background: radial-gradient(circle at 30% 30%, #ff7d94, var(--accent-hot));
  box-shadow: 0 8px 30px rgba(255, 77, 109, 0.45);
  animation: pulse 1.4s ease-in-out infinite;
}

.mic-btn.busy { opacity: 0.5; pointer-events: none; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; min-height: 20px; }
