:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f5f7;
  color: #17191f;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(75, 123, 236, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(32, 191, 107, 0.12), transparent 30%),
    #f4f5f7;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow,
.question-kicker {
  margin: 0 0 8px;
  color: #5c6472;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.65rem, 4vw, 3.1rem);
  max-width: 720px;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.12;
}

.nav-actions,
.admin-actions,
.admin-header,
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(31, 35, 46, 0.08);
  padding: clamp(18px, 4vw, 34px);
}

.progress-row {
  color: #5c6472;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  background: #e9ecf1;
  border-radius: 999px;
  margin-bottom: 30px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: #17191f;
  border-radius: inherit;
  transition: width 180ms ease;
}

.question-area {
  display: grid;
  gap: 24px;
}

.section-heading {
  margin-bottom: 20px;
}

.mandala-panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #ffffff;
}

.mandala-wrap {
  position: relative;
  width: 220px;
  aspect-ratio: 1;
}

#progressMandala {
  display: block;
  width: 100%;
  height: 100%;
}

#progressMandala path {
  transition:
    fill 180ms ease,
    stroke 180ms ease,
    transform 120ms ease;
  transform-origin: center;
}

#progressMandala path:hover,
#progressMandala path:focus-visible {
  transform: scale(1.018);
  outline: none;
}

.mandala-center {
  position: absolute;
  inset: 50%;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  translate: -50% -50%;
  border: 1px solid #dfe3ea;
  border-radius: 50%;
  background: #ffffff;
  text-align: center;
}

.mandala-center strong {
  display: block;
  font-size: 1.2rem;
}

.mandala-center span {
  color: #5c6472;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.mandala-copy {
  max-width: 48ch;
  margin: 10px 0 14px;
  color: #5c6472;
  line-height: 1.4;
}

.mandala-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mandala-dot {
  width: 16px;
  height: 16px;
  border: 1px solid #cfd5df;
  border-radius: 50%;
  background: #ffffff;
}

.mandala-dot-complete {
  border-color: var(--dot-color);
  background: var(--dot-color);
}

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

.mobile-quiz-picker {
  display: none;
}

.mobile-quiz-picker label {
  display: block;
  margin-bottom: 8px;
  color: #5c6472;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.mobile-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.mobile-picker-row select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: #ffffff;
  color: #17191f;
  font: inherit;
}

.quiz-card {
  min-height: 150px;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #ffffff;
  color: #17191f;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    transform 120ms ease,
    box-shadow 120ms ease;
}

.quiz-card strong {
  font-size: 1.15rem;
}

.quiz-card span {
  color: #3f4652;
  line-height: 1.4;
}

.quiz-card small {
  color: #5c6472;
  font-weight: 700;
}

