* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 任何带 hidden 属性的元素都必须真的隐藏：
   否则像 .manual{display:flex} / .card.gate{display:grid} 这类规则会盖掉 hidden */
[hidden] { display: none !important; }

:root {
  --bg: #0d1512;
  --card: #15201b;
  --card-2: #1b2922;
  --line: #26382f;
  --text: #e8f3ec;
  --muted: #8aa398;
  --green: #22c55e;
  --green-d: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
}
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #17291f 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 10px; max-width: 560px; margin: 0 auto;
}
h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }
h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
main { max-width: 560px; margin: 0 auto; padding: 0 14px 40px; }

.chip {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 10px; background: rgba(255,255,255,.02);
}
.chip.warn { color: var(--amber); border-color: #4a3a12; background: rgba(245,158,11,.10); font-weight: 700; }
.chip.strong { color: var(--green); border-color: #1d4a31; background: rgba(34,197,94,.12); font-weight: 700; }
.chip.strong .n { font-size: 16px; font-variant-numeric: tabular-nums; }

/* 右上角：剩余次数 + 更换卡密 */
.head-actions { display: flex; align-items: center; gap: 8px; }
.head-actions .btn.small { padding: 8px 12px; font-size: 12.5px; }
#exhaustedHint { color: var(--amber); font-weight: 600; }

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; margin: 12px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: none; border-radius: 14px;
  padding: 14px 16px; font-size: 15px; font-weight: 600;
  color: var(--text); background: #223029; cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--green) 0%, var(--green-d) 100%); color: #04140a; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.start { background: linear-gradient(180deg, #34d399 0%, #059669 100%); color: #03150c; font-size: 17px; padding: 16px; margin-top: 6px; }

.scan-actions { display: grid; gap: 10px; }
.manual { display: flex; gap: 8px; margin-top: 12px; }
.manual input {
  flex: 1; min-width: 0; border-radius: 12px; border: 1px solid var(--line);
  background: #101a15; color: var(--text); padding: 12px 14px; font-size: 15px;
}
.manual .btn { width: auto; padding: 12px 18px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.hint:empty { display: none; }

video { width: 100%; border-radius: 14px; margin-top: 12px; background: #000; }

.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dev-name { font-size: 18px; font-weight: 700; }
.dev-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); white-space: nowrap;
}
.badge.ok { color: var(--green); border-color: #1d4a31; background: rgba(34,197,94,.08); }
.badge.busy { color: var(--amber); border-color: #4a3a12; background: rgba(245,158,11,.08); }
.badge.bad { color: var(--red); border-color: #4a1d1d; background: rgba(239,68,68,.08); }

.gates { list-style: none; margin: 12px 0 4px; padding: 0; display: grid; gap: 6px; }
.gates li { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.gates li .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.gates li.bad .dot { background: var(--red); }
.gates li.bad { color: #fecaca; }

.price-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-top: 1px dashed var(--line); font-size: 14px;
}
.price-row span { color: var(--muted); }
.accent { color: var(--green); }

.run-head { display: flex; align-items: center; gap: 12px; }
.run-title { font-weight: 700; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; color: var(--green); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }

.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-list li {
  display: block;
  font-size: 13px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.025); border: 1px solid var(--line);
}
.order-main { display: flex; justify-content: space-between; gap: 10px; }
.order-err { margin-top: 6px; color: var(--amber); font-size: 12px; line-height: 1.5; }
.order-actions { margin-top: 8px; }
.mini-link {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; cursor: pointer;
}
.mini-link:active { background: rgba(255,255,255,.06); }
.order-list .muted, .muted { color: var(--muted); }
.st { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.st.running, .st.starting { color: var(--green); }
.st.unknown { color: var(--amber); }
.st.failed { color: var(--red); }
.st.settled { color: var(--muted); }

.mask {
  position: fixed; inset: 0; background: rgba(3,8,6,.72);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; z-index: 50; backdrop-filter: blur(3px);
}
.mask[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 480px; background: var(--card-2);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; display: grid; gap: 12px;
}
.sheet h3 { margin: 0; font-size: 17px; }
#confirmText { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.sheet-emblem {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
  color: var(--green); background: rgba(34,197,94,.12); border: 1px solid #1d4a31;
}
.sheet-emblem[hidden] { display: none; }
.sheet input {
  border-radius: 12px; border: 1px solid var(--line); background: #101a15;
  color: var(--text); padding: 12px 14px; font-size: 15px;
}
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions .btn:only-child { grid-column: 1 / -1; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #0b1a12; border: 1px solid var(--line); color: var(--text);
  padding: 12px 16px; border-radius: 14px; font-size: 14px; z-index: 60;
  max-width: 90vw; box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
.toast.err { border-color: #5b2222; color: #fecaca; }
.toast.ok { border-color: #1d4a31; color: #bbf7d0; }

/* 洗车中控制面板 */
.ctrl-panel { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.ctrl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ctrl-btn {
  border: 1px solid var(--line); background: #1d2c24; color: var(--text);
  border-radius: 14px; padding: 16px 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform .06s ease, filter .15s ease;
}
.ctrl-btn:active { transform: scale(.97); }
.ctrl-btn:disabled { opacity: .5; cursor: wait; }
.ctrl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.ctrl-btn.pause { border-color: #4a3a12; color: var(--amber); }
.ctrl-btn.settle { background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%); color: #1a1206; border: none; }
.ctrl-actions .ctrl-btn:only-child { grid-column: 1 / -1; }

/* 确认弹窗里的指定账号 */
.pin-row { display: grid; gap: 8px; }
.pin-row input[type="text"], .pin-row input:not([type]) {
  border-radius: 12px; border: 1px solid var(--line); background: #101a15;
  color: var(--text); padding: 12px 14px; font-size: 15px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.check input { width: 16px; height: 16px; }

/* 卡密门 + 手机号条 */
.card.gate { display: grid; gap: 12px; }
.card.gate h2 { margin: 0; font-size: 16px; color: var(--text); }
.card.gate input {
  border-radius: 12px; border: 1px solid var(--line); background: #101a15;
  color: var(--text); padding: 14px; font-size: 17px; letter-spacing: 1px; text-align: center;
}
.phone-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phone-label { font-size: 12px; color: var(--muted); }
.phone-value { font-size: 20px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.btn.small { width: auto; padding: 10px 14px; font-size: 13px; border-radius: 10px; }

/* 卡密说明 */
.card.notice { padding: 12px 16px; }
.notice-text { margin: 0; font-size: 13px; line-height: 1.8; color: var(--muted); }
.notice-text + .notice-text { margin-top: 8px; }
.notice-text .hl { color: var(--amber); font-weight: 700; }
.notice-text b { font-size: 15px; }
.notice-steps {
  counter-reset: nstep; list-style: none; margin: 6px 0 0; padding: 0;
  display: grid; gap: 4px; font-size: 13px; line-height: 1.8; color: var(--muted);
}
.notice-steps li { counter-increment: nstep; padding-left: 20px; position: relative; }
.notice-steps li::before { content: counter(nstep) "、"; position: absolute; left: 0; top: 0; color: var(--muted); }
.notice-steps .hl { color: var(--amber); font-weight: 700; }
.notice-expiry { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.notice-expiry.warn { color: var(--amber); font-weight: 700; }

/* 车牌 */
.plate-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.plate-value { font-weight: 700; letter-spacing: 1px; font-size: 14px; }
.sheet input {
  width: 100%; margin: 10px 0 4px; border-radius: 12px;
  border: 1px solid var(--line); background: #101a15; color: var(--text);
  padding: 12px; font-size: 17px; text-align: center; letter-spacing: 2px; text-transform: uppercase;
}

/* 停车券 */
.voucher-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.voucher-tip-title { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.voucher-tips {
  counter-reset: vtip; list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; gap: 10px; font-size: 13px; color: var(--muted); line-height: 1.85;
}
.voucher-tips li { counter-increment: vtip; padding-left: 24px; position: relative; }
.voucher-tips li::before {
  content: counter(vtip);
  position: absolute; left: 0; top: 4px;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--amber);
  background: rgba(245,158,11,.12); border: 1px solid #4a3a12;
}
.voucher-tips .hl { color: var(--amber); font-weight: 700; }
.voucher-foot { margin-top: 12px; }
.voucher-result { margin-top: 12px; }
.voucher-qr { display: grid; justify-items: center; gap: 8px; }
.voucher-qr img { width: 200px; height: 200px; border-radius: 12px; background: #fff; padding: 8px; }
.voucher-none {
  color: var(--text); font-size: 13.5px; line-height: 1.6; font-weight: 600;
  margin: 4px 0 0; padding: 10px 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-left: 3px solid var(--green); border-radius: 12px;
}
