:root {
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", "PingFang SC", sans-serif;
  color: #282828;
  background: #d2ebff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --panel: #fffceb;
  --navy: #143c6e;
  --gold: #ffc828;
  --gold-edge: #d2a01e;
  --blue-bg: #d2ebff;
  --orange-bg: #ffe1d2;
  --green: #27ae60;
  --hint: #6e7d87;
  --panel-width: min(92vw, 1100px);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; }
#root, #app { width: 100%; min-height: 100%; margin: 0; }
body { min-width: 320px; min-height: 100vh; min-height: 100dvh; }
button, input, select { font: inherit; }
button { color: inherit; }
#app { height: 100%; min-height: 0; display: grid; place-items: center; }

.app-root {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  padding: clamp(8px, 1.5vh, 16px) clamp(10px, 2vw, 26px);
  transition: background-color 180ms ease;
}

#app { flex: 1 1 auto; }

.stage {
  width: var(--panel-width);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  position: relative;
  border: 2px solid rgba(210, 160, 30, .55);
  border-radius: clamp(18px, 2.2vw, 30px);
  background: rgba(255, 252, 235, .97);
  box-shadow: 0 16px 44px rgba(35, 73, 102, .16);
  padding: clamp(18px, 2.8vh, 30px) clamp(24px, 5.2vw, 72px);
  text-align: center;
  scrollbar-width: thin;
}

.stage::before, .stage::after {
  content: "✦";
  position: absolute;
  top: 18px;
  color: rgba(255, 200, 40, .60);
  font-size: clamp(22px, 3vw, 34px);
  pointer-events: none;
}
.stage::before { left: 20px; }
.stage::after { right: 20px; }

/* The brief fixation marker belongs at the physical viewport center, not inside a card. */
.stage[data-screen="practice-fixation"] {
  position: fixed;
  z-index: 2;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.stage[data-screen="practice-fixation"]::before,
.stage[data-screen="practice-fixation"]::after { display: none; }
.stage[data-screen="practice-fixation"] .lead { margin: 0; line-height: 1; }

.eyebrow {
  color: #71808a;
  letter-spacing: .04em;
  font-size: clamp(13px, 1.25vw, 16px);
  margin: 0 0 14px;
}

h1, h2, p { margin-top: 0; }
h1 {
  color: var(--navy);
  font-size: clamp(25px, 3vw, 42px);
  line-height: 1.35;
  margin-bottom: clamp(20px, 2.6vh, 30px);
}
.lead {
  font-size: clamp(18px, 2vw, 27px);
  line-height: 1.75;
  margin: 0 auto 16px;
  max-width: 800px;
  white-space: pre-line;
}
.body-copy {
  font-size: clamp(16px, 1.65vw, 21px);
  line-height: 1.9;
  white-space: pre-line;
  max-width: 850px;
  margin: 0 auto;
}
.hint { color: var(--hint); font-size: clamp(14px, 1.35vw, 17px); margin: 18px 0 0; }
.small-hint { color: var(--hint); font-size: 14px; margin: 12px 0 0; }

.button-row, .choice-grid, .money-row, .scale-row, .form-grid, .download-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  flex-wrap: wrap;
}
.button-row { margin-top: clamp(22px, 3vh, 34px); }
.choice-grid { margin: clamp(24px, 4vh, 42px) auto 0; max-width: 940px; }
.choice-grid.compact { margin-top: 24px; gap: 12px; }

