/* ============================================
   教程网站 - 苹果风格移动端样式
   桌面端显示手机放大版（居中手机框）
   ============================================ */

:root {
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --border: #e5e5ea;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.1);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --nav-height: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-user-scalable: none;
    user-scalable: none;
}

/* ========== 桌面端：手机放大版容器 ========== */
.phone-frame {
    max-width: 430px;
    width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    background: #ffffff;
    position: relative;
    padding-top: var(--safe-top);
    padding-bottom: calc(20px + var(--safe-bottom));
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

/* 更大屏幕时显示手机边框效果 */
@media (min-width: 560px) {
    body {
        background: #e8e8ed;
        padding: 20px 0;
    }
    .phone-frame {
        border-radius: 36px;
        overflow: hidden;
        min-height: calc(100vh - 40px);
        border: 1px solid rgba(0, 0, 0, 0.06);
    }
}

/* ========== 头部 ========== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    padding: 24px 20px 14px;
    display: flex;
    align-items: center;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

/* ========== Banner 轮播 ========== */
.banner-carousel {
    position: relative !important;
    overflow: hidden !important;
    margin: 12px 16px 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.08) !important;
    width: calc(100% - 32px) !important;
    max-width: calc(100% - 32px) !important;
    height: 160px !important;
    max-height: 160px !important;
}

.banner-track {
    display: flex !important;
    transition: transform 0.4s ease !important;
    height: 100% !important;
}

.banner-slide {
    flex: 0 0 100% !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    position: relative !important;
}

.banner-slide a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.banner-slide img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

.banner-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
}

.banner-dot.active {
    width: 18px;
    border-radius: 3px;
    background: #fff;
}

.app-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: #000;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    margin-right: 10px;
    flex-shrink: 0;
}
.back-btn svg { display: block; flex-shrink: 0; }
.back-btn .back-text {
    font-size: 23px;
    font-weight: 500;
    color: #000;
    line-height: 1;
}

/* ========== 底部版权 ========== */
.site-footer {
    border-top: 0.5px solid rgba(0,0,0,0.08);
    text-align: center !important;
    margin-top: 80px;
    padding: 10px 16px 24px;
    color: #999;
    font-size: 12px;
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-line;
    flex-shrink: 0;
}

/* ========== 首页 Hero 区 ========== */
.hero {
    padding: 28px 20px 16px;
    text-align: center;
}

.hero-illustration {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 0 auto 20px;
    border-radius: var(--radius-lg);
}

.hero h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    text-align: left;
}

.hero .slogan {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: left;
}

/* ========== 教程目录卡片 ========== */
.section-title {
    padding: 20px 20px 12px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.category-list {
    padding: 0 16px;
}

/* 分割线 */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 16px;
}

.category-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.category-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.category-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-arrow {
    color: #c7c7cc;
    font-size: 20px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ========== 文章列表 ========== */
.article-list {
    padding: 0 16px;
}

.article-card {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

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

.article-cover {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
    background: #f0f0f0;
}

.article-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.article-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.article-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ========== 文章详情 ========== */
.article-detail {
    padding: 0 20px;
}

.article-detail h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    padding-top: 20px;
    line-height: 1.25;
}

.article-detail .detail-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.article-detail .detail-meta {
    font-size: 13px;
    color: var(--text-tertiary);
    padding-bottom: 16px;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 20px;
}

.article-detail .detail-cover {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.article-content {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-primary);
    word-wrap: break-word;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 28px 0 14px;
    letter-spacing: -0.3px;
}

.article-content h3 {
    font-size: 19px;
    font-weight: 600;
    margin: 22px 0 12px;
}

.article-content video {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 240px !important;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    display: block;
    background: #2d3748;
    border: 1px solid #d0d0d5;
    overflow: hidden;
    object-fit: contain;
}

/* 视频/图片前后的空段落隐藏 */
.article-content p:has(+ video),
.article-content p:has(+ img),
.article-content video + p:has(br:only-child),
.article-content img + p:has(br:only-child) {
    display: none;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    border: 1px solid #d0d0d5;
    display: block;
}

.article-content ul, .article-content ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 8px 16px;
    margin: 16px 0;
    background: #f5f5f7;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.article-content a {
    color: var(--primary);
    text-decoration: none;
}

.article-content pre {
    background: #1d1d1f;
    color: #f5f5f7;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 14px;
    margin: 16px 0;
}

.article-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.article-content pre code {
    background: none;
    padding: 0;
}

/* 字号切换按钮 */
.font-size-control {
    position: fixed;
    right: 20px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
}

.font-size-control button {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--primary);
    cursor: pointer;
    border-bottom: 0.5px solid var(--border);
}

.font-size-control button:last-child {
    border-bottom: none;
}

/* ========== 通用页面 ========== */
.page-content {
    padding: 20px;
    flex: 1;
}

.article-detail {
    flex: 1;
    padding: 16px 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state .icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 工具/店铺/联系卡片 */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.info-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 0.5px solid var(--border);
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-item .ci-icon {
    font-size: 24px;
    margin-right: 14px;
    width: 40px;
    text-align: center;
}

.contact-item .ci-label {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.contact-item .ci-value {
    font-size: 16px;
    font-weight: 500;
}

/* 按钮 */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:active {
    background: var(--primary-hover);
}

/* ========== 工具页 ========== */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}

.tool-item {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 20px 14px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}

.tool-item:active {
    transform: scale(0.96);
}

.tool-item .ti-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.tool-item .ti-name {
    font-size: 14px;
    font-weight: 500;
}

/* ========== 店铺页 ========== */
.shop-banner {
    margin: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.shop-banner img {
    width: 100%;
    display: block;
}

.product-list {
    padding: 0 16px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    box-shadow: var(--shadow-sm);
}

.product-card img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-right: 14px;
}

.product-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.product-info .price {
    color: #ff3b30;
    font-size: 18px;
    font-weight: 700;
}

.product-info .desc {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}
