/* ==========================================
   Apple ID Tutorial - iOS-Style Interface
   兼容 PC / iPad / iPhone
   ========================================== */

   :root {
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-gray: #8E8E93;
    --ios-gray2: #AEAEB2;
    --ios-gray3: #C7C7CC;
    --ios-gray4: #D1D1D6;
    --ios-gray5: #E5E5EA;
    --ios-gray6: #F2F2F7;
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-text: #000000;
    --ios-text2: #3C3C43;
    --ios-text3: #8E8E93;
    --ios-separator: rgba(60, 60, 67, 0.12);
    --max-width: 360px;
    --frame-radius: 44px;
    --phone-aspect: 440 / 956;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    background: #000;
    color: var(--ios-text);
    overflow-x: hidden;
}

/* ============ Error Page ============ */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: var(--ios-bg);
    text-align: center;
}
.error-icon { font-size: 64px; margin-bottom: 20px; }
.error-page h2 { font-size: 24px; font-weight: 600; margin-bottom: 12px; }
.error-page p { color: var(--ios-text3); font-size: 16px; margin-bottom: 8px; }
.error-page .sub-text { font-size: 14px; }

/* ============ App Container ============ */
#app {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
    overflow: hidden;
}

/* ============ Step Pages ============ */
.step-page {
    display: none;
    width: min(
        var(--max-width),
        calc(100vw - 40px),
        calc((100dvh - 40px) * var(--phone-aspect))
    );
    max-width: var(--max-width);
    animation: fadeIn 0.35s ease;
}
.step-page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-30px); }
}

.step-page.leaving {
    animation: fadeOut 0.25s ease forwards;
}

/* ============ iPhone Frame ============ */
.iphone-frame {
    background: var(--ios-bg);
    border-radius: var(--frame-radius);
    overflow: hidden;
    box-shadow:
        0 0 0 3px #1a1a1a,
        0 0 0 6px #333,
        0 25px 80px rgba(0, 0, 0, 0.5);
    width: 100%;
    aspect-ratio: var(--phone-aspect);
    height: auto;
    max-height: calc(100dvh - 40px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============ iOS Status Bar ============ */
.ios-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ios-text);
    background: var(--ios-card);
    position: relative;
    z-index: 10;
}
.ios-status-bar::before {
    content: '';
    position: absolute;
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(72px, 24vw, 100px);
    height: 26px;
    background: #000;
    border-radius: 16px;
}
.ios-status-bar .time { position: relative; z-index: 1; }
.ios-status-bar .icons {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 1;
}
.ios-status-bar .icons svg {
    /* 直接放大图标本体，提升“线条粗细”观感（比 filter 更稳定） */
    transform: scale(1.12);
    transform-origin: center;
}
.ios-status-bar .icons svg:last-child {
    /* 电池图标单独略小一点，避免视觉过重 */
    transform: scale(1.08);
}

/* ============ iOS Navigation Bar ============ */
.ios-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    background: var(--ios-card);
    border-bottom: 0.5px solid var(--ios-separator);
}
.nav-back {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--ios-blue);
    font-size: 17px;
    cursor: pointer;
    padding: 4px;
    font-family: inherit;
}
.nav-title {
    font-size: 17px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.nav-right {
    font-size: 13px;
    color: var(--ios-text3);
    padding: 4px 10px;
    background: var(--ios-gray6);
    border-radius: 12px;
}

/* ============ Welcome Page ============ */
.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    background: var(--ios-card);
}
.app-icon-large { margin-bottom: 24px; }
/* 教程图标：与原先 SVG 尺寸一致 */
.app-icon-large .tutorial-icon-appstore-lg {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}
.ios-option .option-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
}
.ios-option .option-icon .tutorial-icon-setting,
.ios-option .option-icon .tutorial-icon-appstore {
    width: 28px;
    height: 28px;
    object-fit: cover;
    display: block;
}
/* 设置图为直角 JPEG，需在 img 上显式圆角才能与 App Store 图标视觉一致 */
.ios-option .option-icon .tutorial-icon-setting {
    border-radius: 22%;
}
.welcome-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.welcome-desc {
    font-size: 15px;
    color: var(--ios-text3);
    line-height: 1.6;
    margin-bottom: 36px;
}
.step-indicators {
    display: flex;
    gap: 8px;
    margin-bottom: 36px;
}
.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ios-gray4);
    transition: all 0.3s;
}
.indicator.active {
    background: var(--ios-blue);
    width: 24px;
    border-radius: 4px;
}

