:root {
  --fg: #0a0a0a;
  --muted: #666;
  --bg: #ffffff;
  --panel: #f4f4f4;
  --border: #e2e2e2;
  --accent: #0a0a0a;
  --rec: #e23838;
  --rec-soft: rgba(226, 56, 56, 0.22);
  --warn: #f0a000;
  --error: #c81e1e;
  --ok: #2fa84a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  padding:
    calc(env(safe-area-inset-top, 0) + 24px)
    20px
    calc(env(safe-area-inset-bottom, 0) + 28px);
  display: flex;
  flex-direction: column;
}

.hdr { text-align: center; margin-bottom: 40px; }
.hdr h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.hdr .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
}
.hidden { display: none !important; }

.big-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--border);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, background 0.2s ease, border-color 0.2s ease;
}
.big-circle:active { transform: scale(0.97); }
.big-circle:disabled { opacity: 0.55; cursor: not-allowed; }

.big-circle.recording {
  background: var(--rec);
  border-color: var(--rec);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--rec-soft); }
  50%      { box-shadow: 0 0 0 22px transparent; }
}

.mic-glyph {
  width: 56px;
  height: 56px;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z"/></svg>') center/contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z"/></svg>') center/contain no-repeat;
}
.stop-glyph {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 6px;
}

.hint {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  margin: 0;
  letter-spacing: 2px;
}
.timer.warn { color: var(--warn); }

.field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
input[type="text"] {
  width: 100%;
  font-size: 16px;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--fg);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus { border-color: var(--accent); }

audio {
  width: 100%;
  border-radius: 12px;
  background: var(--panel);
}

button.primary, button.secondary {
  width: 100%;
  font-size: 16px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button.primary {
  background: var(--accent);
  color: #ffffff;
}
button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
button.secondary:active, button.primary:active { transform: scale(0.99); }

.error {
  color: var(--error);
  font-size: 14px;
  text-align: center;
  margin: 0;
  line-height: 1.4;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.check {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--ok);
  color: #ffffff;
  font-size: 48px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
