/* 兑换页唯一样式：手机优先单列，账号状态统一用「会员卡」呈现；日间钴蓝，夜间纯黑底 */

:root {
    color-scheme: light;
    --bg: #f2f4f7;
    --surface: #ffffff;
    --sunken: #f6f8fa;
    --ink: #17202b;
    --muted: #5e6b7a;
    --faint: #8995a3;
    --line: #dde2e8;
    --accent: #2454d6;
    --accent-ink: #ffffff;
    --accent-soft: rgba(36, 84, 214, .08);
    --card: #17295e;
    --card-ink: #f1f5ff;
    --card-muted: #a9b8dc;
    --card-line: rgba(241, 245, 255, .14);
    --plan-on-bg: #dbe6ff;
    --plan-on-ink: #17295e;
    --ok: #18865a;
    --ok-soft: rgba(24, 134, 90, .1);
    --run: #2454d6;
    --warn: #a86400;
    --warn-soft: rgba(168, 100, 0, .1);
    --danger: #c2384b;
    --danger-soft: rgba(194, 56, 75, .09);
    --sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* 夜间用纯黑底，靠层级灰区分区块，会员卡保留钴蓝作为唯一色块 */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000;
    --surface: #101114;
    --sunken: #17191d;
    --ink: #eceff4;
    --muted: #9aa3ae;
    --faint: #6b737d;
    --line: #24272d;
    --accent: #7fa2ff;
    --accent-ink: #050812;
    --accent-soft: rgba(127, 162, 255, .13);
    --card: #15285f;
    --card-ink: #f1f5ff;
    --card-muted: #a9b8dc;
    --card-line: rgba(241, 245, 255, .13);
    --plan-on-bg: #7fa2ff;
    --plan-on-ink: #050812;
    --ok: #4cc38a;
    --ok-soft: rgba(76, 195, 138, .13);
    --run: #7fa2ff;
    --warn: #e0a040;
    --warn-soft: rgba(224, 160, 64, .13);
    --danger: #ff8095;
    --danger-soft: rgba(255, 128, 149, .12);
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.6 var(--sans);
    font-variant-numeric: tabular-nums;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; }
