/* ==========================================================================
   步数助手 · 移动端样式（深色毛玻璃 + 主色绿 #07c160）
   纯手写 CSS，无任何外部框架/CDN/字体。
   布局：移动端优先，最大宽度 480px 居中；底部固定 Tab 栏。
   ========================================================================== */

/* ---------- 变量 ---------- */
:root {
    --green: #07c160;
    --green-dark: #059c4e;
    --green-soft: rgba(7, 193, 96, 0.14);
    --bg: #060b08;
    --bg-2: #0b120e;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.1);
    --stroke: rgba(255, 255, 255, 0.12);
    --stroke-soft: rgba(255, 255, 255, 0.07);
    --text: #eaf3ed;
    --text-dim: #9fb3a8;
    --text-faint: #6f8479;
    --danger: #ff6b6b;
    --warn: #ffbf3f;
    --radius: 16px;
    --radius-sm: 12px;
    --tabbar-h: 62px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(1100px 520px at 50% -10%, rgba(7, 193, 96, 0.16), transparent 60%),
        radial-gradient(700px 420px at 100% 100%, rgba(7, 193, 96, 0.07), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 骨架 ---------- */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 14px calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom));
    position: relative;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 2px 10px;
    background: linear-gradient(180deg, rgba(6, 11, 8, 0.92) 60%, rgba(6, 11, 8, 0));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-icon { width: 26px; height: 26px; fill: var(--green); flex: 0 0 auto; }
.brand-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: var(--glass);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { padding-top: 4px; min-height: 40vh; }

/* ---------- 卡片（毛玻璃） ---------- */
.card {
    position: relative;
    background: linear-gradient(180deg, var(--glass-strong), var(--glass));
    border: 1px solid var(--stroke-soft);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: var(--shadow);
}

.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}
.card-title .sub { font-size: 12px; color: var(--text-faint); font-weight: 400; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12px; }
.hidden { display: none !important; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 顶部用户卡 ---------- */
.user-card { display: flex; align-items: center; gap: 14px; }
.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.05);
}
.user-name { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid rgba(7, 193, 96, 0.3);
}
.badge.gray { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); border-color: var(--stroke); }
.badge.warn { background: rgba(255, 191, 63, 0.12); color: var(--warn); border-color: rgba(255, 191, 63, 0.3); }
.badge.danger { background: rgba(255, 107, 107, 0.12); color: var(--danger); border-color: rgba(255, 107, 107, 0.3); }

/* ---------- 步数按钮网格 ---------- */
.step-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.step-btn {
    appearance: none;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}
.step-btn .unit { font-size: 11px; font-weight: 400; color: var(--text-faint); margin-left: 2px; }
.step-btn:active { transform: scale(0.95); }
.step-btn.active {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green);
}
.step-btn.active .unit { color: var(--green); }

/* ---------- 表单控件 ---------- */
.field { margin-bottom: 12px; }
.label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.input, .select {
    width: 100%;
    appearance: none;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.18s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus { border-color: var(--green); }
.input[type="number"] { -moz-appearance: textfield; }
.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
    background: var(--glass-strong);
    color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--green), var(--green-dark)); color: #04140b; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--stroke); color: var(--text); }
