/* 雾面精密 · Apple-inspired mobile-first UI */
:root {
    --brand: #087cff;
    --brand-dark: #0066d6;
    --brand-soft: #eaf4ff;
    --ink: #111827;
    --text: #344054;
    --muted: #667085;
    --faint: #98a2b3;
    --line: rgba(16,24,40,.10);
    --line-strong: rgba(16,24,40,.16);
    --surface: rgba(255,255,255,.84);
    --surface-solid: #fff;
    --bg: #f4f7fb;
    --danger: #e5484d;
    --warning-bg: #fff9eb;
    --warning-text: #9a6700;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow-soft: 0 16px 50px rgba(31,45,61,.08), 0 2px 8px rgba(31,45,61,.04);
    --shadow-float: 0 24px 70px rgba(20,33,51,.18);
    --ring: 0 0 0 4px rgba(8,124,255,.13);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
body {
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
.page { width: min(100%, 720px); margin: 0 auto; padding: 28px 22px 56px; }

/* Phone identity and history */
.identity-card { max-width: 620px; margin: 8vh auto 0; }
.identity-panel {
    padding: 40px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.92);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    animation: panelIn .46s cubic-bezier(.2,.8,.2,1) both;
}
.identity-panel h1,
.identity-heading { margin: 0 0 22px; color: var(--ink); font-size: 22px; font-weight: 700; line-height: 1.35; letter-spacing: -.02em; }
.identity-panel .field-plain { margin-bottom: 14px; }
.text-back { margin: -8px 0 18px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 13px; }
.text-back:hover { color: var(--brand); }
.history-list { display: grid; gap: 10px; margin: 0 0 18px; }
.history-item {
    width: 100%; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 15px 16px; text-align: left; color: var(--ink); background: rgba(255,255,255,.72);
    border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.history-item:hover { transform: translateY(-2px); border-color: rgba(8,124,255,.28); background: #fff; box-shadow: 0 10px 30px rgba(31,45,61,.07); }
.history-item span { min-width: 0; }
.history-item b, .history-item small { display: block; }
.history-item b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.history-item small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.history-item em { flex: 0 0 auto; color: var(--brand); font-size: 13px; font-style: normal; font-weight: 650; }

/* Progress */
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 26px 28px 22px;
    margin: 0 0 28px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.92);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}
.step { position: relative; min-width: 0; text-align: center; }
.step::after {
    content: "";
    position: absolute;
    z-index: 0;
    top: 21px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #d8dee8;
    transition: background .45s ease;
}
.step:last-child::after { display: none; }
.step .dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 9px;
    border: 1.5px solid #d7dde6;
    border-radius: 50%;
    background: rgba(255,255,255,.96);
    color: var(--faint);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(31,45,61,.05);
    transition: color .35s ease, background .35s ease, border-color .35s ease, box-shadow .35s ease, transform .35s cubic-bezier(.2,.8,.2,1);
}
.step em {
    display: block;
    overflow: hidden;
    color: var(--faint);
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .35s ease;
}
.step.active .dot {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: 0 0 0 5px rgba(8,124,255,.12), 0 8px 22px rgba(8,124,255,.22);
    transform: translateY(-1px);
}
.step.active em { color: var(--brand); }
.step.done .dot { color: #fff; background: var(--brand); border-color: var(--brand); }
.step.done em { color: var(--muted); }
.step.done::after { background: var(--brand); }

/* Main surfaces */
.card { position: relative; min-height: 220px; }
.panel { animation: panelIn .46s cubic-bezier(.2,.8,.2,1) both; }
#panel-1, #panel-3 {
    padding: 34px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.92);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(125%);
    -webkit-backdrop-filter: blur(22px) saturate(125%);
}
.panel-title {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: clamp(26px, 5vw, 34px);
    font-weight: 730;
    letter-spacing: -.035em;
    line-height: 1.22;
}
.tip { max-width: 620px; margin-bottom: 24px; color: var(--muted); font-size: 15px; line-height: 1.75; }

