:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #fffaf2;
  --ink: #202124;
  --muted: #6c665d;
  --line: #ddd3c4;
  --blue: #2b6cb0;
  --green: #2f855a;
  --amber: #bd6b00;
  --red: #b83232;
  --shadow: 0 18px 50px rgba(45, 35, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(43, 108, 176, 0.12), transparent 32%),
    linear-gradient(220deg, rgba(47, 133, 90, 0.14), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 40px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

#home-view,
.question-card,
#result-view,
.loading-core {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(221, 211, 196, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

#home-view {
  min-height: calc(100vh - 64px);
  padding: 28px;
}

.hero-visual {
  position: relative;
  min-height: 180px;
  margin: -4px 0 28px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(32, 33, 36, 0.88), rgba(43, 108, 176, 0.82)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.08) 18px 19px);
}

.hero-asset {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meter {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 42px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  opacity: 0;
}

.meter span {
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.12);
}

.meter span:nth-child(1) {
  background: rgba(184, 50, 50, 0.72);
}

.meter span:nth-child(2) {
  background: rgba(189, 107, 0, 0.72);
}

.signal-card {
  position: absolute;
  left: 24px;
  bottom: 22px;
  display: grid;
  gap: 4px;
  color: #fff;
  opacity: 0;
}

.signal-card b {
  font-size: 20px;
  letter-spacing: 0;
}

.signal-card small {
  color: rgba(255, 255, 255, 0.72);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.16;
}

.subtitle {
  margin: 14px 0 0;
  font-size: 20px;
  line-height: 1.45;
  word-break: break-all;
}

.description,
.result-copy {
  color: var(--muted);
  line-height: 1.8;
  word-break: break-all;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.meta-row span,
.tag-row span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-size: 13px;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary-btn {
  width: 100%;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.ghost-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.icon-btn {
  width: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.disclaimer,
.confidence-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-wrap {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.12);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.2s ease;
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
}

.question-card {
  min-height: calc(100vh - 104px);
  padding: 28px;
}

.question-card h2 {
  margin: 0 0 28px;
  font-size: 28px;
  line-height: 1.35;
}

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

.option-btn {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.option-btn:hover {
  border-color: var(--blue);
}

.loading-core {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
  padding: 28px;
  text-align: center;
}

.spinner {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border: 8px solid rgba(43, 108, 176, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#result-view {
  padding: 24px;
}

.result-hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(43, 108, 176, 0.14), rgba(47, 133, 90, 0.12)),
    #fff;
}

.persona-icon {
  float: right;
  width: 118px;
  height: 118px;
  margin: 0 0 12px 18px;
  object-fit: contain;
}

.persona-icon[hidden] {
  display: none;
}

.persona-code {
  display: inline-flex;
  margin: 10px 0 0;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.punchline {
  margin: 16px 0 0;
  font-size: 20px;
  font-weight: 700;
  word-break: break-all;
}

.score-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.score-panel div,
.insight-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.score-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.score-panel b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.insight-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.insight-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.insight-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.share-card {
  margin: 18px 0;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 33, 36, 0.78), rgba(43, 108, 176, 0.42)),
    url("./assets/share-card-console-bg.svg") center / cover,
    var(--ink);
  color: #fff;
}

.share-card p,
.share-card h2,
.share-card strong,
.share-card span,
.share-card small {
  display: block;
  margin: 0;
}

.share-card p,
.share-card small {
  color: rgba(255, 255, 255, 0.72);
}

.share-card h2 {
  margin-top: 18px;
  font-size: 30px;
  line-height: 1.18;
  word-break: break-all;
}

.share-card strong {
  margin-top: 10px;
  font-size: 17px;
}

.share-card span {
  margin-top: 18px;
}

.share-card small {
  margin-top: 18px;
}

.result-actions {
  display: grid;
  gap: 10px;
}

@media (max-width: 520px) {
  .app-shell {
    width: 100vw;
    max-width: 390px;
    margin: 0;
    padding: 12px;
  }

  #home-view,
  .question-card,
  #result-view,
  .loading-core {
    min-height: calc(100vh - 24px);
  }

  h1 {
    font-size: 32px;
  }

  .question-card h2 {
    font-size: 24px;
  }

  .persona-icon {
    display: block;
    float: none;
    width: 76px;
    height: 76px;
    margin: 0 0 8px auto;
  }

  .score-panel {
    grid-template-columns: 1fr;
  }
}