/* ============ iOS Primary Button ============ */
.ios-btn-primary {
    width: 100%;
    max-width: 320px;
    padding: 16px 32px;
    background: var(--ios-blue);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.ios-btn-primary:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* ============ Step Content ============ */
.step-content {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
}
.step-question {
    text-align: center;
    margin-bottom: 28px;
}
.question-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.step-question h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}
.question-desc {
    font-size: 15px;
    color: var(--ios-text3);
    line-height: 1.5;
}
.question-hint {
    font-size: 13px;
    color: var(--ios-blue);
    margin-top: 10px;
    padding: 8px 14px;
    background: rgba(0, 122, 255, 0.08);
    border-radius: 10px;
    display: inline-block;
}

/* ============ iOS Option Buttons ============ */
.ios-options {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--ios-separator);
    border-radius: 14px;
    overflow: hidden;
}
.ios-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--ios-card);
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s;
    width: 100%;
}
.ios-option:active { background: var(--ios-gray5); }
.ios-option .option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.option-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--ios-text);
}
.option-subtitle {
    font-size: 13px;
    color: var(--ios-text3);
}
.option-arrow { flex-shrink: 0; }

/* Option States */
.ios-option.correct {
    background: #e8f5e9 !important;
    position: relative;
}
.ios-option.correct::after {
    content: '✓';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ios-green);
    font-size: 20px;
    font-weight: 700;
}
.ios-option.wrong {
    background: #fce4ec !important;
    animation: shake 0.5s ease;
    position: relative;
}
.ios-option.wrong::after {
    content: '✗';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ios-red);
    font-size: 20px;
    font-weight: 700;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* ============ Version Badges ============ */
.version-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.version-badge.old { background: var(--ios-orange); }
.version-badge.new { background: var(--ios-green); }

.version-option.selected {
    background: rgba(0, 122, 255, 0.06) !important;
}
.version-option.selected .option-check::after {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ios-blue);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='white'/%3E%3C/svg%3E");
    background-size: 16px;
    background-repeat: no-repeat;
    background-position: center;
}
.option-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--ios-gray3);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}
.version-option.selected .option-check {
    border-color: var(--ios-blue);
}

/* ============ Step 3 Visual Polish ============ */
.step-page[data-step="3"] .step-content {
    padding-top: 18px;
}
.step-page[data-step="3"] .question-icon {
    font-size: 36px;
    margin-bottom: 10px;
}
.step-page[data-step="3"] .step-question h2 {
    font-size: clamp(28px, 4.4vw, 34px);
    line-height: 1.18;
    letter-spacing: -0.2px;
    margin-bottom: 10px;
}
.step-page[data-step="3"] .question-desc {
    font-size: 14px;
    color: #8a8a90;
}
.step-page[data-step="3"] .question-hint {
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(58, 124, 255, 0.12);
}
.step-page[data-step="3"] .ios-options {
    border-radius: 16px;
    border: 1px solid #ececf2;
    background: #ececf2;
}
.step-page[data-step="3"] .version-option {
    padding: 14px 14px;
}
.step-page[data-step="3"] .version-option .option-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    overflow: hidden;
}
.step-page[data-step="3"] .version-option .option-text {
    gap: 0;
    justify-content: center;
}
.step-page[data-step="3"] .option-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
}
.step-page[data-step="3"] .option-subtitle {
    font-size: 12px;
    color: #8c8c92;
}
.step-page[data-step="3"] .version-badge {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.3px;
}
.step-page[data-step="3"] .option-check {
    width: 32px;
    height: 32px;
    border-width: 3px;
    border-color: #c2c2c9;
}
.step-page[data-step="3"] .version-option.selected .option-check::after {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: 17px;
}
.step-page[data-step="3"] .version-option.selected .option-check {
    border-color: transparent;
}

