:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --panel: #fbfaf7;
  --paper: #ffffff;
  --ink: #27241f;
  --muted: #6d655b;
  --line: #dfd7ca;
  --accent: #5f7d73;
  --accent-dark: #3f6258;
  --accent-soft: #e2ebe6;
  --warning: #a56c3f;
  --shadow: 0 24px 70px rgba(65, 55, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #efe7dc, #f8f6f1 48%, #e8eee9);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 28px;
  width: min(1380px, calc(100% - 36px));
  margin: 24px auto;
}

.side-panel,
.workspace {
  background: rgba(251, 250, 247, 0.88);
  border: 1px solid rgba(223, 215, 202, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.side-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  padding: 28px;
  border-radius: 8px;
}

.brand,
.eyebrow {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.14;
}

h1 {
  margin-top: 18px;
  font-size: 34px;
}

h2 {
  margin-top: 10px;
  font-size: 32px;
}

h3 {
  margin-top: 24px;
  font-size: 20px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.lead {
  max-width: 760px;
  font-size: 18px;
}

.progress-card,
.notice {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--muted);
  line-height: 1.55;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ded2;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

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

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.steps span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ede6db;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.steps .active {
  color: var(--ink);
  font-weight: 700;
}

.steps .active span {
  background: var(--accent);
  color: white;
}

.workspace {
  min-height: calc(100vh - 48px);
  border-radius: 8px;
}

form {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  padding: 44px;
}

.screen.active {
  display: block;
}

.hint {
  margin-bottom: 28px;
}

.question-list {
  display: grid;
  gap: 18px;
}

.question {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.question-title {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.45;
}

.options {
  display: grid;
  gap: 10px;
}

.options.scale,
.options.profile-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.options.uwes-scale {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.options.ten-scale {
  grid-template-columns: repeat(10, minmax(46px, 1fr));
}

label.option {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e4ddd2;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

label.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

label.option input {
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.number-option {
  justify-content: center;
  min-height: 50px;
  padding: 8px;
  font-weight: 700;
}

.number-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.profile-question {
  margin: 0;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 650;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding: 18px 44px;
  border-top: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.96);
  backdrop-filter: blur(16px);
}

.action-group {
  display: flex;
  gap: 12px;
}

button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 18px;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.ghost {
  background: white;
  color: var(--accent-dark);
  border-color: var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.summary-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.report {
  max-width: 860px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report h2 {
  margin-top: 28px;
  font-size: 24px;
}

.report h3 {
  font-size: 18px;
}

.report p,
.report li {
  color: #4f4941;
  line-height: 1.72;
}

.error {
  outline: 2px solid var(--warning);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    min-height: auto;
  }

  .options.scale,
  .options.profile-options,
  .options.uwes-scale,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .options.ten-scale {
    grid-template-columns: repeat(5, minmax(46px, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    background: var(--bg);
  }

  .shell {
    width: 100%;
    margin: 0;
    gap: 0;
  }

  .side-panel,
  .workspace {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .screen,
  .side-panel {
    padding: 18px;
  }

  .side-panel {
    padding-bottom: 14px;
  }

  .side-panel p,
  .steps {
    display: none;
  }

  .progress-card {
    margin-top: 16px;
    padding: 12px;
  }

  .question-list {
    gap: 14px;
  }

  .question {
    padding: 15px;
  }

  .question-title {
    font-size: 16px;
  }

  label.option {
    min-height: 52px;
    padding: 12px;
  }

  .options.ten-scale {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
  }

  .scale-caption {
    display: grid;
    gap: 4px;
  }

  .actions {
    padding: 12px;
    gap: 10px;
  }

  .action-group {
    flex: 1;
  }

  .action-group button {
    flex: 1;
  }

  .ghost {
    display: none;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 23px;
  }

  .lead {
    font-size: 16px;
  }

  .report {
    padding: 18px;
  }
}

@media (max-width: 390px) {
  .screen,
  .side-panel {
    padding: 14px;
  }

  .options.ten-scale {
    grid-template-columns: repeat(5, minmax(40px, 1fr));
  }

  button {
    padding: 0 12px;
  }
}
