:root {
  --bg: #0b1220;
  --card: #131c2e;
  --card2: #1a2438;
  --line: #24314b;
  --fg: #e8eef8;
  --muted: #8d9cb5;
  --accent: #3ddc97;
  --danger: #ff6b6b;
  --radius: 16px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #16233a 0%, var(--bg) 55%);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100%;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(32px + env(safe-area-inset-bottom));
}

header { text-align: center; }

h1 {
  font-size: 1.6rem;
  margin: 6px 0 2px;
  letter-spacing: -0.02em;
}

.status {
  min-height: 1.3em;
  font-size: 0.9rem;
  color: var(--muted);
  transition: color .2s;
}
.status.ok { color: var(--accent); }
.status.err { color: var(--danger); }

/* ---- mikki ---- */
.mic-wrap { display: flex; flex-direction: column; align-items: center; margin: 22px 0 6px; }

.mic {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(160deg, #2ee6a0, #17b883);
  color: #06240f;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 34px rgba(45, 220, 150, 0.28);
  transition: transform .12s ease, box-shadow .2s, background .2s;
}
.mic svg { width: 54px; height: 54px; fill: currentColor; }
.mic:active { transform: scale(0.96); }

.mic.rec {
  background: linear-gradient(160deg, #ff8080, #e5484d);
  color: #2a0505;
  animation: pulse 1.4s infinite;
}
.mic.busy { background: var(--card2); color: var(--muted); box-shadow: none; cursor: progress; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.55); }
  70%  { box-shadow: 0 0 0 26px rgba(229, 72, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); }
}

.hint { color: var(--muted); font-size: 0.86rem; text-align: center; margin: 12px 0 0; }

/* ---- tekstikenttä ---- */
.textform { display: flex; gap: 8px; margin: 20px 0 4px; }
.textform input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 1rem;
}
.textform input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.textform button {
  width: 50px;
  border-radius: 12px;
  border: none;
  background: var(--card2);
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
}
.textform button:active { background: var(--line); }

/* ---- lista ---- */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.ghost {
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 2px;
}
.ghost.danger { color: var(--danger); opacity: .9; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px;
  animation: slide .18s ease;
}
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }

.item .check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: none;
  flex: 0 0 auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 15px;
}
.item .check:hover { border-color: var(--accent); }
.item .label { flex: 1; font-size: 1.02rem; line-height: 1.3; word-break: break-word; }
.item .qty {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--card2);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.item .del {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.15rem; padding: 4px 6px; line-height: 1;
}
.item .del:hover { color: var(--danger); }

.done-wrap { margin-top: 18px; }
.done-wrap summary {
  cursor: pointer; color: var(--muted); font-size: .85rem;
  padding: 6px 2px; list-style: none;
}
.done-wrap summary::-webkit-details-marker { display: none; }
.list.done .item { opacity: .6; }
.list.done .label { text-decoration: line-through; }
.list.done .check { background: var(--accent); border-color: var(--accent); color: #06240f; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
  padding: 26px 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (min-width: 720px) {
  h1 { font-size: 1.9rem; }
  .mic { width: 116px; height: 116px; }
}
