/* ==================================================================
   《PO 猫的日记》全局样式 —— iOS 液态玻璃风格
   自动适配浏览器日间 / 夜间模式
   ================================================================== */

/* ---------- 主题变量：日间模式（默认） ---------- */
/* 规则：面板/按钮/排行榜 = 白色透明玻璃 + 黑色文字 */
:root {
    --tint-color: 255, 255, 255;
    --tint-opacity: 0.55;
    --glass-scrim: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-border-soft: rgba(255, 255, 255, 0.55);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --inner-highlight: rgba(255, 255, 255, 0.95);
    --glass-radius: 28px;

    --accent: #6d5fe0;
    --accent-2: #5a4dc7;
    --accent-soft: rgba(109, 95, 224, 0.14);

    /* 页面文字（主菜单等，直接显示在浅色背景上）：黑色 */
    --text: #1a1a24;
    --text-dim: rgba(30, 30, 45, 0.72);
    --text-faint: rgba(30, 30, 45, 0.5);

    /* 面板文字（弹窗/排行榜内，白色透明玻璃上）：黑色 */
    --panel-text: #1a1a24;
    --panel-text-dim: rgba(30, 30, 45, 0.75);
    --panel-text-faint: rgba(30, 30, 45, 0.55);
    --title-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);

    /* 次级按钮：白色透明玻璃，黑字（颜色继承 --text） */
    --btn-ghost-bg: rgba(255, 255, 255, 0.55);
    --btn-ghost-border: rgba(90, 77, 199, 0.35);
    --btn-ghost-hover-bg: rgba(255, 255, 255, 0.75);

    /* 输入框 / 勾选框 */
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-border: rgba(90, 77, 199, 0.3);
    --check-border: rgba(90, 77, 199, 0.45);
    --check-bg: rgba(255, 255, 255, 0.5);

    /* 轨道 / 滚动条 */
    --track-bg: rgba(90, 77, 199, 0.18);
    --thumb-bg: rgba(90, 77, 199, 0.3);

    /* 遮罩（日间用浅灰，避免把弹窗压黑） */
    --overlay-bg: rgba(120, 120, 140, 0.22);
    --scrim-strong: rgba(80, 80, 100, 0.4);

    /* 背景虚化（主菜单时启用） */
    --bg-blur: 0px;

    /* 按钮文字色：日间黑字 */
    --btn-text: #1a1a24;

    --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 主题变量：夜间模式 ---------- */
