/* 主界面悬浮球：挂在 #app 内、各 .page 外；须高于情侣空间与各全屏子层(≤100280)，否则进入情侣空间等功能后「球消失」 */
/* API 快捷弹窗 .main-float-api-modal、音乐相关 .modal 须高于本容器，见同文件对应规则 */
.main-float-root {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100350;
    /* 悬浮球逻辑使用相对本容器的 left/top，须用 absolute 而非 fixed（fixed 会相对视口跑出小手机框） */
}

.main-float-root .main-float-btn,
.main-float-root .main-float-panel {
    pointer-events: auto;
}

/* 主屏悬浮球：相对 .main-float-root，始终落在大手机里的「小手机」区域内 */
.main-float-root > .main-float-btn {
    position: absolute;
    right: 10px;
    top: 110px;
    left: auto;
    bottom: auto;
}

.main-float-root > .main-float-panel {
    position: absolute;
    right: auto;
}

/* 停靠时不再向左右挤出屏幕外，保持完全落在大手机内容区内（特异性高于下方 .is-docked-* 的 translateX） */
.main-float-root > .main-float-btn.is-docked-left,
.main-float-root > .main-float-btn.is-docked-right {
    transform: none;
}

.main-float-btn,
.offline-float-btn {
    border: none;
    border-radius: 50%;
    background: transparent;
    padding: 0;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none; /* 便于拖拽；配合 pointermove preventDefault */
    transition: transform .25s ease, opacity .25s ease, box-shadow .25s ease;
}

.main-float-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.offline-float-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 10px;
    top: 110px;
    /* 独立于 .main-float-root；须高于聊天顶栏与各覆盖层以便拖动 */
    z-index: 100350;
}

.main-float-btn-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    filter: saturate(1.08) contrast(1.04);
    pointer-events: none; /* 触摸命中统一落在 button，避免 Safari 对 img 长按/拖图片干扰 */
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.offline-float-btn-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 16px;
    /* SVG 小彩球含卫星；contain 避免 cover 切掉角落 */
    object-fit: contain;
    filter: saturate(1.04) contrast(1.02);
    pointer-events: none; /* 触摸命中统一落在 button，避免 Safari 对 img 长按/拖图片干扰 */
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.main-float-btn:active,
.offline-float-btn:active {
    transform: scale(0.98);
}

.main-float-btn.dragging,
.offline-float-btn.dragging {
    opacity: 0.9;
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

.main-float-btn.is-idle {
    opacity: 0.52;
}

.offline-float-btn.is-idle {
    opacity: 0.52;
}

.main-float-btn.is-docked-left {
    transform: translateX(-20px);
}

.main-float-btn.is-docked-right {
    transform: translateX(20px);
}

/* iOS AssistiveTouch 风格：磨砂玻璃正方形快捷面板（3x3 网格，第 7 项居中） */
.main-float-panel {
    position: fixed; /* 线下悬浮球等若复用类名时保留；主屏内由 .main-float-root > .main-float-panel 覆盖为 absolute */
    top: 174px;
    right: 10px;
    z-index: 2;
    display: none;
    width: 150px;
    height: 150px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(245, 245, 250, 0.75); /* 75% 不透明 = 25% 透明 */
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    box-sizing: border-box;
}

.main-float-panel.show {
    display: grid;
}

.main-float-panel-btn {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    padding: 4px 2px;
    background: transparent;
    color: rgba(28, 28, 32, 0.92);
    font-size: 9px;
    font-weight: 500;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: background 0.15s ease, transform 0.12s ease;
}

.main-float-panel-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.main-float-panel-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.94);
}

/* 主面板第三行：左「更多」、中「主页」、右「手机」（须限定 #main-float-panel，避免影响二级面板） */
#main-float-panel .main-float-panel-btn:nth-child(7) {
    grid-column: 2;
    grid-row: 3;
}

#main-float-panel .main-float-panel-btn:nth-child(8) {
    grid-column: 3;
    grid-row: 3;
}

#main-float-panel .main-float-panel-btn:nth-child(9) {
    grid-column: 1;
    grid-row: 3;
}

/* 二级快捷功能面板 */
.main-float-more-panel {
    display: none;
}

.main-float-more-panel.show {
    display: grid;
}

/* 二级面板第二行：左 IF线、中 返回、右 微信 */
.main-float-more-panel .main-float-panel-btn:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

.main-float-more-panel .main-float-back-btn {
    grid-column: 2;
    grid-row: 2;
}

.main-float-panel-btn-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(28, 28, 32, 0.88);
}

.main-float-panel-btn-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.main-float-panel-btn-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: rgba(28, 28, 32, 0.85);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 快捷 API 弹层：须高于 .main-float-root(100350) 与各情侣空间内抬升的 .modal */
.main-float-api-modal.modal {
    z-index: 100400;
}

.main-float-api-modal-content {
    width: 340px;
    max-width: 92%;
    border-radius: 26px;
    overflow: hidden;
}

