:root {
  --bg: #0d0f12;
  --panel: #16191f;
  --line: #262b33;
  --text: #eef1f5;
  --muted: #8b93a1;
  --accent: #ff4d4d;
  --ok: #35c26a;
  color-scheme: dark;
}

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

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
}

/* --- login --- */

.login {
  margin: auto;
  width: min(340px, 88vw);
  text-align: center;
}

.login h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.02em; }
.login p { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

input[type="password"] {
  width: 100%;
  padding: 15px 16px;
  font-size: 17px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

input[type="password"]:focus { border-color: #3d4552; }

.login button {
  width: 100%;
  margin-top: 12px;
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  color: #0d0f12;
  background: var(--text);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.error { color: var(--accent); font-size: 14px; min-height: 20px; margin-top: 12px; }

/* --- app --- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

header .brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

header .status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.dot.busy { background: #f5a623; animation: pulse 1.1s ease-in-out infinite; }
.dot.rec { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.dot.ok { background: var(--ok); }

@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

#transcript {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  resize: none;
  padding: 16px;
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}

#transcript::placeholder { color: #555c68; }

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tools button {
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.tools button:active { background: #1e222a; }
.tools .count { margin-left: auto; font-size: 12px; color: var(--muted); }

footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 26px;
}

#record {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, box-shadow .2s ease;
  box-shadow: 0 0 0 0 rgba(255, 77, 77, .45);
}

#record:active { transform: scale(.94); }

#record .glyph {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #fff;
  transition: border-radius .18s ease, width .18s ease, height .18s ease;
}

#record.recording { animation: ring 1.6s ease-out infinite; }
#record.recording .glyph { border-radius: 6px; width: 26px; height: 26px; }

@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, .5); }
  100% { box-shadow: 0 0 0 26px rgba(255, 77, 77, 0); }
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: .03em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translate(-50%, 12px);
  background: #2a2f38;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