/* 规则：面板/按钮/排行榜 = 暗黑玻璃 + 白色文字 */
@media (prefers-color-scheme: dark) {
    :root {
        --tint-color: 20, 20, 32;
        --tint-opacity: 0.45;
        --glass-scrim: rgba(18, 18, 30, 0.92);
        --glass-border: rgba(255, 255, 255, 0.18);
        --glass-border-soft: rgba(255, 255, 255, 0.1);
        --glass-shadow: rgba(0, 0, 0, 0.5);
        --inner-highlight: rgba(255, 255, 255, 0.3);

        --accent: #8b7cf7;
        --accent-2: #b39dff;
        --accent-soft: rgba(139, 124, 247, 0.22);

        /* 页面文字（深色背景上）：白色 */
        --text: #ffffff;
        --text-dim: rgba(255, 255, 255, 0.82);
        --text-faint: rgba(255, 255, 255, 0.55);

        /* 面板文字（暗黑玻璃上）：白色 */
        --panel-text: #ffffff;
        --panel-text-dim: rgba(255, 255, 255, 0.84);
        --panel-text-faint: rgba(255, 255, 255, 0.58);
        --title-shadow: 0 2px 10px rgba(0, 0, 0, 0.65), 0 1px 2px rgba(0, 0, 0, 0.8);

        /* 次级按钮：暗黑玻璃，白字 */
        --btn-ghost-bg: rgba(20, 20, 30, 0.5);
        --btn-ghost-border: rgba(255, 255, 255, 0.28);
        --btn-ghost-hover-bg: rgba(40, 40, 55, 0.6);

        --input-bg: rgba(255, 255, 255, 0.08);
        --input-border: rgba(255, 255, 255, 0.25);
        --check-border: rgba(255, 255, 255, 0.4);
        --check-bg: rgba(255, 255, 255, 0.06);

        --track-bg: rgba(255, 255, 255, 0.14);
        --thumb-bg: rgba(255, 255, 255, 0.3);

        --overlay-bg: rgba(5, 5, 12, 0.6);
        --scrim-strong: rgba(5, 5, 12, 0.72);

        /* 按钮文字色：夜间白字 */
        --btn-text: #ffffff;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
        'Microsoft YaHei', 'Hiragino Sans GB', system-ui, sans-serif;
    color: var(--text);
    background: #0a0a0f;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    user-select: none;
    -webkit-user-select: none;
}

.lg-svg-defs { position: absolute; width: 0; height: 0; }

.hidden { display: none !important; }
.invisible { opacity: 0 !important; pointer-events: none !important; }

/* ==================================================================
   背景层（主菜单进入时渐进式虚化）
   ================================================================== */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: url('/asset/start.png') center/cover no-repeat;
    background-color: #05050a;
    transform: scale(1.04);
    /* 关键：blur 通过 CSS 变量控制，主菜单时由 .menu-blur 渐进增大 */
    filter: blur(var(--bg-blur)) saturate(1.1);
    transition: transform 0.6s var(--ease-out), filter 1.1s var(--ease-smooth);
    will-change: transform, filter;
}

/* 主菜单阶段：背景渐进虚化 */
.menu-blur { --bg-blur: 18px; }

.bg-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.18) 100%);
}
@media (prefers-color-scheme: dark) {
    .bg-vignette {
        background:
            radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.5) 100%),
            linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.4) 100%);
    }
}

/* ==================================================================
   应用容器与屏幕
   ================================================================== */
#frame {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

#app {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.screen {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
    opacity: 0;
    pointer-events: none;
    /* 与 .overlay 一致的遮罩背景，让玻璃面板效果统一 */
    background: var(--overlay-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: opacity 0.5s var(--ease-smooth);
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* 主菜单、加载页不需要遮罩，直接展示在背景上 */
#screen-menu,
#screen-loading {
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* ==================================================================
   液态玻璃通用面板（iOS 风格）
   ================================================================== */
.glass {
    position: relative;
    isolation: isolate;
    border-radius: var(--glass-radius);
    /* 液态玻璃双层背景：上层半透明（通透感），下层衬底（可读性） */
    background:
        rgba(var(--tint-color), var(--tint-opacity)),
        var(--glass-scrim);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 8px 24px var(--glass-shadow),
        inset 0 0 20px -5px var(--inner-highlight);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
    backdrop-filter: blur(28px) saturate(1.8);
    overflow: hidden;
}

/* 顶部高光（iOS 玻璃质感，跟随主题） */
.glass-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    border-radius: var(--glass-radius) var(--glass-radius) 0 0;
    background: linear-gradient(180deg, var(--inner-highlight), transparent);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

/* 确保面板内容在高光之上 */
.modal, .device-card, .rank-wrap, .finish-card {
    position: relative;
    z-index: 1;
}
.modal > *, .device-card > *, .rank-wrap > *, .finish-card > * {
    position: relative;
    z-index: 1;
}

/* 标题投影：保证任意背景下可读 */
.modal-title,
.finish-title,
.rank-title {
    text-shadow: var(--title-shadow);
}

/* ==================================================================
   设备检测屏
   ================================================================== */
.device-card {
    min-width: min(420px, 88vw);
    padding: 36px 32px 28px;
    text-align: center;
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    transition: transform 0.5s var(--ease-spring), opacity 0.4s var(--ease-out);
}

.screen.active .device-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.device-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-2);
}

.device-icon svg { width: 30px; height: 30px; }