.btn-danger { background: rgba(255, 107, 107, 0.16); border-color: rgba(255, 107, 107, 0.4); color: #ffb3b3; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* 加载态：按钮内联小圆圈 */
.spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 6px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn-primary .spinner { border-color: rgba(4, 20, 11, 0.35); border-top-color: #04140b; }

/* 开关（纯 CSS，无组件库） */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    position: relative;
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid var(--stroke);
    transition: background 0.2s ease;
    flex: 0 0 auto;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}
.switch input:checked + .track { background: var(--green); border-color: var(--green); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch .switch-text { font-size: 14px; }

/* ---------- 列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--stroke-soft);
}
.list li:last-child { border-bottom: none; }
.list .li-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list .li-title { font-size: 14px; }
.list .li-sub { font-size: 12px; color: var(--text-faint); }
.list .li-right { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.tag-ok { color: var(--green); }
.tag-bad { color: var(--danger); }

.empty {
    padding: 18px 6px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
}

/* ---------- 状态 / 提示条 ---------- */
.banner {
    margin: 2px 0 12px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--stroke);
    background: var(--glass);
    word-break: break-word;
}
.banner.error { border-color: rgba(255, 107, 107, 0.42); background: rgba(255, 107, 107, 0.1); color: #ffc0c0; }
.banner.success { border-color: rgba(7, 193, 96, 0.42); background: var(--green-soft); color: #9ff0c2; }
.banner.warn { border-color: rgba(255, 191, 63, 0.42); background: rgba(255, 191, 63, 0.1); color: #ffe0a3; }
.banner.info { color: var(--text-dim); }

.inline-error {
    margin-top: 8px;
    font-size: 13px;
    color: #ffb3b3;
    min-height: 18px;
}

/* 输入框下方的小字提示（用户名可用性检查等） */
.hint {
    margin-top: 6px;
    font-size: 12px;
    min-height: 16px;
    color: var(--text-faint);
    word-break: break-word;
}
.hint.ok { color: var(--green); }
.hint.bad { color: #ffb3b3; }
.hint.pending { color: var(--text-dim); }

/* 弹层内的表单间距收紧一点 */
.modal-box .field:last-of-type { margin-bottom: 4px; }
.modal-box .section-hint { margin-top: 4px; }

/* ---------- 二维码区 ---------- */
.qr-wrap {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.qr-box {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}
.qr-box canvas, .qr-box img { display: block; width: 200px; height: 200px; }
.qr-tip { font-size: 12px; color: var(--text-dim); text-align: center; }
.qr-raw {
    max-width: 100%;
    font-size: 11px;
    color: var(--text-faint);
    word-break: break-all;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--stroke-soft);
    border-radius: 8px;
    padding: 8px;
    max-height: 96px;
    overflow: auto;
}

/* ---------- 购买页 ---------- */
.plan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--stroke-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--glass-strong), var(--glass));
    margin-bottom: 12px;
}
.plan.best { border-color: rgba(7, 193, 96, 0.55); box-shadow: 0 0 0 1px rgba(7, 193, 96, 0.2) inset; }
.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-desc { font-size: 12px; color: var(--text-dim); }
.plan-price { font-size: 20px; font-weight: 700; color: var(--green); white-space: nowrap; }
.plan-price .unit { font-size: 12px; color: var(--text-faint); font-weight: 400; }

/* ---------- 复制行 ---------- */
.copy-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
}
.copy-row .copy-val { flex: 1 1 auto; min-width: 0; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- 折叠教程 ---------- */
details.acc {
    border: 1px solid var(--stroke-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.03);
}
details.acc summary { cursor: pointer; font-size: 14px; font-weight: 600; outline: none; }
details.acc .acc-body { margin-top: 10px; font-size: 13px; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }

/* ---------- 底部 Tab 栏 ---------- */
.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    align-items: stretch;
    z-index: 30;
    background: rgba(8, 14, 10, 0.86);
    border-top: 1px solid var(--stroke-soft);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}
.tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-faint);
    font-size: 11px;
    transition: color 0.18s ease;
}
.tab svg { width: 22px; height: 22px; fill: currentColor; }
.tab.active { color: var(--green); }

/* ---------- Toast ---------- */
.toast-root {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
    pointer-events: none;
}
.toast {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text);
    background: rgba(18, 26, 21, 0.96);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    word-break: break-word;
    animation: toast-in 0.2s ease-out;
}
.toast.success { border-color: rgba(7, 193, 96, 0.5); color: #a9f3c9; }
.toast.error { border-color: rgba(255, 107, 107, 0.5); color: #ffc3c3; }
.toast.warn { border-color: rgba(255, 191, 63, 0.5); color: #ffe2ad; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 确认弹层 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-box {
    position: relative;
    width: min(88vw, 340px);
    background: #121a15;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.modal-title { margin: 0 0 8px; font-size: 16px; }
.modal-text { margin: 0 0 16px; font-size: 13.5px; color: var(--text-dim); white-space: pre-wrap; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 细分隔线与小标题 ---------- */
.divider { height: 1px; background: var(--stroke-soft); margin: 14px 0; }
.section-hint { font-size: 12px; color: var(--text-faint); margin-top: 8px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; }
.kv .k { color: var(--text-dim); font-size: 13px; }
.loading-block { padding: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