@media (max-width: 480px) {
    .step-page[data-step="3"] .step-question h2 {
        font-size: 20px;
    }
    .step-page[data-step="3"] .question-desc {
        font-size: 13px;
    }
    .step-page[data-step="3"] .question-hint {
        font-size: 12px;
        padding: 7px 12px;
    }
    .step-page[data-step="3"] .version-badge {
        width: 100%;
        height: 100%;
        border-radius: 12px;
        font-size: 16px;
    }
    .step-page[data-step="3"] .version-option .option-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }
    .step-page[data-step="3"] .option-title {
        font-size: 15px;
    }
    .step-page[data-step="3"] .option-check {
        width: 28px;
        height: 28px;
        border-width: 3px;
    }
    .step-page[data-step="3"] .version-option.selected .option-check::after {
        width: 100%;
        height: 100%;
        background-size: 16px;
    }
}

/* ============ iOS Alert Dialog Mock ============ */
.ios-alert-mock {
    display: flex;
    justify-content: center;
    padding: 20px;
}
.ios-alert-box {
    background: rgba(242, 242, 247, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    width: 100%;
    max-width: 300px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}
.alert-header {
    padding: 20px 20px 8px;
    text-align: center;
    font-size: 17px;
}
.alert-body {
    padding: 0 20px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--ios-text2);
    line-height: 1.5;
}
.alert-actions {
    border-top: 0.5px solid var(--ios-separator);
    display: flex;
    flex-direction: column;
}
.alert-action {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 17px;
    color: var(--ios-blue);
    cursor: pointer;
    font-family: inherit;
    border-top: 0.5px solid var(--ios-separator);
    transition: background 0.15s;
}
.alert-action:first-child { border-top: none; }
.alert-action:active { background: rgba(0, 0, 0, 0.05); }
.alert-action.primary { font-weight: 600; }

.alert-action.correct {
    background: #e8f5e9 !important;
    color: var(--ios-green) !important;
}
.alert-action.wrong {
    background: #fce4ec !important;
    color: var(--ios-red) !important;
    animation: shake 0.5s ease;
}

