:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #687080;
  --line: #dde2ea;
  --red: #d94343;
  --green: #15855d;
  --gold: #b7791f;
  --blue: #246bfe;
  --shadow: 0 18px 50px rgba(24, 31, 42, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

.wechat-share-seed {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 300px;
  height: 300px;
  opacity: 0.01;
  pointer-events: none;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.loading-view,
.start-view,
.quiz-view,
.result-view {
  min-height: calc(100vh - 72px);
}

.loading-view,
.start-view {
  display: grid;
  align-content: center;
  gap: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.mini-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.hero-grid,
.quiz-grid,
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.96fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.question-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 520px;
}

.hero-copy h1,
.result-panel h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy p,
.result-copy {
  max-width: 650px;
  color: #3c4350;
  font-size: 18px;
  line-height: 1.75;
}

.market-board {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid #cfd7e5;
  border-radius: 8px;
  background: #111820;
  box-shadow: var(--shadow);
}

.market-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #e9eef7;
  font-weight: 750;
}

.market-header span:last-child {
  color: #67d9a8;
}

#market-canvas {
  width: 100%;
  height: 390px;
  display: block;
}

.ticker-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
}

.ticker-row div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 12px;
  color: #e9eef7;
  background: rgba(255, 255, 255, 0.05);
}

.ticker-row small {
  display: block;
  margin-top: 6px;
  color: #8da0b8;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.option-btn {
  min-height: 46px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary-btn {
  width: fit-content;
  min-width: 168px;
  padding: 0 22px;
  color: #fff;
  background: var(--ink);
  font-weight: 750;
}

.secondary-btn,
.ghost-btn {
  padding: 0 16px;
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 700;
}

.ghost-btn {
  background: transparent;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.option-btn:hover {
  transform: translateY(-1px);
}

.progress-wrap {
  margin-bottom: 28px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: #e6ebf2;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
  transition: width 0.22s ease;
}

.question-panel {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.question-panel h2 {
  margin: 0 0 22px;
  font-size: 30px;
  line-height: 1.28;
  letter-spacing: 0;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-btn {
  width: 100%;
  min-height: 62px;
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.option-btn strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
}

.option-btn.is-selected {
  border-color: var(--blue);
  background: #f3f7ff;
}

.quiz-aside {
  display: grid;
  gap: 16px;
  align-content: stretch;
}

.personality-strip {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.strip-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
}

.strip-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.strip-items span {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 6px;
  color: #394150;
  background: #f2f5f9;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-view {
  display: grid;
  align-content: center;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.result-card-inner {
  padding: 28px;
}

.result-description {
  margin: 0;
  color: #333b48;
  font-size: 16px;
  line-height: 1.75;
}

.result-kicker {
  color: var(--muted);
  font-weight: 750;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.tag-list span {
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.quote-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.quote-btn {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: #333b48;
  text-align: left;
  cursor: pointer;
}

.share-preview {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #d9e1ed;
  border-radius: 8px;
  background: #f8fafc;
}

.share-preview span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.share-preview p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.result-card .actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.result-card .primary-btn,
.result-card .secondary-btn {
  width: 100%;
  min-width: 0;
}

.share-mask[hidden] {
  display: none;
}

.share-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.share-mask.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.share-mask-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(12, 16, 24, 0.62);
  cursor: pointer;
}

.share-guide {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 14px;
  width: min(320px, calc(100vw - 28px));
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.share-guide-arrow {
  position: absolute;
  top: -16px;
  right: 22px;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.share-guide h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.share-guide p {
  margin: 0 0 16px;
  color: #4b5565;
  font-size: 15px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 10;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  background: rgba(22, 24, 29, 0.92);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.error-view {
  max-width: 640px;
  margin: 80px auto;
  padding: 28px;
  border: 1px solid #f3b4b4;
  border-radius: 8px;
  background: #fff7f7;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px 14px 24px;
  }

  .hero-grid,
  .quiz-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .question-panel,
  .result-panel,
  .market-board {
    min-height: auto;
  }

  .hero-copy h1,
  .result-panel h1 {
    font-size: 40px;
  }

  .question-panel {
    padding: 22px;
  }

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

  #market-canvas {
    height: 260px;
  }

  .ticker-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .loading-view,
  .start-view,
  .quiz-view,
  .result-view {
    min-height: calc(100vh - 38px);
  }

  .topbar {
    margin-bottom: 14px;
  }

  .brand-mark {
    max-width: 70vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-copy {
    justify-content: start;
    padding-top: 18px;
  }

  .hero-copy p,
  .result-copy {
    font-size: 16px;
    line-height: 1.65;
  }

  .hero-copy h1,
  .result-panel h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  .result-view {
    align-content: start;
  }

  .result-grid {
    gap: 14px;
  }

  .result-panel {
    justify-content: start;
  }

  .result-copy {
    margin: 0;
  }

  .tag-list {
    margin: 14px 0;
  }

  .tag-list span {
    border-radius: 6px;
  }

  .result-card {
    box-shadow: none;
  }

  .result-card-inner {
    padding: 18px;
  }

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

  .result-card .primary-btn,
  .result-card .secondary-btn {
    min-height: 48px;
  }

  .quote-btn {
    padding: 12px;
    font-size: 14px;
    line-height: 1.55;
  }

  .quiz-aside {
    display: none;
  }

  .question-panel {
    padding: 18px;
    box-shadow: none;
  }

  .option-btn {
    min-height: 56px;
  }

  .toast {
    width: calc(100vw - 28px);
    text-align: center;
  }
}
