/* =====================================================================
   卡萨帝人设基因测试 - 样式表
   设计：深蓝主色 + 暖金高亮 + 米白背景
   适配：手机优先,微信内打开,375px 起
   ===================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #FAF7F2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* 安全补丁：二重保险隐藏 */
.screen[aria-hidden="true"] {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ====== 通用容器 ====== */
.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: screenIn 0.4s ease;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   欢迎页
   ===================================================================== */

.screen-welcome {
  background: linear-gradient(165deg, #0A2540 0%, #163E6B 60%, #1E5AAF 100%);
  color: #FAF7F2;
  justify-content: center;
  align-items: center;
  padding: 0 32px;
  text-align: center;
  position: absolute;
  z-index: 1;
}

.welcome-deco {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  pointer-events: none;
}

.deco-1 {
  width: 280px;
  height: 280px;
  background: #C8A872;
  top: -80px;
  right: -80px;
  opacity: 0.18;
}

.deco-2 {
  width: 320px;
  height: 320px;
  background: #2A6FD9;
  bottom: -120px;
  left: -100px;
  opacity: 0.35;
}

.welcome-inner {
  position: relative;
  z-index: 1;
  max-width: 360px;
  width: 100%;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(200, 168, 114, 0.5);
  border-radius: 100px;
  margin-bottom: 32px;
  font-size: 12px;
  letter-spacing: 2px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  background: #C8A872;
  border-radius: 50%;
}

.brand-name {
  color: #C8A872;
  font-weight: 500;
}

.welcome-title {
  font-size: 64px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.title-line {
  display: block;
}

.title-line-gold {
  background: linear-gradient(135deg, #E8C896 0%, #C8A872 50%, #A88B5A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-tagline {
  font-size: 17px;
  color: rgba(250, 247, 242, 0.85);
  margin-bottom: 40px;
  font-weight: 300;
  letter-spacing: 4px;
}

.welcome-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 36px;
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.meta-num {
  font-size: 28px;
  font-weight: 700;
  color: #C8A872;
  letter-spacing: 0;
}

.meta-label {
  font-size: 13px;
  color: rgba(250, 247, 242, 0.7);
}

.meta-divider {
  width: 1px;
  height: 16px;
  background: rgba(200, 168, 114, 0.4);
}

.welcome-desc {
  font-size: 14px;
  color: rgba(250, 247, 242, 0.65);
  line-height: 1.8;
  margin-bottom: 48px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  padding: 18px 36px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #0A2540;
  background: linear-gradient(135deg, #E8C896 0%, #C8A872 100%);
  border-radius: 100px;
  box-shadow: 0 10px 30px rgba(200, 168, 114, 0.3);
  transition: all 0.25s ease;
  margin: 0 auto;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 5px 15px rgba(200, 168, 114, 0.3);
}

.btn-arrow {
  font-size: 18px;
  transition: transform 0.25s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.welcome-foot {
  margin-top: 28px;
  font-size: 12px;
  color: rgba(250, 247, 242, 0.45);
  letter-spacing: 1px;
}

/* =====================================================================
   答题页
   ===================================================================== */

.screen-question {
  background: #FAF7F2;
  padding: 0 24px 32px;
}

.q-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 20px;
  position: sticky;
  top: 0;
  background: #FAF7F2;
  z-index: 10;
}

.q-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #0A2540;
  flex-shrink: 0;
}

.q-back:active {
  background: rgba(10, 37, 64, 0.06);
}

.q-progress {
  flex: 1;
  height: 4px;
  background: rgba(10, 37, 64, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.q-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0A2540, #C8A872);
  border-radius: 2px;
  width: 5%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-counter {
  font-size: 13px;
  color: #0A2540;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}

.q-body {
  flex: 1;
  padding-top: 32px;
  animation: qIn 0.4s ease;
}

@keyframes qIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.q-num {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #C8A872;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.q-title {
  font-size: 24px;
  font-weight: 700;
  color: #0A2540;
  line-height: 1.4;
  margin-bottom: 8px;
}

.q-subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 32px;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(10, 37, 64, 0.04);
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.q-option:active {
  transform: scale(0.98);
  background: #F4EFE5;
  border-color: #C8A872;
}

.q-option-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0A2540, #1E5AAF);
  color: #C8A872;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.q-option-text {
  flex: 1;
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1.5;
  font-weight: 500;
}

/* =====================================================================
   加载页
   ===================================================================== */

.screen-loading {
  background: #0A2540;
  color: #FAF7F2;
  justify-content: center;
  align-items: center;
}

.loading-inner {
  text-align: center;
}

.loading-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 32px;
}

.loading-ring span {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: #C8A872;
  border-radius: 50%;
  animation: ringSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-ring span:nth-child(2) {
  inset: 10px;
  border-top-color: #E8C896;
  animation-duration: 1.5s;
  animation-direction: reverse;
}

.loading-ring span:nth-child(3) {
  inset: 20px;
  border-top-color: #fff;
  animation-duration: 1.8s;
}

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

.loading-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.loading-sub {
  font-size: 13px;
  color: rgba(200, 168, 114, 0.8);
  letter-spacing: 1px;
  min-height: 20px;
}

/* =====================================================================
   结果页
   ===================================================================== */

.screen-result {
  background: #FAF7F2;
  padding: 0 0 40px;
}

.result-deco {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 380px;
  background: linear-gradient(165deg, #0A2540 0%, #163E6B 100%);
  z-index: 0;
  border-radius: 0 0 32px 32px;
}

.result-inner {
  position: relative;
  z-index: 1;
  padding: 40px 24px 0;
  max-width: 480px;
  margin: 0 auto;
  animation: resultIn 0.6s ease;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-head {
  text-align: center;
  color: #FAF7F2;
  margin-bottom: 28px;
}

.result-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 4px;
  color: #C8A872;
  font-weight: 500;
  margin-bottom: 12px;
}

.result-eyebrow::before,
.result-eyebrow::after {
  content: "——";
  margin: 0 8px;
  opacity: 0.6;
}

.result-label {
  font-size: 13px;
  color: rgba(250, 247, 242, 0.7);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.result-name {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 1px;
  margin-bottom: 14px;
  color: #E8C896;
  text-shadow: 0 2px 12px rgba(232, 200, 150, 0.3);
  position: relative;
  display: inline-block;
}

.result-name::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #C8A872, transparent);
}

.result-category {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(200, 168, 114, 0.2);
  border: 1px solid rgba(200, 168, 114, 0.4);
  border-radius: 100px;
  font-size: 12px;
  color: #C8A872;
  letter-spacing: 2px;
}

.result-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 8px 32px rgba(10, 37, 64, 0.08);
  margin-bottom: 16px;
}

.result-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #C8A872;
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.result-desc {
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1.7;
  margin-bottom: 4px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.result-tag {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  color: #0A2540;
  background: rgba(10, 37, 64, 0.06);
  border-radius: 100px;
  font-weight: 500;
}

.result-highlight {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #FFF8E8, #F4EFE5);
  border-left: 3px solid #C8A872;
  border-radius: 0 12px 12px 0;
  font-size: 14px;
  color: #0A2540;
  font-weight: 500;
  margin-bottom: 16px;
}

.result-highlight::before {
  content: "✦";
  color: #C8A872;
  font-size: 18px;
}

.result-list {
  list-style: none;
  margin-top: 4px;
}

.result-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #1a1a1a;
  line-height: 1.6;
}

.result-list li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C8A872;
}

/* ====== 次人设 ====== */

.runner-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(10, 37, 64, 0.04);
}

.runner-title {
  font-size: 12px;
  color: #999;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.runner-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(10, 37, 64, 0.04);
}

.runner-item:last-child {
  border-bottom: none;
}

.runner-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(10, 37, 64, 0.06);
  color: #0A2540;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.runner-rank.top {
  background: linear-gradient(135deg, #C8A872, #A88B5A);
  color: #fff;
}

.runner-name {
  flex: 1;
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 500;
}

.runner-bar-wrap {
  width: 80px;
  height: 4px;
  background: rgba(10, 37, 64, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.runner-bar {
  height: 100%;
  background: linear-gradient(90deg, #0A2540, #C8A872);
  border-radius: 2px;
}

.runner-pct {
  font-size: 12px;
  color: #999;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* ====== 操作按钮 ====== */

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

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #0A2540;
  background: #fff;
  border: 1.5px solid #0A2540;
  border-radius: 100px;
  transition: all 0.2s ease;
}

.btn-secondary:active {
  transform: scale(0.98);
  background: #F4EFE5;
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-size: 14px;
  color: #0A2540;
  background: transparent;
  border: none;
  border-radius: 100px;
}

.btn-ghost:active {
  background: rgba(10, 37, 64, 0.04);
}

.result-footer {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 32px;
  padding: 0 16px;
  line-height: 1.7;
}

/* =====================================================================
   Toast
   ===================================================================== */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 37, 64, 0.92);
  color: #FAF7F2;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* =====================================================================
   小屏适配
   ===================================================================== */

@media (max-width: 360px) {
  .welcome-title { font-size: 56px; }
  .q-title { font-size: 21px; }
  .result-name { font-size: 28px; }
  .meta-num { font-size: 24px; }
}

@media (min-width: 768px) {
  .app {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);
  }
}

/* 大屏：模拟手机外观 */
@media (min-height: 700px) {
  .welcome-inner {
    transform: translateY(-20px);
  }
}
