/* 卡战备：手机优先。
   概念：军需处的领用单。墨色顶部放一个巨大的目标数字，下方一条警示琥珀线就是「目标线」；
   结果是可逐项勾选的领用单。琥珀只表示「需要注意」：目标线、主按钮、警告。 */

:root {
  --page: #d9dfe1;
  --slip: #f6f7f5;
  --ink: #101c26;
  --muted: #56656f;
  --line: #c3ccd0;
  --hero: #101c26;
  --hero-ink: #f6f7f5;
  --hero-muted: #9fb0bb;
  --amber: #f5b800;
  --amber-ink: #101c26;
  --danger: #b3321f;
  --info-bg: #e9eef0;

  --sans: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei UI",
          "Microsoft YaHei", system-ui, sans-serif;
  --num: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "DIN Condensed",
         "Roboto Condensed", "Arial Narrow", var(--sans);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1218;
    --slip: #16212b;
    --ink: #eef1ef;
    --muted: #93a2ad;
    --line: #2a3945;
    --hero: #060b0f;
    --danger: #ff8d7a;
    --info-bg: #1c2833;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
button, input, summary { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.num, .dial, .cost { font-family: var(--num); font-variant-numeric: tabular-nums; }

.app { min-height: 100svh; display: flex; flex-direction: column; }

/* ---------- 顶部：目标数字 ---------- */
.hero { background: var(--hero); color: var(--hero-ink); padding: calc(env(safe-area-inset-top) + 18px) 0 22px; }
.inner, #status, .foot { width: min(560px, 100% - 32px); margin-inline: auto; }
.brand { margin: 0 0 22px; font-weight: 800; font-size: 1.05rem; letter-spacing: .08em; }
.ask { display: block; font-size: 1rem; color: var(--hero-muted); }

.dial {
  display: block; width: 100%; margin: 2px 0 0; padding: 0 0 4px;
  font-size: clamp(3.4rem, 19vw, 5.5rem); font-weight: 700; line-height: 1.05; letter-spacing: -.01em;
  color: var(--hero-ink); caret-color: var(--amber);
  background: transparent; border: 0; border-bottom: 4px solid var(--amber); border-radius: 0;
}
.dial::placeholder { color: #3b4c58; }
.dial:focus-visible { outline: none; border-bottom-color: var(--hero-ink); }
.dial[aria-invalid="true"] { border-bottom-color: #ff8d7a; }

.hint { margin: 8px 0 0; font-size: .85rem; color: var(--hero-muted); }
.err { margin: 8px 0 0; font-size: .95rem; font-weight: 700; color: var(--danger); }
.hero .err { color: #ff9d8c; }

.modes { margin-top: 18px; }
.modes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.modes-title { font-size: .85rem; color: var(--hero-muted); }
.modes-note { font-size: .78rem; color: #7f93a0; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 78px; width: 100%; padding: 9px 12px 11px; text-align: left;
  color: var(--hero-ink); background: #13212b; border: 1.5px solid #3b4c58; border-radius: 6px;
}
.mode:active { background: #1d2d39; }
.mode-kind { font-size: .72rem; font-weight: 700; color: var(--hero-muted); }
.mode[data-tier="top"] .mode-kind,
.mode[data-tier="limited"] .mode-kind { color: var(--amber); }
.mode-maps { font-size: .95rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.mode-zb { margin-top: auto; font-family: var(--num); font-size: 1.3rem; font-weight: 700; line-height: 1.1; }
.mode-zb small { margin-left: 1px; font-size: .78rem; font-weight: 700; }
.mode[aria-pressed="true"] { border-color: var(--amber); background: #1a2933; box-shadow: inset 0 -3px 0 var(--amber); }
.mode[aria-pressed="true"] .mode-kind { color: var(--amber); }
.mode-custom {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 48px; margin-top: 8px; padding: 0 14px;
  color: var(--hero-ink); background: transparent;
  border: 1.5px dashed #3b4c58; border-radius: 6px;
}
.mode-custom:active { background: #1d2d39; }
.mode-custom .custom-label { font-size: .9rem; font-weight: 700; }
.mode-custom .custom-hint { font-size: .78rem; color: var(--hero-muted); }
.modes-foot { margin: 8px 0 0; font-size: .78rem; line-height: 1.4; color: #7f93a0; }

.more { margin-top: 14px; }
.more summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; color: var(--hero-muted); cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before {
  content: ""; width: 7px; height: 7px; margin-right: 10px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform .15s;
}
.more[open] summary::before { transform: rotate(45deg); }
.more-body { padding: 4px 0 4px 17px; border-left: 2px solid #26363f; }
.sub { display: block; margin: 14px 0 4px; font-size: .9rem; color: var(--hero-muted); }
.line {
  width: 100%; min-height: 48px; padding: 8px 12px; font-size: 1.15rem; font-family: var(--num);
  background: transparent; color: var(--hero-ink); border: 1.5px solid #3b4c58; border-radius: 6px;
}
.line::placeholder { color: #5d7080; }
.line[aria-invalid="true"] { border-color: #ff8d7a; }

.check { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; position: relative; }
.check input { position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; }
.check .box { flex: none; width: 24px; height: 24px; border: 2px solid var(--hero-muted); border-radius: 5px; position: relative; }
.check input:checked + .box { background: var(--amber); border-color: var(--amber); }
.check input:checked + .box::after {
  content: ""; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px;
  border: solid var(--amber-ink); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.check input:focus-visible + .box { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- 结果 ---------- */
#status { flex: 1; padding: 18px 0 8px; }
.stamp { margin: 0 0 12px; font-size: .8rem; line-height: 1.45; color: var(--muted); }
.stamp b { color: var(--ink); font-weight: 700; }
.stamp p { margin: 0; }
.stamp p + p { margin-top: 2px; }

.notice { position: relative; margin: 0 0 12px; padding: 12px 14px 12px 22px; border-radius: 6px; background: var(--info-bg); }
.notice strong { display: block; }
.notice p { margin: 2px 0 0; font-size: .92rem; color: var(--muted); }
.notice::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; border-radius: 6px 0 0 6px; background: var(--muted); }
/* 警示条：琥珀斜纹，只用于会让用户买错东西的情况 */
.notice.warn::before {
  background: repeating-linear-gradient(135deg, var(--amber) 0 6px, var(--ink) 6px 12px);
}
.notice.bad::before { background: var(--danger); }

.empty { padding: 36px 4px; text-align: center; color: var(--muted); }
.working { padding: 36px 4px; text-align: center; color: var(--muted); }
.working::after {
  content: ""; display: block; width: 96px; height: 4px; margin: 14px auto 0; border-radius: 2px;
  background: linear-gradient(90deg, var(--line) 0 30%, var(--amber) 30% 60%, var(--line) 60%) 0 0 / 200% 100%;
  animation: sweep 1s linear infinite;
}
@keyframes sweep { to { background-position: -200% 0; } }

.group-title { margin: 22px 2px 8px; font-size: .95rem; font-weight: 700; color: var(--ink); }

/* 领用单 */
.slip { position: relative; margin: 0 0 12px; background: var(--slip); border-radius: 8px; }
.slip-top { padding: 16px 16px 14px; }
.badge { display: inline-block; margin-bottom: 6px; padding: 2px 8px; font-size: .8rem; font-weight: 800; background: var(--amber); color: var(--amber-ink); border-radius: 3px; }
.cost-line { display: flex; align-items: baseline; gap: 8px; }
.cost { font-size: 2.9rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.cost-unit { font-size: .95rem; color: var(--muted); }
.fit { margin: 8px 0 0; color: var(--muted); }
.fit b { color: var(--ink); }
.fit .num { font-weight: 700; color: var(--ink); }

.tear { position: relative; height: 0; margin: 0; border-top: 2px dashed var(--line); }
.tear::before, .tear::after {
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--page);
}
.tear::before { left: -10px; }
.tear::after { right: -10px; }

.items { list-style: none; margin: 0; padding: 6px 0; }
.item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 0 12px; align-items: start;
  width: 100%; min-height: 56px; padding: 10px 16px; text-align: left;
  background: none; border: 0;
}
.item[data-depth="1"] { margin-left: 22px; width: calc(100% - 22px); padding-left: 14px; border-left: 2px solid var(--line); min-height: 50px; }
.tick { grid-row: 1 / span 2; width: 24px; height: 24px; margin-top: 2px; border: 2px solid var(--muted); border-radius: 5px; position: relative; }
.item[aria-checked="true"] .tick { background: var(--amber); border-color: var(--amber); animation: pop .16s ease-out; }
.item[aria-checked="true"] .tick::after {
  content: ""; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px;
  border: solid var(--amber-ink); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
@keyframes pop { 50% { transform: scale(1.18); } }
.item .what { min-width: 0; }
.item .slot { display: block; font-size: .8rem; color: var(--muted); line-height: 1.3; }
.item .name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.item[data-depth="1"] .name { font-weight: 500; }
.item .power { display: block; font-size: .8rem; color: var(--muted); font-family: var(--num); }
.item .power.neg { color: var(--danger); }
.item .price { font-size: 1.1rem; font-weight: 700; white-space: nowrap; align-self: center; grid-row: 1 / span 2; grid-column: 3; }
.item[aria-checked="true"] .name,
.item[aria-checked="true"] .price { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.slip-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 14px; }
.left { font-size: .95rem; color: var(--muted); }
.left .num { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.copy {
  min-height: 44px; padding: 0 16px; font-weight: 700; background: none;
  border: 1.5px solid var(--ink); border-radius: 6px;
}
.copy:active { background: var(--info-bg); }

/* 其他方案：折叠成一行 */
details.slip > summary { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; min-height: 64px; padding: 12px 16px; cursor: pointer; }
details.slip > summary::-webkit-details-marker { display: none; }
.sum-cost { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.sum-note { text-align: right; font-size: .85rem; color: var(--muted); line-height: 1.35; }
.sum-note b { color: var(--ink); }
.sum-name { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ---------- 底部 ---------- */
.foot { padding: 14px 0 20px; font-size: .78rem; color: var(--muted); }
.foot p { margin: 2px 0; }

.bar {
  position: sticky; bottom: 0; z-index: 5; padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--page); border-top: 1px solid var(--line);
}
.go {
  display: block; width: min(560px, 100%); min-height: 56px; margin: 0 auto;
  font-size: 1.1rem; font-weight: 800; letter-spacing: .03em;
  color: var(--amber-ink); background: var(--amber); border: 0; border-radius: 8px;
}
.go:active { filter: brightness(.94); }
.go[disabled] { opacity: .65; cursor: progress; }

@media (min-width: 700px) {
  .hero { padding-bottom: 30px; }
  .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slip-top { padding: 20px; }
  .item { padding-inline: 20px; }
  .slip-foot { padding-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 复制兜底用的离屏文本框 */
.sr-copy { position: fixed; left: -9999px; top: 0; opacity: 0; }