.device-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    color: var(--panel-text);
}

.device-tip {
    font-size: 14px;
    line-height: 1.7;
    color: var(--panel-text-dim);
    margin-bottom: 24px;
}

/* ==================================================================
   按钮（iOS 风格）
   ================================================================== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 30px;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--btn-text);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s var(--ease-spring), box-shadow 0.25s var(--ease-out), background 0.25s, opacity 0.25s, border-color 0.25s;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #ffffff;
    box-shadow: 0 6px 22px rgba(109, 95, 224, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 10px 30px rgba(109, 95, 224, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.96); }

.btn-ghost {
    /* 次级按钮：玻璃质感 + 描边 */
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    color: var(--btn-text);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.btn-ghost:hover {
    background: var(--btn-ghost-hover-bg);
}

.btn-block { width: 100%; }
.btn-sm { padding: 10px 20px; font-size: 13px; }
.btn-lg { padding: 16px 38px; font-size: 16px; }

/* 按钮光波 */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.5s var(--ease-out), height 0.5s var(--ease-out), opacity 0.5s;
    opacity: 0;
    pointer-events: none;
}
.btn:active::after { width: 320px; height: 320px; opacity: 1; transition: 0s; }

/* ==================================================================
   加载屏
   ================================================================== */
.loader {
    position: absolute;
    left: 64px;
    bottom: 64px;
    max-width: min(380px, 60vw);
}

.screen.active .loader {
    animation: loader-in 0.6s var(--ease-spring) both;
}

@keyframes loader-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.loader-title {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--text-dim);
    margin-bottom: 16px;
    text-transform: uppercase;
    text-shadow: var(--title-shadow);
}

.loader-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--track-bg);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.loader-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 14px rgba(139, 124, 247, 0.7);
    transition: width 0.3s var(--ease-out);
}

.loader-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
}

.loader-text {
    font-size: 13px;
    color: var(--text-dim);
    text-shadow: var(--title-shadow);
}

.loader-percent {
    font-size: 13px;
    font-family: 'SF Mono', ui-monospace, monospace;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* ==================================================================
   公告 / 通用弹窗
   ================================================================== */
.modal {
    width: min(560px, 90vw);
    max-height: 82vh;
    padding: 32px 32px 26px;
    display: flex;
    flex-direction: column;
    transform: translateY(24px) scale(0.95);
    opacity: 0;
    transition: transform 0.5s var(--ease-spring), opacity 0.4s var(--ease-out);
}

.screen.active .modal,
.overlay.active .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.modal-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--panel-text);
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--thumb-bg) transparent;
    padding-right: 4px;
    margin: 0 -4px 4px 0;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--thumb-bg); border-radius: 2px; }

.announce-content {
    font-size: 15px;
    line-height: 1.85;
    color: var(--panel-text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-foot {
    margin-top: 22px;
    flex-shrink: 0;
}

/* 勾选行 */
.check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    cursor: pointer;
    font-size: 14px;
    color: var(--panel-text-dim);
    user-select: none;
}

.check-row input { position: absolute; opacity: 0; width: 0; height: 0; }

.check-box {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 1.5px solid var(--check-border);
    background: var(--check-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s var(--ease-spring);
}

.check-row input:checked + .check-box {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(109, 95, 224, 0.5);
}

.check-box svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0.4);
    transition: all 0.25s var(--ease-spring);
}

.check-row input:checked + .check-box svg {
    opacity: 1;
    transform: scale(1);
}

/* ==================================================================
   主菜单
   ================================================================== */
.menu {
    position: relative;
    z-index: 2;
    text-align: center;
}

