:root {
  color-scheme: dark;
  --ink: #f4f1ea;
  --muted: #b7b1a6;
  --line: #3a404c;
  --panel: #141820;
  --accent: #d7dde8;
  --danger: #ffb4b4;
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: #07080c;
}
main {
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}
h1 { margin: 0 0 8px; font-size: 1.6rem; }
p { margin: 0; }
.card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
label { color: var(--muted); font-size: 0.92rem; }
input, textarea, button { font: inherit; }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #0c0e13;
}
textarea { resize: vertical; min-height: 112px; }
button {
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  color: #111318;
  background: var(--accent);
  font-weight: 700;
}
button:disabled { opacity: 0.55; }
button.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}
.row { display: flex; gap: 10px; }
.row button { flex: 1; }
.row button[aria-pressed="true"] {
  color: #111318;
  background: var(--accent);
  border-color: var(--accent);
}
#doll {
  width: min(100%, 560px);
  height: min(72vh, 680px);
  margin: 0 auto 8px;
  border-radius: 16px;
  overflow: hidden;
  background: #10141c;
}
#doll canvas { width: 100%; height: 100%; display: block; }
.hint { margin: 0 0 16px; color: var(--muted); text-align: center; }
.status { min-height: 1.4em; color: var(--muted); }
.status.error { color: var(--danger); }
.controls { margin-bottom: 16px; }
.label { color: var(--muted); font-size: 0.92rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button {
  min-height: 40px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font-weight: 600;
}
.choices button[aria-pressed="true"] {
  color: #111318;
  background: var(--accent);
  border-color: var(--accent);
}
input[type="range"] { padding: 0; accent-color: #d7dde8; }
#lip-tune:not([hidden]) {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
#lip-reset { justify-self: start; }
.slider {
  display: grid;
  grid-template-columns: minmax(7.5rem, 9.5rem) 1fr 2.5rem;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.slider output { text-align: right; font-variant-numeric: tabular-nums; }