/* ============ Step2 Apple Security Flow ============ */
.step2-content {
    background: #f3f4f8;
    position: relative;
}
.apple-security-screen {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 26px 18px 18px;
}
.security-lock-icon {
    margin-bottom: 16px;
}
.security-title {
    font-size: clamp(24px, 7.2vw, 40px);
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.12;
    letter-spacing: -0.3px;
    white-space: nowrap;
}
.security-desc {
    font-size: 15px;
    line-height: 1.5;
    color: #1d1d1f;
    margin-bottom: 12px;
    max-width: 332px;
    font-weight: 500;
}
.security-mask-line {
    width: 236px;
    height: 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    background: linear-gradient(90deg, #d6d6db 0%, #ececef 50%, #d6d6db 100%);
}
.security-link {
    color: #6a8fb9;
    font-size: 14px;
    text-decoration: none;
    margin-bottom: auto;
    font-weight: 500;
}
.security-actions {
    width: 100%;
    max-width: 360px;
    margin-top: 26px;
}
.security-continue-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    background: #2f6fdd;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    padding: 14px 16px;
    font-family: inherit;
    cursor: pointer;
}
.security-other-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: #2f6fdd;
    font-size: 15px;
    font-weight: 600;
    margin-top: 14px;
    font-family: inherit;
    cursor: pointer;
}
.security-continue-btn.disabled {
    background: #c7c7cc;
    color: #ffffff;
    cursor: not-allowed;
}
.security-other-btn.disabled {
    color: #b0b0b6;
    cursor: not-allowed;
}
.step2-modal-layer {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(25, 25, 28, 0.18);
    backdrop-filter: blur(0.6px);
    -webkit-backdrop-filter: blur(0.6px);
    z-index: 20;
}
.step2-modal-layer.show {
    display: flex;
}
.step2-alert-box {
    width: min(278px, 92vw);
    max-width: 278px;
    border-radius: 14px;
    background: rgba(242, 242, 247, 0.96);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.step2-alert-box .alert-header {
    padding: 14px 14px 6px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
}
.step2-alert-box .alert-body {
    padding: 0 14px 14px;
    font-size: 12px;
    line-height: 1.35;
    color: #3d3d43;
}
.step2-alert-box .alert-actions {
    border-top: 0.5px solid rgba(60, 60, 67, 0.24);
    display: flex;
    flex-direction: row;
}
.step2-alert-box .alert-action {
    padding: 12px 12px;
    font-size: 17px;
    line-height: 1.2;
    border-top: none;
    color: #2f6fdd;
    width: 50%;
    text-align: center;
}
.step2-alert-box .alert-action.primary {
    font-weight: 600;
    border-right: 0.5px solid rgba(60, 60, 67, 0.24);
}

/* ============ App Store Mock ============ */
.appstore-mock {
    background: var(--ios-card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.ipad-mock {
    border-radius: 26px;
    background: #eff0f5;
    border: 1px solid #ececf1;
    padding-bottom: 12px;
}
.step-page[data-step="4"] .step-content,
.step-page[data-step="5"] .step-content {
    padding: 0;
    position: relative;
    overflow: hidden;
}
.step-page[data-step="4"] .ipad-mock,
.step-page[data-step="5"] .ipad-mock {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding-top: 10px;
}
.step-page[data-step="4"] .ipad-mock .appstore-menu,
.step-page[data-step="5"] .ipad-mock .appstore-menu,
.step-page[data-step="4"] .ipad-mock .account-profile-card,
.step-page[data-step="5"] .ipad-mock .account-profile-card {
    margin-left: 12px;
    margin-right: 12px;
}
.account-sheet-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    padding: 18px 16px 14px;
    position: relative;
}
.account-sheet-title.with-back {
    font-size: 18px;
    border-bottom: 0.5px solid var(--ios-separator);
}
.account-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}
.sheet-back, .sheet-close {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #3a3a3c;
    font-size: 34px;
    line-height: 1;
}
.sheet-back { left: 16px; }
.sheet-close { right: 16px; }
.sheet-close.solid {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e5e6ec;
    color: #6f7076;
    font-size: 40px;
    font-weight: 200;
    line-height: 1;
    letter-spacing: -1px;
    transform: translateY(-50%);
    top: 50%;
    right: 14px;
}
.sheet-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #e8e9ee;
    color: #64656c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 300;
    padding: 0;
}
.sheet-icon-btn.left {
    font-size: 42px;
    color: #4e4f56;
}
.sheet-icon-btn.right {
    font-size: 33px;
}
.account-profile-card {
    margin: 0 14px 12px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #ececf2;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.gamecenter-card {
    margin-top: -4px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.gamecenter-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4d6d 0%, #feca57 34%, #48dbfb 66%, #5f27cd 100%);
}
.game-title {
    color: #1473b8;
}
.external-mark {
    margin-left: auto;
    color: #9d9da3;
    font-size: 16px;
}
.account-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f4d9bf 0%, #d1a78a 45%, #9f7a62 100%);
}
.account-meta {
    line-height: 1.25;
}
.account-name {
    font-size: 18px;
    color: #1d1d1f;
}
.account-mail {
    font-size: 14px;
    color: #8e8e93;
}
.appstore-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 0.5px solid var(--ios-separator);
}
.appstore-greeting {
    font-size: 22px;
    font-weight: 700;
}
.appstore-menu { display: flex; flex-direction: column; }
.appstore-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    color: var(--ios-text);
    width: 100%;
    text-align: left;
    border-bottom: 0.5px solid var(--ios-separator);
    transition: background 0.15s;
}
.appstore-menu-item:last-child { border-bottom: none; }
.appstore-menu-item:active { background: var(--ios-gray5); }
.appstore-menu-item .arrow {
    margin-left: auto;
    flex-shrink: 0;
}
.appstore-menu-item span { flex: 1; }
.ipad-mock .appstore-menu {
    background: #fff;
    margin: 0 14px 12px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #efeff4;
}
.ipad-mock .appstore-menu.light-group .appstore-menu-item {
    color: #1473b8;
}
.ipad-mock .appstore-menu-item {
    font-size: 17px;
    padding: 18px 16px;
}
.ipad-mock .appstore-menu-item .arrow path {
    stroke: #c6c6cc;
}
.ipad-mock .appstore-menu-item .arrow {
    width: 10px;
    height: 16px;
}
.row-user-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ececef;
    position: relative;
    flex-shrink: 0;
}
.row-user-icon::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c9c9cf;
}
.row-user-icon::after {
    content: '';
    position: absolute;
    left: 4px;
    bottom: 3px;
    width: 16px;
    height: 8px;
    border-radius: 8px 8px 3px 3px;
    background: #c9c9cf;
}
.step5-modal {
    margin-top: 0;
    position: relative;
    z-index: 2;
    border-radius: 22px;
    overflow: hidden;
    background: #eceef4;
    border: 1px solid #e5e7ef;
    box-shadow: 0 8px 24px rgba(25, 30, 60, 0.08);
}
.step5-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 0;
    padding: 8px 14px;
    min-height: 46px;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.16);
}
.step5-title {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    line-height: 1.1;
}
.step-page[data-step="5"] .sheet-icon-btn.right,
.step-page[data-step="5"] .sheet-icon-btn.left {
    position: static;
    transform: none;
    right: auto;
    top: auto;
}
.step-page[data-step="5"] .sheet-icon-btn {
    width: 34px;
    height: 34px;
}
.step-page[data-step="5"] .sheet-icon-btn.left {
    font-size: 34px;
}
.step-page[data-step="5"] .sheet-icon-btn.right {
    font-size: 28px;
}
.step-page[data-step="5"] .step5-option-group .appstore-menu-item {
    display: grid;
    grid-template-columns: 24px 1fr 10px;
    align-items: center;
    column-gap: 12px;
}
.step-page[data-step="5"] .step5-option-group .appstore-menu-item .arrow {
    width: 9px;
    min-width: 9px;
    height: 15px;
    display: block;
}
.step-page[data-step="5"] .step5-option-group .appstore-menu-item .arrow path {
    stroke-width: 2;
}
.step-page[data-step="5"] .step5-option-group {
    margin-top: 10px;
}
.step5-bg-mock {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 6px;
    height: 260px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(218, 220, 228, 0.72), rgba(223, 224, 232, 0.34));
    z-index: 0;
}
.step5-bg-mock .bg-row {
    height: 58px;
    margin: 18px 18px 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.48);
}
@media (max-width: 480px) {
    .step-page[data-step="4"] .step-content,
    .step-page[data-step="5"] .step-content {
        padding: 0;
    }
    .step-page[data-step="4"] .ipad-mock,
    .step-page[data-step="5"] .ipad-mock {
        border-radius: 0;
        padding-top: 8px;
    }
    .account-sheet-title {
        font-size: 17px;
    }
    .sheet-close.solid {
        width: 38px;
        height: 38px;
        font-size: 36px;
    }
    .account-profile-card {
        margin: 0 12px 10px;
    }
    .step5-header {
        grid-template-columns: 1fr;
        padding: 7px 12px;
        min-height: 42px;
    }
    .sheet-icon-btn {
        width: 36px;
        height: 36px;
        background: #e2e4eb;
    }
    .sheet-icon-btn.left {
        font-size: 38px;
    }
    .sheet-icon-btn.right {
        font-size: 30px;
    }
    .sheet-close.solid {
        right: 12px;
    }
    .step-page[data-step="5"] .step5-option-group .appstore-menu-item .arrow {
        width: 8px;
        min-width: 8px;
        height: 14px;
    }
    .step-page[data-step="5"] .sheet-icon-btn {
        width: 32px;
        height: 32px;
    }
    .step-page[data-step="5"] .sheet-icon-btn.left {
        font-size: 32px;
    }
    .step-page[data-step="5"] .sheet-icon-btn.right {
        font-size: 26px;
    }
}

