:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #5d665f;
  --paper: #fffaf0;
  --mint: #d7f4df;
  --leaf: #0f7b66;
  --leaf-dark: #085949;
  --red: #f35b55;
  --yellow: #ffd05a;
  --blue: #4a98f7;
  --lilac: #c9b6ff;
  --shadow: 5px 5px 0 rgba(70, 51, 42, 0.12);
  --border: rgba(23, 32, 28, 0.12);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(70, 51, 42, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(70, 51, 42, 0.055) 1px, transparent 1px),
    #fff4d8;
  background-size: 34px 34px;
  overflow-x: hidden;
}

button {
  border: 0;
  font: inherit;
}

.app {
  width: min(100vw, 480px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  position: relative;
}

.screen {
  display: none;
  min-height: calc(100svh - 38px);
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

.intro-screen {
  justify-content: space-between;
  gap: 18px;
}

.top-pill,
.question-tag,
.result-flag {
  width: fit-content;
  padding: 7px 10px;
  border: 1px solid rgba(15, 123, 102, 0.28);
  border-radius: 999px;
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 123, 102, 0.08);
}

.intro-copy {
  padding-top: 6px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 14px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: 0;
}

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

.intro-text {
  max-width: 22em;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.68;
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-wrap,
.result-visual {
  width: 100%;
  min-height: 250px;
  border: 2px solid rgba(23, 32, 28, 0.14);
  border-radius: 8px;
  background: #fffdf4;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-wrap {
  aspect-ratio: 1 / 1;
}

.result-visual {
  aspect-ratio: 1 / 1;
  min-height: 250px;
}

.hero-wrap img,
.result-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.primary-btn {
  color: white;
  background: var(--leaf);
  box-shadow: 5px 5px 0 rgba(70, 51, 42, 0.18);
}

.secondary-btn {
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 123, 102, 0.24);
}

.primary-btn:active,
.secondary-btn:active,
.answer-btn:active,
.icon-btn:active {
  transform: translateY(2px) scale(0.99);
}

.quiz-screen {
  gap: 18px;
}

.quiz-top {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(23, 32, 28, 0.12);
  border-radius: 8px;
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(18, 52, 43, 0.1);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.progress-block {
  min-width: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.progress-meta span {
  min-width: 0;
  white-space: nowrap;
}

.progress-track {
  height: 11px;
  border: 1px solid rgba(23, 32, 28, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.progress-fill {
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--red), var(--leaf));
  transition: width 0.28s ease;
}

.question-panel,
.result-panel {
  border: 2px solid rgba(23, 32, 28, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.question-panel {
  padding: 18px;
}

.question-tag {
  margin-bottom: 12px;
}

.question-panel h2 {
  margin-bottom: 18px;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.answer-btn {
  min-height: 66px;
  padding: 13px 14px;
  border: 1px solid rgba(23, 32, 28, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: #fffdf7;
  cursor: pointer;
  text-align: left;
  font-weight: 850;
  line-height: 1.38;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 8px 18px rgba(18, 52, 43, 0.07);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.answer-btn:hover,
.answer-btn.is-selected {
  border-color: rgba(15, 123, 102, 0.45);
  background: linear-gradient(135deg, #ffffff 0%, #e8ffe7 100%);
  box-shadow: 0 12px 22px rgba(15, 123, 102, 0.14);
}

.result-screen {
  gap: 12px;
}

.result-flag {
  margin-bottom: 0;
}

.result-visual {
  display: grid;
  place-items: center;
  min-height: 250px;
  aspect-ratio: 1 / 1;
}

.result-illustration {
  width: 100%;
  height: 100%;
  display: block;
}

.result-panel {
  padding: 16px;
  overflow: hidden;
}

.result-code {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  margin-bottom: 9px;
  padding: 5px 9px;
  border-radius: 8px;
  color: var(--leaf-dark);
  background: var(--mint);
  font-size: 13px;
  font-weight: 950;
}

.result-panel h2 {
  margin-bottom: 10px;
  font-size: 29px;
  line-height: 1.14;
  letter-spacing: 0;
}

.result-desc {
  margin-bottom: 14px;
  color: #2c3a33;
  font-size: 15px;
  line-height: 1.72;
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trait-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.trait-chip {
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf0;
}

.trait-chip span,
.result-line span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.trait-chip strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

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

.result-line + .result-line {
  margin-top: 10px;
}

.result-line p {
  margin-bottom: 0;
  color: #2c3a33;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 10;
  max-width: min(86vw, 360px);
  min-height: 42px;
  padding: 11px 14px;
  border-radius: 8px;
  color: white;
  background: rgba(23, 32, 28, 0.92);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 360px) {
  .app {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 40px;
  }

  .question-panel h2 {
    font-size: 22px;
  }

  .trait-grid,
  .result-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  .app {
    width: min(100%, 520px);
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .screen {
    min-height: calc(100svh - 56px);
  }
}
