/* 朋友问卷页、结果页共用的样式：纸张 + 积木 */
:root {
  --paper: #f6efe2; --paper-2: #efe5d2; --card: #fffaf1;
  --ink: #2b2622; --ink-soft: #6d635a; --line: #e2d6bf;
  --tomato: #e4572e; --mustard: #f3a712; --teal: #2a9d8f; --sky: #4f7fd9; --rose: #e9859a; --leaf: #7bab52;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 90% -10%, #fbe3c2 0%, transparent 60%),
    radial-gradient(700px 420px at -10% 110%, #e6efe0 0%, transparent 55%),
    var(--paper);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.2 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 22px 16px 60px; }
.wrap.wide { max-width: 880px; }

.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand a { font-family: var(--serif); font-weight: 900; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand a span { color: var(--tomato); }
.logo { width: 24px; height: 24px; display: inline-block; vertical-align: -4px; margin-right: 6px; }

.card {
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px;
  box-shadow: 6px 6px 0 var(--ink); padding: 26px 22px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 900; margin: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--ink); border-radius: 8px; cursor: pointer; text-decoration: none;
  font: 600 15px var(--sans); padding: 12px 20px; color: var(--ink); background: var(--mustard);
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; white-space: nowrap;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn.primary { background: var(--tomato); color: #fff; }
.btn.ghost { background: #fff; }
.btn.full { width: 100%; }
[hidden] { display: none !important; }
.link { background: none; border: none; font: inherit; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
.link:hover { color: var(--tomato); }

/* 选项 / 关键词：像一块块积木 */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  position: relative; border: 1.5px solid var(--ink); border-radius: 7px; background: #fff;
  padding: 10px 15px; font: 500 15px var(--sans); color: var(--ink); cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .1s, background .15s, box-shadow .1s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
/* 选中后变成一块拼图：上面和右边各有一个凸起 */
.chip.on { color: #fff; border-color: transparent; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); animation: pick .3s ease; margin-right: 6px; }
.chip.on::before, .chip.on::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: inherit; }
.chip.on::before { top: -7px; left: calc(50% - 7px); }
.chip.on::after { right: -7px; top: calc(50% - 7px); }
@keyframes pick { 50% { transform: translateY(-4px) scale(1.04); } }
.chip:disabled { opacity: .35; cursor: not-allowed; }

textarea, input[type=text] {
  width: 100%; border: 1.5px solid var(--ink); border-radius: 8px; background: #fff; color: var(--ink);
  padding: 12px 14px; font: 15.5px/1.7 var(--sans); outline: none; resize: none;
}
textarea:focus, input[type=text]:focus { box-shadow: 0 0 0 3px #f9d48a; }
.count { text-align: right; font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

/* 积木掉落 */
.block {
  border-radius: 6px; color: #fff; position: relative; box-shadow: inset 0 -5px 0 rgba(0,0,0,.14);
  display: flex; align-items: center; justify-content: center; font-weight: 600; letter-spacing: .04em;
}
.block::before, .block::after { content: ""; position: absolute; top: -6px; width: 14px; height: 7px; border-radius: 3px 3px 0 0; background: inherit; }
.block::before { left: 18%; } .block::after { right: 18%; }
.drop { animation: drop .8s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes drop { 0% { transform: translateY(-300px) rotate(-8deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.fade-up { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50;
  transition: all .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.spinner { display: inline-flex; gap: 6px; }
.spinner span { width: 10px; height: 10px; border-radius: 2px; animation: hop 1s infinite ease-in-out; }
.spinner span:nth-child(1) { background: var(--tomato); }
.spinner span:nth-child(2) { background: var(--mustard); animation-delay: .15s; }
.spinner span:nth-child(3) { background: var(--teal); animation-delay: .3s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

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

/* ---------- 拼图板 ---------- */
.puzzle { width: 100%; height: auto; display: block; overflow: visible; }
.pz path { stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.pz text { fill: #fff; font-family: var(--sans); font-weight: 700; pointer-events: none; }
.pz text.pz-sub { font-weight: 400; opacity: .85; }
.pz-empty path { stroke: #cdbfa6; stroke-dasharray: 6 6; stroke-width: 1.8; fill: rgba(255,255,255,.35); }
.pz-empty text { fill: #b8aa90; font-weight: 500; }
.pz-star path { stroke-width: 3.2; }
.pz { transform-box: fill-box; transform-origin: center; animation: snap .9s cubic-bezier(.2,1.25,.4,1) both; }
.pz-empty { animation: fadeIn .6s ease both; }
@keyframes snap {
  0% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- 拼图人格卡 ---------- */
.type-card { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: center; }
.type-img { aspect-ratio: 3 / 4; border: 1.5px solid var(--ink); border-radius: 12px; overflow: hidden; position: relative; background: var(--paper-2); }
.type-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.type-img .ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; font-family: var(--serif); font-weight: 900; font-size: 26px; text-align: center; padding: 14px; }
.type-img .ph small { font: 400 11px var(--sans); opacity: .85; letter-spacing: .1em; }
.type-name { font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1.2; margin: 6px 0 8px; }
.type-tag { font-family: var(--serif); font-size: 17px; line-height: 1.6; margin: 0 0 12px; }
.type-desc { font-size: 14.5px; line-height: 1.85; color: #4a423b; margin: 0 0 10px; }
.type-gift { font-size: 13.5px; color: var(--ink-soft); }
.shares { display: flex; height: 12px; border-radius: 6px; overflow: hidden; border: 1.5px solid var(--ink); margin: 14px 0 6px; }
.shares i { display: block; height: 100%; }
.shares-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-soft); }
.shares-legend b { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
@media (max-width: 560px) {
  .type-card { grid-template-columns: 1fr; }
  .type-img { max-width: 240px; margin: 0 auto; width: 100%; }
  .type-name { font-size: 28px; }
}

/* ---------- 中英切换 ---------- */
.brand-right { display: flex; align-items: center; gap: 12px; }
.lang-toggle {
  border: 1.5px solid var(--ink); border-radius: 999px; background: #fff; color: var(--ink);
  font: 600 12.5px var(--sans); padding: 5px 12px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.lang-toggle:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
html[lang="en"] .q, html[lang="en"] h1, html[lang="en"] h2 { letter-spacing: -0.01em; }
html[lang="en"] .note q { quotes: "\201C" "\201D"; }
