/* 人格配对局 / Type & Stars —— 奶油贴纸风
   令牌与 ios/TypeStars/Sources/Theme.swift 同一套（量自设计稿 export-1b，见 ios/README.md §二点五）：
   描边 2px、右下硬阴影 4px 无模糊、点阵 18.5px、卡片圆角 18px。
   ⚠️ 唯一刻意偏离：次要文字 iOS 是 #A1A1A1，在奶油底上对比度只有 2.3:1，网页改用 #756C62（≈4.8:1）。 */
:root {
  --bg: #FFF8EE;
  --paper: #F3E9D8;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --soft: #756C62;
  --red: #FF5A36;
  --yellow: #FFD84D;
  --pink: #FFE8DF;
  --dot: #EEE7DE;
  --b: 2px;
  --sh: 4px;
  --r: 18px;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.1px, transparent 1.3px);
  background-size: 18.5px 18.5px;
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}
.wrap { max-width: 540px; margin: 0 auto; padding: 14px 16px calc(64px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
.screen { display: none; }
.screen.on { display: block; animation: in .28s cubic-bezier(.2, .8, .3, 1); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 贴纸：粗黑描边 + 右下硬阴影；按下时「压进阴影里」（位移，不是缩放） */
.sticker { background: var(--surface); border: var(--b) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh) var(--sh) 0 var(--ink); }

/* 顶栏 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 22px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 900; font-size: 16px; color: var(--ink); text-decoration: none; }
.brand img { border: var(--b) solid var(--ink); border-radius: 9px; }
.toggles { display: flex; gap: 6px; }
.tg { background: var(--surface); border: var(--b) solid var(--ink); color: var(--ink); border-radius: 999px; padding: 4px 11px; font: 800 12px/1.4 var(--text); cursor: pointer; }
.tg.act { background: var(--ink); color: #fff; }

/* 字 */
.display { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 9.6vw, 46px); line-height: 1.12; letter-spacing: -.01em; margin: 6px 0 12px; }
.display.sm { font-size: clamp(28px, 8vw, 36px); }
.display.xs { font-size: 26px; margin: 0 0 8px; }
.display .hl { color: var(--red); }
.center { text-align: center; }
.sub { color: var(--soft); font-size: 15px; margin: 0 0 22px; }
.sechead { font-weight: 900; font-size: 13px; letter-spacing: .1em; margin: 26px 0 12px; }
.disc { font-size: 11.5px; color: var(--soft); line-height: 1.7; margin: 26px 0 0; }
.disc a { color: var(--soft); }

/* 按钮 */
.btn {
  display: block; width: 100%; border: var(--b) solid var(--ink); border-radius: 999px; cursor: pointer;
  font: 800 17px/1.3 var(--text); padding: 16px 14px; margin: 0 0 14px; color: var(--ink); background: var(--surface);
  box-shadow: var(--sh) var(--sh) 0 var(--ink); transition: transform .08s ease-out, box-shadow .08s ease-out;
}
.btn:active, .unlockbar:active, .opt:active, .mine:active { transform: translate(var(--sh), var(--sh)); box-shadow: 0 0 0 var(--ink); }
.btn-main { background: var(--red); color: #fff; }
.btn-alt { background: var(--yellow); }
.btn-ghost { background: var(--surface); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .cap { display: block; font-size: 12.5px; font-weight: 600; opacity: .85; margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2.tight .btn { font-size: 15px; padding: 14px 10px; }
.linkbtn { display: block; margin: 4px auto 0; background: none; border: 0; color: var(--soft); font: 600 14.5px var(--text); padding: 8px; cursor: pointer; }

/* 常驻解锁条：可见性只取决于「是否已解锁」（HANDOVER 红线 7） */
.unlockbar { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--yellow); border-radius: 999px; padding: 12px 18px; margin: 0 0 14px; font: 800 14.5px var(--text); color: var(--ink); cursor: pointer; text-align: left; }
.unlockbar::before { content: "🔓"; }
.unlockbar::after { content: "›"; margin-left: auto; font-size: 20px; line-height: 1; }

.card { background: var(--surface); border: var(--b) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh) var(--sh) 0 var(--ink); padding: 16px 18px; margin: 0 0 14px; }
.note { background: var(--pink); border: var(--b) solid var(--ink); border-radius: var(--r); padding: 12px 15px; font-size: 13px; margin: 8px 0 0; }
.note b { display: block; margin-bottom: 2px; }
.note a { color: var(--ink); font-weight: 700; }
.pill { display: inline-block; background: var(--yellow); border: var(--b) solid var(--ink); border-radius: 999px; padding: 3px 12px; font: 800 13px/1.5 var(--text); }
.pill.red { background: var(--red); color: #fff; }
.pill.pink { background: var(--pink); color: var(--red); }

/* 首页：我的人设 */
.mine { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; margin: 0 0 14px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.mine .g { font-size: 30px; line-height: 1; }
.mine b { display: block; font-size: 15px; }
.mine span { font-size: 12.5px; color: var(--soft); }

/* 表单 */
.field { margin: 0 0 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; margin-bottom: 7px; }
.field input, .field select {
  width: 100%; background: var(--surface); border: var(--b) solid var(--ink); border-radius: 14px; color: var(--ink);
  font: 600 17px var(--text); padding: 13px 14px; outline: none; appearance: none; -webkit-appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.field input:focus, .field select:focus { box-shadow: 3px 3px 0 var(--red); }
.signpv { text-align: center; }
.signpv .g { font-size: 38px; line-height: 1.2; }
.signpv .k { font-size: 12.5px; letter-spacing: .12em; color: var(--soft); margin-top: 2px; }
.signpv .n { font-family: var(--display); font-size: 24px; font-weight: 900; }
.signpv .t { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* 答题 */
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.hint { font-size: 12.5px; color: var(--soft); text-align: right; }
.prog { height: 10px; border: var(--b) solid var(--ink); border-radius: 999px; background: var(--surface); overflow: hidden; margin: 0 0 24px; }
.prog i { display: block; height: 100%; width: 0; background: var(--red); transition: width .3s; }
.qtext { font-family: var(--display); font-size: 25px; font-weight: 900; line-height: 1.35; margin: 0 0 22px; }
.opt { display: block; width: 100%; text-align: left; background: var(--surface); border: var(--b) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh) var(--sh) 0 var(--ink); padding: 17px 18px; margin: 0 0 14px; color: var(--ink); font: 700 16.5px/1.45 var(--text); cursor: pointer; transition: transform .08s, box-shadow .08s; }
#q-back { margin-top: 10px; }

/* 传手机 */
.pass { text-align: center; padding: 26px 0 18px; }
.passicon { width: 92px; height: 92px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; font-size: 46px; background: var(--yellow); border-radius: 26px; transform: rotate(-6deg); }

/* 人设卡 */
.persona { text-align: center; padding: 22px 18px 20px; border-radius: 24px; margin: 0 0 6px; }
.persona .code { display: inline-block; margin: 0 0 10px; }
.persona .name { font-family: var(--display); font-size: 38px; font-weight: 900; line-height: 1.15; margin: 4px 0 0; }
.persona .el { font-family: var(--display); font-size: 30px; font-weight: 900; line-height: 1.2; }
.persona .tag { font-size: 15px; font-weight: 600; margin: 12px 0 0; }
.persona .traits { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 14px 0 0; }
.dash { border: 0; border-top: 2px dashed #CFC5B6; margin: 14px 0; }
.dim { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 13.5px; font-weight: 800; }
.dim:last-child { margin-bottom: 0; }
.dim .lb { width: 1.4em; text-align: center; flex: none; }
.dim .track { flex: 1; height: 12px; border: var(--b) solid var(--ink); border-radius: 999px; position: relative; overflow: hidden; background: var(--bg); }
.dim .track i { position: absolute; top: 0; bottom: 0; background: var(--red); }
.dim .pc { width: 3em; text-align: right; flex: none; font-variant-numeric: tabular-nums; color: var(--soft); }

/* 名单 */
.quota { font-size: 13.5px; font-weight: 700; margin: -10px 0 16px; }
.plist { margin: 0 0 16px; }
.pitem { display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin: 0 0 12px; }
.pav { width: 42px; height: 42px; border-radius: 50%; border: var(--b) solid var(--ink); flex: none; display: flex; align-items: center; justify-content: center; font: 900 18px var(--display); }
.pitem .pn { flex: 1; min-width: 0; }
.pitem .pn b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .pn span { font-size: 12.5px; color: var(--soft); font-weight: 700; letter-spacing: .04em; }
.pitem .del { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; padding: 6px 8px; color: var(--soft); }
.empty { text-align: center; color: var(--soft); font-size: 14px; padding: 26px 10px; border: var(--b) dashed var(--ink); border-radius: var(--r); margin: 0 0 16px; background: var(--surface); }

/* 揭晓 */
.pair { padding: 16px 17px; margin: 0 0 14px; border-radius: 22px; }
.pair.compact { border-radius: var(--r); padding: 13px 16px; }
.pair .ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pair .who { font-size: 18px; font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair.compact .who { font-size: 15.5px; }
.pair .types { font-size: 12.5px; color: var(--soft); font-weight: 700; margin-top: 2px; }
.pair .sc { flex: none; font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.pair.compact .sc { font-size: 24px; }
.pair.best .sc { color: var(--red); }
.pair .why { font-size: 14.5px; margin: 0; }
.pair .crown { margin: 0 0 12px; }
.repbtn { margin-top: 12px; background: none; border: var(--b) solid var(--ink); border-radius: 999px; padding: 6px 14px; font: 800 13px var(--text); cursor: pointer; color: var(--ink); }
.repbtn.locked::before { content: "🔒 "; }
.pop { opacity: 0; animation: pop .34s cubic-bezier(.2, .9, .3, 1.2) forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; opacity: 1; } .screen.on { animation: none; } }

/* 发卡 */
.guest { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 0 0 12px; }
.guest .gi { flex: 1; min-width: 0; }
.guest .gi b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest .gi .pill { font-size: 12px; padding: 1px 10px; margin: 3px 0; }
.guest .gi small { display: block; font-size: 12.5px; color: var(--soft); font-weight: 700; }
.guest .btn { width: auto; margin: 0; padding: 9px 16px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }

/* 弹层 */
.modal { position: fixed; inset: 0; background: rgba(26, 26, 26, .55); display: none; align-items: flex-end; justify-content: center; z-index: 60; padding: 16px; }
.modal.on { display: flex; }
.sheet { width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; padding: 22px 20px 16px; background: var(--bg); border-radius: 26px; }
@media (min-height: 700px) { .modal { align-items: center; } }
.benefits { list-style: none; margin: 0 0 20px; padding: 16px 18px; }
.benefits li { display: flex; gap: 12px; align-items: flex-start; font-weight: 700; margin: 0 0 12px; }
.benefits li:last-child { margin: 0; }
.benefits li::before { content: "✓"; flex: none; width: 26px; height: 26px; border: var(--b) solid var(--ink); border-radius: 50%; background: var(--yellow); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; }
.rsec { margin: 0 0 14px; }
.rsec h4 { margin: 0 0 4px; font-size: 15px; font-weight: 900; }
.rsec p { margin: 0; font-size: 14.5px; }
#sh-img { display: block; width: 100%; height: auto; border: var(--b) solid var(--ink); border-radius: 14px; margin: 0 0 16px; -webkit-touch-callout: default; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; padding: 9px 18px; font: 700 14px var(--text); z-index: 80; }

/* 双人链接 */
.invite { padding: 4px 18px 6px; margin: 22px 0 18px; background: var(--pink); }
.invite .sechead { margin-top: 18px; }
.invite .sub { margin-bottom: 14px; }
.duohead { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 6px 0 18px; background: var(--yellow); transform: rotate(-1.5deg); }
.duohead .g { font-size: 40px; line-height: 1; }
.duohead b { display: block; font-family: var(--display); font-size: 20px; font-weight: 900; }
.duohead span { font-size: 13px; font-weight: 700; }
.duoscore { text-align: center; padding: 20px 18px 18px; }
.duoscore .big { font-family: var(--display); font-weight: 900; font-size: 84px; line-height: 1; color: var(--red); font-variant-numeric: tabular-nums; }
.duoscore .lbl { font-weight: 900; font-size: 13px; letter-spacing: .1em; margin-bottom: 6px; }
.duopair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
.duopair .card { margin: 0; padding: 12px 14px; text-align: center; }
.duopair .card b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duopair .card .n { font-family: var(--display); font-weight: 900; font-size: 18px; line-height: 1.25; margin: 4px 0 2px; }
.duopair .card span { font-size: 12px; color: var(--soft); font-weight: 700; }

/* ===================== 宽屏（2026-10-25 Michael：手机保持窄版，电脑显示宽版） =====================
   规则：手机（<720px）一个像素都不改——所有宽屏样式都在媒体查询里；HTML 只加了包裹层，元素顺序没动，
   所以窄屏下 .split / .side / .main / .actions 都是普通的块，叠起来就是原来的顺序。 */
.hero-art { display: none; }

@media (min-width: 720px) {
  .wrap { max-width: 720px; padding: 22px 28px 80px; }
  /* 揭晓：两张大卡（最来电 / 最上头）各占一行，其余配对两列 */
  #rv-body, #ho-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; }
  #rv-body .pair:not(.compact) { grid-column: 1 / -1; }
  .actions { max-width: 560px; margin: 8px auto 0; }
  .split > .side.actions { max-width: none; margin: 0; }
}

@media (min-width: 1000px) {
  .wrap { max-width: 1120px; padding: 28px 44px 96px; }
  .top { margin: 0 0 44px; }
  .display { font-size: 64px; }
  .display.sm { font-size: 44px; }
  .sub { font-size: 16.5px; }

  /* 两栏：左右各一半，右栏 / 左栏的「side」吸顶 */
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; align-items: start; }
  .split > .side { position: sticky; top: 28px; }

  /* 首页：左文案右示例卡 */
  .split.hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; min-height: calc(100vh - 220px); }
  .split.hero .main { max-width: 520px; }
  .hero-art { display: block; position: relative; padding: 10px 0 10px 20px; }

  /* 表单类页面：居中的一条窄栏（表单拉宽了反而难填） */
  .screen.narrow.on { max-width: 600px; margin: 0 auto; }

  /* 结果页：左边人设卡吸顶 */
  #s-result .persona { padding: 34px 28px 30px; }
  #s-result .persona .name { font-size: 48px; }
  #s-result .persona .el { font-size: 38px; }
  #s-result .main > .sechead:first-child { margin-top: 4px; }

  /* 名单页：左名单右操作 */
  #s-party .side.actions { padding-top: 92px; }

  /* 揭晓：最来电 / 最上头 并排一行，其余三列 */
  #rv-body { grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 18px; grid-auto-flow: row dense; }
  #rv-body .pair:not(.compact) { grid-column: span 3; }
  #rv-body .pair.best { order: -2; }
  #rv-body .pair:not(.compact):not(.best) { order: -1; }
  #rv-body .pair.compact { grid-column: span 2; }
  #s-reveal .sub.center { max-width: 640px; margin-left: auto; margin-right: auto; }

  /* 发卡：三列 */
  #ho-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* 双人：左分数右两人 */
  #s-duo .duoscore .big { font-size: 120px; }
}

/* 首页右侧：示例卡 + 三步 */
.hero-card { width: 340px; margin: 0 auto 30px; transform: rotate(4deg); background: var(--bg); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 12px 12px 0 var(--ink); text-align: center; padding: 30px 22px 28px; }
.hero-card .wm { color: var(--red); font-weight: 900; font-size: 13px; letter-spacing: .32em; }
.hero-card .acc { display: inline-block; margin: 18px 0 12px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 999px; padding: 5px 18px; font-weight: 900; font-size: 20px; }
.hero-card .code { font-weight: 900; font-size: 15px; }
.hero-card .nm { font-family: var(--display); font-weight: 900; font-size: 38px; line-height: 1.08; margin: 8px 0 2px; }
.hero-card .el { font-family: var(--display); font-weight: 900; font-size: 30px; }
.hero-card .tg2 { font-size: 14px; font-weight: 600; margin-top: 10px; }
.hero-card .sc { margin-top: 16px; color: var(--red); font-weight: 900; font-size: 18px; }
.hero-steps { list-style: none; margin: 0 auto; padding: 0; max-width: 400px; counter-reset: st; }
.hero-steps li { counter-increment: st; display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 16px; margin: 0 0 12px; }
.hero-steps li::before { content: counter(st); flex: none; width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 900; box-shadow: 2px 2px 0 var(--ink); }

/* 完整版：5 档作答 + 说明书 */
.opt.lk { padding: 13px 18px; margin-bottom: 10px; font-size: 16px; }
.opt.lk.on { background: var(--yellow); }
.deepcta { display: block; width: 100%; text-align: left; background: var(--yellow); padding: 14px 18px; margin: 4px 0 16px; font: 800 15px/1.45 var(--text); color: var(--ink); cursor: pointer; }
.axis { display: grid; grid-template-columns: 1.3em 1fr 1.3em 5.5em; align-items: center; gap: 8px; font-weight: 900; font-size: 13.5px; margin: 0 0 12px; }
.axis:last-child { margin-bottom: 0; }
.axis .track { height: 12px; border: var(--b) solid var(--ink); border-radius: 999px; position: relative; overflow: hidden; background: var(--bg); }
.axis .track i { position: absolute; top: 0; bottom: 0; background: var(--red); }
.axis .track b { position: absolute; top: -2px; bottom: -2px; left: 50%; width: 2px; background: var(--ink); opacity: .35; }
.axis .lbl { font-size: 12px; text-align: right; color: var(--soft); font-weight: 800; }
.axis .lbl.mid { color: var(--red); }
.rsec2 { margin: 0 0 22px; }
.rsec2 > h3 { font-family: var(--display); font-weight: 900; font-size: 22px; margin: 0 0 12px; }
.rlist { margin: 0; padding: 0; list-style: none; }
.rlist li { position: relative; padding: 0 0 0 22px; margin: 0 0 10px; font-size: 15px; }
.rlist li::before { content: "✦"; position: absolute; left: 0; color: var(--red); }
.flip { padding: 14px 16px; margin: 0 0 14px; }
.flip .fh { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.flip .lt { display: inline-flex; width: 28px; height: 28px; border: var(--b) solid var(--ink); border-radius: 8px; background: var(--yellow); align-items: center; justify-content: center; font-family: var(--display); font-weight: 900; }
.flip .called { font-size: 13.5px; color: var(--soft); font-weight: 700; }
.flip .called s { text-decoration-thickness: 2px; }
.flip p { margin: 0 0 8px; font-size: 15px; }
.flip p:last-child { margin: 0; }
.flip .k { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: .06em; margin-right: 6px; color: var(--red); }
.flip.mid { background: var(--pink); }
.flip.mid h4 { margin: 0 0 6px; font-size: 15px; font-weight: 900; }

/* 异地加入 */
.roomstat { font-size: 13.5px; font-weight: 800; margin: -4px 0 16px; padding: 10px 14px; border: var(--b) dashed var(--ink); border-radius: 14px; background: var(--surface); }
.roomstat::before { content: "📡 "; }
.pitem .rtag { display: inline-block; font-style: normal; margin-left: 6px; font-size: 11px; font-weight: 900; color: var(--red); border: 1.5px solid var(--red); border-radius: 999px; padding: 0 7px; letter-spacing: 0; vertical-align: 1px; }
.rm-steps { margin: 6px 0 14px; max-width: none; }
.rm-steps li { font-size: 15px; }
#m-room .note { margin: 0 0 16px; }
