:root {
  --bg: #07100c;
  --bg-soft: #0d1a14;
  --line: #1b3327;
  --green: #35e07f;
  --green-dim: #17301f;
  --white: #f3fff8;
  --muted: #8fae9e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  min-height: 100%;
  overscroll-behavior-y: contain;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 10px; }
h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
h2 { font-size: 14px; margin: 18px 0 10px; color: var(--muted); font-weight: 600;
     text-transform: uppercase; letter-spacing: .8px; }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green-dim);
  box-shadow: 0 0 0 0 rgba(53, 224, 127, .5);
  transition: background .2s;
}
.dot.on { background: var(--green); animation: pulse 1.8s infinite; }
.dot.hot { background: var(--white); box-shadow: 0 0 14px 2px var(--green); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 224, 127, .45); }
  70% { box-shadow: 0 0 0 12px rgba(53, 224, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 127, 0); }
}

main { padding: 0 16px calc(92px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

.stage {
  padding: 11px 0 9px;
  text-align: center;
}

.eq-wrap { position: relative; }

canvas#eq {
  width: 100%;
  height: 190px;
  display: block;
  border-radius: 18px;
  background: radial-gradient(120% 100% at 50% 0%, #0f1f17 0%, #07100c 70%);
  border: 1px solid var(--line);
}

#status { margin: 7px 0 2px; color: var(--muted); font-size: 14px; min-height: 20px; }
.heard { margin: 0; min-height: 24px; font-size: 17px; color: var(--white); }

/* Микрофон в плашке, рядом с отправкой: обе кнопки одного размера,
   поле ввода занимает всю оставшуюся ширину. */
.mic-btn {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: transparent;
  color: var(--green);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.mic-btn:active { transform: scale(.94); }
.mic-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.mic-btn .stop-icon { display: none; }

/* Идёт приём: белым, с пульсацией — как и полосы эквалайзера */
.mic-btn.recording {
  background: var(--white);
  border-color: var(--white);
  color: #04150c;
  animation: mic-pulse 1.6s infinite;
}
.mic-btn.recording .mic-icon { display: none; }
.mic-btn.recording .stop-icon { display: block; }

@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(53, 224, 127, .55); }
  70%  { box-shadow: 0 0 0 14px rgba(53, 224, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 127, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .mic-btn.recording { animation: none; }
}

button.primary {
  background: var(--green);
  color: #04150c;
  border: 0;
  border-radius: 999px;
  padding: 14px 34px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
button.primary:active { transform: scale(.98); }
button.primary.stop { background: var(--white); }

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* Плашка ввода закреплена внизу: набирают задачу чаще всего, дотянувшись большим
   пальцем, и уезжать вместе со списком она не должна. */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom))
           max(12px, env(safe-area-inset-left));
  gap: 8px;
  background: rgba(7, 16, 12, .92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1; min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 16px;
  color: var(--white);
  font-size: 16px;                      /* меньше — и iOS увеличивает страницу при фокусе */
}
.composer input::placeholder { color: #5f7a6c; }

.send-btn {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: #04150c;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.send-btn svg { width: 22px; height: 22px; fill: currentColor; margin-left: 2px; }
.send-btn:active { transform: scale(.94); }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tasks li {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tasks li.empty { color: var(--muted); justify-content: center; border-style: dashed; }
.tasks .text { flex: 1; min-width: 0; }
.tasks .meta { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.tasks .check {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: transparent;
  color: var(--green);
  font-size: 16px;
  cursor: pointer;
}
.tasks .check:active { background: var(--green); color: #04150c; }

dialog {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--white);
  border-radius: 18px;
  padding: 20px;
  width: min(420px, 92vw);
}
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--white);
  font-size: 15px;
}
.field small { display: block; color: #6d8a7b; font-size: 12px; margin-top: 6px; }
.row { display: flex; gap: 10px; justify-content: flex-end; }

.diag { margin: 4px 0 16px; }
.diag summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.diag pre {
  margin: 8px 0 0;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}
