/* ============================================
   FCL 安卓教程站 - 样式(v3 polished)
   设计系统: 薄荷绿主色(mint), 单色基调, 语义色白/灰/红/橙
   排版: 微软雅黑/PingFang SC, 正文 14px, 标题 15px 半粗
   组件: 卡片/按钮/徽标/状态点/进度条/提示条/灯箱
   ============================================ */

:root {
    /* 薄荷绿 10 阶色板 */
    --mint-50:  #f0fdfa;
    --mint-100: #ccfbf1;
    --mint-200: #99f6e4;
    --mint-300: #6ee7b7;
    --mint-400: #34d399;
    --mint-500: #10b981;
    --mint-600: #0d9474;
    --mint-700: #0f766e;
    --mint-800: #115e59;
    --mint-900: #134e4a;

    /* 语义色: 白 / 灰 / 红 / 橙 */
    --bg:          #f7f8f6;
    --surface:     #ffffff;
    --surface-2:   #f2f6f4;
    --text:        #1a1f36;
    --text-muted:  #6b7280;
    --text-faint:  #9ca3af;
    --primary:     var(--mint-500);
    --primary-dark:var(--mint-700);
    --primary-soft:var(--mint-50);
    --danger:      #ef4444;
    --danger-soft: #fef2f2;
    --warn:        #f59e0b;
    --warn-soft:   #fff7ed;

    /* 边界与圆角 */
    --border:      #e5e7eb;
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   16px;
    --shadow:      0 2px 8px rgba(16, 185, 129, 0.08);
    --shadow-hover:0 4px 16px rgba(16, 185, 129, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ============ 通用组件 ============ */

/* 卡片 */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-ghost {
    background: var(--surface);
    color: var(--primary-dark);
    border: 1px solid var(--border);
}

/* 徽标 */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-gray {
    background: var(--surface-2);
    color: var(--text-muted);
}

.badge-warn {
    background: var(--warn-soft);
    color: var(--warn);
}

/* 状态点 */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.dot-active {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.dot-done {
    background: var(--primary-dark);
}

/* 进度条 */
.progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--mint-400));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============ 首页 ============ */

/* 顶部粘性导航条 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(17, 94, 89, 0.08);
}

.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--mint-700));
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.topbar-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-spacer {
    flex: 1;
}

.topbar-count {
    font-size: 12px;
    color: var(--text-faint);
    background: var(--surface-2);
    padding: 4px 10px;
    border-radius: 100px;
    font-weight: 600;
}

/* 首页主体 */
.home-hero {
    padding: 32px 0 12px;
}

.home-hero h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-hero p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px 16px;
    text-align: center;
    border: 1px solid rgba(17, 94, 89, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* 教程列表 */
.home-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 32px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.home-section-title::before {
    content: "";
    width: 5px;
    height: 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--primary), var(--mint-400));
}

.tutorial-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    padding-bottom: 48px;
}

.tutorial-card {
    display: flex;
    gap: 0;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid rgba(17, 94, 89, 0.06);
}

.tutorial-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(16, 185, 129, 0.2);
}

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

.tutorial-cover {
    width: 140px;
    background: var(--surface-2);
    overflow: hidden;
    flex-shrink: 0;
}

.tutorial-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tutorial-card:hover .tutorial-cover img {
    transform: scale(1.05);
}

.tutorial-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tutorial-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    color: var(--text);
}

.tutorial-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.7;
    flex: 1;
}

.tutorial-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tutorial-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 48px 0;
    color: var(--text-muted);
}

/* ============ 详情页 ============ */

/* 顶部粘性条: 返回 + 标题 + 实时进度 */
.detail-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(17, 94, 89, 0.08);
}

.detail-topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.back-link:active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.detail-topbar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.detail-topbar-progress {
    width: 120px;
    flex-shrink: 0;
}

.detail-topbar-progress .progress {
    margin-bottom: 4px;
}

.detail-topbar-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: right;
}

/* 手机端: 顶部进度条与底部悬浮条重复, 隐藏顶部那条(保留可选阶段的底部条) */
@media (max-width: 767px) {
    .detail-topbar-progress {
        display: none;
    }
}

/* 页面头 */
.page-hero {
    padding: 20px 0;
}

.page-hero .badge {
    margin-bottom: 10px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.4;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}

