/* 價值觀小測驗 — mobuforest.com/values/
   介面色用官網「夜森」色票。系統字，不載入官網子集字型（以免缺字）。 */
:root {
  --primary: #17443F;
  --mist: #E8F0EE;
  --moon: #C9DCD7;
  --ink: #23302E;
  --paper: #FFFFFF;
  --muted: #4E605C;
  --deep: #0F2E2A;
  --on-primary: #fff;
  --primary-rgb: 23, 68, 63;
  --header-bg: rgba(232, 240, 238, .92);
  --shadow: 0 1px 2px rgba(35, 48, 46, .05), 0 10px 30px -12px rgba(35, 48, 46, .18);
  --shadow-card: 0 6px 20px rgba(23, 68, 63, .10);
  --font: "Noto Sans CJK TC", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --r-l: 24px;
  --r-m: 20px;
  --r-pill: 999px;
  --tap: 44px;
  --head: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    url("img/paper-grain.png") repeat,
    var(--mist);
  background-size: 160px 160px, auto;
  background-blend-mode: multiply, normal;
}
button, a { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
.nw { white-space: nowrap; }
.keep { word-break: keep-all; line-break: strict; overflow-wrap: normal; }
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--paper); color: var(--primary); padding: 8px 16px;
  border-radius: 999px; font-weight: 700;
}
.skip:focus { left: 12px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  flex: none;
  height: var(--head);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  min-height: calc(var(--head) + env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  border-bottom: 1px solid rgba(23, 68, 63, .10);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
}
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 22px; width: auto; display: block; }
.header-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .06em;
  white-space: nowrap;
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
body[data-screen="start"] #screen-start,
body[data-screen="error"] #screen-error,
body[data-screen="q"] #screen-q,
body[data-screen="result"] #screen-result,
body[data-screen="invite"] #screen-invite,
body[data-screen="pair"] #screen-pair { display: flex; }

/* 題目頁不可捲；結果頁可捲 */
#screen-q { overflow: hidden; padding: 8px 14px 10px; }
#screen-start,
#screen-error,
#screen-result,
#screen-invite,
#screen-pair {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

/* 開始 */
.start-hero {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 120px;
  margin: 4px 0 8px;
  position: relative;
}
.start-hero::before {
  content: "";
  position: absolute;
  width: 180px; height: 180px;
  left: 50%; top: 55%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201, 220, 215, .95) 0%, rgba(232, 240, 238, 0) 68%);
  pointer-events: none;
}
.start-hero .pet {
  position: relative;
  z-index: 1;
  max-height: 118px;
  width: auto;
  filter: drop-shadow(0 8px 14px rgba(35, 48, 46, .16));
}
.start-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .08em;
  line-height: 1.3;
  margin-bottom: 10px;
}
.intro {
  text-align: center;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}
.intro p { margin: 0 0 8px; }
#screen-start .actions { margin-top: 18px; }

/* 錯誤 */
.error-msg {
  text-align: center;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  margin: 28px 8px 0;
}
#screen-error .actions { margin-top: 24px; }

/* 進度與題目 */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex: none;
  min-height: 28px;
}
.bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--moon);
  overflow: hidden;
  min-width: 0;
}
.bar > i {
  display: block;
  height: 100%;
  width: 10%;
  background: var(--primary);
  border-radius: 3px;
}
.pcount {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
}
.btn-back {
  flex: none;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .04em;
}
.btn-back[hidden] { display: none; }
.q-title {
  flex: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--primary);
  letter-spacing: .04em;
  text-align: center;
  margin: 2px 0 10px;
}
.options {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  align-content: stretch;
}
.opt {
  background: var(--paper);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-card);
  border: 1.5px solid rgba(23, 68, 63, .08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 8px 14px;
  min-height: var(--tap);
  min-width: 0;
  text-align: center;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}
