/* 小创星盘 —— 吊牌：库房灰白棉布、黑尼龙吊牌、安全橙扎带、45° 警示条，字都装在直引号里。 */
@font-face { font-family: "XC Tag"; src: url(/fonts/tag-ui.woff2?v=6) format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "XC Cond"; src: url(/fonts/cond.woff2?v=1) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --ground: #f1f1ef;
  --ground-2: #e4e4e1;
  --ink: #0e0e0e;
  --ink-2: #3d3d3b;
  --tag: #0e0e0e;
  --on-tag: #ffffff;
  --on-tag-2: #b9b9b6;
  --rule-tag: #4a4a48;
  --orange: #ff5a1f;
  --orange-press: #e2480f;
  --display: "XC Tag", "XC Report", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --cond: "XC Cond", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --gutter: clamp(16px, 5vw, 40px);
  --tilt: -3deg;
  --tag-w: 352px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink);
  font: 15px/1.65 var(--body); overflow-x: hidden;
  /* 棉布：极淡的经纬纹 */
  background-image:
    repeating-linear-gradient(0deg, rgba(14,14,14,.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(14,14,14,.018) 0 1px, transparent 1px 3px);
}
::selection { background: var(--orange); color: var(--ink); }
/* 灰底上用黑色焦点框（橙色在灰底只有 2.8:1），黑吊牌上用橙色 */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.tag :focus-visible, .closing :focus-visible { outline-color: var(--orange); }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--on-tag); padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; }

/* 直引号：Latin 标签一律装在 "" 里 */
.q::before, .q::after { content: '"'; }
.q { font-family: var(--cond); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- 顶部条 ---------- */
.strip {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 10px; font-size: 13px;
  border-bottom: 1.5px solid var(--ink);
}
.strip .brand { text-decoration: none; }
.strip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#strip-b { text-align: right; }

main { display: block; outline: none; }
.loading { min-height: 70vh; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--ink-2); }
.loading .q { font-size: 28px; color: var(--ink); }

/* ---------- 吊牌首屏 ---------- */
.hero { position: relative; padding: 46px var(--gutter) 0; min-height: calc(100svh - 48px); display: flex; flex-direction: column; overflow-x: clip; }
.hazard {
  position: relative; margin: -22px -30% 0; height: 46px; transform: rotate(-7deg); flex: none;
  background: repeating-linear-gradient(45deg, var(--ink) 0 16px, var(--ground) 16px 32px);
  border-block: 2px solid var(--ink); z-index: 0;
}
.tagwrap { position: relative; z-index: 1; width: min(var(--tag-w), 100% - 28px); flex: none; margin: 0 auto 0 0; transform-origin: 50% 0; transform: rotate(var(--tilt)); }
/* 扎带：末端落在孔心（孔心距吊牌顶 27px），扎带头贴在旁边 */
.tie { position: absolute; left: calc(50% - 4px); top: -41px; width: 8px; height: 68px; background: var(--orange); border-radius: 4px; transform: rotate(16deg); transform-origin: 50% 100%; z-index: 3; }
.tie::after { content: ''; position: absolute; left: 7px; bottom: 6px; width: 15px; height: 12px; background: var(--orange); border-radius: 2px; }
.tag {
  position: relative; background: var(--tag); color: var(--on-tag);
  border-radius: 14px 14px 22px 22px; padding: 54px 22px 22px;
  box-shadow: 0 18px 30px -18px rgba(14,14,14,.55), 0 2px 4px rgba(14,14,14,.25);
}
.grommet { position: absolute; left: 50%; top: 16px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--ground); border: 4px solid #5d5d5a; z-index: 2; }
.stamp { font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .05em; color: var(--orange); }
.headline { font-family: var(--display); font-weight: 900;
  /* 按最长一行的字数定字号，保证每行装得下、不把最后一个字挤下去 */
  font-size: min(34px, calc((min(var(--tag-w), 100vw - 2 * var(--gutter) - 28px) - 50px) / (var(--chars, 12) + .8))); line-height: 1.32; margin: 12px 0 0; letter-spacing: -.01em; }