.btn {
  min-height: 48px;
  border: 2px solid #d1e0ec;
  border-radius: 14px;
  background: #fff;
  color: var(--navy);
  padding: 11px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(15px, 1.55vw, 19px);
  line-height: 1.35;
  transition: transform 90ms ease, box-shadow 100ms ease, border-color 100ms ease, background 100ms ease;
  touch-action: manipulation;
}
.btn:hover { border-color: #5993bd; box-shadow: 0 4px 12px rgba(20,60,110,.10); }
.btn:disabled { opacity: .66; cursor: wait; box-shadow: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #f0b300; outline-offset: 3px; }
.btn-primary { background: var(--green); color: white; border-color: #198e4a; }
.btn-primary:hover { background: #219653; border-color: #177640; }
.btn-confirm { min-width: 190px; }
.btn-confirm:disabled { cursor: not-allowed; color: #8c96a0; background: #dce0e6; border-color: #b6c0ca; box-shadow: none; }
.btn-selected { background: #fff3c2; border-color: var(--gold-edge); box-shadow: 0 0 0 3px rgba(210,160,30,.20); }
.btn-gold {
  width: clamp(54px, 6vw, 76px);
  height: clamp(54px, 6vw, 76px);
  min-height: 54px;
  border-radius: 50%;
  padding: 0;
  background: var(--gold);
  border: 3px solid var(--gold-edge);
  color: white;
  font-family: Consolas, monospace;
  font-size: clamp(20px, 2.3vw, 30px);
  box-shadow: inset 0 -3px 0 rgba(160,100,0,.13), 0 3px 0 rgba(90,60,0,.08);
}
.btn-gold.btn-selected { background: #f0ad08; outline: 4px solid rgba(210,160,30,.25); }
.btn-plain { background: #fff; }
.btn-large { padding: 14px 26px; min-width: 210px; }
.option-card { min-width: min(190px, 100%); max-width: 310px; flex: 1 1 180px; min-height: 72px; }
.option-card.wide { max-width: 430px; }
.option-card.single-row { min-width: 140px; }
.selected-note { min-height: 25px; color: #238653; font-weight: 700; margin-top: 15px; }
.stage p.question { color: var(--navy); font-size: clamp(19px, 2vw, 27px); line-height: 1.55; margin: 15px auto; max-width: 870px; }
.progress { color: #bd8c0b; letter-spacing: .18em; font-size: clamp(18px, 2vw, 25px); margin: 0 0 12px; }
.feedback { min-height: 38px; color: var(--green); font-weight: 700; font-size: clamp(17px, 1.7vw, 22px); margin-top: 15px; }
.feedback.no { color: #c0392b; }

.form-grid {
  align-items: stretch;
  gap: 15px 18px;
  max-width: 780px;
  margin: 0 auto;
}
.field { flex: 1 1 215px; min-width: min(200px, 100%); text-align: left; }
.field label { display: block; margin: 0 0 7px 3px; font-size: 15px; font-weight: 700; color: #344c60; }
.field input, .field select {
  width: 100%; height: 49px; border: 2px solid #cad8e3; border-radius: 11px;
  padding: 0 13px; background: white; color: #222; font-size: 17px;
}
.field-error { color: #b42318; font-weight: 700; min-height: 22px; margin: 13px 0 0; }
.partner-line { display: flex; justify-content: center; align-items: center; gap: 13px; color: var(--navy); font-weight: 700; font-size: clamp(17px, 2vw, 24px); margin: 8px 0 20px; }
.avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 3px solid; display: inline-grid; place-items: center; color: white; font-size: 16px; }
.avatar.blue { background: #3498db; border-color: #2980b9; }
.avatar.orange { background: #e67e22; border-color: #d35400; }
.round-info { color: var(--hint); font-size: 15px; margin: 0 0 14px; }
.money-row {
  width: max-content;
  max-width: 100%;
  gap: clamp(8px, 1.4vw, 19px);
  margin: 24px auto 4px;
  justify-content: center;
  flex-wrap: nowrap;
}
.scale-control {
  --scale-button-size: clamp(54px, 5.2vw, 66px);
  --scale-button-gap: clamp(7px, .8vw, 12px);
  width: max-content;
  max-width: calc(100% - 24px);
  margin: clamp(20px, 3vh, 30px) auto 0;
}
.scale-row { gap: clamp(5px, .85vw, 11px); flex-wrap: nowrap; margin: 25px auto 0; }
.scale-control .scale-row {
  width: max-content;
  max-width: 100%;
  gap: var(--scale-button-gap);
  flex-wrap: nowrap;
  margin: 0;
}
.scale-button {
  width: var(--scale-button-size, clamp(49px, 5vw, 60px));
  min-width: var(--scale-button-size, clamp(49px, 5vw, 60px));
  flex: none;
  padding: 10px 3px;
  font-size: clamp(17px, 1.6vw, 20px);
}
.scale-labels {
  position: relative;
  width: 100%;
  height: 1.5em;
  margin: 14px 0 0;
  color: var(--hint);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.3;
}
.scale-labels span { position: absolute; top: 0; white-space: nowrap; }
.scale-labels span:first-child {
  left: calc(var(--scale-button-size) / 2);
  transform: translateX(-50%);
}
.scale-labels span:last-child {
  right: calc(var(--scale-button-size) / 2);
  transform: translateX(50%);
}
.countdown { color: #3498db; font-size: clamp(26px, 3vw, 40px); font-weight: 800; margin: 18px 0; font-variant-numeric: tabular-nums; }
.result-box { background: white; border: 2px solid var(--gold-edge); border-radius: 16px; padding: clamp(14px, 2.2vw, 24px); margin: 20px auto; max-width: 800px; }
.result-box p { margin: 7px 0; color: var(--navy); font-size: clamp(17px, 1.8vw, 23px); line-height: 1.6; }
.result-box .strong { font-weight: 800; font-size: clamp(20px, 2.2vw, 29px); }
.quiz-stars { color: #e6ab00; letter-spacing: 5px; font-size: 22px; }
.qa-banner { position: fixed; z-index: 5; left: 10px; bottom: 9px; border-radius: 6px; padding: 5px 9px; background: #17324d; color: white; font: 12px/1.2 sans-serif; opacity: .78; }
.download-row { margin-top: 20px; }
.download-card { background: #fff; border: 1px solid #d9e2e8; padding: 13px; border-radius: 12px; }
.screen-message { color: #4d606d; font-size: 16px; line-height: 1.6; margin: 0 auto; max-width: 800px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .app-root { padding: 9px; }
  #app { place-items: start center; }
  .stage { width: 100%; max-height: calc(100dvh - 18px); padding: 26px 15px 22px; }
  .stage::before { left: 12px; top: 10px; }
  .stage::after { right: 12px; top: 10px; }
  .scale-row { flex-wrap: wrap; max-width: 440px; }
  .scale-labels { margin-top: 10px; }
  .field { flex-basis: 100%; }
}

@media (max-height: 820px) and (min-width: 761px) {
  .stage { padding-top: 18px; padding-bottom: 18px; }
  h1 { margin-bottom: 18px; }
  .choice-grid { margin-top: 18px; }
  .button-row { margin-top: 18px; }
}

@media (min-aspect-ratio: 1.7) {
  .stage { width: min(88vw, 1180px); }
}
