* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 16px;
    padding-bottom: 40px;
}

/* 头部 */
.header {
    text-align: center;
    padding: 32px 0 24px;
}

.logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.device-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.device-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.device-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.device-switch-btn:active {
    transform: scale(0.96);
    background: #e2e8f0;
}

/* 状态栏 */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-bar.success {
    background: #d1fae5;
    color: #065f46;
}

.status-bar.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-icon {
    display: flex;
    align-items: center;
}

/* 主内容 */
.main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    display: flex;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-step {
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    flex-shrink: 0;
}

.step-badge {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.step-line {
    flex: 1;
    width: 2px;
    background: var(--border);
    margin-top: 8px;
}

.step-done {
    background: var(--success);
}

.card-body {
    flex: 1;
    padding: 24px 20px 24px 0;
}

.card-body h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.card-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* 成功卡片 */
.card-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #a7f3d0;
}

.card-success .step-line {
    display: none;
}

.card-success h2 {
    color: #065f46;
}

.card-success .card-desc {
    color: #047857;
}

/* 主按钮 */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
    background: var(--primary-dark);
}

/* PAC地址输入框 */
.pac-input-wrapper {
    margin-bottom: 10px;
}

.pac-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.pac-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* PAC按钮组 */
.pac-btn-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-copy {
    flex: 1;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-copy:active {
    transform: scale(0.96);
}

.btn-copy.copied {
    background: var(--success);
}

/* 刷新按钮 */
.btn-refresh {
    flex-shrink: 0;
    padding: 12px 14px;
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-refresh:active {
    transform: scale(0.96);
    background: #e2e8f0;
}

.btn-refresh.refreshing svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* PAC提示 */
.pac-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* 缓存清除指南 */
.cache-guide {
    margin-top: 12px;
}

.cache-guide-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.cache-guide-toggle:hover {
    background: #fde68a;
}

.cache-guide-content {
    margin-top: 10px;
    padding: 14px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    color: #78350f;
}

.cache-guide-content p {
    margin-bottom: 10px;
}

.cache-guide-content ol {
    margin: 0;
    padding-left: 20px;
}

.cache-guide-content li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.cache-guide-tip {
    margin-top: 10px;
    margin-bottom: 0 !important;
    padding-top: 10px;
    border-top: 1px dashed #fcd34d;
    font-size: 12px;
    color: #a16207;
}

/* 指引框 */
.guide-box {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.guide-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

.guide-num {
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 1px;
}

/* 提示说明 */
.guide-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #eff6ff;
    border-radius: 8px;
    font-size: 13px;
    color: #1e40af;
}

.guide-note svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.guide-note.success {
    background: #ecfdf5;
    color: #047857;
}

.guide-note.warning {
    background: #fffbeb;
    color: #92400e;
}

/* 系统级证书链接 */
.btn-system-cert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding: 10px 16px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-system-cert:active {
    background: #fde68a;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* 警告状态 */
.status-bar.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Safari引导提示 */
.safari-guide {
    margin-bottom: 20px;
}

.safari-guide-content {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.safari-icon {
    margin-bottom: 12px;
}

.safari-guide-content p {
    font-size: 14px;
    color: #1e40af;
    margin-bottom: 16px;
    line-height: 1.6;
}

.safari-guide-content strong {
    color: #1d4ed8;
}

.btn-copy-link {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-copy-link:active {
    background: #2563eb;
}

/* iOS 跳转按钮 */
.guide-step-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 12px 30px;
}

.btn-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-jump:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.btn-jump svg {
    flex-shrink: 0;
}

.jump-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding-left: 4px;
}

/* 教程入口 */
.tutorial-entry {
    margin-bottom: 16px;
}

.tutorial-btns {
    display: flex;
    gap: 10px;
}

.btn-tutorial {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tutorial:active {
    transform: scale(0.98);
}

.btn-tutorial-video {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-tutorial-image {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* 视频弹窗 */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal.show {
    display: flex;
}

.video-modal-content {
    width: 100%;
    max-width: 400px;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a;
    color: white;
    font-size: 15px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-close:hover {
    opacity: 1;
}

.video-container video {
    width: 100%;
    display: block;
}

/* Android WiFi跳转按钮 */
.btn-jump-wifi {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-jump-wifi:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

/* 图文教程弹窗 */
.image-tutorial-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.image-tutorial-modal.show {
    display: flex;
}

.image-tutorial-content {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    margin: auto 0;
}

.image-tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 600;
}

.platform-tabs {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    background: var(--bg);
}

.platform-tab {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.platform-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.image-tutorial-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tutorial-image-wrapper {
    width: 100%;
}

.tutorial-image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
}

/* 图片全屏横向滑动查看 */
.image-fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 2000;
}

.image-fullscreen.show {
    display: block;
}

.btn-close-fullscreen {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-fullscreen:active {
    background: rgba(0, 0, 0, 0.8);
}

.fullscreen-scroll {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    scroll-snap-type: x proximity;
}

.fullscreen-scroll img {
    height: 100vh;
    width: auto;
    max-width: none;
    display: block;
    flex-shrink: 0;
}

/* 响应式 */
@media (max-width: 360px) {
    .app {
        padding: 16px 12px;
    }
}
