/*
 * B 方向「老杂志心理测试页」（D-014）：首页、翻到的这一页、通用答题、通用结果。
 * 样子照 30-视觉设计/原型/proto.css（参考实现）；颜色、字体、圆角只读 themes.css 的变量。
 * 全部限定在 .mag 视图里，恋爱依恋测试（ECR）的专属页不受影响。
 */

/* 主题色可以过渡：翻牌时整页专色平滑换掉 */
@property --t-ink   { syntax: '<color>'; inherits: true; initial-value: #585550; }
@property --t-print { syntax: '<color>'; inherits: true; initial-value: #8A8782; }
@property --t-wash  { syntax: '<color>'; inherits: true; initial-value: #F4F3F2; }
@property --t-field { syntax: '<color>'; inherits: true; initial-value: #C9C7C3; }

body { font-synthesis: none; } /* 快乐体只有一个字重，禁止浏览器假加粗 */
body.themed {
  background: var(--stock); font-family: var(--t-font); color: var(--graphite); caret-color: var(--t-ink);
  transition: --t-ink .6s var(--ease-out), --t-print .6s var(--ease-out), --t-wash .6s var(--ease-out), --t-field .6s var(--ease-out);
}
body.themed ::selection { background: var(--t-field); color: var(--graphite); }
.defs { position: absolute; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mag svg { width: 1em; height: 1em; flex: none; }
.mag :focus-visible { outline: 3px solid var(--t-ink); outline-offset: 3px; border-radius: 2px; }
.mag button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mag { position: relative; padding-top: 6px; line-height: 1.6; }

/* 页眉栏线：左栏目，右页码 */
.mag .runhead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 12px; letter-spacing: .08em; color: var(--graphite);
  padding-bottom: 6px; border-bottom: 1.5px solid var(--graphite);
  box-shadow: 0 3px 0 -1.5px var(--stock), 0 4px 0 -1.5px var(--graphite);
}
.mag .runhead > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mag .folio { white-space: nowrap; }
.mag .folio b { font-weight: 700; font-variant-numeric: tabular-nums; }

.mag .display { font-family: var(--t-font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1.08; text-wrap: balance; }

/* 网点：两层错开的圆点 = 45° 加网 */
.mag .rfield::before, .mag .sticker::before, .mag .cell.on, .mag .seg.on, .mag .tags li, .mag .drawn-shell::before {
  background-image:
    radial-gradient(circle, var(--t-print) 0 26%, transparent 29%),
    radial-gradient(circle, var(--t-print) 0 26%, transparent 29%);
  background-size: var(--dot) var(--dot);
  background-position: 0 0, calc(var(--dot) / 2) calc(var(--dot) / 2);
}

/* ---------- 按钮：优惠券条 ---------- */
.mag .coupon {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 58px; margin-top: 22px; padding: 0 28px;
  font-family: var(--t-font-display); font-weight: 400; font-size: 21px; letter-spacing: .04em;
  color: var(--t-ink); border: 2px dashed var(--t-ink); border-radius: 0;
  transition: transform .15s var(--ease-out);
}
.mag .coupon.solid { color: var(--on-ink); background: var(--t-ink); border: 0; outline: 2px dashed color-mix(in srgb, var(--on-ink) 70%, transparent); outline-offset: -8px; }
.mag .coupon.solid:focus-visible { outline: 3px solid var(--graphite); outline-offset: 3px; }
.mag .coupon::before, .mag .coupon::after { content: ""; position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--stock); }
.mag .coupon::before { left: -9px; }
.mag .coupon::after { right: -9px; }
.mag .coupon:not(.solid)::before, .mag .coupon:not(.solid)::after { border: 2px dashed var(--t-ink); }
.mag .coupon svg { width: 22px; height: 22px; }
.mag .coupon:active { transform: translateY(1px) rotate(-.4deg); }
.mag .coupon:disabled { opacity: .45; cursor: default; }

.mag .link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px;
  font-size: 14px; color: var(--graphite);
  text-decoration: underline; text-decoration-color: var(--t-print); text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.mag .link-btn svg { width: 18px; height: 18px; color: var(--t-ink); }
.mag .link-btn:disabled, .mag .link-btn[aria-disabled="true"] { color: var(--muted); text-decoration: none; cursor: default; }

.mag .hint { white-space: pre-line; margin-top: 12px; font-size: 14px; text-align: center; color: var(--muted); }
.mag .err { min-height: 1.4em; margin-top: 4px; font-size: 14px; text-align: center; color: var(--t-ink); font-weight: 700; }
.mag .sec-h { margin: 30px 0 8px; font-family: var(--t-font-display); font-weight: 400; font-size: 22px; color: var(--graphite); }

/* ================= 首页 ================= */
.mag .home-title { margin: 30px 0 0; font-size: clamp(52px, 17vw, 76px); color: var(--t-ink); text-shadow: var(--misreg); transform: rotate(-2.5deg); transform-origin: left; }
.mag .home-title span { display: block; }
.mag .home-title span + span { margin-left: .6em; }

.mag .bubble {
  position: relative; display: inline-block; margin: 22px 0 0 6px; padding: 10px 18px;
  font-size: 19px; font-weight: 700; border: 2px solid var(--graphite); border-radius: 26px 22px 28px 20px / 22px 26px 20px 28px; background: var(--paper);
}
.mag .bubble::after {
  content: ""; position: absolute; left: 34px; bottom: -11px; width: 18px; height: 18px;
  background: var(--paper); border-right: 2px solid var(--graphite); border-bottom: 2px solid var(--graphite);
  transform: skewX(28deg) rotate(38deg);
}

.mag .sticker-wrap { position: relative; display: grid; place-items: center; margin-top: 18px; padding: 18px 0 6px; }
.mag .sticker { position: relative; display: grid; place-items: center; width: 220px; height: 220px; border: 2.5px dashed var(--graphite); border-radius: 50%; }
.mag .sticker::before { content: ""; position: absolute; inset: 22px; border-radius: 50%; transform: translate(12px, 10px); }
.mag .sticker input {
  position: relative; width: 190px; text-align: center; border: 0; background: transparent; padding: 0;
  font-family: var(--t-font-display); font-weight: 400; font-size: 132px; line-height: 1; color: var(--t-ink);
  text-shadow: 3px 2px 0 var(--graphite); font-variant-numeric: tabular-nums; outline: none; border-radius: 0;
}
.mag .sticker input.three { font-size: 92px; } /* 三位数（100）缩字号：375 宽下 132px 的 100 有 224px，超出输入框 */
.mag .sticker input::placeholder { color: var(--t-print); text-shadow: none; }
.mag .sticker:focus-within { border-style: solid; border-color: var(--t-ink); }
.mag .doodle { position: absolute; color: var(--t-print); }
.mag .doodle-a { width: 30px; height: 30px; left: 12%; top: 14%; transform: rotate(-12deg); }
.mag .doodle-b { width: 20px; height: 20px; right: 16%; top: 62%; transform: rotate(18deg); color: var(--t-ink); }
.mag .dice { position: absolute; right: 0; bottom: -4px; }

/* 首页下方：没做完的、今天翻到的、上次结果 */
.mag .paper-row {
  display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 12px 14px;
  background: var(--paper); border: 2px solid var(--graphite); border-radius: var(--t-radius); cursor: pointer;
}
.mag .paper-row div { flex: 1; min-width: 0; }
.mag .paper-row .dot { display: none; } /* 「上次结果」行里的圆点在杂志页没有样式，不藏的话它也按 flex: 1 占走左半行 */
.mag .paper-row b { display: block; font-size: 15px; }
.mag .paper-row span { display: block; font-size: 12px; color: var(--muted); }
.mag .paper-row em { font-style: normal; font-size: 20px; color: var(--t-ink); }
.mag .tlist { list-style: none; border-top: 2px solid var(--graphite); }
.mag .tlist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stock-edge); cursor: pointer; }
.mag .tlist .num { width: 44px; font-family: var(--t-font-display); font-size: 28px; line-height: 1; color: var(--t-ink); text-shadow: var(--misreg); font-variant-numeric: tabular-nums; }
.mag .tlist div { flex: 1; min-width: 0; }
.mag .tlist b { display: block; font-size: 15px; }
.mag .tlist span { display: block; font-size: 12px; color: var(--muted); }
.mag .tlist em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--t-ink); }

