/* =====================================================================
 * 精神领域（Mind Realm）· ②号子屏幕入口组件样式
 * ---------------------------------------------------------------------
 * mre-  ②号子屏幕入口组件（星球 + 双文字条）
 * 公测版只保留入口按钮占位，领域内部界面（原 mrg-* / 星图样式）不随包发布。
 * 独立文件：不与其它功能共用选择器；仅对自身挂载槽做定位微调。
 * ===================================================================== */

/* ============================================================
 * ②号子屏幕入口组件
 * 通过负外边距把本组件上提到快捷区的流内横带（快捷区自身经
 * sub-screen-2-shortcuts.css 纯视觉下移，本横带只剩本组件）。
 * 2026-08-17：快捷区下移后本组件水平居中，视觉更平衡。
 * ============================================================ */

#ss2-widget-mind-realm-entry {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    /* Preserve the original flow slot so the lower widget band does not move. */
    height: calc(var(--home-quick-btn-size, 70px) * 2 + var(--home-quick-btn-gap, 12px));
    /* 上提：抵消 2×2 磁贴高度 + 功能区纵向 gap（与 sub-screen-2.css 的 clamp 同步） */
    margin-top: calc((var(--home-quick-btn-size, 70px) * 2 + var(--home-quick-btn-gap, 12px)) * -1 - clamp(12px, 2.4vh, 18px));
    /* 可见入口水平居中，并按真实视口宽度缩放，不再取固定 2×2 快捷区的剩余宽度。 */
    width: 56vw;
    min-width: 180px;
    max-width: 242px;
    margin-left: auto;
    margin-right: auto;
    pointer-events: none; /* 空隙不挡下层；按钮自身恢复 */
}

.mre-widget {
    pointer-events: auto;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    width: 100%;
    height: 29vw;
    min-height: 102px;
    max-height: 128px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}

.mre-widget:active .mre-planet { transform: translateY(-50%) scale(0.96); }

/* ---------- 星球 ---------- */
.mre-planet {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24vw;
    height: 24vw;
    min-width: 76px;
    min-height: 76px;
    max-width: 104px;
    max-height: 104px;
    border-radius: 50%;
    overflow: hidden;
    z-index: 3;
    background: #05030a;
    box-shadow:
        0 6px 22px rgba(10, 6, 26, 0.45),
        0 0 26px rgba(214, 178, 94, 0.28);
    transition: transform 0.18s ease;
}

.mre-planet-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: mre-planet-spin 90s linear infinite;
}

@keyframes mre-planet-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* 星球图缺失时的 CSS 兜底：金色星球 */
.mre-planet--fallback {
    background:
        radial-gradient(circle at 34% 30%, rgba(240, 214, 141, 0.95) 0%, rgba(190, 150, 70, 0.9) 26%, rgba(94, 70, 28, 0.95) 58%, rgba(20, 14, 6, 1) 100%);
}
.mre-planet--fallback::after {
    content: '';
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    border: 1px solid rgba(240, 214, 141, 0.4);
    transform: rotate(-18deg) scaleY(0.42);
}

.mre-planet-glow {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: inset 0 0 18px rgba(240, 214, 141, 0.22);
    animation: mre-planet-breath 5.5s ease-in-out infinite;
}

@keyframes mre-planet-breath {
    0%, 100% { box-shadow: inset 0 0 14px rgba(240, 214, 141, 0.16); }
    50%      { box-shadow: inset 0 0 26px rgba(240, 214, 141, 0.34); }
}

/* ---------- 双文字条 ---------- */
.mre-bars {
    position: absolute;
    top: 5%;
    bottom: 5%;
    right: 0;
    /* 从星球中线附近开始，被星球压住一角（参考音乐组件的层叠关系） */
    left: 21.5%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    gap: clamp(6px, 2vw, 9px);
    z-index: 2;
}

.mre-bar {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    border-radius: 999px;
    /* 文字避开被星球覆盖的区域 */
    /* 文字起点越过响应式星球右缘，窄屏时也不会被星球压住。 */
    padding-left: calc(27.4% + 10px);
    padding-right: 12px;
    padding-right: clamp(10px, 3.5vw, 14px);
    box-sizing: border-box;
    overflow: hidden;
}

/* 上条：纯白 · 不透明度 85% · 模糊 30px */
.mre-bar--top {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 8px 20px rgba(30, 20, 60, 0.10);
}

/* 下条：无底色 · 不透明度 85% · 模糊 30px（毛玻璃透出壁纸） */
.mre-bar--bottom {
    background: rgba(255, 255, 255, 0);
    opacity: 0.85;
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow: 0 8px 20px rgba(30, 20, 60, 0.08);
}

.mre-bar-text {
    display: block;
    width: 100%;
    font-family: Georgia, 'Times New Roman', 'STSong', serif;
    font-size: 12px;
    font-size: clamp(11px, 3.25vw, 13px);
    letter-spacing: 0.05em;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* 上条恒为浅底 → 深色文字 */
.mre-bar--top .mre-bar-text {
    color: rgba(38, 30, 58, 0.92);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* 下条：默认深色字 + 双向光晕（取样失败也保底可读） */
.mre-bar--bottom .mre-bar-text {
    color: rgba(38, 30, 58, 0.92);
    text-shadow:
        0 0 6px rgba(255, 255, 255, 0.85),
        0 1px 2px rgba(255, 255, 255, 0.65);
}

/* 壁纸取样结果：亮背景 → 深色字 */
.mre-widget.mre-adapt-dark .mre-bar--bottom .mre-bar-text {
    color: rgba(34, 26, 54, 0.94);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.75), 0 1px 2px rgba(255, 255, 255, 0.55);
}

/* 壁纸取样结果：暗背景 → 白色字 */
.mre-widget.mre-adapt-light .mre-bar--bottom .mre-bar-text {
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 0 8px rgba(8, 6, 20, 0.85), 0 1px 3px rgba(8, 6, 20, 0.6);
}

/* 短屏手机 / 横屏 WebView：进一步收紧，但保持星球、双条和整体比例同步。 */
@media (max-height: 700px) {
    #ss2-widget-mind-realm-entry {
        width: 50vw;
        min-width: 176px;
        max-width: 220px;
    }

    .mre-widget {
        height: 26vw;
        min-height: 96px;
        max-height: 112px;
    }

    .mre-planet {
        width: 21vw;
        height: 21vw;
        min-width: 70px;
        min-height: 70px;
        max-width: 90px;
        max-height: 90px;
    }

    .mre-bar-text {
        font-size: 11.5px;
        font-size: clamp(10.5px, 3vw, 12px);
    }
}
