/* 今日头条移动端主题样式 */

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #fff;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 头部导航 */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
}

.site-logo {
    font-size: 18px;
    font-weight: 600;
    color: #ff6b00;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    gap: 10px;
    margin-left: 0;
    justify-content: flex-start;
}

.header-nav .nav-link {
    color: #222;
    font-size: 16px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    background: transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.header-nav .nav-link:hover {
    color: #ff6b00;
    background: rgba(255, 107, 0, 0.08);
}

.header-nav .nav-link.active {
    color: #fff;
    background: #ff6b00;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.header-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
}

.header-btn svg {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* 分类标签栏 */
.category-tabs {
    position: sticky;
    top: 50px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    z-index: 999;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tabs-wrapper {
    display: flex;
    padding: 0 8px;
    white-space: nowrap;
}

.tab-item {
    flex-shrink: 0;
    padding: 12px 16px;
    font-size: 15px;
    color: #666;
    position: relative;
    transition: color 0.2s;
}

.tab-item.active {
    color: #ff6b00;
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #ff6b00;
    border-radius: 2px;
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 100px);
    padding-bottom: 72px;
    width: 100%;
}

/* 文章列表 */
.article-list {
    background: #fff;
    width: 100%;
}

.article-card {
    padding: 12px 16px;
    border-bottom: 1px solid #f4f5f6;
    background: #fff;
    transition: background 0.2s;
}

.article-card:active {
    background: #f8f8f8;
}

/* 文章卡片图片容器 */
.article-card .card-images {
    display: flex;
    gap: 4px;
    margin: 10px 0;
}

/* 单图样式 - 全宽显示 */
.article-card.single-image .card-images {
    display: block;
}

.article-card.single-image .image-item {
    width: 100%;
    height: 200px;
    border-radius: 4px;
    overflow: hidden;
}

.article-card.single-image .image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 两图样式 - 各占50% */
.article-card.two-images .card-images {
    display: flex;
    gap: 4px;
}

.article-card.two-images .image-item {
    flex: 1;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
}

.article-card.two-images .image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card .card-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: #222;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.article-card .card-content {
    overflow: hidden;
}

.article-card .card-summary {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.article-card .card-summary ul,
.article-card .card-summary ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-card .card-summary ul li::before,
.article-card .card-summary ol li::before {
    display: none;
}

.article-card .card-summary li {
    padding: 0;
    margin: 0;
}

/* 文章卡片内容区 */
.article-card .card-content {
    overflow: hidden;
}

/* 三图样式 - 各占33.3% */
.article-card.three-images .card-images {
    display: flex;
    gap: 4px;
}

.article-card.three-images .image-item {
    flex: 1;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
}

.article-card.three-images .image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文章元信息 */
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item svg {
    width: 14px;
    height: 14px;
}

/* 加载更多 */
.load-more {
    padding: 20px;
    text-align: center;
}

.load-more-btn {
    display: inline-block;
    padding: 10px 30px;
    background: #fff;
    color: #666;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s;
}

.load-more-btn:active {
    background: #f8f8f8;
}

/* 文章详情页 */
.article-detail {
    background: #fff;
    padding-bottom: 0;
    min-height: calc(100vh - 106px);
}

/* 推荐页面无头部样式 */
.article-detail.no-header {
    padding-top: 0;
}

.article-detail.no-header .article-content.no-header-content {
    padding-top: 16px;
}

.article-header {
    padding: 16px;
    border-bottom: 1px solid #f4f5f6;
}

.article-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
    color: #222;
    margin-bottom: 12px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-tags .tag {
    padding: 4px 12px;
    background: #f4f5f6;
    border-radius: 3px;
    font-size: 13px;
    color: #666;
}

.article-content {
    padding: 20px 16px 40px;
    font-size: 17px;
    line-height: 1.8;
    color: #333;
    word-wrap: break-word;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 32px 0 16px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
}

.article-content h1 {
    font-size: 26px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.article-content h2 {
    font-size: 22px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f4f5f6;
}

.article-content h3 {
    font-size: 19px;
    position: relative;
    padding-left: 12px;
}

.article-content h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.3em;
    width: 4px;
    height: 1.2em;
    background: #ff6b00;
    border-radius: 2px;
}

.article-content h4 {
    font-size: 17px;
}

.article-content h5 {
    font-size: 16px;
}

.article-content h6 {
    font-size: 15px;
    color: #666;
}

.article-content p {
    margin-bottom: 16px;
    text-align: justify;
}

.article-content img {
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
}

.article-content a {
    color: #ff6b00;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.article-content a:hover {
    border-bottom-color: #ff6b00;
}

.article-content ul,
.article-content ol {
    padding-left: 20px;
    margin: 16px 0;
    line-height: 1.8;
}

.article-content ul {
    list-style: none;
}

.article-content ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 12px;
}

.article-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 6px;
    height: 6px;
    background: #ff6b00;
    border-radius: 50%;
}

.article-content ol {
    list-style: none;
    counter-reset: item;
}

.article-content ol li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    counter-increment: item;
}

.article-content ol li::before {
    content: counter(item) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: #ff6b00;
    font-weight: 600;
}

