:root {
  color-scheme: dark;
  --bg: #171513;
  --surface: rgba(39, 35, 31, 0.9);
  --surface-2: #302a25;
  --line: rgba(255, 244, 224, 0.12);
  --text: #f7efe3;
  --muted: #b9ad9d;
  --ember: #f07c43;
  --ember-light: #ffb16e;
  --gold: #d6a958;
  --sage: #9fa88b;
  --danger: #da735c;
  --radius: 24px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 85% -10%, rgba(184, 86, 36, 0.2), transparent 35%),
    linear-gradient(180deg, #1a1816 0%, #121110 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, textarea { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}
.ambient-one { top: 24%; left: -180px; background: var(--gold); }
.ambient-two { right: -170px; bottom: 8%; background: var(--ember); }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(66px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(23, 21, 19, 0.76);
  backdrop-filter: blur(18px);
}

.brand, .quiet-button {
  border: 0;
  background: none;
  cursor: pointer;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 8px 0; font-weight: 650; letter-spacing: 0.06em; }
.brand-mark { display: flex; align-items: end; gap: 2px; width: 22px; height: 28px; }
.brand-mark i { display: block; width: 5px; border-radius: 8px 8px 2px 2px; background: linear-gradient(var(--ember-light), var(--ember)); box-shadow: 0 0 13px rgba(240, 124, 67, 0.36); }
.brand-mark i:nth-child(1) { height: 17px; transform: rotate(-8deg); }
.brand-mark i:nth-child(2) { height: 24px; }
.brand-mark i:nth-child(3) { height: 14px; transform: rotate(9deg); }
.quiet-button { padding: 8px 0; color: var(--muted); font-size: 13px; }

.app-shell { width: min(100%, 720px); margin: 0 auto; padding: 30px 20px calc(56px + env(safe-area-inset-bottom)); }
.hero { padding: 34px 2px 40px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--ember-light); font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.hero h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(48px, 15vw, 76px); font-weight: 500; letter-spacing: 0.02em; line-height: 1.08; }
.hero-lead { max-width: 560px; margin: 18px 0 24px; color: #d8cfc2; font-family: "Songti SC", "STSong", serif; font-size: 19px; line-height: 1.75; }
.hero-note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.65; }
.ember-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 12px var(--ember); }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 24px; font-weight: 600; }
.section-heading > span { padding-bottom: 3px; color: var(--muted); font-size: 12px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card {
  position: relative;
  display: flex;
  min-height: 220px;
  padding: 22px;
  overflow: hidden;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(57, 49, 42, 0.96), rgba(35, 31, 28, 0.96));
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}
.theme-card::after { content: ""; position: absolute; right: -45px; bottom: -55px; width: 135px; height: 135px; border-radius: 50%; background: var(--card-glow, var(--ember)); opacity: 0.12; filter: blur(10px); }
.theme-card:nth-child(2) { --card-glow: #8faa8c; }
.theme-card:nth-child(3) { --card-glow: #d78082; }
.theme-card:nth-child(4) { --card-glow: #88a7bd; }
.theme-card:nth-child(5) { --card-glow: #d4a45b; }
.theme-card:nth-child(6) { --card-glow: #9c8cc5; }
.theme-card:active { transform: scale(0.985); }
.theme-card:focus-visible { outline: 2px solid var(--ember-light); outline-offset: 3px; }
.theme-index { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.theme-title { margin-top: 20px; font-family: "Songti SC", "STSong", serif; font-size: 25px; }
.theme-intro { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.theme-action { display: flex; width: 100%; margin-top: auto; padding-top: 20px; justify-content: space-between; color: #eadfce; font-size: 12px; }
.theme-action b { color: var(--ember-light); font-size: 17px; }

.how-it-works { padding: 54px 2px 0; }
.how-it-works ol { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 18px 0 0; padding: 1px; overflow: hidden; list-style: none; border-radius: 20px; background: var(--line); }
.how-it-works li { display: grid; padding: 18px; gap: 5px; background: #1e1b19; }
.how-it-works li span { color: var(--ember); font-family: ui-monospace, monospace; font-size: 10px; }
.how-it-works li strong { font-size: 14px; }
.how-it-works li small { color: var(--muted); line-height: 1.5; }

.flow-shell { min-height: calc(100vh - 130px); }
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.progress-track { flex: 1; height: 3px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,0.08); }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ember), var(--gold)); transition: width 300ms ease; }
.progress-row small { color: var(--muted); font-size: 11px; }
.flow-heading h1 { margin: 10px 0 12px; font-family: "Songti SC", "STSong", serif; font-size: 36px; font-weight: 500; line-height: 1.28; }
.flow-heading p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.guide-card { position: relative; margin: 24px 0; padding: 20px 20px 20px 24px; border: 1px solid rgba(240,124,67,0.22); border-radius: 20px; background: rgba(66, 48, 37, 0.56); }
.guide-card::before { content: ""; position: absolute; top: 20px; left: 0; width: 3px; height: 28px; border-radius: 0 4px 4px 0; background: var(--ember); }
.guide-card label { color: var(--ember-light); font-size: 10px; font-weight: 700; letter-spacing: 0.13em; }
.guide-card p { margin: 8px 0 0; color: #e8ded0; font-size: 14px; line-height: 1.75; }
.question-list { display: grid; gap: 16px; margin-top: 24px; }
.field label { display: block; margin-bottom: 8px; color: #ddd2c3; font-size: 13px; }
.field textarea {
  width: 100%; min-height: 100px; resize: vertical; padding: 15px 16px; color: var(--text); line-height: 1.65;
  border: 1px solid var(--line); border-radius: 17px; outline: none; background: rgba(255,255,255,0.045);
}
.field textarea:focus { border-color: rgba(240,124,67,0.58); box-shadow: 0 0 0 3px rgba(240,124,67,0.08); }
.counter-bar { position: sticky; z-index: 12; top: calc(74px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; margin: 22px 0 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(28,25,23,0.92); backdrop-filter: blur(14px); }
.counter-bar strong { color: var(--ember-light); font-size: 13px; }
.counter-bar span { color: var(--muted); font-size: 12px; }
.dimension-block { margin: 24px 0; }
.dimension-block h3 { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-card { position: relative; min-height: 122px; padding: 17px; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.035); cursor: pointer; transition: 160ms ease; }
.match-card strong { display: block; font-family: "Songti SC", serif; font-size: 20px; font-weight: 500; }
.match-card small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.match-card.selected { border-color: rgba(240,124,67,0.68); background: linear-gradient(145deg, rgba(113,59,37,0.48), rgba(65,43,33,0.55)); box-shadow: inset 0 0 0 1px rgba(255,177,110,0.09); }
.match-card.selected::after { content: "✓"; position: absolute; top: 12px; right: 12px; color: var(--ember-light); }
.ranking-list { display: grid; gap: 10px; margin: 24px 0; }
.rank-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,0.04); }
.rank-number { color: var(--gold); font-family: ui-monospace, monospace; font-size: 13px; }
.rank-copy strong { display: block; font-size: 16px; }
.rank-copy small { display: block; margin-top: 4px; color: var(--muted); }
.rank-actions { display: flex; gap: 5px; }
.rank-actions button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.04); cursor: pointer; }
.burn-stage { display: grid; gap: 12px; margin: 26px 0; }
.burn-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.035); cursor: pointer; }
.burn-card.selected { border-color: rgba(240,124,67,0.7); background: rgba(105,53,34,0.38); }
.match-stick { position: relative; flex: 0 0 10px; width: 10px; height: 62px; border-radius: 9px; background: linear-gradient(90deg,#c99355,#edbd7c,#b67b43); }
.match-stick::before { content: ""; position: absolute; top: -5px; left: -2px; width: 14px; height: 17px; border-radius: 55% 55% 45% 45%; background: #8c3728; }
.burn-card.selected .match-stick::before { background: var(--ember); box-shadow: 0 0 18px rgba(240,124,67,0.7); animation: flame 950ms ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(0.9) rotate(-3deg); } to { transform: scale(1.08) rotate(3deg); } }
.burn-copy strong { display: block; font-family: "Songti SC", serif; font-size: 20px; font-weight: 500; }
.burn-copy small { display: block; margin-top: 5px; color: var(--muted); }
.scenario-card { margin: 18px 0; padding: 19px; border-radius: 19px; background: linear-gradient(145deg, rgba(85,63,39,0.42), rgba(52,43,35,0.58)); border: 1px solid rgba(214,169,88,0.2); }
.scenario-card strong { color: var(--gold); font-size: 12px; }
.scenario-card p { margin: 9px 0 0; color: #e5dbcd; line-height: 1.7; }
.action-dock { position: sticky; z-index: 20; bottom: 0; display: flex; gap: 10px; margin: 30px -20px calc(-56px - env(safe-area-inset-bottom)); padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(23,21,19,0.9); backdrop-filter: blur(18px); }
.primary-button, .secondary-button { min-height: 50px; padding: 0 20px; border-radius: 16px; cursor: pointer; }
.primary-button { flex: 1; border: 0; background: linear-gradient(135deg, var(--ember), #c95c31); color: #fff7ee; font-weight: 650; box-shadow: 0 10px 24px rgba(190,76,35,0.22); }
.primary-button:disabled { opacity: 0.38; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--muted); }
.report-cover { padding: 30px 0 8px; }
.report-cover h1 { margin: 12px 0; font-family: "Songti SC", serif; font-size: 38px; font-weight: 500; }
.core-values { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0; }
.core-values span { padding: 9px 14px; border: 1px solid rgba(240,124,67,0.26); border-radius: 999px; background: rgba(240,124,67,0.09); color: var(--ember-light); }
.report-section { margin: 14px 0; padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,0.035); }
.report-section h2 { margin: 0 0 10px; font-family: "Songti SC", serif; font-size: 21px; font-weight: 500; }
.report-section p { margin: 0; color: #d8cfc2; font-size: 14px; line-height: 1.85; }
.report-list { padding-left: 20px; color: #d8cfc2; line-height: 1.8; }
.disclaimer { margin-top: 22px; padding: 16px; color: var(--muted); font-size: 11px; line-height: 1.7; border-top: 1px solid var(--line); }
.invite-panel { margin: 24px 0; padding: 22px; border: 1px solid rgba(214,169,88,0.24); border-radius: 22px; background: linear-gradient(145deg, rgba(76,57,35,0.48), rgba(40,34,29,0.7)); }
.invite-panel h2 { margin: 0 0 9px; font-family: "Songti SC", serif; font-size: 23px; font-weight: 500; }
.invite-panel p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.relationship-options { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.relationship-options button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.04); cursor: pointer; }
.relationship-options button.selected { border-color: var(--gold); color: #ffe3af; background: rgba(214,169,88,0.12); }
.invite-link { display: block; width: 100%; margin: 12px 0; padding: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 12px; background: rgba(0,0,0,0.2); color: #e6d8c3; font-size: 12px; }
.relation-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loading { display: grid; min-height: 55vh; place-items: center; text-align: center; }
.loading-flame { width: 18px; height: 34px; margin: 0 auto 20px; border-radius: 60% 40% 55% 45%; background: linear-gradient(var(--ember-light), var(--ember)); box-shadow: 0 0 35px rgba(240,124,67,0.46); animation: flame 750ms ease-in-out infinite alternate; }
.loading p { color: var(--muted); }
.toast { position: fixed; z-index: 60; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); left: 18px; max-width: 560px; margin: auto; padding: 14px 16px; border: 1px solid rgba(218,115,92,0.42); border-radius: 14px; background: rgba(74,42,35,0.96); color: #ffe7df; box-shadow: var(--shadow); }
.hidden { display: none !important; }

@media (max-width: 480px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .theme-card { min-height: 205px; padding: 18px; }
  .theme-title { font-size: 22px; }
  .theme-intro { font-size: 11px; }
  .action-dock { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
}

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