:root {
  --bg: #0f1220;
  --bg2: #171a2e;
  --card: #1d2138;
  --accent: #6c5ce7;
  --accent2: #00d2a8;
  --text: #eef0ff;
  --muted: #9aa0c0;
  --danger: #ff5c7a;
}

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

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg));
  color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
header h1 { font-size: 1.4rem; margin: 0; }

.icon-btn, .ghost-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid #2a2f4d;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1rem;
  cursor: pointer;
}
.ghost-btn { width: 100%; margin-top: 10px; padding: 12px; }

main { padding: 0 16px 40px; max-width: 640px; margin: 0 auto; }

/* mic */
.mic-zone { text-align: center; padding: 18px 0 8px; }
.mic {
  width: 132px; height: 132px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--accent), #4834c4);
  box-shadow: 0 12px 36px rgba(108,92,231,0.45);
  transition: transform .12s ease, box-shadow .2s ease;
  position: relative;
}
.mic .mic-icon { font-size: 3rem; }
.mic:active { transform: scale(0.96); }
.mic.recording {
  background: linear-gradient(145deg, var(--danger), #c0244a);
  box-shadow: 0 0 0 0 rgba(255,92,122,0.7);
  animation: pulse 1.3s infinite;
}
.mic.busy { opacity: .6; }
.mic.listening {
  background: linear-gradient(145deg, var(--accent2), #009e7f);
  box-shadow: 0 12px 36px rgba(0,210,168,0.45);
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,92,122,0.6); }
  70% { box-shadow: 0 0 0 26px rgba(255,92,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,92,122,0); }
}

.status { color: var(--muted); margin: 16px 0 12px; min-height: 1.2em; }

.listen-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .92rem;
  background: var(--card); padding: 10px 14px; border-radius: 999px;
  border: 1px solid #2a2f4d;
}
.listen-toggle input { width: 18px; height: 18px; accent-color: var(--accent2); }

/* notes */
.notes { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.note {
  background: var(--card);
  border: 1px solid #262b47;
  border-radius: 16px;
  padding: 14px 16px;
}
.note .note-text {
  width: 100%; background: transparent; border: none; resize: none;
  color: var(--text); font-size: 1.05rem; line-height: 1.5;
  font-family: inherit; outline: none;
  min-height: 1.6em; display: block; overflow: hidden;
}
.note .note-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; color: var(--muted); font-size: .78rem;
}
.note .note-actions { display: flex; gap: 6px; }
.note .note-actions button {
  background: transparent; border: none; color: var(--muted);
  font-size: 1rem; cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.note .note-actions button:active { background: #2a2f4d; }
.note.pending { opacity: .7; border-style: dashed; }
.empty { color: var(--muted); text-align: center; margin-top: 30px; }

/* settings drawer */
.drawer {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; z-index: 20;
}
.drawer.hidden { display: none; }
.drawer-inner {
  background: var(--bg2); width: 100%;
  border-radius: 22px 22px 0 0; padding: 22px 20px 30px;
  border-top: 1px solid #2a2f4d;
}
.drawer-inner h2 { margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field.row { flex-direction: column; }
.field span { color: var(--muted); font-size: .85rem; }
.field input, .field select {
  background: var(--card); color: var(--text);
  border: 1px solid #2a2f4d; border-radius: 12px; padding: 12px;
  font-size: 1rem; font-family: inherit;
}
.test-result { color: var(--muted); font-size: .85rem; min-height: 1em; }
