/**
 * 启动遮罩（CDN 测线 / 正在加载资源）— 在 Angular 与全局 styles 之前加载
 * 布局避免 inset / CSS Grid min() 等 Android 8.1 WebView（Chrome 61–66）不支持的写法
 */
/* 与 global.scss $page-bg-gray 一致（浅色为白底） */
html {
    min-height: 100%;
    min-height: -webkit-fill-available;
    background-color: #ffffff;
    --theme-color: #0fa248;
    /* 测速遮罩品牌区（正在选择线路 / 正在加载资源 共用） */
    --boot-brand-color: #0fa248;
    --boot-brand-color-dark: #6ee0a0;
    --boot-brand-title-size: 26px;
    --boot-brand-title-weight: 600;
    --boot-brand-title-spacing: 0.02em;
    --boot-brand-domain-size: 16px;
    --boot-brand-domain-weight: 500;
    --boot-brand-domain-spacing: 0.12em;
}

html.dark {
    background-color: #1f1f1f;
}

body {
    min-height: 100%;
    min-height: -webkit-fill-available;
    background-color: #ffffff;
}

html.dark body {
    background-color: #1f1f1f;
}

html.boot-splash-active:not(.dark),
html.boot-splash-active:not(.dark) body.boot-splash-active {
    background-color: #ffffff !important;
}

html.boot-splash-active.home-page-bg:not(.dark) {
    background-color: #ffffff !important;
}

html.dark.boot-splash-active,
html.dark.boot-splash-active body.boot-splash-active {
    background-color: #1f1f1f !important;
}

body.boot-splash-active {
    overflow: hidden;
    background-color: #ffffff;
}

html.dark body.boot-splash-active {
    background-color: #1f1f1f;
}

body.boot-splash-active app-root {
    visibility: hidden !important;
    pointer-events: none !important;
}

body.boot-splash-active .loading_index {
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-box-orient: vertical !important;
    -webkit-box-direction: normal !important;
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    -webkit-box-align: center !important;
    -webkit-align-items: center !important;
    align-items: center !important;
    -webkit-box-pack: center !important;
    -webkit-justify-content: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 2147483646 !important;
}

body.boot-splash-active .cdn-line-status:not(.cdn-line-status--error) {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: #888888 !important;
}

body.boot-splash-active .cdn-line-spinner {
    display: block !important;
}

/* 测线遮罩：14px + flex 垂直居中（品牌 159 + 间距 20 + 状态 72） */
html.boot-splash-active,
body.boot-splash-active {
    font-size: 14px !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.boot-splash-active .loading_index,
body.boot-splash-active .loading_index * {
    box-sizing: border-box !important;
}

.loading_index {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483646;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 16px;
    font-size: 14px;
    line-height: 1.5;
    background-color: #ffffff;
    pointer-events: auto;
    opacity: 1;
}

.loading_index > * {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

body.boot-splash-active .loading_index {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 16px !important;
    font-size: 14px !important;
}

html.dark .loading_index {
    background-color: #1f1f1f;
}

/* 测速各阶段共用 .loading_index，子元素样式固定，仅 #cdn-line-status 文案会变 */
.loading_index-brand__logo,
.loading_index-brand__title,
.loading_index-brand__domain {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    -webkit-font-smoothing: antialiased;
}

.loading_index-brand__logo {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 72px;
    height: 72px;
    min-width: 72px;
    max-width: 72px;
    margin: 0 auto 6px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #6a6a6a;
}

.loading_index-brand__title {
    margin-bottom: 6px;
    font-size: var(--boot-brand-title-size);
    font-weight: var(--boot-brand-title-weight);
    line-height: 1.3;
    color: var(--boot-brand-color);
    letter-spacing: var(--boot-brand-title-spacing);
}

.loading_index-brand__domain {
    margin-bottom: 20px;
    font-size: var(--boot-brand-domain-size);
    font-weight: var(--boot-brand-domain-weight);
    line-height: 1.3;
    color: var(--boot-brand-color);
    letter-spacing: var(--boot-brand-domain-spacing);
}

html.dark .loading_index-brand__title,
html.dark .loading_index-brand__domain {
    color: var(--boot-brand-color-dark);
}

body.boot-splash-active .loading_index-brand__logo,
body.boot-splash-active .loading_index-brand__title,
body.boot-splash-active .loading_index-brand__domain {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
}

body.boot-splash-active .loading_index-brand__logo {
    box-sizing: border-box !important;
    width: 72px !important;
    height: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    margin: 0 auto 6px !important;
    border-radius: 12px !important;
    border: 1px solid #6a6a6a !important;
}

body.boot-splash-active .loading_index-brand__title {
    margin: 0 0 6px !important;
    font-size: var(--boot-brand-title-size) !important;
    font-weight: var(--boot-brand-title-weight) !important;
    line-height: 1.3 !important;
    color: var(--boot-brand-color) !important;
    letter-spacing: var(--boot-brand-title-spacing) !important;
}

body.boot-splash-active .loading_index-brand__domain {
    margin: 0 0 20px !important;
    font-size: var(--boot-brand-domain-size) !important;
    font-weight: var(--boot-brand-domain-weight) !important;
    line-height: 1.3 !important;
    color: var(--boot-brand-color) !important;
    letter-spacing: var(--boot-brand-domain-spacing) !important;
}

html.dark body.boot-splash-active .loading_index-brand__title,
html.dark body.boot-splash-active .loading_index-brand__domain {
    color: var(--boot-brand-color-dark) !important;
}

.cdn-line-spinner {
    display: block;
    width: 22px;
    height: 22px;
    margin: 4px auto 10px;
    border: 2px solid #cccccc;
    border-top-color: #0fa248;
    border-radius: 50%;
    -webkit-animation: cdn-line-spin 0.75s linear infinite;
    animation: cdn-line-spin 0.75s linear infinite;
}

.loading_index.loading_index--error .cdn-line-spinner {
    visibility: hidden;
    -webkit-animation: none;
    animation: none;
}

@-webkit-keyframes cdn-line-spin {
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

@keyframes cdn-line-spin {
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

.loading_index--has-status #cdn-line-status.cdn-line-status,
.loading_index--busy #cdn-line-status.cdn-line-status {
    display: inline-block;
}

.cdn-line-status:not(.cdn-line-status--error) {
    display: inline-block;
    margin: 0;
    padding: 0;
    min-width: 9.5em;
    min-height: 21px;
    line-height: 21px;
    text-align: center;
    font-size: inherit;
    color: #888888 !important;
    white-space: nowrap;
}

.loading_index--error #cdn-line-status.cdn-line-status {
    max-width: calc(100vw - 48px);
}

.cdn-line-status.cdn-line-status--error {
    display: block;
    margin: 0;
    padding: 0 8px;
    text-align: center;
    font-size: inherit;
    min-height: 21px;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    color: #ff4444 !important;
}

.cdn-boot-retry {
    display: none;
    margin-top: 16px;
    padding: 10px 28px;
    font-size: 15px;
    line-height: 1.2;
    color: #ffffff;
    background: #0fa248;
    background: var(--theme-color, #0fa248);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.loading_index--error .cdn-boot-retry {
    display: inline-block;
}

/**
 * 首页关键布局（与 tab-index.scss 对齐，在 styles.*.css 未就绪时防 FOUC）
 * 仅覆盖 Tab 首页 #main 首屏结构，勿在此处堆叠完整主题样式。
 */
ion-content.content_bg#main,
ion-content#main {
    --padding-start: 0;
    --padding-end: 0;
}

ion-content.content_bg#main .top-search-bar,
ion-content#main .top-search-bar {
    position: relative;
    padding: 6px 5px;
}

ion-content.content_bg#main .top-search-bar .logo,
ion-content#main .top-search-bar .logo {
    position: absolute;
    left: 5px;
    top: 8px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

ion-content.content_bg#main .top-search-bar .right-icon,
ion-content#main .top-search-bar .right-icon {
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 26px;
}