.appstore-menu-item.correct {
    background: #e8f5e9 !important;
}
.appstore-menu-item.wrong {
    background: #fce4ec !important;
    animation: shake 0.5s ease;
}

/* ============ App Store Tabs (iOS 17.5+) ============ */
.appstore-tabs {
    display: flex;
    justify-content: space-around;
    padding: 16px 8px;
    background: var(--ios-card);
    border-top: 0.5px solid var(--ios-separator);
}
.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    color: var(--ios-gray);
    padding: 8px 6px;
    border-radius: 10px;
    transition: all 0.2s;
    min-width: 52px;
}
.tab-item:active { background: var(--ios-gray6); }
.correct-tab { color: var(--ios-blue); }

.tab-item.correct {
    background: #e8f5e9 !important;
    color: var(--ios-green) !important;
}
.tab-item.wrong {
    background: #fce4ec !important;
    color: var(--ios-red) !important;
    animation: shake 0.5s ease;
}

/* ============ Success / Password Page ============ */
.success-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 38px 20px 24px;
    background: var(--ios-card);
}
.success-checkmark {
    margin-bottom: 10px;
}
.check-animation {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.6s ease 0.3s forwards;
}
@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}
.status-hero {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
    text-align: center;
}
.account-summary-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--ios-text);
    word-break: break-all;
    line-height: 1.25;
}
.account-summary-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}
.account-summary-status-badge.normal {
    background: #dcfce7;
    color: #15803d;
}
.account-summary-status-badge.abnormal {
    background: #fee2e2;
    color: #b91c1c;
}
.account-summary-status-badge.unknown {
    background: #f2f2f7;
    color: #6b7280;
}
.account-status-warning {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: #c2410c;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 8px 10px;
}