.screen.active .menu { animation: menu-in 0.7s var(--ease-spring) both; }
@keyframes menu-in {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

.logo {
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    margin-bottom: 10px;
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 10px rgba(90, 77, 199, 0.35));
}
@media (prefers-color-scheme: dark) {
    .logo {
        background: linear-gradient(180deg, #ffffff, #cfc6ff);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.5));
    }
}

.logo-sub {
    font-size: 14px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 48px;
}

.menu-btns {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.menu-btn {
    width: min(280px, 80vw);
}

/* ==================================================================
   通用遮罩弹窗（姓名/确认/重复）
   ================================================================== */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease-smooth);
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==================================================================
   姓名输入
   ================================================================== */
.name-input {
    width: 100%;
    padding: 16px 18px;
    font-size: 18px;
    font-family: inherit;
    color: var(--panel-text);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 16px;
    outline: none;
    text-align: center;
    letter-spacing: 0.1em;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
    margin-bottom: 12px;
}

.name-input::placeholder { color: var(--panel-text-faint); letter-spacing: 0.05em; }

.name-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(109, 95, 224, 0.18);
}

.name-hint {
    font-size: 12.5px;
    color: var(--panel-text-faint);
    text-align: center;
    margin-bottom: 6px;
    line-height: 1.6;
}

.name-counter {
    font-size: 12px;
    color: var(--panel-text-faint);
    font-family: 'SF Mono', ui-monospace, monospace;
    text-align: right;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.modal-actions .btn { flex: 1; }

.confirm-text {
    font-size: 15px;
    line-height: 1.9;
    color: var(--panel-text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

.confirm-text .name-highlight {
    color: var(--accent-2);
    font-weight: 700;
}

/* ==================================================================
   Toast 提示（iOS 通知胶囊，深底白字）
   ================================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(64px + var(--safe-bottom));
    transform: translate(-50%, 20px);
    z-index: 200;
    padding: 13px 22px;
    border-radius: 999px;
    font-size: 13.5px;
    color: #ffffff;
    background: rgba(20, 16, 32, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out), transform 0.35s var(--ease-spring);
    max-width: 86vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ==================================================================
   游戏播放页
   ================================================================== */
#stage {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #000;
    overflow: hidden;
}

.bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    background: #000;
}

/* 字幕层 */
.captions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 11%;
    z-index: 3;
    display: flex;
    justify-content: center;
    padding: 0 6vw;
    pointer-events: none;
}

.caption-text {
    max-width: min(820px, 88vw);
    text-align: center;
    font-size: clamp(18px, 3.2vw, 30px);
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    text-shadow:
        0 2px 14px rgba(0, 0, 0, 0.85),
        0 0 2px rgba(0, 0, 0, 0.9);
    padding: 10px 22px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
    letter-spacing: 0.04em;
}

.caption-text.show {
    opacity: 1;
    transform: translateY(0);
}

/* 游戏页准备遮罩 */
.stage-ready {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--scrim-strong);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    gap: 18px;
    transition: opacity 0.5s var(--ease-out);
}

.stage-ready.hide { opacity: 0; pointer-events: none; }

.ready-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--accent-2);
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ready-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.08em;
}

/* 结算屏 */
.finish-screen {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--scrim-strong);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s var(--ease-out);
}

.finish-screen.active { opacity: 1; pointer-events: auto; }

.finish-card {
    width: min(460px, 90vw);
    padding: 36px 32px 28px;
    text-align: center;
}

.finish-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(139, 124, 247, 0.5);
    animation: pop 0.6s var(--ease-spring) both;
}

@keyframes pop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

.finish-icon svg { width: 32px; height: 32px; color: #fff; }

.finish-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--panel-text);
}

.finish-time {
    font-size: 14px;
    color: var(--panel-text-dim);
    line-height: 1.7;
    margin-bottom: 6px;
}

.finish-time strong {
    color: var(--accent-2);
    font-family: 'SF Mono', ui-monospace, monospace;
    font-weight: 600;
}

.finish-note {
    font-size: 12.5px;
    color: var(--panel-text-faint);
    margin-bottom: 22px;
}

/* ==================================================================
   排行榜
   ================================================================== */
.rank-wrap {
    width: min(620px, 92vw);
    max-height: 88vh;
    padding: 30px 28px 24px;
    display: flex;
    flex-direction: column;
}