ion-content.content_bg#main .top-search-bar .top-search-wrap,
ion-content#main .top-search-bar .top-search-wrap {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    min-height: 36px;
    margin: 0 40px 0 40px;
    border-radius: 18px;
}

ion-content.content_bg#main .tab-banner-wrap,
ion-content#main .tab-banner-wrap {
    position: relative;
    margin: 0 5px 8px;
    border-radius: 8px;
    overflow: hidden;
}

ion-content.content_bg#main .tab-banner-wrap::before,
ion-content#main .tab-banner-wrap::before {
    content: '';
    display: block;
    width: 100%;
    padding-bottom: 56.25%;
}

ion-content.content_bg#main .tab-banner-placeholder,
ion-content#main .tab-banner-placeholder {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: #e8e8e8;
}

html.dark ion-content.content_bg#main .tab-banner-placeholder,
html.dark ion-content#main .tab-banner-placeholder {
    background-color: #2a2a2a;
}

ion-content.content_bg#main .tab-banner-wrap > .swiper,
ion-content#main .tab-banner-wrap > .swiper {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

ion-content.content_bg#main .actions-toolbar,
ion-content#main .actions-toolbar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-around;
    justify-content: space-around;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin: 6px 5px;
    padding: 10px 2px 8px;
    min-height: 84px;
    border-radius: 8px;
}

ion-content.content_bg#main .actions-toolbar .actions-toolbar-item,
ion-content#main .actions-toolbar .actions-toolbar-item {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

ion-content.content_bg#main .gundong,
ion-content#main .gundong {
    position: relative;
    margin: 0 5px 8px;
    padding: 0 10px 0 36px;
    min-height: 40px;
    border-radius: 20px;
    overflow: hidden;
}

ion-content.content_bg#main ion-grid,
ion-content#main ion-grid {
    padding: 0;
}

ion-content.content_bg#main ion-col,
ion-content#main ion-col {
    padding: 4px;
}

ion-content.content_bg#main app-cover .book .cover,
ion-content#main app-cover .book .cover {
    position: relative;
    width: 100%;
    padding-bottom: 140%;
    overflow: hidden;
    border-radius: 5px;
}

ion-content.content_bg#main app-cover .book .cover .image,
ion-content#main app-cover .book .cover .image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 首页数据未返回时的骨架屏（遮罩收起后首帧） */
ion-content#main .home-skeleton-grid {
    padding: 0;
}

ion-content#main .home-skeleton-grid ion-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

ion-content#main .home-skeleton-grid ion-col {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 33.333%;
    flex: 0 0 33.333%;
    max-width: 33.333%;
    padding: 4px;
    box-sizing: border-box;
}

ion-content#main .home-skeleton-grid ion-thumbnail {
    display: block;
    width: 100%;
    height: 140px;
}