/* ================= 翻到的这一页 ================= */
.mag .drawn-shell { position: relative; margin: 26px 9px 0 0; transform-origin: left center; }
.mag .drawn-shell::before { content: ""; position: absolute; inset: 0; transform: translate(9px, 9px); }
.mag .drawn { position: relative; padding: 22px 20px 16px; background: var(--paper); border: 2px solid var(--graphite); }
.mag .drawn-shell.turn { animation: turn .7s var(--ease-out) both; }
@keyframes turn {
  from { clip-path: inset(0 100% 0 0); transform: perspective(900px) rotateY(20deg); } /* 正角度：右边缘朝远处转，投影只会变窄，375 宽不撑出横向滚动 */
  to   { clip-path: inset(-20px -20px -20px 0); transform: none; }
}
.mag .drawn-kicker { font-size: 13px; color: var(--muted); }
.mag .drawn-kicker b { color: var(--t-ink); }
.mag .drawn-title { margin-top: 8px; font-size: 34px; color: var(--graphite); text-shadow: var(--misreg); }
.mag .drawn-meta { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--t-ink); }
.mag .drawn-intro { margin-top: 8px; font-size: 15px; }
.mag .drawn-actions { display: grid; justify-items: center; gap: 4px; }
.mag .drawn-actions .coupon { margin-top: 16px; }
.mag .drawn .coupon::before, .mag .drawn .coupon::after { background: var(--paper); }