.opt:focus-visible { outline-offset: 0; }
.opt::before {
  content: "";
  position: absolute;
  width: 160px; height: 160px;
  left: 50%; top: 28%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201, 220, 215, .95) 0%, rgba(232, 240, 238, 0) 70%);
  pointer-events: none;
  z-index: 0;
}
.opt .pet {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: 90%;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 16px rgba(35, 48, 46, .16));
  margin-bottom: 8px;
}
.opt .lab {
  position: relative;
  z-index: 1;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: .04em;
}
.opt .who {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* 結果共用 */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 8px;
}
.hero .pets {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  min-height: 112px;
  margin-bottom: 4px;
}
.hero .pets::before {
  content: "";
  position: absolute;
  width: 220px; height: 180px;
  left: 50%; top: 50%;
  transform: translate(-50%, -52%);
  background: radial-gradient(circle, rgba(201, 220, 215, .95) 0%, rgba(232, 240, 238, 0) 70%);
  pointer-events: none;
}
.hero .pet {
  position: relative;
  z-index: 1;
  max-height: 120px;
  max-width: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(35, 48, 46, .16));
}
.hero .pets.multi .pet { max-height: 100px; max-width: 100px; }
.kicker {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .08em;
  margin-top: 2px;
}
.hero h1, .result-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .10em;
  line-height: 1.3;
}
.lines p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .08em;
  margin: 12px 0 6px;
}
.tend, .same-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chip {
  background: var(--paper);
  border-radius: 12px;
  min-height: 36px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(35, 48, 46, .05);
  border: 1px solid rgba(23, 68, 63, .08);
  min-width: 0;
}
.chip img {
  width: auto;
  height: 26px;
  max-width: 32px;
  object-fit: contain;
  flex: none;
}
.chip b {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
}
.recap { display: flex; flex-direction: column; gap: 4px; }
.recap .item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 2px;
  font-size: 14px;
  line-height: 1.4;
  min-width: 0;
}
.recap .stem { color: var(--muted); font-weight: 700; flex: none; }
.recap .pick { color: var(--ink); font-weight: 700; text-align: right; min-width: 0; }
.foot-note {
  margin: 14px 0 8px;
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  letter-spacing: .04em;
  text-align: center;
  touch-action: manipulation;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 8px 20px -8px rgba(var(--primary-rgb), .7);
}
.btn-ghost {
  background: var(--paper);
  color: var(--primary);
  box-shadow: inset 0 0 0 1.5px rgba(var(--primary-rgb), .25);
}
.btn-open { width: 100%; }
.feedback {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}

/* 邀請 */
.invite-lead { text-align: center; margin: 4px 0 14px; }
.invite-lead h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .08em;
  margin: 8px 0;
}
.invite-lead p { font-size: 15px; line-height: 1.65; color: var(--ink); }
.link-card {
  background: var(--paper);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-card);
  padding: 14px 14px 12px;
  text-align: center;
}
.link-card .url {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .01em;
  line-height: 1.5;
  word-break: break-all;
}
.link-card .note {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.nick-field { margin: 12px 0 4px; }
.nick-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.nick-field input {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid rgba(23, 68, 63, .2);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.nick-field .hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* 雙人 */
.pair-kicker {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .12em;
  margin-bottom: 4px;
}
.pair-nick {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.pair-d1 {
  text-align: center;
  margin: 4px 0 8px;
}
.pair-d1 p {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .04em;
  line-height: 1.45;
}
.diff-list { display: flex; flex-direction: column; gap: 8px; }
.diff {
  background: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 68, 63, .08);
}
.diff p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.talk { margin-top: 4px; }
.talk-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.talk-item .mark {
  flex: none;
  color: var(--primary);
  font-weight: 700;
  margin-top: 1px;
}

@media (max-width: 359px) {
  .q-title { font-size: 18px; margin-bottom: 8px; }
  .opt { padding: 8px 6px 10px; border-radius: 20px; }
  .opt .lab { font-size: 15px; }
  #screen-q { padding: 6px 10px 8px; }
  .start-hero { height: 96px; }
  .start-hero .pet { max-height: 94px; }
  .start-title { font-size: 20px; }
  .intro { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 貼文／限動，做法同 /pair */
.ratio-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(23, 68, 63, .08);
  border-radius: 14px;
}
.ratio-seg button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
}
.ratio-seg button.on {
  background: var(--paper);
  box-shadow: 0 1px 4px rgba(23, 68, 63, .18);
}
.ratio-seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.opt .halo, .halo-img {
  position: absolute;
  width: 200px;
  height: 200px;
  left: 50%;
  top: 22%;
  transform: translate(-50%, -20%);
  object-fit: contain;
  opacity: .88;
  pointer-events: none;
  z-index: 0;
}
.hero .halo-img, .invite-pets .halo-img, .start-hero .halo-img {
  width: 220px;
  height: 220px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
}
.invite-pets {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 128px;
  margin-bottom: 4px;
}
.invite-pets .pet {
  position: relative;
  z-index: 1;
  max-height: 120px;
  width: auto;
  filter: drop-shadow(0 8px 14px rgba(35, 48, 46, .16));
}