/* Password Card */
.password-card {
    width: 100%;
    background: var(--ios-gray6);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    text-align: center;
    border: 1px solid #ececf1;
}
.password-label {
    font-size: 13px;
    color: var(--ios-text3);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.password-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--ios-text);
    margin-bottom: 12px;
    word-break: break-all;
    user-select: all;
    -webkit-user-select: all;
}
.password-text {
    font-family: "SF Mono", "Menlo", "Courier New", monospace;
    font-size: 24px;
    color: var(--ios-blue);
    letter-spacing: 1px;
}
.password-divider {
    height: 0.5px;
    background: var(--ios-separator);
    margin: 12px 0;
}
.copy-password-btn {
    width: 100%;
    padding: 12px;
    background: var(--ios-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    transition: all 0.2s;
}
.copy-password-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}
.custom-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    /* 该按钮位于密码灰色模块外侧，不需要再叠加 margin-top（否则与密码卡 margin-bottom 叠加过大） */
    margin-top: 0;
    margin-bottom: 14px;
}

/* Warning Box */
.warning-box {
    width: 100%;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 14px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.8;
    color: #5D4037;
}
.warning-box strong { color: #E65100; }

@media (max-width: 480px) {
    .success-content {
        padding: 30px 16px 18px;
    }
    .success-checkmark svg {
        width: 72px;
        height: 72px;
    }
    .success-title {
        font-size: 22px;
    }
    .account-summary-name {
        font-size: 16px;
    }
    .password-text {
        font-size: 22px;
        letter-spacing: 0.6px;
    }
}

/* ============ Toast Notifications ============ */
.ios-toast {
    position: fixed;
    top: 56px;
    left: 50%;
    width: min(440px, calc(100vw - 32px));
    transform: translateX(-50%) translateY(-125%);
    opacity: 0;
    visibility: hidden;
    z-index: 10000;
    transition: transform 0.32s ease, opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}
.ios-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}
.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.ios-toast.success .toast-content {
    background: rgba(255, 255, 255, 0.94);
}
.toast-icon {
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2b7fff;
    font-size: 18px;
}
.ios-toast.success .toast-icon {
    color: #2eaf58;
}
.ios-toast:not(.success) .toast-icon {
    color: #ff3b30;
}
.ios-toast .toast-text {
    line-height: 1.35;
}
.toast-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.toast-countdown {
    display: none;
    font-size: 13px;
    line-height: 1.3;
    color: #6b7280;
    font-weight: 600;
}
.ios-toast.show .toast-countdown:not(:empty) {
    display: block;
}

/* ============ Responsive Design ============ */

/* Large screens / PC */
@media (min-width: 769px) {
    #app {
        padding: 40px;
    }
    .step-page {
        width: min(
            var(--max-width),
            calc(100vw - 80px),
            calc((100dvh - 80px) * var(--phone-aspect))
        );
    }
}

/* iPad */
@media (min-width: 481px) and (max-width: 768px) {
    #app {
        padding: 30px;
    }
    .step-page {
        max-width: 400px;
    }
}