/* ================= 答题 ================= */
.mag .qmark {
  margin-top: 22px; font-family: var(--t-font-display); font-weight: 400; font-size: 84px; line-height: 1;
  color: var(--t-print); text-shadow: 3px 2px 0 var(--graphite); transform: rotate(-4deg); transform-origin: left;
}
.mag .question { margin-top: 14px; font-size: 30px; color: var(--graphite); }
.mag .question.swap { animation: in .3s ease; }
.mag .flow { list-style: none; margin-top: 26px; display: grid; justify-items: center; }
.mag .flow li { position: relative; display: grid; justify-items: center; max-width: 100%; }
.mag .flow li:nth-child(4n+1) { transform: translateX(-14px); }
.mag .flow li:nth-child(4n+3) { transform: translateX(14px); }
.mag .opt {
  position: relative; min-width: 168px; max-width: calc(100vw - 72px); min-height: 48px; padding: 8px 20px;
  font-size: 17px; font-weight: 700; line-height: 1.4; background: var(--paper);
  border: 2px solid var(--graphite); border-radius: var(--t-radius);
  transition: background-color .2s var(--ease-out);
}
.mag .flow li:nth-child(odd) .opt { transform: rotate(-.8deg); }
.mag .flow li:nth-child(even) .opt { transform: rotate(.7deg); }
.mag .opt:hover, .mag .opt[aria-checked="true"] { background: var(--t-wash); }
.mag .opt:disabled { opacity: .4; cursor: not-allowed; }   /* D-137：「除了刚才选的」那一项 */
.mag .opt:disabled:hover { background: none; }
.mag .flow .down { width: 20px; height: 20px; margin: 2px 0; color: var(--graphite); }
.mag .loop { position: absolute; left: -16px; top: -12px; width: calc(100% + 32px); height: calc(100% + 24px); pointer-events: none; overflow: visible; }
.mag .loop path { fill: none; stroke: var(--t-ink); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 520; stroke-dashoffset: 520; animation: draw .45s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.mag .cutline { position: relative; height: 18px; margin-top: 30px; border-top: 2px dotted var(--graphite); }
.mag .cutline i { position: absolute; top: -8px; left: 0; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--t-ink); transition: left .4s var(--ease-out); }
.mag .quiz-foot { margin-top: 2px; }