code { font-family: var(--mono); font-size: .92em; }

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.wrap { width: min(560px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 32px; }

/* ---------- 顶部：品牌一行 + 分段切换 ---------- */

.site-header { padding: 18px 0 12px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand-mark { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.brand-mark svg { width: 18px; height: 18px; fill: currentColor; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle { flex: none; margin-left: auto; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.site-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 14px; padding: 4px; border-radius: 12px; background: var(--surface); }
.site-nav a { padding: 8px 0; border-radius: 9px; text-align: center; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 13px; white-space: pre-line; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- 通用块 ---------- */

.sheet { background: var(--surface); border-radius: 16px; padding: 18px; }
.sheet + .sheet { margin-top: 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.lead { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.group-title { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.sheet-tight { padding: 14px; }
.cells + .group-title { margin-top: 14px; }

.input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--sunken); color: var(--ink); font: 14px/1.5 var(--sans); }
.input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.input-code { font-family: var(--mono); }
/* 等宽输入框的中文占位符会落到宋体，改回无衬线 */
.input-code::placeholder { font-family: var(--sans); color: var(--faint); }
textarea.input { min-height: 96px; resize: vertical; font-size: 13px; }

.field-msg { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.field-msg:empty { display: none; }
.field-msg.is-error { color: var(--danger); }
.field-msg.is-success { color: var(--ok); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; margin-top: 14px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn.is-loading { cursor: progress; }
.btn.is-loading::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; cursor: pointer; }
.link-btn:disabled { color: var(--faint); cursor: not-allowed; }

/* ---------- 进度与步骤：完成的变成一行小条，当前的是整块，未到的不显示 ---------- */

.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.progress-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-bar i { display: block; width: 33.4%; height: 100%; background: var(--accent); transition: width .3s ease; }
.progress[data-step="2"] .progress-bar i { width: 66.7%; }
.progress[data-step="3"] .progress-bar i { width: 100%; }

.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.step:not(.is-current):not(.is-done) { display: none; }
.step-body { display: none; }
.step.is-current .step-body { display: block; }
.step-done { display: none; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: 13.5px; }
.step.is-done .step-done { display: flex; }
.done-mark { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-size: 11px; }
.done-label { flex: none; color: var(--muted); }
.step-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px var(--mono); }
.step-edit { flex: none; margin-left: auto; }

/* ---------- 会员卡：整页唯一的重色块 ---------- */

.mcard { position: relative; margin-top: 14px; padding: 16px 18px; border-radius: 16px; background: var(--card); color: var(--card-ink); overflow: hidden; isolation: isolate; }
.mcard::after { content: ""; position: absolute; z-index: -1; right: -40px; top: -60px; width: 180px; height: 180px; border: 28px solid var(--card-line); border-radius: 50%; pointer-events: none; }
.mcard-solo { margin: 12px 0; }
.mcard-top { display: flex; align-items: center; gap: 8px; color: var(--card-muted); font-size: 13px; }
.mcard-top .plan { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--card-line); color: var(--card-ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.mcard-top .plan.is-on { background: var(--plan-on-bg); color: var(--plan-on-ink); }
.mcard-top .plan:empty { display: none; }
.mcard-mail { margin: 6px 0 14px; font-size: 16px; font-weight: 700; word-break: break-all; }
.mcard-stats { display: flex; align-items: flex-end; gap: 18px; }
.mcard-stats .stat b { display: block; font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.mcard-stats .stat:first-child b { font-size: 38px; line-height: 1; }
.mcard-stats .stat small { display: block; margin-top: 4px; color: var(--card-muted); font-size: 12px; }
.mcard-stats .stat + .stat { padding-left: 18px; border-left: 1px solid var(--card-line); }
.mcard-stats .stat.is-missing b { font-size: 16px; font-weight: 600; color: var(--card-muted); }
.mcard-empty { margin: 0; color: var(--card-muted); font-size: 13px; }
.mcard-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--card-line); color: var(--card-muted); font-size: 12.5px; }
.mcard-foot:empty { display: none; }
.mcard-foot b { margin-left: 4px; color: var(--card-ink); font-weight: 600; }

/* ---------- 信息行：dt / dd 成对平铺 ---------- */

.list { display: grid; grid-template-columns: auto minmax(0, 1fr); margin: 10px 0 0; font-size: 14px; }
.list dt, .list dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list dt { padding-right: 16px; color: var(--muted); white-space: nowrap; }
.list dd { margin: 0; text-align: right; font-weight: 600; word-break: break-all; }
.list dt:nth-last-of-type(1), .list dd:last-child { border-bottom: 0; }
.list:empty { display: none; }
.list + .list { margin-top: 14px; border-top: 1px solid var(--line); }

/* 紧凑网格：订单和账号查询的字段多，按格平铺，避免标签和值之间大段留白 */
.cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; }
.cells:empty { display: none; }
.cells > div { min-width: 0; padding: 7px 10px; border-radius: 9px; background: var(--sunken); }
.cells dt { color: var(--muted); font-size: 12px; line-height: 1.4; }
.cells dd { margin: 1px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.cells .is-missing dd { color: var(--faint); font-weight: 500; }
@media (min-width: 520px) { .cells { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 13px; cursor: pointer; }
.check input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }

.guide { margin-top: 12px; color: var(--muted); font-size: 13px; }
.guide summary { color: var(--ink); cursor: pointer; }
.guide ol { margin: 8px 0 0; padding-left: 18px; }
.guide p { margin: 6px 0 0; }

/* ---------- 兑换结果 ---------- */

.result:focus { outline: none; }
.result-status { display: flex; align-items: center; gap: 12px; }
.result-status h2 { margin: 0; }
.result-status p { margin: 0; color: var(--muted); font-size: 13.5px; }
.result-status p:empty { display: none; }
.result-mark { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--run); font-size: 22px; font-weight: 800; }
.result-mark::after { content: "…"; }
.result[data-status="success"] .result-mark { background: var(--ok-soft); color: var(--ok); }
.result[data-status="success"] .result-mark::after { content: "✓"; }
.result[data-status="failed"] .result-mark { background: var(--danger-soft); color: var(--danger); }
.result[data-status="failed"] .result-mark::after { content: "!"; }

/* ---------- 订单列表 ---------- */

.orders { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.orders:empty { display: none; }
.order { position: relative; padding: 12px 14px 12px 18px; border-radius: 12px; background: var(--surface); overflow: hidden; }
.order::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--faint); }
.order[data-status="success"]::before { background: var(--ok); }
.order[data-status="processing"]::before,
.order[data-status="unknown"]::before { background: var(--run); }
.order[data-status="failed"]::before,
.order[data-status="error"]::before { background: var(--danger); }
.order-head { display: flex; align-items: center; gap: 10px; }
.order-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 600 14px var(--mono); }
.badge { flex: none; margin-left: auto; padding: 1px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge[data-status="success"] { background: var(--ok-soft); color: var(--ok); }
.badge[data-status="processing"],
.badge[data-status="unknown"] { background: var(--accent-soft); color: var(--run); }
.badge[data-status="failed"],
.badge[data-status="error"] { background: var(--danger-soft); color: var(--danger); }
.order .cells { margin-top: 10px; }
.order-note { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.site-footer { margin-top: 24px; text-align: center; color: var(--faint); font-size: 12.5px; }
.site-footer:empty { display: none; }

@media (max-width: 380px) {
    .wrap { width: calc(100% - 24px); }
    .sheet { padding: 16px 14px; }
    .mcard-stats { gap: 14px; }
    .mcard-stats .stat + .stat { padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
