:root {
  --bg: #f6f5ee;
  --surface: #fffffa;
  --ink: #1f1e18;
  --muted: #66645a;
  --line: #e2e0d2;
  --accent: #55532a;
  --accent-soft: #f8f6c2;
  --focus: #8f8a12;
  --error: #a3271b;
  --lemon: #ebe61f;
  --lemon-ink: #24230f;
  --lemon-edge: #8f8a12;
  --lemon-soft: #f8f6c2;
  --lemon-off: #ebe9c6;
  --lemon-off-ink: #6a675c;
  --radius: 14px;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161612;
    --surface: #1f1f1a;
    --ink: #eeeddf;
    --muted: #a6a494;
    --line: #36352b;
    --accent: #e8e32a;
    --accent-soft: #33321a;
    --focus: #e8e32a;
    --error: #ff8a7a;
    --lemon: #e8e32a;
    --lemon-ink: #1c1b0c;
    --lemon-edge: #e8e32a;
    --lemon-soft: #33321a;
    --lemon-off: #38361c;
    --lemon-off-ink: #a6a294;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-left), calc((100% - 648px) / 2)) 10px;
  background: var(--bg);
}

.brand { font: 600 15px/1.2 var(--serif); letter-spacing: .02em; }
.stage { font-size: 13px; color: var(--muted); white-space: nowrap; }

.progress { height: 3px; background: var(--line); position: sticky; top: 44px; z-index: 2; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px calc(48px + env(safe-area-inset-bottom));
  outline: none;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: clamp(26px, 6vw, 34px); }
h2 { font-size: clamp(21px, 5vw, 26px); }
h3 { font-size: 18px; }
p { margin: 0 0 14px; }
.lead { font-size: 18px; color: var(--muted); }
.muted { color: var(--muted); font-size: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
}

.field { display: block; margin: 0 0 18px; }
.field > span { display: block; font-weight: 500; margin-bottom: 6px; }

input[type="text"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, button:focus-visible, .option:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.check { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 20px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

button {
  font: 500 16px/1.2 var(--sans);
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 22px;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--lemon); color: var(--lemon-ink); border-color: var(--lemon-edge); font-weight: 600; transition: filter .15s; }
.btn-primary:hover:not(:disabled) { filter: brightness(.96); }
.btn-primary:disabled { background: var(--lemon-off); color: var(--lemon-off-ink); border-color: transparent; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.q-count { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.q-text { font: 600 clamp(20px, 5vw, 24px)/1.35 var(--serif); margin: 0 0 20px; }

.options { display: grid; gap: 10px; }
.option {
  display: block;
  width: 100%;
  text-align: left;
  font: 400 16px/1.45 var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  min-height: 52px;
  transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--lemon-edge); }
.option[aria-pressed="true"] { border-color: var(--lemon-edge); background: var(--lemon-soft); box-shadow: inset 0 0 0 1px var(--lemon-edge); }

.result-kicker { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; font-weight: 600; }
.result-card h2 { margin-bottom: 10px; }
.result-card .section { margin-top: 18px; }
.result-card .section h3 { font-family: var(--sans); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.question-quote { font: italic 500 18px/1.45 var(--serif); border-left: 3px solid var(--accent); padding-left: 14px; margin: 0; }
.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { margin: 0 0 8px; }
.artists { display: grid; gap: 12px; }
.artist-name { font-weight: 600; }

details.card > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card[open] > summary { margin-bottom: 10px; }
details.card > summary::after { content: "Показать"; flex: none; font-size: 14px; color: var(--accent); }
details.card[open] > summary::after { content: "Свернуть"; }

.secondary h3 { margin-bottom: 6px; }

.scale-item { margin: 0 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; }
.scale-item legend { padding: 0; margin-bottom: 12px; font-weight: 500; float: left; width: 100%; }
.scale-item legend + * { clear: both; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale label { position: relative; }
.scale input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.scale span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; border: 1px solid var(--line); border-radius: 10px;
  font-weight: 600; cursor: pointer; background: var(--bg);
}
.scale input:checked + span { background: var(--lemon); color: var(--lemon-ink); border-color: var(--lemon-edge); }
.scale input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.scale-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; gap: 8px; }

.invalid { border-color: var(--error) !important; }
.error { color: var(--error); font-size: 15px; margin-top: 8px; }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.counter { font-size: 13px; color: var(--muted); text-align: right; margin-top: 4px; }
