
:root {
  --bg: #f7f4ef;
  --card: #fffdf8;
  --text: #1f1f1f;
  --muted: #756f66;
  --line: #e2dbd1;
  --accent: #1f1f1f;
  --soft: #eee7dc;
  --danger: #9b2c2c;
  --success: #2f6f4e;
  --radius: 22px;
  --shadow: 0 20px 60px rgba(31,31,31,.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(0,0,0,.05), transparent 32%),
    linear-gradient(135deg, #f8f5ef 0%, #ece4d8 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 24px;
}
body.centered { align-items: center; }
body.top { align-items: flex-start; }
.app { width: min(1020px, 100%); }
.shell {
  background: rgba(255,253,248,.92);
  border: 1px solid rgba(226,219,209,.95);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
header {
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
}
h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 4vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}
h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.045em;
}
h3 { margin: 0 0 14px; font-size: 1.05rem; letter-spacing: -0.02em; }
p { margin: 0; }
.subtitle, .muted {
  color: var(--muted);
  line-height: 1.55;
  max-width: 760px;
  font-size: .98rem;
}
.badge {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 850;
  white-space: nowrap;
}
main { padding: 30px 32px 32px; }
.context-card {
  border: 1px solid var(--line);
  background: #f4eee5;
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.55;
  font-size: .92rem;
}
.context-card strong { color: var(--text); }
.topbar { display: grid; gap: 14px; margin-bottom: 28px; }
.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e6ded3;
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .26s ease;
}
.dots {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 6px;
}
.dot {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #ddd5cb;
  padding: 0;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}
.dot:hover:not(:disabled) { transform: translateY(-1px); }
.dot.answered { background: #8b8379; }
.dot.current { background: var(--accent); transform: scaleY(1.5); }
.dot:disabled { cursor: not-allowed; opacity: .45; }
.question-card {
  min-height: 390px;
  display: grid;
  align-content: center;
  gap: 28px;
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  position: relative;
  overflow: hidden;
}
.question-card::before {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -140px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(0,0,0,.035);
}
.question-content {
  position: relative;
  transition: opacity .19s ease, transform .19s ease;
}
.question-content.fade-out { opacity: 0; transform: translateY(8px); }
.category-label {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .82rem;
  letter-spacing: .13em;
  font-weight: 850;
  text-transform: uppercase;
}
.question {
  margin: 0;
  font-size: clamp(1.48rem, 5vw, 2.45rem);
  line-height: 1.13;
  letter-spacing: -0.045em;
  max-width: 800px;
}
.scale {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.option {
  border: 1px solid var(--line);
  background: #fbf8f2;
  border-radius: 16px;
  padding: 15px 10px;
  min-height: 88px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  color: var(--text);
  font: inherit;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.option:hover { transform: translateY(-2px); border-color: #beb5a8; }
.option.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(0,0,0,.14);
  transform: translateY(-2px);
}
.option strong { display: block; font-size: 1.25rem; line-height: 1; }
.option span { font-size: .78rem; line-height: 1.25; font-weight: 700; }
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}
.control-group { display: flex; gap: 10px; flex-wrap: wrap; }
button.action, a.action {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-size: .92rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.action:hover:not(:disabled), a.action:hover { transform: translateY(-1px); }
button.action:disabled { opacity: .42; cursor: not-allowed; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line) !important; }
.primary { background: var(--accent); color: white; }
.secondary { background: var(--soft); color: var(--text); border: 1px solid var(--line) !important; }
.notice, .status {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f1eadf;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
}
.status.success { color: var(--success); }
.status.error { color: var(--danger); }
.results { display: none; animation: show .26s ease both; }
@keyframes show { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-hero {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 18px;
}
.result-hero h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 5vw, 3rem);
  letter-spacing: -0.06em;
  line-height: 1;
}
.result-hero p { margin: 0; color: var(--muted); line-height: 1.6; }
.grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 22px;
}
.bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 62px;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  font-size: .86rem;
  font-weight: 800;
}
.bar-row span:first-child { line-height: 1.25; }
.bar-bg { height: 12px; border-radius: 999px; background: #e8e0d6; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.score { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cards { display: grid; gap: 10px; }
.card {
  padding: 14px;
  border-radius: 16px;
  background: #f5efe6;
  border: 1px solid var(--line);
}
.card strong { display: block; margin-bottom: 5px; }
.card span { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex;
  border: 1px solid var(--line);
  background: #fbf8f2;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 750;
}
.reading { margin-top: 18px; display: grid; gap: 10px; }
.reading ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }
.footer-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
}
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbf8f2;
  color: var(--text);
  border-radius: 999px;
  padding: 13px 16px;
  font: inherit;
  outline: none;
}
input[type="text"]:focus { border-color: #afa497; }
.test-links { display: grid; gap: 12px; margin-top: 22px; }
.test-link {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 6px;
}
.test-link strong { font-size: 1.05rem; }
.test-link span { color: var(--muted); line-height: 1.45; }
.hidden { display: none !important; }
@media (max-width: 760px) {
  body { padding: 12px; align-items: stretch; }
  .shell { border-radius: 24px; min-height: calc(100vh - 24px); }
  header { padding: 22px 20px 16px; display: grid; }
  main { padding: 20px; }
  .badge { width: fit-content; }
  .dots { grid-template-columns: repeat(8, 1fr); }
  .question-card { min-height: 430px; padding: 22px; }
  .scale { grid-template-columns: 1fr; }
  .option { min-height: 54px; grid-template-columns: 42px 1fr; text-align: left; justify-items: start; padding: 11px 14px; }
  .option strong { font-size: 1rem; }
  .controls, .name-row { display: grid; }
  .control-group { width: 100%; }
  button.action, a.action { flex: 1; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 128px 1fr 54px; }
}
@media print {
  body { background: white; padding: 0; }
  .shell { box-shadow: none; border: 0; }
  .controls, .footer-actions, .topbar, .notice, .context-card, .name-row { display: none !important; }
  .results { display: block !important; }
}
