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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

.container {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 60px 40px 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
}

.title {
    font-size: 24px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

.emoji {
    font-size: 20px;
}

.subtitle {
    font-size: 14px;
    color: #666666;
    margin-bottom: 30px;
}

.tabs-container {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 3px;
    min-width: 0;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 0;
    overflow: visible;
    border-radius: 8px;
    background-color: transparent;
    border: none;
    width: 100%;
}

.tab {
    padding: 10px 0;
    font-size: 13px;
    color: #666666;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 0;
    min-width: 0;
    width: 100%;
    position: relative;
    z-index: 1;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.tab.active {
    background-color: #ffffff;
    color: #000000;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transform: translateY(0);
    border-color: #d7d7d7;
    padding: 6px 0;
    height: 34px;
    margin-top: 2px;
}

.tab:hover {
    color: #222222;
    background-color: #f0f0f0;
}

.tab:active {
    transform: scale(0.97);
}

.tab:focus-visible {
    outline: 2px solid #777777;
    outline-offset: -2px;
}

.download-list {
    margin-bottom: 30px;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
    background-color: #333333;
    color: #cccccc;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-item:hover {
    color: #ffffff;
    background-color: #444444;
    transform: translateY(-1px);
}

.download-item:active {
    color: #aaaaaa;
    background-color: #222222;
    transform: translateY(0);
}

.download-item:focus-visible {
    outline: 2px solid #777777;
    outline-offset: 2px;
}

.download-empty {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px dashed #d8d8d8;
    border-radius: 8px;
    color: #999999;
    font-size: 13px;
    line-height: 1.5;
}

.download-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 500;
}

.status {
    flex-shrink: 0;
    font-size: 12px;
    color: #cccccc;
    margin-right: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background-color: #4caf50;
}

.status-indicator.offline {
    background-color: #f44336;
}

/* 内容区域样式 */
.content {
    display: none;
}

.content.active {
    display: block;
}

/* 教程部分样式 */
.tutorial {
    margin-bottom: 30px;
    text-align: center;
}

.tutorial-title {
    font-size: 14px;
    color: #333333;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.check-icon {
    margin-right: 6px;
    font-size: 16px;
}

.icons {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

.icon {
    width: 36px;
    height: 36px;
    background-color: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #999999;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon:hover {
    color: #333333;
    background-color: #e0e0e0;
}

.icon:active {
    color: #666666;
    background-color: #d0d0d0;
}

.copyright {
    font-size: 12px;
    color: #999999;
}

/* Logo样式 */
.logo {
    position: absolute;
    top: -95px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.logo img {
    max-width: 120px;
    height: auto;
    border: none;
    background: none;
}

/* 移动端适配：解决 TV/苹果带教程页面整体过高溢出问题 */
/* 放宽到 768px，覆盖所有手机及平板竖屏 */
@media (max-width: 768px) {
    body {
        /* 顶部留足空间，容纳悬挂在 container 上方的 logo，避免被裁切 */
        padding: 75px 8px 12px;
    }
    .container {
        /* 顶部 padding 保留给悬挂 logo 的下半部分 */
        padding: 45px 16px 22px;
        /* 智能居中：内容小于视口时垂直居中，超过视口时从顶部开始可滚动 */
        margin-top: auto;
        margin-bottom: auto;
    }
    /* 保持 logo 悬挂在卡片顶部上方的原版视觉效果 */
    .logo {
        top: -70px;
    }
    .logo img {
        max-width: 80px;
    }
    .title {
        font-size: 21px;
        margin-bottom: 4px;
    }
    .subtitle {
        font-size: 12px;
        margin-bottom: 16px;
    }
    .tabs-container {
        margin-bottom: 16px;
        padding: 3px;
    }
    .tabs {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-flow: row;
    }
    .tab {
        min-width: 0;
        width: 100%;
        margin: 0;
        font-size: 12px;
        padding: 8px 0;
        height: 34px;
    }
    .tab:nth-child(-n + 3) {
        grid-column: span 2;
    }
    .tab:nth-child(4) {
        grid-column: 1 / span 3;
    }
    .tab:nth-child(5) {
        grid-column: 4 / span 3;
    }
    .tab.active {
        height: 30px;
        padding: 5px 0;
    }
    .download-list {
        margin-bottom: 16px;
    }
    .download-item {
        min-height: 44px;
        padding: 11px 12px;
        margin-bottom: 8px;
        font-size: 13px;
    }
    .download-empty {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
    }
    .tutorial {
        margin-bottom: 16px;
    }
    .tutorial-title {
        font-size: 13px;
        margin-bottom: 10px;
    }
    .icons {
        gap: 8px;
    }
    .icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .copyright {
        font-size: 11px;
    }
}

/* 超小屏（iPhone SE 等 320-374px）进一步微调 */
@media (max-width: 374px) {
    body {
        padding: 60px 6px 10px;
    }
    .container {
        padding: 38px 12px 18px;
    }
    .logo {
        top: -58px;
    }
    .logo img {
        max-width: 68px;
    }
    .title {
        font-size: 19px;
    }
    .tab {
        min-width: 0;
        font-size: 11px;
        padding: 7px 0;
        height: 30px;
    }
    .tab.active {
        height: 26px;
        padding: 4px 0;
    }
    .download-item {
        padding: 10px 12px;
        font-size: 12px;
    }
    .icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .icons {
        gap: 6px;
    }
    /* 公告模块超小屏 */
    .marquee-item { font-size: 11px; padding: 0 6px; }
    .ann-card { padding-right: 40px; }
    .ann-card-close { top: 3px; right: 4px; }
    .ann-popup-actions { gap: 8px; }
    .ann-popup-btn { width: 100%; }
    .ann-card-title { font-size: 12px; }
    .ann-card-content { font-size: 11px; }
    .ann-bottom-title { font-size: 11px; }
    .ann-bottom-text { font-size: 10px; }
    .ann-popup-title { font-size: 15px; }
    .ann-popup-content { font-size: 12px; }
}

/* ============================================================
   公告模块样式
   ============================================================ */

/* 类型颜色变量 */
.ann-info    { --ann-bg: #e8f1ff; --ann-border: #4a90e2; --ann-text: #1a4f8a; --ann-btn: #4a90e2; }
.ann-warning { --ann-bg: #fff8e1; --ann-border: #f5a623; --ann-text: #8a5a00; --ann-btn: #f5a623; }
.ann-success { --ann-bg: #e8f7ed; --ann-border: #38a169; --ann-text: #1f5c34; --ann-btn: #38a169; }
.ann-primary { --ann-bg: #f3e8ff; --ann-border: #8b5cf6; --ann-text: #5b21b6; --ann-btn: #8b5cf6; }

/* ---------- 顶部跑马灯 ---------- */
.announcement-marquee {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, #fafafa, #f0f0f0, #fafafa);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
}
.marquee-icon {
    flex-shrink: 0;
    font-size: 14px;
    opacity: 0.7;
}
.marquee-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 20px;
}
.marquee-track {
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    will-change: transform;
    animation: marquee-scroll linear infinite;
}
@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.marquee-item {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    font-size: 13px;
    color: var(--ann-text, #555);
    background: var(--ann-bg, #f5f5f5);
    border-radius: 12px;
    margin-right: 8px;
    line-height: 20px;
}
.marquee-clickable {
    cursor: pointer;
    transition: opacity 0.2s ease;
    user-select: none;
}
.marquee-clickable:focus-visible {
    outline: 2px solid #777777;
    outline-offset: 2px;
}
.marquee-clickable:hover { opacity: 0.75; }
.marquee-icon-inline { margin-right: 4px; }
.marquee-sep { color: #bbb; margin: 0 4px; }

/* ---------- 顶部横幅卡片 ---------- */
.announcement-cards {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ann-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--ann-bg);
    border-left: 4px solid var(--ann-border);
    border-radius: 8px;
    padding: 12px 40px 12px 14px;
    color: var(--ann-text);
    position: relative;
    animation: ann-slide-in 0.3s ease-out;
}
@keyframes ann-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ann-card-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1.4;
}
.ann-card-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}
.ann-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}
.ann-card-content {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.9;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.ann-card-btn {
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--ann-btn);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.ann-card-btn:hover { opacity: 0.85; }
.ann-card-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.ann-card-close:hover {
    background: rgba(0,0,0,0.08);
    color: #333;
}

/* ---------- 底部公告列表 ---------- */
.announcement-bottom {
    margin-top: 24px;
    margin-bottom: 16px;
    text-align: left;
}
.announcement-bottom-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e0e0e0;
    text-align: center;
}
#announcement-bottom-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ann-bottom-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--ann-bg, #f9f9f9);
    border-left: 3px solid var(--ann-border, #ccc);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--ann-text, #555);
}
.ann-bottom-icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1.5;
}
.ann-bottom-content {
    flex: 1;
    min-width: 0;
}
.ann-bottom-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.4;
}
.ann-bottom-text {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.9;
    word-break: break-word;
}
.ann-bottom-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
}
.ann-bottom-time {
    color: #999;
}
.ann-bottom-link {
    color: var(--ann-btn, #4a90e2);
    text-decoration: none;
    font-weight: 500;
}
.ann-bottom-link:hover { text-decoration: underline; }

/* ---------- 首屏弹窗 ---------- */
.announcement-popup-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    animation: popup-fade-in 0.25s ease-out;
}
@keyframes popup-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.announcement-popup {
    background: #fff;
    border-radius: 14px;
    border-top: 5px solid var(--ann-border, #4a90e2);
    padding: 28px 24px 20px;
    max-width: 360px;
    width: 100%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: popup-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popup-pop-in {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}
.ann-popup-icon {
    font-size: 36px;
    margin-bottom: 12px;
}
.ann-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
    line-height: 1.4;
}
.ann-popup-content {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-break: break-word;
}
.ann-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.ann-popup-btn {
    min-height: 44px;
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--ann-btn, #4a90e2);
    color: #fff;
}
.ann-popup-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.ann-popup-secondary {
    background: #e2e8f0;
    color: #4a5568;
}
.ann-popup-secondary:hover { background: #cbd5e0; }

/* ---------- 公告样式移动端适配 ---------- */
@media (max-width: 768px) {
    .announcement-marquee { padding: 6px 10px; margin-bottom: 12px; }
    .marquee-item { font-size: 12px; padding: 0 8px; }
    .announcement-cards { margin-bottom: 12px; gap: 8px; }
    .ann-card { padding: 10px 40px 10px 12px; }
    .ann-card-title { font-size: 13px; }
    .ann-card-content { font-size: 11px; }
    .announcement-bottom { margin-top: 18px; margin-bottom: 12px; }
    .ann-bottom-item { padding: 8px 10px; }
    .ann-bottom-title { font-size: 12px; }
    .ann-bottom-text { font-size: 11px; }
    .announcement-popup { padding: 22px 18px 16px; }
    .ann-popup-title { font-size: 16px; }
    .ann-popup-content { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