.main-float-api-settings-content {
    padding: 8px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

.main-float-api-modal-content .settings-content.main-float-api-settings-content {
    flex: none;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.main-float-api-sheet {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main-float-api-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.03em;
}

.main-float-api-control {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    font-size: 14px;
    background: #fafafa;
    color: #1a1a1a;
}

.main-float-api-control:focus {
    outline: none;
    border-color: #07C160;
    background: #fff;
}

.main-float-api-select {
    cursor: pointer;
}

.main-float-models-list {
    max-height: 160px;
    overflow-y: auto;
    margin-top: 0;
    border-radius: 12px;
}

.main-float-api-sheet .main-float-fetch-models-btn {
    width: 100%;
    margin: 0;
    min-height: 44px;
    border-radius: 12px;
    box-sizing: border-box;
}

.main-float-api-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 0;
    padding-top: 4px;
}

.main-float-api-modal-actions .wallet-modal-btn {
    flex: 1;
}

/* Main music island and floating music expanded state. */
.main-music-island {
    /* 相对 #app（小手机框）定位，避免 fixed 相对浏览器视口跑出框外 */
    position: absolute;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    /* 略高于 .main-float-root，避免全屏图层下灵动岛仍被埋没 */
    z-index: 100355;
    display: none;
    /* 避免父层吞掉命中，导致全屏 scrim 收不到点击 */
    pointer-events: none;
}

.main-music-island.show {
    display: block;
}

.main-music-island-shell,
.main-music-island-expanded,
.main-music-island-expanded-scrim {
    pointer-events: auto;
}

/* 展开态：全屏透明层，点击空白处收起（底图上的假控件由 HUD 白底遮盖） */
.main-music-island-expanded-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: default;
}

.main-music-island.expanded .main-music-island-expanded-scrim {
    display: block;
}

.main-music-island-shell {
    position: relative;
    z-index: 1;
    width: min(268px, 88vw);
    height: 56px;
    border: none;
    border-radius: 28px;
    padding: 0 14px 0 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #2d3748;
    background: linear-gradient(135deg, #E8F4F0 0%, #E9E7F5 100%);
    box-shadow: 0 14px 32px rgba(112, 128, 165, 0.18);
    cursor: pointer;
    transition: opacity 0.4s ease;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.main-music-island .main-music-island-player-card {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    cursor: default;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.main-music-island .main-music-island-player-card.dragging {
    opacity: 0.96;
    cursor: grabbing;
}

.main-music-island-shell.dragging {
    opacity: 0.92;
    cursor: grabbing;
}

.main-music-island-shell.is-idle {
    opacity: 0.4;
}

.main-music-island-shell-artwrap {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.main-music-island-compact-art {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.main-music-island-shell-row {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-left: 6px;
}

.main-music-island-compact-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 600;
    text-shadow: none;
}

.main-music-island-compact-play {
    flex-shrink: 0;
    font-size: 17px;
    line-height: 1;
    text-shadow: none;
}

/* 展开态：与主屏 .music-player-card 同一套横向毛玻璃卡片（仅样式；逻辑仍用原 id 绑定） */
.main-music-island-expanded {
    display: none;
    width: min(340px, 94vw);
    margin-top: 10px;
    background: transparent;
    overflow: visible;
    box-shadow: none;
    border-radius: 0;
    container-type: inline-size;
    container-name: mainisle;
}

.main-music-island.expanded .main-music-island-expanded {
    display: block;
    position: relative;
    z-index: 3;
}

.main-music-island.expanded .main-music-island-shell {
    display: none;
}

.main-music-island .main-music-island-player-card {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    cursor: default;
}

.main-music-island .main-music-island-player-card .music-player-row {
    flex: 1;
    min-height: clamp(88px, 30cqw, 110px);
}

.main-music-island .main-music-island-album-wrap {
    cursor: default;
}

/* 展开区无独立 home slot 容器名，沿用 mainisle 供 cqw 回落 */
@supports not (width: 1cqw) {
    .main-music-island .main-music-island-player-card {
        min-height: 96px;
    }
    .main-music-island .main-music-island-player-card .music-player-row {
        min-height: 88px;
    }
}

.main-music-island .main-music-island-ctrls {
    flex-shrink: 0;
    margin-top: 1px;
}

.main-music-island-more-wrap {
    position: relative;
}

/* 主屏灵动岛「更多」：菜单不透明度 85%，避免底层聊天/底图透过毛玻璃干扰音量条识别 */
.main-music-island-more-wrap .music-more-dropdown {
    z-index: 5000;
    background: linear-gradient(
            135deg,
            rgba(232, 244, 240, 0.85) 0%,
            rgba(233, 231, 245, 0.85) 100%
        )
        !important;
    border: 1px solid rgba(255, 255, 255, 0.48) !important;
    box-shadow:
        0 16px 34px rgba(112, 128, 165, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-appearance="dark"] .main-music-island-more-wrap .music-more-dropdown {
    background: linear-gradient(135deg, rgba(38, 42, 52, 0.85) 0%, rgba(44, 48, 58, 0.85) 52%, rgba(32, 36, 44, 0.85) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* 音量滑轨在主菜单上对比略增强（仍沿用全局 .music-volume-slider 形状） */
.main-music-island-more-wrap .music-volume-slider {
    background: rgba(95, 114, 141, 0.38);
}

/* 日间：高亮磨砂白 */
html[data-appearance="light"] .main-float-panel {
    background: rgba(245, 245, 250, 0.75);
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 14px 28px rgba(32, 44, 74, 0.16);
}

html[data-appearance="light"] .main-float-panel-btn,
html[data-appearance="light"] .main-float-panel-btn-icon,
html[data-appearance="light"] .main-float-panel-btn-label {
    color: rgba(28, 28, 32, 0.9);
}

html[data-appearance="light"] .main-float-panel-btn:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* 夜间：磨砂深色玻璃 */
html[data-appearance="dark"] .main-float-panel {
    background: rgba(28, 28, 32, 0.55);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
}

html[data-appearance="dark"] .main-float-panel-btn,
html[data-appearance="dark"] .main-float-panel-btn-icon,
html[data-appearance="dark"] .main-float-panel-btn-label {
    color: rgba(245, 245, 250, 0.92);
}

html[data-appearance="dark"] .main-float-panel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

html[data-appearance="dark"] .main-float-panel-btn:active {
    background: rgba(255, 255, 255, 0.18);
}