.headline span { display: block; }
.headline em { font-style: normal; color: var(--orange); }
.tagline { margin: 12px 0 0; color: var(--on-tag-2); font-size: 13.5px; line-height: 1.6; text-wrap: pretty; }
.plates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 20px; }
.plate {
  display: block; width: 100%; text-align: left; background: none; border: 1.5px solid var(--on-tag); color: var(--on-tag);
  padding: 7px 8px 9px; min-height: 64px; cursor: pointer; perspective: 600px; border-radius: 0;
}
.plate small { display: block; font-size: 11.5px; color: var(--on-tag-2); }
.plate b { display: block; font-family: var(--display); font-weight: 900; font-size: 19px; line-height: 1.3; }
.plate .back { display: none; font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .03em; line-height: 1.25; }
.plate[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.plate[aria-pressed="true"] small { color: var(--ink); }
.plate[aria-pressed="true"] b { display: none; }
.plate[aria-pressed="true"] .back { display: block; }
.plate.na b { color: var(--on-tag-2); font-size: 15px; }
.care-mini { margin: 18px 0 0; padding: 12px 0 0; border-top: 1px solid var(--rule-tag); list-style: none; font-size: 12.5px; line-height: 1.55; }
.care-mini li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; }
.care-mini li + li { margin-top: 6px; }
.care-mini svg { width: 20px; height: 20px; margin-top: 1px; }
.care-mini span { color: var(--on-tag-2); }
.care-mini b { color: var(--on-tag); font-weight: 600; }

.hero-foot { position: relative; z-index: 1; margin-top: auto; padding: 34px 0 28px; display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.hero-foot .q { font-size: 30px; line-height: .95; display: block; max-width: 7ch; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  background: var(--orange); color: var(--ink); border: 0; border-radius: 0; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--orange-press); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { background: var(--ground-2); color: var(--ink-2); cursor: progress; }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: transparent; border: 1.5px solid var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--on-tag); }

/* ---------- 正文 ---------- */
.body { padding: 8px var(--gutter) 40px; max-width: 680px; margin: 0 auto; }
.sec { padding: 34px 0 6px; }
.sec + .sec { border-top: 1.5px solid var(--ink); }
.sec h2 { font-family: var(--display); font-weight: 900; font-size: 24px; line-height: 1.25; margin: 0 0 16px; }
.sec h2::before, .sec h2::after { content: '"'; font-family: var(--cond); }
.lead { font-size: 15px; color: var(--ink-2); margin: -6px 0 18px; }

.words { display: flex; flex-wrap: wrap; gap: 8px; }
.word { border: 1.5px solid var(--ink); padding: 6px 12px 7px; font-family: var(--display); font-weight: 900; font-size: 17px; background: var(--ground); }
.word:first-child { background: var(--orange); border-color: var(--orange); }

