/* 首页 WAP 文游门户 — 固定浅色主题，不跟随系统深色模式 */
.safari-content.is-start-page {
    color-scheme: light;
    background: #f2f2f7;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* 保留 easyclick-shell 的 padding-top/bottom，避免内容被顶栏/底栏遮挡 */
    padding-bottom: var(--safari-bottom-chrome-h, calc(55px + env(safe-area-inset-bottom, 0px)));
}

.portal-home {
    color-scheme: light;
    color: #1c1c1e;
    line-height: 1.45;
    min-height: 100%;
    padding: 8px 16px 24px;
    box-sizing: border-box;
}

.portal-home-container {
    max-width: 640px;
    margin: 0 auto;
}

.portal-home-loading,
.portal-home-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #8e8e93;
    font-size: 15px;
}

.portal-home-error {
    color: #ff3b30;
}

/* 顶部品牌区 */
.portal-home-hero {
    margin-bottom: 20px;
    padding: 4px 4px 0;
}

.portal-home-hero-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1c1c1e;
    line-height: 1.15;
}

.portal-home-hero-tagline {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #636366;
    font-weight: 500;
}

.portal-home-hero-desc {
    margin: 8px 0 0;
    font-size: 14px;
    color: #8e8e93;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.portal-home-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 分区卡片 */
.portal-home-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 14px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.portal-home-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
    padding: 0 2px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1c1c1e;
}

.portal-home-section-title-text {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.portal-home-section-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: #8e8e93;
    background: #f2f2f7;
    padding: 3px 8px;
    border-radius: 10px;
}

.portal-home-section-dot {
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, #007aff 0%, #5856d6 100%);
    flex-shrink: 0;
}

/* 应用图标网格 */
.portal-home-card-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
}

.portal-home-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: transparent;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    width: 100%;
}

.portal-home-tile:active {
    opacity: 0.72;
    transform: scale(0.96);
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.portal-home-tile-icon {
    --tile-hue: 210;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(
        145deg,
        hsl(var(--tile-hue), 72%, 58%) 0%,
        hsl(calc(var(--tile-hue) + 28), 68%, 48%) 100%
    );
    box-shadow:
        0 4px 12px hsla(var(--tile-hue), 55%, 45%, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.portal-home-tile-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    color: #3a3a3c;
    word-break: break-all;
}

/* 兼容旧结构（无 tile 包装时） */
.portal-home-card-body a:not(.portal-home-tile),
.portal-home-card-body button.portal-home-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    min-height: auto;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    color: inherit;
}

.portal-home-card-body .name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    color: #3a3a3c;
}

@media (max-width: 360px) {
    .portal-home-card-body {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px 6px;
    }

    .portal-home-tile-icon {
        width: 52px;
        height: 52px;
        font-size: 20px;
        border-radius: 13px;
    }
}

@media (min-width: 481px) {
    .portal-home-container {
        max-width: 720px;
    }

    .portal-home-card-body {
        grid-template-columns: repeat(5, 1fr);
        gap: 14px 10px;
    }

    .portal-home-tile-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
        border-radius: 15px;
    }

    .portal-home-tile-name {
        font-size: 12px;
    }
}

@media (min-width: 769px) {
    .portal-home-container {
        max-width: 960px;
    }

    .portal-home-card-body {
        grid-template-columns: repeat(6, 1fr);
    }
}