/* Fields */
.field { margin-bottom: 26px; }
.field > label {
    display: block;
    margin-bottom: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 680;
    letter-spacing: -.01em;
}
.field .req { margin-left: 2px; color: var(--danger); }
.field-hint { margin: -4px 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
input[type=text], input[type=number], input[type=email], input[type=tel],
input[type=date], input[type=time], input[type=datetime-local], select, textarea {
    width: 100%;
    min-height: 54px;
    padding: 14px 16px;
    color: var(--ink);
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(16,24,40,.14);
    border-radius: var(--radius-md);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 1px 2px rgba(16,24,40,.02);
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
input::placeholder, textarea::placeholder { color: #a4adbb; }
input:hover, select:hover, textarea:hover { border-color: rgba(16,24,40,.26); background: #fff; }
input:focus, select:focus, textarea:focus {
    border-color: rgba(8,124,255,.72);
    background: #fff;
    box-shadow: var(--ring), 0 10px 24px rgba(31,45,61,.06);
}
input:disabled, select:disabled, textarea:disabled { color: var(--faint); background: rgba(242,244,247,.82); cursor: not-allowed; opacity: 1; }
input[type=date], input[type=time], input[type=datetime-local] { color-scheme: light; }
textarea { min-height: 124px; resize: vertical; line-height: 1.75; }
.textarea-box { position: relative; }
.textarea-box textarea { padding-bottom: 38px; }
.example-link {
    position: absolute;
    right: 14px;
    bottom: 12px;
    z-index: 1;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.example-link:hover { opacity: .85; }

.upload-field { display: grid; gap: 8px; }
.upload-field .upload-input {
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    color: var(--muted);
    border: 1.5px dashed rgba(8,124,255,.25);
    border-radius: var(--radius-md);
    background: rgba(247,250,255,.88);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.upload-field .upload-input:hover { border-color: rgba(8,124,255,.48); background: #f4f9ff; }
.upload-field .upload-input:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.upload-field .upload-input::file-selector-button {
    margin-right: 12px;
    padding: 9px 13px;
    color: var(--brand-dark);
    background: #fff;
    border: 1px solid rgba(8,124,255,.18);
    border-radius: 10px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(31,45,61,.05);
}
.upload-field .upload-input:disabled { opacity: .6; cursor: wait; }
.upload-hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.upload-status { min-height: 18px; color: var(--brand); font-size: 12.5px; font-weight: 600; }
.upload-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-preview.hidden { display: none; }
.upload-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.upload-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.upload-name, .upload-file-link { font-size: 13px; color: var(--brand); word-break: break-all; }
.upload-err { margin: 0; padding: 0; min-height: 0; }
.upload-err:not(:empty) { margin-top: 4px; padding: 8px 10px; min-height: auto; }
#confirmText {
    min-height: 480px;
    padding: 28px;
    color: #172033;
    background: rgba(255,255,255,.88);
    border-color: rgba(255,255,255,.96);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    font-size: 16px;
    line-height: 1.9;
    caret-color: var(--brand);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    scrollbar-width: none;
}
#confirmText::-webkit-scrollbar { display: none; }
.select-wrap { position: relative; }
.select-wrap::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
select { padding-right: 44px; cursor: pointer; }
.opt-group { display: flex; flex-wrap: wrap; gap: 10px; }
.display-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.display-mode-options .opt-item { min-height: 58px; justify-content: center; text-align: center; }
.module-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-options .module-option { justify-content: flex-start; min-width: 0; }
.module-options.is-disabled { display: block; min-height: 54px; padding: 15px 16px; color: var(--faint); background: rgba(242,244,247,.72); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); }
.module-empty { font-size: 13px; }
.field .opt-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    padding: 11px 16px;
    color: var(--text);
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(16,24,40,.12);
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    user-select: none;
    box-shadow: 0 2px 8px rgba(31,45,61,.035);
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.field .opt-item:hover { transform: translateY(-1px); border-color: rgba(8,124,255,.34); background: #fff; box-shadow: 0 8px 20px rgba(31,45,61,.07); }
.field .opt-item:active { transform: scale(.985); }
.field .opt-item input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.field .opt-item::before {
    content: "";
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    border: 1.5px solid #b7c0cd;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 4px #fff;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.field .opt-item:has(input[type=checkbox])::before { border-radius: 6px; box-shadow: none; }
.field .opt-item:has(input:checked) {
    color: var(--brand-dark);
    background: linear-gradient(180deg, #f5faff 0%, #edf6ff 100%);
    border-color: rgba(8,124,255,.46);
    box-shadow: 0 0 0 3px rgba(8,124,255,.08), 0 8px 22px rgba(8,124,255,.08);
}
.field .opt-item:has(input[type=radio]:checked)::before { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 4px #fff; }
.field .opt-item:has(input[type=checkbox]:checked)::before {
    border-color: var(--brand);
    background-color: var(--brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10 3 3 7-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 17px;
}
.field .opt-item:has(input:focus-visible) { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field .opt-item:has(input:disabled) { opacity: .52; cursor: not-allowed; transform: none; }

.module-field-group {
    margin-top: 18px;
    padding: 24px 22px 2px;
    background: rgba(248,251,255,.76);
    border: 1px solid rgba(8,124,255,.12);
    border-radius: 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
    animation: panelIn .32s cubic-bezier(.2,.8,.2,1) both;
}
.module-field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.module-field-head h3 { color: var(--ink); font-size: 17px; font-weight: 720; letter-spacing: -.02em; }
.module-field-head span { padding: 4px 9px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; font-size: 11px; font-weight: 700; }
.module-field-group .field:last-child { margin-bottom: 20px; }

/* Buttons */
.btn {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--ink);
    font-size: 15px;
    font-weight: 680;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .16s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { color: #fff; background: var(--brand); box-shadow: 0 10px 26px rgba(8,124,255,.22); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 14px 30px rgba(8,124,255,.26); }
.btn-primary:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }
.btn-ghost { color: var(--ink); background: rgba(255,255,255,.72); border-color: var(--line); }
.btn-ghost:hover { background: #fff; border-color: var(--line-strong); }
.btn-lg { width: 100%; }
.btn-row { display: flex; gap: 12px; margin-top: 22px; }
.btn-row .btn { flex: 1; }

/* Messages */
.err-box { min-height: 0; margin-top: 11px; color: var(--danger); font-size: 13px; white-space: pre-line; }
.warn { display: none; margin-bottom: 16px; padding: 12px 14px; color: var(--warning-text); background: var(--warning-bg); border: 1px solid #f2dfad; border-radius: var(--radius-sm); font-size: 13px; }
.warn.show { display: block; animation: panelIn .3s ease both; }

/* Success */
#panel-3 .done { padding: 16px 4px 4px; text-align: center; }
#panel-3 .done-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--brand);
    border-radius: 50%;
    box-shadow: 0 0 0 8px rgba(8,124,255,.09), 0 18px 38px rgba(8,124,255,.22);
    animation: successPop .55s cubic-bezier(.2,.9,.25,1.25) both;
}
#panel-3 .done-icon svg { width: 34px; height: 34px; }
#panel-3 .done h2 { color: var(--ink); font-size: 28px; letter-spacing: -.03em; }
#panel-3 .done p { max-width: 480px; margin: 10px auto 24px; color: var(--muted); font-size: 15px; }

/* Loading */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--brand);
    background: rgba(244,247,251,.72);
    backdrop-filter: blur(22px) saturate(120%);
    -webkit-backdrop-filter: blur(22px) saturate(120%);
    animation: fadeIn .2s ease both;
}
.overlay p { font-size: 14px; font-weight: 650; }
.spinner { width: 44px; height: 44px; border: 3px solid rgba(8,124,255,.15); border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }

/* Modal */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(14,23,38,.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeIn .25s ease both;
}
.modal {
    width: min(100%, 400px);
    padding: 34px 28px 28px;
    text-align: center;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 28px;
    box-shadow: var(--shadow-float);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
    animation: modalIn .42s cubic-bezier(.2,.9,.2,1.12) both;
}
.modal-icon { width: 64px; height: 64px; margin: 0 auto 17px; display: grid; place-items: center; color: #fff; background: var(--brand); border-radius: 50%; box-shadow: 0 12px 30px rgba(8,124,255,.23); }
.modal-icon svg { width: 32px; height: 32px; }
.modal h3 { margin-bottom: 8px; color: var(--ink); font-size: 23px; letter-spacing: -.025em; }
.modal p { margin-bottom: 24px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.modal-text .modal-text-body {
    max-height: 52vh;
    overflow: auto;
    margin-bottom: 22px;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    text-align: left;
    background: rgba(248,250,252,.92);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.modal-text h3 { margin-top: 0; }

.hidden { display: none !important; }
.foot { margin-top: 28px; color: var(--faint); font-size: 12px; text-align: center; }
.login-banner {
    width: min(100%, 620px);
    aspect-ratio: 1 / 1;
    margin: 28px auto 0;
    overflow: hidden;
    background: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.92);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
    animation: panelIn .5s .08s cubic-bezier(.2,.8,.2,1) both;
}
.login-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }

@keyframes panelIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes successPop { from { opacity: 0; transform: scale(.65); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
    .page { padding: 16px 14px 36px; }
    .identity-card { margin-top: 5vh; }
    .identity-panel { padding: 30px 22px 24px; border-radius: 24px; }
    .history-item { align-items: flex-start; flex-direction: column; gap: 7px; }
    .display-mode-options { grid-template-columns: 1fr; }
    .module-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-field-group { margin-left: -4px; margin-right: -4px; padding: 21px 18px 1px; border-radius: 18px; }
    .steps { margin-bottom: 22px; padding: 20px 10px 18px; border-radius: 22px; }
    .step::after { top: 18px; }
    .step .dot { width: 38px; height: 38px; margin-bottom: 7px; font-size: 14px; }
    .step em { font-size: 12px; }
    #panel-1, #panel-3 { padding: 24px 20px; border-radius: 24px; }
    .panel-title { font-size: 28px; }
    .tip { margin-bottom: 20px; font-size: 14px; }
    #confirmText { min-height: 52vh; max-height: 62vh; padding: 22px 20px; border-radius: 20px; font-size: 15px; }
    .btn-row {
        position: sticky;
        bottom: 10px;
        z-index: 5;
        flex-direction: column-reverse;
        padding: 9px;
        margin: 14px -2px 0;
        background: rgba(244,247,251,.78);
        border: 1px solid rgba(255,255,255,.92);
        border-radius: 20px;
        box-shadow: 0 12px 36px rgba(31,45,61,.10);
        backdrop-filter: blur(20px) saturate(130%);
        -webkit-backdrop-filter: blur(20px) saturate(130%);
    }
    .btn-row .btn { width: 100%; flex: auto; }
    .modal-mask { align-items: end; padding: 12px; }
    .modal { width: 100%; padding: 30px 22px 22px; border-radius: 28px; }
    .login-banner { margin-top: 22px; border-radius: 22px; }
}

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