:root {
  --bg: #fff7ef;
  --card: #ffffff;
  --ink: #2b2024;
  --muted: #7d6e72;
  --line: #f0e2d6;
  --accent: #ff6b4a;
  --accent-ink: #ffffff;
  --accent-soft: #ffe7df;
  --ok: #2e9e6b;
  --ok-soft: #e1f5ea;
  --skip: #b9a9ad;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(120, 60, 40, .08);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100vh; min-height: 100dvh; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Шапка с прогрессом */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 247, 239, .94);
  backdrop-filter: blur(8px);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px;
  border-bottom: 1px solid var(--line);
}
.top-row { max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 800; letter-spacing: .02em; color: var(--accent); }
.save { font-size: 13px; color: var(--muted); }
.save.err { color: #c0392b; }
.bar { max-width: 640px; margin: 8px auto 0; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.dots { max-width: 640px; margin: 8px auto 0; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.dots::-webkit-scrollbar { display: none; }
.dot {
  flex: 0 0 auto;
  min-width: 34px; height: 34px;
  border-radius: 17px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 14px; font-weight: 700;
  color: var(--muted);
}
.dot.done { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.dot.skip { background: #f4eff0; border-color: var(--skip); color: var(--skip); }
.dot.cur { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Основная колонка */
.app { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; flex: 1 0 auto; }
.loading { color: var(--muted); text-align: center; margin-top: 30vh; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}
.num { font-size: 14px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
h1 { font-size: 28px; line-height: 1.2; margin: 6px 0 14px; font-weight: 800; }
h2 { font-size: 23px; line-height: 1.25; margin: 4px 0 10px; font-weight: 800; }
.q { margin: 0 0 12px; font-size: 18px; }
.why {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 15px;
  color: #6b4337;
}
.why b { font-weight: 700; }
.intro p { margin: 0 0 12px; }
.intro ul { padding-left: 20px; margin: 0 0 16px; }
.intro li { margin-bottom: 6px; }

/* Варианты */
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.choice {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 24px;
  padding: 9px 16px;
  min-height: 44px;
  font-weight: 600;
}
.choice.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

/* Поля */
.fields { display: grid; gap: 12px; margin-bottom: 14px; }
label.f span { display: block; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input.in, textarea.in {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fffdfb;
  padding: 11px 13px;
  outline: none;
}
input.in:focus, textarea.in:focus { border-color: var(--accent); }
textarea.in { min-height: 130px; resize: vertical; }
.tip { font-size: 13px; color: var(--muted); margin: 6px 2px 14px; }

/* Кнопки голоса и файла */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tool {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  border-radius: 14px;
  border: 1.5px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  font-weight: 700;
}
.tool svg { width: 20px; height: 20px; flex: 0 0 auto; }
.tool.rec { background: var(--accent); color: var(--accent-ink); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 107, 74, .18); } }

/* Вложения */
.atts { display: grid; gap: 10px; margin-bottom: 14px; }
.att { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fffdfb; }
.att-head { display: flex; align-items: center; gap: 8px; }
.att-name { flex: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 13px; color: var(--muted); }
.att-del { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 6px; }
.att audio { width: 100%; margin-top: 8px; height: 40px; }
.att-tr { margin-top: 6px; font-size: 15px; color: #4d3f43; white-space: pre-wrap; }
.att-tr.wait { color: var(--muted); font-style: italic; }
.prog { margin-top: 8px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.prog > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.att.err { border-color: #e8a49a; }
.att-err { font-size: 13px; color: #c0392b; margin-top: 4px; }
.retry { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0; margin-left: 6px; }

.skip {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: none;
  padding: 11px 14px;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}
.skip.on { border-style: solid; border-color: var(--skip); background: #f4eff0; color: #6f6266; }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 14px; }

/* Навигация */
.nav { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  border: 0;
  font-weight: 800;
  font-size: 17px;
}
.btn.main { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); flex: 0 0 38%; }
.btn:disabled { opacity: .5; }

/* Итог */
.sum { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.sum button {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 10px 12px;
}
.sum .st { margin-left: auto; font-size: 13px; font-weight: 700; white-space: nowrap; }
.st.done { color: var(--ok); }
.st.skip { color: var(--skip); }
.st.empty { color: var(--accent); }
.thanks { text-align: center; }
.thanks .big { font-size: 46px; line-height: 1; margin-bottom: 8px; color: var(--ok); }

.author-sign {
  margin-top: auto;
  text-align: center;
  font-size: 11px;
  color: var(--ink);
  opacity: .45;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 560px) {
  .card { padding: 28px 28px; }
  h1 { font-size: 32px; }
}