/* ================= 结果 ================= */
.mag .banner { display: inline-block; margin-top: 22px; padding: 6px 18px 8px; font-size: 34px; color: var(--on-ink); background: var(--t-ink); transform: rotate(-2deg); }
.mag .rfield { position: relative; margin: 16px -16px 0; padding: 26px 16px 28px; background: var(--t-field); overflow: hidden; isolation: isolate; }
.mag .rfield::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .9;
  -webkit-mask-image: linear-gradient(to left, #000 10%, transparent 72%); mask-image: linear-gradient(to left, #000 10%, transparent 72%);
}
.mag .art { position: relative; height: 120px; margin-bottom: 8px; }
.mag .art-dot { position: absolute; border-radius: 50%; border: 2px solid var(--graphite); }
.mag .a1 { width: 110px; height: 110px; right: 6px; top: 0; background: var(--t-wash); }
.mag .a2 { width: 62px; height: 62px; right: 96px; top: 46px; background: var(--t-print); }
.mag .a3 { width: 26px; height: 26px; right: 64px; top: 14px; background: var(--graphite); }
.mag .field-kicker { font-size: 15px; font-weight: 700; }
.mag .rname { margin-top: 4px; font-size: clamp(46px, 14vw, 64px); text-shadow: var(--misreg); color: var(--graphite); }
.mag .rname.long { font-size: clamp(30px, 9.4vw, 44px); }
.mag .rtagline { margin-top: 6px; font-size: 15px; line-height: 1.5; color: var(--muted); }   /* D-113 型名下短句 */
#gr-tagline { text-wrap: balance; }   /* 10-03 总控定：两行时收到差不多长，不留一两个字的尾巴；按 id 写，皮肤换掉类也生效；不支持的浏览器忽略 */
/* 正文里的换行是分段（题库文案用 \n\n 另起一段，比如末尾的求助句），照原样显示 */
.mag .rtext { margin-top: 20px; font-size: 16px; line-height: 1.8; white-space: pre-line; }
.mag .tags { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.mag .tags li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; font-weight: 700; font-size: 15px; background-color: var(--paper); border: 1.5px solid var(--graphite); }
.mag .tags li:nth-child(odd) { transform: rotate(-1.5deg); }
.mag .tags li:nth-child(even) { transform: rotate(1.2deg); }
.mag .tags li span { background: var(--paper); padding: 0 3px; }
.mag .tags svg { width: 18px; height: 18px; color: var(--t-ink); }

