/* 店员核销页：白底 + 品牌蓝 #2563EB + 圆角 14，跟 App 同一套克制的口味。
   颜色对比度（WCAG AA ≥ 4.5）已逐对核过，见 README 的对照表。 */
:root {
  --bg: #FFFFFF;
  --text: #0A0A0A;
  --text-2: #5C6370;        /* 白底 6.0:1 */
  --field: #F2F3F5;         /* 输入框底，同 App 的灰底输入 */
  --hairline: #E6E8EB;
  --blue: #2563EB;          /* 白字 5.2:1 */
  --blue-press: #1D4ED8;
  --avatar-bg: #E8EEFD;
  --ok: #15803D;            /* 白字 5.0:1 */
  --bad: #B91C1C;           /* 白字 6.5:1 */
  --neutral: #F2F3F5;
  --neutral-text: #3F4652;  /* 灰底 8.9:1 */
  --error-text: #B91C1C;    /* 白底 6.5:1 */
  --focus: #2563EB;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101010;
    --text: #F3F5F7;
    --text-2: #A1A7B0;      /* 深底 7.6:1 */
    --field: #1E1E1E;
    --hairline: #2A2A2A;
    --blue: #2563EB;
    --blue-press: #3B82F6;
    --avatar-bg: #1C2A4A;
    --ok: #15803D;
    --bad: #B91C1C;
    --neutral: #1E1E1E;
    --neutral-text: #D5D9DF;
    --error-text: #F87171;  /* 深底 6.9:1 */
    --focus: #60A5FA;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}
.wordmark { height: 26px; width: auto; display: block; }
.top-label { font-size: 13px; font-weight: 500; color: var(--text-2); }

/* ---------- 状态色块 ---------- */
.status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--neutral);
  color: var(--neutral-text);
  transition: background-color .2s ease, color .2s ease;
}
.status[data-tone="ok"] { background: var(--ok); color: #FFFFFF; }
.status[data-tone="bad"] { background: var(--bad); color: #FFFFFF; }
.status-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
}
.status[data-tone="neutral"] .status-icon { background: transparent; }
.status-icon svg { width: 26px; height: 26px; display: block; }
.status-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.status-detail { margin: 4px 0 0; font-size: 15px; line-height: 1.4; }
.status[data-tone="ok"] .status-detail,
.status[data-tone="bad"] .status-detail { color: #FFFFFF; }
.status.is-big { flex-direction: column; text-align: center; gap: 12px; padding: 32px 20px 28px; }
.status.is-big .status-icon { width: 64px; height: 64px; }
.status.is-big .status-icon svg { width: 36px; height: 36px; }
.status.is-big .status-title { font-size: 30px; }
.status.is-big .status-detail { font-size: 16px; font-weight: 500; }
.status:focus { outline: none; }
.status:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid currentColor;
  border-right-color: transparent;
  opacity: .7;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .status { transition: none; }
}

/* ---------- 券卡 ---------- */
.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 18px 6px;
}
.winner { display: flex; align-items: center; gap: 12px; }
.avatar {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: #1D4ED8;           /* 浅蓝底 5.9:1 */
  display: grid;
  place-items: center;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) { .avatar { color: #93B4FB; } }
.avatar-initial { font-size: 20px; font-weight: 600; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.winner-text { min-width: 0; }
.winner-name, .winner-handle { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-name { font-size: 17px; font-weight: 600; }
.winner-handle { font-size: 15px; color: var(--text-2); }

.prize-label { margin: 18px 0 2px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.prize { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }

.meta { margin: 14px 0 0; }
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  font-size: 15px;
}
.meta-row dt { color: var(--text-2); flex: none; }
.meta-row dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-title { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.form-hint { margin: -6px 0 2px; font-size: 15px; color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 17px; /* ≥16 防 iOS 聚焦自动放大 */
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--text-2); opacity: .7; }
.input[aria-invalid="true"] { border-color: var(--error-text); }
.input-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg);
  pointer-events: none;
}
.select-wrap .input { padding-right: 44px; }
.store-fixed {
  margin: 0;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.field-error { margin: -4px 0 0; font-size: 14px; font-weight: 500; color: var(--error-text); }

.btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--blue); color: #FFFFFF; margin-top: 4px; }
.btn-primary:active { background: var(--blue-press); }
.btn-primary:disabled { background: var(--field); color: var(--text-2); cursor: not-allowed; }
.btn-secondary { background: var(--field); color: var(--text); }
.lock-note { margin: 0; text-align: center; font-size: 14px; color: var(--text-2); }

/* 焦点永远可见 */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.input:focus-visible { outline-offset: 0; }

.foot { margin-top: auto; padding-top: 12px; text-align: center; }
.foot-link {
  display: inline-block;
  padding: 10px 8px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
}
@media (prefers-color-scheme: dark) { .foot-link { color: #60A5FA; } }
.foot-note { margin: 2px 0 0; font-size: 12px; color: var(--text-2); }

@media (min-width: 600px) {
  .page { padding-top: 40px; }
}