.quiz-card:hover,
.quiz-card:focus-visible {
  border-color: #17191f;
  box-shadow: 0 10px 18px rgba(31, 35, 46, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.quiz-card-complete {
  border-color: #b7e4c7;
  background: #f3fff6;
}

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

.answer-button {
  min-height: 86px;
  padding: 18px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #ffffff;
  color: #17191f;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    transform 120ms ease,
    box-shadow 120ms ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  border-color: #17191f;
  box-shadow: 0 10px 18px rgba(31, 35, 46, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.icon-button,
.text-button,
.primary-button,
.danger-button {
  min-height: 42px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: #ffffff;
  color: #17191f;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  font-size: 1.35rem;
}

.text-button,
.primary-button,
.danger-button {
  padding: 0 16px;
  font-weight: 700;
}

.profile-reset-button {
  border-color: #17191f;
}

.primary-button {
  margin-top: 22px;
  background: #17191f;
  color: #ffffff;
  border-color: #17191f;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.danger-button {
  color: #b42318;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 28px;
}

.result-visual {
  min-height: 260px;
  border-radius: 8px;
  border: 1px solid rgba(23, 25, 31, 0.1);
  background: #dff1ff;
  position: relative;
  overflow: hidden;
}

.result-visual::before,
.result-visual::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 12px solid currentColor;
  border-radius: 50%;
  opacity: 0.28;
}

.result-visual::after {
  inset: auto 32px 32px auto;
  width: 88px;
  height: 88px;
  border-width: 18px;
}

.result-description {
  max-width: 56ch;
  color: #3f4652;
  font-size: 1.05rem;
  line-height: 1.55;
}

.admin-note {
  max-width: 56ch;
  margin: 8px 0 0;
  color: #5c6472;
  line-height: 1.4;
}

.profile-note {
  margin: 10px 0 0;
  color: #5c6472;
  font-size: 0.9rem;
  line-height: 1.35;
}

.admin-panel {
  margin-top: 18px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.stat-tile,
.question-stat {
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.stat-tile strong {
  display: block;
  font-size: 1.6rem;
}

.stats-list {
  display: grid;
  gap: 14px;
}

.profiles-list {
  margin-bottom: 20px;
}

.profile-markdowns {
  display: grid;
  gap: 12px;
  margin: 0 0 22px;
}

.profile-markdowns-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-markdowns-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.profile-markdowns-list {
  display: grid;
  gap: 10px;
}

.profile-markdown-card {
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.profile-markdown-card summary {
  cursor: pointer;
  padding: 12px 14px;
  color: #20242c;
  font-weight: 800;
}

.profile-markdown-card pre {
  max-height: 360px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-top: 1px solid #dfe3ea;
  background: #f7f8fb;
  color: #2f3642;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.profiles-section {
  display: grid;
  gap: 10px;
}

.profiles-section h3 {
  margin: 0;
  font-size: 1.25rem;
}

.profile-card {
  display: grid;
  gap: 6px;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 16px;
}

.profile-card span,
.profile-card small {
  color: #5c6472;
}

.quiz-stat-section {
  display: grid;
  gap: 12px;
}

.quiz-stat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
}

.quiz-stat-heading h3 {
  margin: 0;
  font-size: 1.25rem;
}

.quiz-stat-heading span {
  color: #5c6472;
  font-weight: 700;
}

.question-stat h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) 48px;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  color: #3f4652;
  font-size: 0.92rem;
}

.bar-track {
  height: 12px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 0;
  background: #4b7bec;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    width: min(100% - 20px, 430px);
    min-height: 100dvh;
    padding: 10px 0;
  }

  .topbar,
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 8px;
    margin-bottom: 8px;
  }

  h1 {
    max-width: calc(100% - 54px);
    font-size: 1.28rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.24rem;
    line-height: 1.1;
  }

  .eyebrow,
  .question-kicker {
    margin-bottom: 4px;
    font-size: 0.68rem;
  }

  .profile-note {
    display: none;
  }

  .nav-actions,
  .admin-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .profile-markdowns-header {
    flex-direction: column;
    gap: 10px;
  }

  .profile-markdown-card pre {
    max-height: 260px;
    font-size: 0.76rem;
  }

  .nav-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
  }

  .icon-button,
  .text-button,
  .primary-button,
  .danger-button {
    min-height: 40px;
  }

  .profile-reset-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .panel {
    padding: 12px;
  }

  .section-heading {
    margin-bottom: 10px;
    padding-right: 54px;
  }

  .answers-grid,
  .quiz-grid,
  .mandala-panel,
  .result-panel,
  .stats-summary {
    grid-template-columns: 1fr;
  }

  .quiz-grid {
    display: none;
  }

  .mobile-quiz-picker {
    display: block;
  }

  .mobile-picker-row .primary-button {
    margin-top: 0;
    padding: 0 14px;
  }

  .mandala-panel {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
  }

  .mandala-wrap {
    width: 118px;
    justify-self: center;
  }

  .mandala-center {
    width: 52px;
    height: 52px;
  }

  .mandala-center strong {
    font-size: 0.92rem;
  }

  .mandala-center span {
    font-size: 0.56rem;
  }

  .mandala-panel h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.08;
  }

  .mandala-copy {
    margin: 6px 0 8px;
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .mandala-legend {
    gap: 4px;
  }

  .mandala-dot {
    width: 10px;
    height: 10px;
  }

  .progress-row {
    gap: 8px;
    font-size: 0.76rem;
    margin-bottom: 6px;
  }

  .progress-track {
    height: 7px;
    margin-bottom: 12px;
  }

  .question-area {
    gap: 10px;
  }

  #questionTitle {
    font-size: clamp(1.05rem, 5.3vw, 1.42rem);
    line-height: 1.12;
  }

  .answers-grid {
    gap: 8px;
  }

  .answer-button {
    min-height: 48px;
    padding: 10px 12px;
    font-size: clamp(0.88rem, 3.8vw, 1rem);
    line-height: 1.2;
  }

  .result-panel {
    gap: 12px;
  }

  .result-visual {
    min-height: 86px;
  }

  .result-visual::before {
    inset: 18px;
    border-width: 8px;
  }

  .result-visual::after {
    width: 42px;
    height: 42px;
    right: 18px;
    bottom: 18px;
    border-width: 10px;
  }

  .result-description {
    font-size: 0.92rem;
    line-height: 1.36;
  }

  .primary-button {
    margin-top: 10px;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .app-shell {
    width: calc(100% - 14px);
    padding: 7px 0;
  }

  .panel {
    padding: 10px;
  }

  .mandala-panel {
    grid-template-columns: 102px minmax(0, 1fr);
  }

  .mandala-wrap {
    width: 102px;
  }

  .answer-button {
    min-height: 44px;
    padding: 8px 10px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 430px);
    padding: 6px 0;
  }

  .topbar {
    gap: 5px;
    margin-bottom: 6px;
  }

  h1 {
    font-size: 1.02rem;
  }

  h2 {
    font-size: 1.08rem;
  }

  .panel {
    padding: 9px;
  }

  .section-heading {
    margin-bottom: 7px;
  }

  .mobile-picker-row select {
    min-height: 42px;
    font-size: 0.92rem;
  }

  body[data-view="quizView"] .topbar,
  body[data-view="resultView"] .topbar {
    display: none;
  }

  body[data-view="quizView"] .app-shell,
  body[data-view="resultView"] .app-shell {
    padding-top: 6px;
  }

  body[data-view="quizView"] .panel,
  body[data-view="resultView"] .panel {
    min-height: calc(100dvh - 12px);
  }

  .mandala-panel {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 9px;
    padding: 8px;
  }

  .mandala-wrap {
    width: 88px;
  }

  .mandala-center {
    width: 42px;
    height: 42px;
  }

  .mandala-center strong {
    font-size: 0.78rem;
  }

  .mandala-center span {
    font-size: 0.48rem;
  }

  .mandala-panel h3 {
    font-size: 0.92rem;
  }

  .mandala-copy,
  .mandala-legend {
    display: none;
  }

  .progress-track {
    margin-bottom: 9px;
  }

  .answer-button {
    min-height: 43px;
    padding: 8px 10px;
    line-height: 1.14;
  }

  .result-visual {
    min-height: 62px;
  }

  .result-description {
    font-size: 0.88rem;
    line-height: 1.28;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .eyebrow,
  .question-kicker {
    font-size: 0.62rem;
  }

  h1 {
    font-size: 0.94rem;
  }

  h2 {
    font-size: 1rem;
  }

  .mandala-panel {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    padding: 7px;
  }

  .mandala-wrap {
    width: 74px;
  }

  .mandala-center {
    width: 36px;
    height: 36px;
  }

  .mandala-center strong {
    font-size: 0.7rem;
  }

  .mandala-center span {
    display: none;
  }

  .answer-button {
    min-height: 39px;
    padding: 7px 9px;
    font-size: 0.86rem;
  }
}