.article-content blockquote {
    padding: 16px 20px;
    margin: 20px 0;
    background: linear-gradient(to right, #fff5f0 0%, #fff 100%);
    border-left: 4px solid #ff6b00;
    color: #666;
    font-style: italic;
    position: relative;
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    left: 8px;
    top: 0;
    font-size: 48px;
    color: #ffe5d6;
    line-height: 1;
    font-family: Georgia, serif;
}

.article-content blockquote p {
    margin: 0;
    position: relative;
    z-index: 1;
}

.article-content code {
    padding: 3px 8px;
    background: #fff5f0;
    border: 1px solid #ffe5d6;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.88em;
    color: #e74c3c;
}

.article-content pre {
    padding: 16px;
    margin: 20px 0;
    background: #282c34;
    border-radius: 6px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.article-content pre code {
    padding: 0;
    background: none;
    border: none;
    color: #abb2bf;
    font-size: 14px;
}

.article-content table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 6px;
    overflow: hidden;
}

.article-content table thead {
    background: #ff6b00;
    color: #fff;
}

.article-content table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.article-content table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.article-content table tr:last-child td {
    border-bottom: none;
}

.article-content table tr:nth-child(even) {
    background: #fafafa;
}

.article-content hr {
    margin: 32px 0;
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

.article-content strong {
    color: #222;
    font-weight: 600;
}

.article-content em {
    color: #666;
}

.article-content mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
}

.article-content del {
    color: #999;
    text-decoration: line-through;
}

/* 文章互动按钮 */
.article-actions {
    background: #fff;
    border-top: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 16px;
    margin-bottom: 72px;
}

.action-bar {
    display: flex;
    justify-content: space-around;
    gap: 16px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:active {
    color: #ff6b00;
}

.action-btn.active {
    color: #ff6b00;
}

.action-btn .icon {
    flex-shrink: 0;
}

/* 相关推荐 */
.related-articles {
    padding: 16px;
    background: #f8f8f8;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #222;
}

/* 列表页 */
.list-container {
    background: #fff;
}

.list-header {
    padding: 20px 16px;
    border-bottom: 1px solid #f4f5f6;
}

.list-title {
    font-size: 24px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.list-description {
    font-size: 14px;
    color: #999;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    color: #666;
    transition: color 0.2s;
    text-decoration: none;
}

.bottom-nav .nav-item:active {
    color: #ff6b00;
    background: rgba(255, 107, 0, 0.05);
}

.bottom-nav .nav-item.active {
    color: #ff6b00;
}

.bottom-nav .nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.bottom-nav .nav-label {
    font-size: 11px;
    line-height: 1;
}

/* 响应式优化 */
@media (max-width: 374px) {
    .article-title {
        font-size: 20px;
    }
    
    .article-content {
        font-size: 16px;
    }
    
    .header-content {
        padding: 0 12px;
    }
    
    .article-card {
        padding: 10px 12px;
    }
}

@media (min-width: 768px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
    
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-card {
    animation: fadeIn 0.3s ease-out;
}

/* 分享面板样式 */
.share-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.share-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.share-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.share-panel.show .share-content {
    transform: translateY(0);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
}

.share-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.share-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.share-option:active {
    background: #f5f5f5;
}

.share-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: #fff;
}

.qq-icon {
    background: #12b7f5;
}

.telegram-icon {
    background: #0088cc;
}

.twitter-icon {
    background: #000;
}

.copy-icon {
    background: #666;
    font-size: 14px;
}

.share-option span {
    font-size: 12px;
    color: #666;
}

/* 访问数按钮样式 */
.views-btn {
    cursor: default;
}

.views-btn:active {
    color: #666 !important;
}

#page-views {
    font-weight: 500;
}

@media (max-width: 374px) {
    .share-options {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* 面包屑导航样式 */
.breadcrumb {
    padding: 12px 16px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
    font-size: 12px;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    color: #999;
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 8px;
    color: #ccc;
    font-size: 14px;
}

.breadcrumb-item a {
    color: #666;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: #ff6600;
}

.breadcrumb-item.active {
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* PWA 浮动安装按钮 */
#pwa-install-btn {
    position: fixed;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8533);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    z-index: 999;
    transition: all 0.3s ease;
    flex-direction: column;
    gap: 0;
}

#pwa-install-btn:active,
#pwa-install-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4);
}

#pwa-install-btn .pwa-icon {
    width: 28px;
    height: 28px;
    color: white;
}

#pwa-install-btn .pwa-label {
    font-size: 10px;
    margin-top: 2px;
    color: white;
    line-height: 1;
}

/* 响应式 - 平板以上 */
@media (min-width: 768px) {
    #pwa-install-btn {
        right: calc(50% - 272px);
    }
}

/* iOS 安装指导模态框 */
.ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: flex-end;
    animation: slideUp 0.3s ease;
    opacity: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ios-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}

.ios-modal-content {
    position: relative;
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
}

.ios-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: white;
}

.ios-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ios-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-modal-close:active {
    color: #666;
}

.ios-modal-body {
    padding: 20px 16px;
}

.ios-step-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px;
}

.ios-step {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.ios-step-num {
    min-width: 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8533);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.ios-step-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    flex: 1;
}

.ios-step-text strong {
    color: #ff6b00;
    font-weight: 600;
}

.ios-tips {
    font-size: 13px;
    color: #666;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin: 16px 0;
    line-height: 1.5;
}

.ios-modal-confirm {
    width: 100%;
    padding: 14px;
    margin: 0;
    background: linear-gradient(135deg, #ff6b00, #ff8533);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ios-modal-confirm:active {
    opacity: 0.9;
    transform: scale(0.98);
}

/* 安全距离 - iPhone 系列 */
@supports (padding: max(0px)) {
    .ios-modal-content {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .ios-modal-confirm {
        margin-bottom: max(0, env(safe-area-inset-bottom));
    }
}