:root {
  --bg: #fbfaf6;
  --card: #ffffff;
  --text: #1d1d1d;
  --muted: #656565;
  --wine: #7a202b;
  --wine-dark: #5c1720;
  --slate: #505965;
  --line: #e7e4de;
  --danger: #c62f35;
  --shadow: 0 10px 32px rgba(35, 28, 25, 0.055);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell {
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 40px 24px 30px;
}
.screen { display: none; min-height: calc(100vh - 70px); min-height: calc(100dvh - 70px); animation: rise-in .38s ease both; }
.screen.is-active { display: flex; flex-direction: column; }
@keyframes rise-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

.auth-wrap { display: flex; flex: 1; align-items: center; justify-content: center; padding: 20px 0; }
.auth-card {
  width: 100%;
  padding: 44px 30px 40px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 35px rgba(30, 30, 30, .08);
}
.auth-title { margin: 0; font-size: 32px; line-height: 1.3; font-weight: 900; letter-spacing: 2px; }
.auth-en { margin: 2px 0 25px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 4px; }
.auth-tip { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.auth-input {
  width: 100%;
  margin-bottom: 24px;
  padding: 17px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus { border-color: var(--wine); box-shadow: 0 0 0 4px rgba(122,32,43,.07); }
.auth-input.is-wrong { animation: shake .32s ease; border-color: var(--danger); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.auth-error { display: none; margin: 14px 0 -5px; color: var(--danger); font-size: 13px; font-weight: 700; }
.auth-error.is-visible { display: block; }

.outline-button {
  width: 100%;
  padding: 14px 20px 15px;
  color: var(--wine);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 2px;
  background: var(--card);
  border: 3px solid var(--wine);
  border-radius: 999px;
  box-shadow: 0 4px 15px rgba(122,32,43,.08);
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.outline-button:active { transform: scale(.975); background: rgba(122,32,43,.045); }

.intro-header { margin: 8px 0 24px; text-align: center; }
.main-title { margin: 0 0 2px; font-size: 42px; line-height: 1.14; font-weight: 950; letter-spacing: 3px; }
.sub-title { margin: 0 0 12px; color: var(--muted); font-size: 13px; letter-spacing: 5px; }
.live-stats {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(80,89,101,.045);
  border: 1px solid rgba(80,89,101,.1);
  border-radius: 99px;
}
.live-stats strong { color: var(--slate); font: 700 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.pulse-dot { width: 6px; height: 6px; background: var(--slate); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(80,89,101,.55); } 70%,100% { box-shadow: 0 0 0 7px rgba(80,89,101,0); } }
.divider { color: #cbc8c2; }
.info-tags { display: flex; gap: 8px; margin-bottom: 27px; }
.info-tag {
  flex: 1;
  padding: 9px 2px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(30,30,30,.025);
}
.info-tag span { margin-right: 3px; color: var(--slate); }
.lead { margin: 0 5px 10px; font-size: 16px; font-weight: 800; }
.intro-card, .result-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.intro-card { padding: 22px 20px; }
.intro-card p { margin: 0 0 15px; color: #2a2a2a; font-size: 14px; line-height: 1.78; }
.intro-card p:last-child { margin-bottom: 0; }
.accent { color: var(--wine); font-weight: 850; }
.strong { font-weight: 850; }
.intro-card .intro-callout { margin-top: 20px; text-align: center; font-size: 15px; font-weight: 900; letter-spacing: 1px; }
.disclaimer { margin: 13px 0 25px; color: var(--muted); font-size: 11px; text-align: center; letter-spacing: .5px; }
.start-area { display: flex; flex: 1; align-items: flex-end; }

.quiz-wrap { display: flex; flex: 1; flex-direction: column; justify-content: center; padding: 5vh 0 9vh; }
.progress-track { width: 100%; height: 5px; margin-bottom: 22px; overflow: hidden; background: var(--line); border-radius: 4px; }
.progress-bar { width: 0; height: 100%; background: var(--wine); border-radius: 4px; transition: width .3s ease; }
.progress-label { margin-bottom: 16px; color: var(--muted); font-size: 12px; font-weight: 700; }
.question-text { min-height: 54px; margin: 0 0 24px; font-size: 18px; line-height: 1.55; font-weight: 850; }
.options { display: grid; gap: 12px; }
.options.is-disabled { pointer-events: none; }
.option {
  width: 100%;
  padding: 15px 16px;
  color: #303030;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 3px 12px rgba(30,30,30,.025);
  cursor: pointer;
  transition: transform .12s, border-color .16s, background .16s, box-shadow .16s;
}
.option:active { transform: scale(.988); }
.option.is-selected { color: var(--wine-dark); background: rgba(122,32,43,.055); border-color: var(--wine); box-shadow: 0 0 0 1px rgba(122,32,43,.18); }
.option-label { margin-right: 5px; color: var(--wine); font-weight: 900; }
.back-button {
  align-self: flex-start;
  margin-top: 25px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  background: none;
  border: 0;
  cursor: pointer;
}
.back-button span { font-size: 20px; vertical-align: -2px; }
.back-button.is-hidden { visibility: hidden; }

.loading-wrap { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.loader { width: 46px; height: 46px; margin-bottom: 28px; border: 3px solid var(--line); border-top-color: var(--wine); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap h2 { margin: 0 0 8px; font-size: 21px; }
.loading-wrap p { margin: 0; color: var(--muted); font-size: 14px; }

.result-wrap { width: 100%; padding-top: 4px; }
.result-header { margin: 0 4px 22px; text-align: center; }
.result-title { margin: 0 0 5px; color: var(--wine); font-size: 31px; line-height: 1.35; font-weight: 950; }
.result-tags { min-height: 22px; margin: 0; color: var(--muted); font-size: 13px; letter-spacing: 1px; }
.result-prefix { margin: 14px 0 0; font-size: 24px; letter-spacing: 1px; }
.result-card { margin-bottom: 20px; padding: 20px; }
.radar-card { position: relative; height: 330px; padding: 10px 2px 30px; }
.radar-chart { width: 100%; height: 275px; }
.radar-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.radar-center { position: absolute; top: 49%; left: 50%; display: flex; flex-direction: column; align-items: center; transform: translate(-50%,-50%); pointer-events: none; }
.radar-center strong { color: var(--wine); font-size: 25px; line-height: 1.05; }
.radar-center span { color: var(--muted); font-size: 10px; font-weight: 700; }
.chart-legend { position: absolute; right: 0; bottom: 12px; left: 0; color: var(--muted); font-size: 10px; text-align: center; }
.chart-legend span { display: inline-block; width: 14px; height: 2px; margin: 0 5px 3px 13px; vertical-align: middle; }
.legend-self { background: var(--wine); }
.legend-average { background: repeating-linear-gradient(90deg,var(--slate) 0 4px,transparent 4px 7px); }
.module-title { display: flex; align-items: center; gap: 8px; margin: 0 0 17px; font-size: 16px; }
.module-title span { color: var(--slate); }
.dimension-row { margin-bottom: 13px; }
.dimension-row:last-child { margin-bottom: 0; }
.dimension-labels { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; }
.dimension-labels strong { font-weight: 850; }
.dimension-labels span { color: var(--muted); }
.dimension-track { height: 7px; overflow: hidden; background: #e6e4e0; border-radius: 5px; }
.dimension-fill { width: 0; height: 100%; background: linear-gradient(90deg,var(--wine),var(--slate)); border-radius: 5px; transition: width 1s ease-out; }
.analysis-heading { display: flex; align-items: center; gap: 8px; margin: 0 5px 14px; font-size: 16px; }
.analysis-heading span { width: 4px; height: 17px; background: var(--wine); border-radius: 3px; }
.analysis-card { margin-top: 0; }
.result-quote { margin: 0 0 15px; color: var(--muted); font-size: 14px; font-style: italic; }
.analysis-text { color: #2a2a2a; font-size: 14px; line-height: 1.85; text-align: justify; }
.analysis-text p { margin: 0 0 14px; }
.advice-box { display: flex; gap: 9px; margin-top: 16px; padding: 15px; font-size: 14px; line-height: 1.75; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.advice-box p { margin: 0; }
.bottom-actions { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.warning { align-self: stretch; margin: 0 8px 24px; color: var(--muted); font-size: 12px; }
.warning span { margin-right: 6px; color: #ce9246; font-weight: 900; }
.restart-button { width: 100%; padding: 14px; color: var(--text); font-size: 15px; font-weight: 800; background: var(--card); border: 1px solid var(--line); border-radius: 99px; box-shadow: 0 4px 12px rgba(30,30,30,.03); cursor: pointer; }
.restart-button:active { transform: scale(.98); }
.bottom-actions footer { margin-top: 23px; color: var(--muted); font-size: 10px; line-height: 1.65; text-align: center; }

@media (max-width: 380px) {
  .app-shell { padding: 28px 17px 24px; }
  .screen { min-height: calc(100dvh - 52px); }
  .main-title { font-size: 37px; }
  .auth-card { padding: 38px 22px; }
  .question-text { font-size: 17px; }
  .option { padding: 13px 14px; font-size: 13px; }
  .radar-card { height: 305px; }
  .radar-chart { height: 250px; }
}

@media (min-width: 700px) {
  body { background: #f2f0eb; }
  .app-shell { background: var(--bg); box-shadow: 0 0 45px rgba(40,30,25,.08); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