/* 步骤 */
.steps {
    padding-bottom: 40px;
}

.step {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px;
    margin: 14px 0;
    scroll-margin-top: 72px;
}

.step-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.step-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 2px 10px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.step-header h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.step-text {
    color: var(--text);
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.8;
}

.step-sub {
    margin: 10px 0 10px 16px;
    padding: 0;
    font-size: 13px;
}

.step-sub li {
    margin: 4px 0;
    color: var(--text-muted);
}

figure {
    margin: 14px 0;
}

figure img {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

figcaption {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 8px;
    text-align: center;
}

/* 提示条 */
.tip {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin: 12px 0;
    line-height: 1.6;
}

.tip strong {
    font-weight: 700;
    flex-shrink: 0;
}

.tip-info {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.tip-warn {
    background: var(--warn-soft);
    color: #9a3412;
}

.tip-warn strong {
    color: var(--warn);
}

.tip-success {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.tip-success strong {
    color: var(--primary);
}

/* 附加步骤 */
.step-extra .step-label {
    background: var(--surface-2);
    color: var(--text-muted);
}

/* 页脚 */
.site-footer {
    text-align: center;
    padding: 32px 0 40px;
    color: var(--text-faint);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.site-footer p {
    margin: 6px 0;
}

code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: Consolas, "JetBrains Mono", monospace;
    font-size: 0.9em;
}

/* ============ 阶段导航(右侧 / 底部) ============ */

/* 桌面端: 右侧垂直进度导航 */
.phase-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: 4px;
}

.phase-nav-title {
    font-size: 11px;
    color: var(--text-faint);
    text-align: right;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.phase-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phase-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.phase-item:active {
    background: var(--primary-soft);
}

.phase-item .phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.phase-item .phase-label {
    font-weight: 600;
    min-width: 56px;
}

.phase-item .phase-desc {
    font-size: 11px;
    color: var(--text-faint);
}

.phase-item.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.phase-item.active .phase-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.phase-item.done .phase-dot {
    background: var(--primary-dark);
}

/* 移动端: 底部悬浮进度条(可点击循环切换) */
.phase-progress-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ppb-phase {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ppb-percent {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 42px;
    text-align: right;
}

/* 底部条提示文案: 告诉用户可以点开切换阶段 */
.ppb-hint {
    font-size: 11px;
    color: var(--primary-dark);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 2px 8px;
    background: var(--primary-soft);
    border-radius: 100px;
    animation: ppb-hint-pulse 2s ease-in-out infinite;
}

@keyframes ppb-hint-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* 移动端阶段选择面板(点底部进度条弹出) */
.ppb-picker {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 72px;
    z-index: 210;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
}

.ppb-picker.open {
    display: flex;
}

.ppb-picker-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-faint);
    padding: 6px 10px 4px;
}

.ppb-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ppb-pick:active,
.ppb-pick.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.ppb-pick-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.ppb-pick.active .ppb-pick-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ppb-pick-label {
    font-weight: 600;
    min-width: 60px;
}

.ppb-pick-desc {
    font-size: 11px;
    color: var(--text-faint);
}

/* 手机端 */
@media (max-width: 767px) {
    .phase-nav {
        display: none;
    }

    body {
        padding-bottom: 72px;
    }

    .site-footer {
        padding-bottom: 96px;
    }
}

/* 桌面端 */
@media (min-width: 768px) {
    .container {
        padding: 0 24px;
    }

    .phase-progress-bottom,
    .ppb-picker {
        display: none;
    }

    .phase-nav {
        display: flex;
    }

    .home-hero h1 {
        font-size: 28px;
    }

    .page-title {
        font-size: 26px;
    }

    .step {
        padding: 20px 24px;
        margin: 16px 0;
        scroll-margin-top: 80px;
    }

    figure img {
        width: auto;
        max-width: 720px;
        margin: 0 auto;
    }

    .toc-list {
        columns: 2;
        display: block;
    }

    .toc-list:not(.open) {
        display: block;
    }

    .toc-toggle {
        display: none;
    }

    .tutorial-list {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        gap: 16px;
    }
}

/* ============ 灯箱 ============ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(19, 78, 74, 0.88);
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.lightbox.active {
    display: flex;
}

.lightbox-inner {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

.lightbox img {
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-close:active {
    background: rgba(255, 255, 255, 0.35);
}