.rank-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-shrink: 0;
}

.rank-title { font-size: 22px; font-weight: 700; color: var(--panel-text); }

.rank-scroll-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.rank-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    padding-right: 10px;
    scrollbar-width: none;
}
.rank-list::-webkit-scrollbar { width: 0; display: none; }
.rank-list::-webkit-scrollbar-thumb { display: none; }

.rank-scrollbar {
    width: 10px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--glass-scrim);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid var(--btn-ghost-border);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s var(--ease-out);
}
.rank-scroll-wrap:hover .rank-scrollbar,
.rank-scroll-wrap:focus-within .rank-scrollbar {
    opacity: 1;
}
.rank-scrollbar.force-show {
    opacity: 1;
}

.rank-scroll-thumb {
    position: absolute;
    left: 1.5px;
    right: 1.5px;
    top: 0;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to));
    box-shadow: 0 2px 8px rgba(130, 100, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.35);
    cursor: grab;
    min-height: 30px;
    transition: transform 0.08s linear, box-shadow 0.2s;
    user-select: none;
    -webkit-user-select: none;
}
.rank-scroll-thumb:hover {
    box-shadow: 0 3px 12px rgba(130, 100, 255, 0.55), inset 0 1px 0 rgba(255,255,255,0.5);
}
.rank-scroll-thumb:active,
.rank-scroll-thumb.dragging {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(130, 100, 255, 0.7), inset 0 1px 0 rgba(255,255,255,0.55);
    transform: scaleX(1.12);
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    margin-bottom: 10px;
    transition: transform 0.2s var(--ease-spring), background 0.2s;
    animation: rank-in 0.4s var(--ease-out) both;
}
.rank-item:hover { background: var(--btn-ghost-hover-bg); transform: translateX(2px); }

@keyframes rank-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rank-num {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-2);
    font-variant-numeric: tabular-nums;
}

.rank-item.top-1 .rank-num { background: linear-gradient(135deg, #ffd86b, #ff9d3d); color: #3a2400; box-shadow: 0 4px 16px rgba(255, 157, 61, 0.4); }
.rank-item.top-2 .rank-num { background: linear-gradient(135deg, #e6e6e6, #b0b0b0); color: #2a2a2a; }
.rank-item.top-3 .rank-num { background: linear-gradient(135deg, #e0a06a, #b07238); color: #2a1500; }

.rank-info { flex: 1; min-width: 0; }
.rank-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--panel-text);
}
.rank-time {
    font-size: 12.5px;
    color: var(--panel-text-faint);
    font-family: 'SF Mono', ui-monospace, monospace;
}

.rank-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--panel-text-faint);
    font-size: 14px;
    line-height: 1.8;
}

/* ==================================================================
   返回主菜单按钮（通用浮动）
   ================================================================== */
.back-bar {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 20px;
    z-index: 30;
}

/* noscript */
.noscript-msg {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    background: #0a0a0f;
    color: #fff;
    font-size: 16px;
    line-height: 1.7;
}

/* ==================================================================
   响应式：横屏强制与手机适配
   ================================================================== */
.is-mobile #app,
.is-mobile .screen,
.is-mobile #stage {
    /* 由 JS 切换 .landscape-locked 状态控制 */
}

.landscape-frame {
    position: fixed;
    z-index: 100;
    transform-origin: top left;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .loader { left: 28px; bottom: 36px; max-width: 70vw; }
    .modal { padding: 26px 22px 22px; }
    .logo-sub { margin-bottom: 36px; }
    .captions { bottom: 14%; }
    .caption-text { font-size: 17px; padding: 8px 16px; }
    .rank-wrap { padding: 24px 18px 18px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .logo { font-size: clamp(32px, 8vh, 56px); }
    .logo-sub { margin-bottom: 24px; }
    .menu-btns { gap: 12px; }
    .menu-btn { width: min(240px, 70vw); }
}