.label { border: 1.5px solid var(--ink); background: #fff; padding: 16px 16px 18px; position: relative; }
.label + .label { margin-top: 12px; }
.label .k { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin-bottom: 10px; }
.label .k b { font-family: var(--display); font-weight: 900; font-size: 20px; }
.label .k span { font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .03em; white-space: nowrap; }
.label p { margin: 0; font-size: 15px; line-height: 1.75; }
.label.hot::before { content: ''; position: absolute; right: 14px; top: -10px; width: 22px; height: 12px; background: var(--orange); }

.care { display: grid; gap: 0; border: 1.5px solid var(--ink); background: #fff; }
.care-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px 14px 15px; align-items: start; }
.care-row + .care-row { border-top: 1px solid var(--ink); }
.care-row svg { width: 40px; height: 40px; }
.care-row h3 { margin: 0; font-size: 14px; font-weight: 700; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.care-row h3 span { font-family: var(--cond); font-weight: 800; font-size: 13.5px; letter-spacing: .03em; color: var(--ink-2); }
.care-row p { margin: 4px 0 0; font-size: 15px; line-height: 1.7; }

.rows { border: 1.5px solid var(--ink); background: #fff; }
.rows > div { padding: 14px 16px 15px; }
.rows > div + div { border-top: 1px solid var(--ink); }
.rows h3 { margin: 0 0 4px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 16px; font-weight: 700; }
.rows h3 span { font-family: var(--cond); font-weight: 800; font-size: 14.5px; letter-spacing: .03em; white-space: nowrap; }
.rows p { margin: 0; font-size: 15px; line-height: 1.7; }
.themes .label .k b::before, .themes .label .k b::after { content: '"'; font-family: var(--cond); }
.closing { margin: 26px 0 0; padding: 18px 16px; background: var(--ink); color: var(--on-tag); font-family: var(--display); font-weight: 900; font-size: 19px; line-height: 1.5; }

/* 规格表 */
.spec-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.wheel { width: 100%; max-width: 420px; margin: 0 auto; display: block; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1.5px solid var(--ink); }
caption { text-align: left; font-family: var(--cond); font-weight: 800; letter-spacing: .04em; font-size: 14px; padding: 0 0 6px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--ground-2); }
th { font-weight: 700; }
td.retro { font-weight: 700; white-space: nowrap; }
td.retro::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--orange); margin-right: 6px; vertical-align: 1px; }
td.num { font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
thead th { background: var(--ink); color: var(--on-tag); font-size: 12.5px; font-weight: 600; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); background: #fff; }
.facts li { padding: 9px 12px; border-bottom: 1px solid var(--ground-2); font-size: 13.5px; }
.facts li:nth-child(odd) { border-right: 1px solid var(--ground-2); }
.facts small { display: block; color: var(--ink-2); font-size: 12px; }
.facts b { font-family: var(--cond); font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.note { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }

.cta { margin-top: 30px; padding: 20px 16px; border: 1.5px dashed var(--ink); display: grid; gap: 12px; }
.cta p { margin: 0; }

/* ---------- 自助排盘表单 ---------- */
.form-tag .headline { font-size: clamp(24px, 6.8vw, 30px); }
.field { display: block; margin-top: 8px; border: 1.5px solid var(--on-tag); padding: 7px 10px 2px; }
.field:focus-within { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.field > span, .field > label > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--on-tag-2); }
.field em { font-style: normal; color: #8a8a87; }
.field input[type="text"], .field input[type="date"], .field input[type="time"] {
  width: 100%; min-height: 40px; background: transparent; color: var(--on-tag); border: 0; border-radius: 0;
  padding: 2px 0 6px; font-size: 18px; font-weight: 700; color-scheme: dark; -webkit-appearance: none; appearance: none; outline: none;
}
.field input::placeholder { color: #8a8a87; font-weight: 400; font-size: 16px; }
.field input:disabled { color: #8a8a87; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; color: var(--on-tag); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); margin: 0; }
.results { list-style: none; margin: 0 -10px; padding: 0; border-top: 1px solid var(--rule-tag); max-height: 236px; overflow-y: auto; }
.results button { display: block; width: 100%; text-align: left; background: var(--tag); color: var(--on-tag); border: 0; border-top: 1px solid var(--rule-tag); padding: 10px; min-height: 44px; cursor: pointer; }
.results button:hover, .results button:focus-visible { background: #262624; outline: none; }
.results small { color: var(--on-tag-2); margin-left: 6px; }
.results .exact { color: var(--orange); font-weight: 600; }
.results button[disabled] { color: var(--on-tag-2); cursor: default; }
.picked { margin: 2px 0 6px; font-family: var(--cond); font-weight: 800; font-size: 14px; letter-spacing: .03em; color: var(--orange); min-height: 1.4em; }
.err { margin: 14px 0 0; padding: 10px 12px; background: var(--orange); color: var(--ink); font-size: 14px; font-weight: 600; }
.form-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.form-actions .btn { width: 100%; }

/* ---------- 空状态 / 出错 ---------- */
.empty .tag p.tagline + .btn, .empty .tag .btn { margin-top: 20px; }

.foot-note { padding: 22px var(--gutter) max(28px, env(safe-area-inset-bottom)); border-top: 1.5px solid var(--ink); font-size: 13px; color: var(--ink-2); }
.foot-note p { margin: 0; }
.engine { margin-top: 4px !important; font-family: var(--cond); font-weight: 800; letter-spacing: .03em; }

/* ---------- 动效：吊牌挂上去时晃一下 ---------- */
@media (prefers-reduced-motion: no-preference) {
  .swing { animation: swing 1.25s cubic-bezier(.22, .9, .3, 1) both; }
  .swing .tie { animation: tie .45s .35s cubic-bezier(.16, 1, .3, 1) both; }
  @keyframes swing {
    0% { transform: rotate(-11deg) translateY(-14px); }
    38% { transform: rotate(1.6deg); }
    62% { transform: rotate(-4.6deg); }
    82% { transform: rotate(-2.4deg); }
    100% { transform: rotate(var(--tilt)); }
  }
  @keyframes tie { from { transform: rotate(16deg) scaleY(.6); } to { transform: rotate(16deg) scaleY(1); } }
  .plate { transition: background-color .18s ease, color .18s ease; }
}

/* ---------- 宽屏：吊牌在左边挂着，正文在右边 ---------- */
@media (min-width: 960px) {
  .page { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(0, 680px); gap: 0 56px; max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
  :root { --tag-w: 400px; }
  .hero { min-height: 0; padding: 64px 0 0; }
  .hazard { margin: -22px 0 0 -60%; }
  .body { padding: 20px 0 60px; margin: 0; }
  .spec-grid { grid-template-columns: 1fr; }
}
@media (min-width: 960px) and (min-height: 880px) {
  .hero { position: sticky; top: 0; height: calc(100vh - 50px); }
}
