:root {
  color-scheme: dark;
  --ink: #1c120e;
  --paper: #f6efe8;
  --clay: #c2412d;
  --clay-deep: #8e2a1c;
  --mute: #d9c7ba;
  --ok: #d8f3df;
  --warn: #ffe7c2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--paper);
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1.15rem;
  padding:
    calc(1.1rem + env(safe-area-inset-top))
    calc(1.15rem + env(safe-area-inset-right))
    calc(1.4rem + env(safe-area-inset-bottom))
    calc(1.15rem + env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 62%, #3a241c 0, transparent 18rem),
    var(--ink);
}

.today {
  margin: 0 auto auto;
  color: var(--mute);
  font-size: 1.05rem;
}

#mic {
  --level: 0;
  position: relative;
  width: min(70vw, 17.5rem);
  height: min(70vw, 17.5rem);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e15a44, var(--clay) 42%, var(--clay-deep));
  color: white;
  cursor: pointer;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.35),
    0 0 0 calc(12px + var(--level) * 34px) rgba(194, 65, 45, 0.24);
  touch-action: manipulation;
  user-select: none;
}

#mic svg { width: 44%; height: 44%; pointer-events: none; }
#mic rect { fill: currentColor; }
#mic .ring {
  position: absolute;
  inset: -0.85rem;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

#mic.recording {
  background: radial-gradient(circle at 35% 30%, #ff7a64, #d44832 45%, #9d2918);
}
#mic.recording .ring {
  border-color: rgba(255, 220, 208, 0.9);
  animation: pulse 1.4s ease-out infinite;
}
#mic.working { opacity: 0.72; }

@keyframes pulse {
  from { transform: scale(0.94); opacity: 0.9; }
  to { transform: scale(1.2); opacity: 0; }
}

.status {
  margin: 0;
  width: 100%;
  max-width: 24rem;
  min-height: 4.6rem;
  text-align: center;
  font-size: 1.35rem;
  line-height: 1.65;
  white-space: pre-line;
}

.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }

.heard {
  margin: 0;
  width: 100%;
  max-width: 24rem;
  min-height: 2.8rem;
  color: var(--mute);
  text-align: center;
  font-size: 1rem;
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  #mic.recording .ring { animation: none; }
}