/* iPhone / Small screens — 先铺满高度，再按手机比例算宽度（宽度不超过屏宽） */
@media (max-width: 480px) {
    :root {
        --frame-radius: 22px;
        /* 与 --phone-aspect: 440 / 956 一致：竖屏手机宽/高 */
        --phone-ar-w: 440;
        --phone-ar-h: 956;
        /* iPhone 模拟外框第二层描边为 6px，需在高度计算中扣除上下共 12px */
        --phone-frame-edge: 6px;
    }
    html, body {
        background: #fff;
    }
    /* 与 #app padding 一致，避免 safe-area 重复扣减 */
    #app {
        padding: 8px;
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
        background: #fff;
        align-items: center;
        justify-content: center;
        min-height: 100dvh;
        flex-direction: column;
        box-sizing: border-box;
    }
    /* 高度优先：可用高/宽与 #app 内容区一致 */
    .step-page {
        max-width: 100%;
        flex: 1;
    }
    .step-page.active {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        /* 勿用 min-height:0，否则会覆盖下方 min-height，导致无法撑满 #app */
        min-height: calc(
            100dvh
            - max(16px, env(safe-area-inset-top, 0px))
            - max(16px, env(safe-area-inset-bottom, 0px))
            - (var(--phone-frame-edge) * 2)
        );
    }
    .iphone-frame {
        border-radius: var(--frame-radius);
        box-shadow:
            0 0 0 5px #1a1a1a,
            0 0 0 10px #333,
            0 18px 48px rgba(0, 0, 0, 0.35);
        /* 先尽量用满可用高度，宽度 = 高 × (440/956)；窄屏时取 min，高度由宽度反推 */
        box-sizing: border-box;
        width: auto;
        aspect-ratio: var(--phone-aspect);
        height: min(
            calc(
                100dvh
                - max(16px, env(safe-area-inset-top, 0px))
                - max(16px, env(safe-area-inset-bottom, 0px))
                - (var(--phone-frame-edge) * 2)
            ),
            calc(
                (100vw - max(16px, env(safe-area-inset-left, 0px)) - max(16px, env(safe-area-inset-right, 0px)))
                * var(--phone-ar-h) / var(--phone-ar-w)
            )
        );
        max-width: calc(
            100vw - max(16px, env(safe-area-inset-left, 0px)) - max(16px, env(safe-area-inset-right, 0px))
        );
        max-height: calc(
            100dvh
            - max(16px, env(safe-area-inset-top, 0px))
            - max(16px, env(safe-area-inset-bottom, 0px))
            - (var(--phone-frame-edge) * 2)
        );
        min-height: 0;
        flex-shrink: 0;
    }
    .ios-status-bar {
        padding: calc(env(safe-area-inset-top, 14px) + 6px) 24px 14px;
    }
    .ios-status-bar::before {
        display: block;
        width: clamp(66px, 22vw, 88px);
        height: 22px;
        top: 8px;
        border-radius: 13px;
    }
    .welcome-content {
        padding: 30px 24px;
    }
    .welcome-title {
        font-size: 24px;
    }
    .ios-alert-box {
        max-width: 280px;
    }
    .security-title {
        font-size: clamp(24px, 9vw, 34px);
        white-space: nowrap;
    }
    .security-desc {
        font-size: 14px;
        max-width: 300px;
    }
    .security-continue-btn {
        font-size: 17px;
        border-radius: 13px;
    }
    .security-other-btn {
        font-size: 14px;
    }
    .step2-alert-box {
        width: min(278px, 90vw);
        max-width: 278px;
        border-radius: 14px;
    }
    .step2-alert-box .alert-header {
        font-size: 17px;
    }
    .step2-alert-box .alert-body {
        font-size: 12px;
    }
    .step2-alert-box .alert-action {
        font-size: 17px;
    }
}

/* Very small screens */
@media (max-width: 350px) {
    .ios-status-bar::before {
        width: clamp(58px, 20vw, 74px);
        height: 20px;
    }
    .step-question h2 { font-size: 20px; }
    .question-desc { font-size: 14px; }
    .option-title { font-size: 15px; }
    .option-subtitle { font-size: 12px; }
    .tab-item { min-width: 44px; font-size: 9px; }
    .tab-item svg { width: 22px; height: 22px; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Keep light mode for the iPhone simulation regardless */
}

/* Smooth scrolling */
html { scroll-behavior: smooth; }

/* Disable text selection on interactive elements */
.ios-option, .alert-action, .tab-item, .appstore-menu-item, .ios-btn-primary, .nav-back {
    user-select: none;
    -webkit-user-select: none;
}

/* Loading state */
.ios-option.disabled, .alert-action.disabled, .tab-item.disabled, .appstore-menu-item.disabled {
    pointer-events: none;
    opacity: 0.5;
}