.mag .meters { margin-top: 24px; padding-top: 18px; border-top: 2px dotted var(--graphite); display: grid; gap: 22px; }
.mag .meters:empty { display: none; }
.mag .meter-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mag .meter-h b { font-size: 15px; }
/* 要让人读准的数（分数）用系统字体粗体：快乐体的 6 像 b、1 像斜杠（D-066 ③） */
.mag .meter-h em { font-style: normal; font-family: var(--t-font); font-weight: 800; font-size: 24px; color: var(--t-ink); font-variant-numeric: tabular-nums; }
.mag .cells { display: grid; grid-template-columns: repeat(5, 1fr); border: 2px solid var(--graphite); margin-top: 6px; }
.mag .cell { height: 22px; border-right: 1.5px solid var(--graphite); background-color: var(--paper); }
.mag .cell:last-child { border-right: 0; }
.mag .cell.on { background-color: var(--t-wash); }
.mag .cell.part {
  background-color: var(--t-wash);
  background-image:
    linear-gradient(to right, transparent var(--p), var(--paper) var(--p)),
    radial-gradient(circle, var(--t-print) 0 26%, transparent 29%),
    radial-gradient(circle, var(--t-print) 0 26%, transparent 29%);
  background-size: 100% 100%, var(--dot) var(--dot), var(--dot) var(--dot);
  background-position: 0 0, 0 0, calc(var(--dot) / 2) calc(var(--dot) / 2);
}
.mag .segs { position: relative; display: flex; border: 2px solid var(--graphite); margin-top: 26px; }
.mag .seg { flex: 1; height: 24px; border-right: 1.5px solid var(--graphite); background-color: var(--paper); }
.mag .seg:last-child { border-right: 0; }
.mag .seg.on { background-color: var(--t-wash); }
.mag .seg-labels { position: relative; height: 18px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mag .seg-labels span { position: absolute; transform: translateX(-50%); }
.mag .seg-labels span:first-child { transform: none; }
.mag .seg-labels span:last-child { transform: translateX(-100%); }
.mag .pin { position: absolute; top: -24px; display: grid; justify-items: center; transform: translateX(-50%); color: var(--t-ink); font-weight: 700; font-size: 13px; }
.mag .pin svg { width: 16px; height: 16px; }

.mag .parts { margin-top: 24px; border-top: 2px dotted var(--graphite); }
.mag .part { padding-top: 16px; }
.mag .part b { display: block; font-size: 15px; color: var(--t-ink); margin-bottom: 4px; }
.mag .part p { font-size: 15px; line-height: 1.75; white-space: pre-line; }
.mag .crisis { margin-top: 20px; padding: 12px 14px; border: 2px solid var(--graphite); border-left-width: 6px; border-left-color: var(--t-ink); background: var(--paper); font-size: 14px; }
.mag .lockbox { margin-top: 26px; }
.mag .lockbox ul { list-style: none; }
.mag .lockbox li { font-size: 15px; line-height: 2; }
.mag .lockbox li::before { content: ""; display: inline-block; width: 10px; height: 5px; border-left: 2px solid var(--t-ink); border-bottom: 2px solid var(--t-ink); transform: rotate(-45deg); margin: 0 9px 4px 2px; vertical-align: middle; } /* 勾用 CSS 画：「✓」字符在安卓 / 微信里粗细不一，有的成彩色 emoji（30 主 10-02） */
.mag .result-actions .coupon:first-child { margin-top: 12px; }
.mag .quota { margin-top: 8px; font-size: 12px; text-align: center; color: var(--muted); }
.mag .card.qy { margin-top: 28px; background: var(--paper); border: 2px solid var(--graphite); border-radius: var(--t-radius); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.mag .card.qy .badge { background: var(--t-ink); color: var(--on-ink); border-radius: var(--t-radius-sm); }
.mag .card.qy p { color: var(--muted); }
.mag .more-links { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }

/* ---------- 头部、页脚、弹层：通用页面上改成平的杂志样式 ---------- */
body.themed .top .logo { background: var(--t-ink); color: var(--on-ink); box-shadow: none; border-radius: var(--t-radius); font-family: var(--t-font-display); font-weight: 400; }
body.themed .top .brand { font-weight: 700; }
body.mag-view .top .brand { visibility: hidden; } /* 页眉栏线里已经有站名 */
body.mag-view .top { height: 50px; }

/* 静音开关（D-019）：杂志页在页眉栏线右端；其他页（ECR、我的、元子中心）在顶栏右边 */
.snd { display: grid; place-items: center; width: 40px; height: 40px; margin: -10px -10px -12px 0; color: var(--graphite, #3D3150); background: none; border: 0; cursor: pointer; }
.snd svg { width: 22px; height: 22px; }
.snd .cross { display: none; }
.snd.off { color: var(--muted, #9D93B0); }
.snd.off .wave { display: none; }
.snd.off .cross { display: inline; }
.snd-top { margin: 0; }
body.mag-view .snd-top { display: none; }
.mag .rh-r { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mag .rh-r .snd { align-self: center; }
body.themed .icon-btn, body.themed .coin-pill { background: var(--paper); border: 1.5px solid var(--graphite); color: var(--graphite); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.themed .site-foot { color: var(--muted); border-top: 1px solid var(--stock-edge); padding-top: 10px; }
body.themed .site-foot a { color: var(--graphite); }
body.themed .sheet, body.themed .dialog { border-radius: var(--t-radius); border: 2px solid var(--graphite); }
body.themed .sheet { border-bottom: 0; border-radius: var(--t-radius) var(--t-radius) 0 0; }
body.themed .sheet h3, body.themed .dialog h3 { font-family: var(--t-font-display); font-weight: 400; }
body.themed .loading b { font-family: var(--t-font-display); font-weight: 400; font-size: 22px; }

@media (prefers-reduced-motion: reduce) {
  .mag *, .mag *::before, .mag *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* fun：重复的小元素轮流借其他分类的专色 */
[data-theme="fun"] .mag .tags li:nth-child(4n+1) svg, [data-theme="fun"] .mag .flow li:nth-child(4n+1) .down, [data-theme="fun"] .mag .doodle-a { color: var(--t-mix-1); }
[data-theme="fun"] .mag .tags li:nth-child(4n+2) svg, [data-theme="fun"] .mag .flow li:nth-child(4n+2) .down, [data-theme="fun"] .mag .doodle-b { color: var(--t-mix-2); }
[data-theme="fun"] .mag .tags li:nth-child(4n+3) svg, [data-theme="fun"] .mag .flow li:nth-child(4n+3) .down { color: var(--t-mix-3); }
[data-theme="fun"] .mag .tags li:nth-child(4n+4) svg, [data-theme="fun"] .mag .flow li:nth-child(4n+4) .down { color: var(--t-mix-4); }
[data-theme="fun"] .mag .opt[aria-checked="true"] { background: color-mix(in srgb, var(--t-mix-1) 16%, var(--paper)); }

/* 趣味题 / 自查小测封面出处行的前缀（D-089，30 主定）：脚注，安静，只加粗换墨色；字号行高随出处行，皮肤换了 #tc-src 的类也照样继承 */
.tc-src-tag { font-weight: 700; color: var(--t-ink); }
