@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap");

:root {
  --background: oklch(0.985 0.006 240);
  --foreground: oklch(0.23 0.03 252);
  --muted-foreground: oklch(0.49 0.02 250);
  --card: #ffffff;
  --secondary: oklch(0.965 0.008 240);
  --muted: oklch(0.945 0.01 245);
  --border: oklch(0.89 0.012 245);
  --primary: oklch(0.56 0.18 245);
  --primary-foreground: #ffffff;
  --ring: oklch(0.62 0.2 262);
  --result-border: oklch(0.87 0.013 246);
  --ok: oklch(0.57 0.15 160);
  --mid: oklch(0.64 0.16 75);
  --low: oklch(0.58 0.20 30);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
}

.page {
  min-height: 100vh;
}

.container {
  width: min(100%, 67rem);
  margin-inline: auto;
  padding-inline: 16px;
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--primary) 4%, transparent);
}

.hero-inner {
  position: relative;
  padding-top: 48px;
  padding-bottom: 40px;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.hero-meta span:first-child {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.hero-meta span:last-child {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

h1 {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 3.2vw, 2.65rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
}

h1 span {
  color: var(--primary);
}

.subtitle {
  margin: 14px 0 0;
  max-width: 70ch;
  color: var(--muted-foreground);
  font-size: 0.93rem;
  line-height: 1.58;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.toolbar-progress {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  height: 6px;
  flex: 1 1 auto;
  max-width: 320px;
  border-radius: 999px;
  background: var(--secondary);
  overflow: hidden;
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 260ms ease;
}

#progress-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

button.primary,
button.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 180ms ease;
}

button.primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

button.primary:hover {
  filter: brightness(0.95);
}

button.primary.primary-large {
  border-radius: 12px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(33, 91, 170, 0.2);
}

button.ghost {
  color: var(--muted-foreground);
  background: transparent;
}

button.ghost:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.legend {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  color: var(--muted-foreground);
  font-size: 0.78rem;
}

.legend-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--foreground);
}

.legend b {
  display: inline-flex;
  width: auto;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 0.66rem;
  white-space: nowrap;
}

#question-groups {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.bottom-submit {
  margin-top: 14px;
  margin-bottom: 8px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
  display: flex;
  justify-content: flex-end;
}

.group {
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 380ms ease forwards;
}

.group-head {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: color-mix(in oklch, var(--dim-accent) 10%, #fff);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
}

.group-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dim-accent);
  flex-shrink: 0;
}

.group h3 {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--dim-title);
}

.group-sub {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.group-body {
  padding: 0 20px;
}

.question {
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.question:last-child {
  border-bottom: 0;
}

.question-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dim-accent);
  background: color-mix(in oklch, var(--dim-accent) 14%, transparent);
}

.q-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--foreground);
  font-weight: 600;
}

.option-wrap {
  margin-top: 10px;
}

.option-grid {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.option {
  display: inline-block;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
}

.option input {
  appearance: none;
  margin: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.option span {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: #f8fbff;
  color: #4d5d70;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid #d7e0ea;
  transition: all 160ms ease;
}

.option:hover span {
  background: #eef4fb;
  border-color: #bfd0e4;
  color: var(--foreground);
}

.option input:checked + span {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
}

button:focus-visible,
.option:has(input:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.results {
  margin-top: 24px;
  margin-bottom: 36px;
  border: 1px solid var(--result-border);
  border-radius: 16px;
  background: #fff;
  padding: 18px;
}

.results h2 {
  font-size: 1.24rem;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.result-card {
  border-radius: 12px;
  border: 1px solid var(--result-border);
  padding: 12px;
  background: #fff;
}

.result-card h4 {
  margin-bottom: 8px;
}

.result-card p {
  margin: 7px 0;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
}

.badge.low {
  background: var(--low);
}

.badge.mid {
  background: var(--mid);
}

.badge.high {
  background: var(--ok);
}

.overall {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--result-border);
}

.overall p {
  margin: 8px 0;
  font-size: 0.92rem;
}

.note {
  margin: 10px 0 0;
  color: var(--muted-foreground);
  font-size: 0.83rem;
}

.site-footer {
  margin-top: 6px;
  padding: 16px 0 24px;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.site-footer p {
  margin: 3px 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--muted-foreground) 90%, #000 10%);
}

.error {
  margin-top: 10px;
  margin-bottom: 8px;
  color: oklch(0.55 0.22 30);
  font-size: 0.86rem;
  font-weight: 600;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 640px) {
  .container {
    padding-inline: 24px;
  }

  .hero-inner {
    padding-top: 58px;
    padding-bottom: 46px;
  }

  .question {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
  }

  .option-wrap {
    margin-top: 0;
    flex-shrink: 0;
  }

  .option {
    width: 39px;
    height: 39px;
  }
}

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

@media (max-width: 620px) {
  .toolbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-progress {
    order: 1;
  }

  .actions {
    order: 2;
    justify-content: flex-end;
  }

  .bottom-submit {
    justify-content: stretch;
  }

  .bottom-submit .primary-large {
    width: 100%;
  }

  .group-head,
  .group-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .q-text {
    font-size: 0.88rem;
  }
}
