:root {
  --red: #e53935;
  --red-press: #c62828;
  --text: #222222;
  --muted: #888888;
  --bg: #fafafa;
  --card: #ffffff;
  --track: #eeeeee;
  --love: #ec407a;
  --passion: #e53935;
  --food: #ffb300;
  --material: #1e88e5;
  --ascetic: #43a047;
  --possess: #ef5350;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  overscroll-behavior: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.app {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.screen {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100vh;
  padding: calc(20px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  display: none;
}

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

.screen[hidden] {
  display: none !important;
}

/* —— Landing —— */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 28px;
}

.landing-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.landing-sub {
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.landing-desc {
  margin: 18px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: #555;
  text-align: left;
}

.char-gallery {
  width: 100%;
  margin-top: 22px;
  text-align: center;
}

.char-gallery-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #666;
}

.char-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.char-gallery-item {
  margin: 0;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.char-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f3f3f3;
}

.char-gallery-item figcaption {
  padding: 6px 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 20px;
}

.feature-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 8px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.feature-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  color: var(--red);
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.feature-desc {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 32px;
  height: 52px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(229, 57, 53, 0.28);
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn-primary:active {
  transform: scale(0.98);
  background: var(--red-press);
}

.btn-secondary {
  display: block;
  width: 100%;
  margin-top: 12px;
  height: 48px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  border: 1px solid #e5e5e5;
}

.btn-secondary:active {
  background: #f5f5f5;
}

.landing-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.disclaimer {
  margin: 28px 0 0;
  font-size: 12px;
  color: #aaa;
  line-height: 1.5;
}

/* —— Quiz —— */
.quiz {
  padding-top: 8px;
}

.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  margin-bottom: 12px;
}

.btn-text {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 4px;
  min-height: 44px;
}

.btn-text:active {
  color: var(--text);
}

.quiz-count {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

.progress-track {
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-pct {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.quiz-question {
  margin: 28px 0 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
}

.quiz-options {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1.5px solid #eee;
  border-radius: 14px;
  padding: 16px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  min-height: 52px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.option-btn:active,
.option-btn.is-picked {
  transform: scale(0.98);
  border-color: var(--red);
  background: #fff5f5;
}

/* —— Analyzing —— */
.analyzing {
  min-height: calc(100dvh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f0c0c0;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.analyzing-text {
  margin: 0;
  font-size: 16px;
  color: #666;
}

/* —— Result —— */
.result {
  padding-top: 8px;
}

.result-card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 16px 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.char-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 12px;
}

.char-img {
  width: min(72vw, 280px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  background: #f3f3f3;
  display: block;
}

.quote-box {
  background: #f3f3f3;
  border-radius: 12px;
  padding: 18px 16px;
  font-size: 15px;
  line-height: 1.7;
  color: #444;
  text-align: center;
}

.badge {
  margin: 16px 0 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--red);
}

.result-title {
  margin: 22px 0 0;
  font-size: 18px;
  font-weight: 800;
  text-align: left;
}

.dim-list {
  margin: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dim-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dim-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
}

.dim-name {
  font-weight: 600;
}

.dim-value {
  font-weight: 700;
  color: #555;
}

.dim-value.is-burst {
  color: var(--material);
}

.dim-track {
  height: 14px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.dim-fill.love { background: var(--love); }
.dim-fill.passion { background: var(--passion); }
.dim-fill.food { background: var(--food); }
.dim-fill.material { background: var(--material); }
.dim-fill.ascetic { background: var(--ascetic); }
.dim-fill.possess { background: var(--possess); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(34, 34, 34, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 20;
  max-width: 86%;
  text-align: center;
  pointer-events: none;
}

.toast[hidden] {
  display: none !important;
}

@media (min-width: 480px) {
  .landing-title {
    font-size: 30px;
  }
}
