/* ===========================================================
   shell.css —— 站点外壳：顶部胶囊导航 + 背景渐变层 + 页面切换
   =========================================================== */

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    font-family: "Poppins", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background: #ffffff;
}

/* ---------- 背景层：每个页面一层，靠 opacity 交叉过渡 ---------- */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.backdrop-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.06);
    /* 慢速交叉渐变，营造切换的仪式感 */
    transition: opacity 1.3s cubic-bezier(.4, 0, .2, 1), transform 1.9s cubic-bezier(.4, 0, .2, 1);
}

.backdrop-layer.is-active {
    opacity: 1;
    transform: scale(1);
}

/* 致命公司：与子页面内部一致的流光渐变（子页面覆盖后不可见，仅用于切换过渡） */
.backdrop-layer[data-page="lethal-company"] {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: shellGradient 15s ease infinite;
}

/* 主页：无背景颜色（纯白），切换时由渐变过渡而来 */
.backdrop-layer[data-page="home"] {
    background: #ffffff;
}

/* 我的世界：纯黑 */
.backdrop-layer[data-page="minecraft"] {
    background: #000000;
}

@keyframes shellGradient {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ---------- 顶部导航 ---------- */
.topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    display: flex;
    justify-content: center;
    padding: 16px 20px;
    pointer-events: none;
    transition: opacity .9s ease, transform .9s ease;
}

/* 我的世界下滑后：导航栏渐变消失，回到顶部自动恢复 */
body.chrome-hidden .topbar {
    opacity: 0;
    transform: translateY(-26px);
    pointer-events: none;
}

/* 主题变量：随当前页面切换 */
body[data-theme="light"] {
    --nav-bg: rgba(255, 255, 255, .62);
    --nav-border: rgba(15, 23, 42, .08);
    --nav-fg: #6b7280;
    --nav-fg-active: #111827;
    --nav-shadow: 0 10px 30px rgba(15, 23, 42, .12);
}

body[data-theme="color"] {
    --nav-bg: rgba(255, 255, 255, .55);
    --nav-border: rgba(255, 255, 255, .68);
    --nav-fg: #f9fafb;
    --nav-fg-active: #111827;
    --nav-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

body[data-theme="dark"] {
    --nav-bg: rgba(24, 24, 27, .62);
    --nav-border: rgba(255, 255, 255, .14);
    --nav-fg: #a1a1aa;
    --nav-fg-active: #111827;
    --nav-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

.page-switch {
    position: relative;
    display: flex;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--nav-border);
    border-radius: 999px;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--nav-shadow);
    pointer-events: auto;
    transition: background .9s ease, border-color .9s ease, box-shadow .9s ease;
}

/* 滑动高亮块 */
.switch-pill {
    position: absolute;
    top: 6px;
    left: 0;
    height: calc(100% - 12px);
    width: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    transition: transform .9s cubic-bezier(.34, 1.28, .64, 1), width .9s cubic-bezier(.34, 1.28, .64, 1);
    will-change: transform, width;
}

.switch-item {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--nav-fg);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color .7s ease, transform .3s ease;
}

.switch-item:hover { transform: translateY(-1px); }

.switch-item.is-active { color: var(--nav-fg-active); }

.switch-item .ico { font-size: 16px; line-height: 1; }

/* ---------- 页面舞台 ---------- */
.stage {
    position: fixed;
    inset: 0;
    z-index: 10;
}

.page {
    position: absolute;
    inset: 0;
    overflow: hidden; /* 主页与致命公司页不出现滚动条 */
    opacity: 0;
    transform: translateX(var(--shift, 0px));
    pointer-events: none;
    /* 慢速、从容的滑入滑出（具体延迟由 shell.js 控制） */
    transition: opacity .95s ease, transform 1.15s cubic-bezier(.22, .61, .36, 1);
    will-change: transform, opacity;
}

.page.is-active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.page-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 主页 / 致命公司：把可能出现的滚动条挤到可视区外，视觉上看不到滚动条；
   内容在极矮窗口下仍可用滚轮查看（滚动条不可见而已） */
.page[data-page="home"] .page-frame,
.page[data-page="lethal-company"] .page-frame {
    width: calc(100% + 24px);
}

/* 我的世界：保留滚动条（后续内容会变长） */
.page[data-page="minecraft"] .page-frame {
    overflow: auto;
}

/* ---------- 加载提示 ---------- */
.boot-hint {
    position: fixed;
    bottom: 18px;
    left: 50%;
    z-index: 40;
    transform: translateX(-50%);
    max-width: min(560px, 92vw);
    padding: 12px 18px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fff1f2;
    color: #9f1239;
    font-size: 13px;
    line-height: 1.7;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.boot-hint code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #ffe4e6;
    font-size: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .topbar { padding: 10px 12px; }
    .switch-item { padding: 9px 14px; font-size: 13px; gap: 5px; }
    .switch-item .txt { display: inline; }
}

@media (max-width: 420px) {
    .switch-item .txt { display: none; }
    .switch-item { padding: 10px 14px; }
    .switch-item .ico { font-size: 18px; }
}

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