/* ============ NyouOS Phone 模式（竖屏手机布局） ============ */

/* 电脑端元素在 Phone 模式下隐藏 */
body.phone-mode #desktop-icons,
body.phone-mode #desktop-context-menu,
body.phone-mode #desktop-widgets-layer,
body.phone-mode #widgets-drawer,
body.phone-mode #widgets-collapsed-bar,
body.phone-mode #lock-widgets-layer,
body.phone-mode #taskbar,
body.phone-mode #start-menu,
body.phone-mode #control-center,
body.phone-mode #fingo-panel,
body.phone-mode #taskview-layer,
body.phone-mode .desktop-wallpaper {
    display: none !important;
}

/* 手机外壳 */
#phone-shell {
    display: none;
}
body.phone-mode #phone-shell {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: min(820px, 94vh);
    aspect-ratio: 9 / 19.5;
    max-width: 94vw;
    background: #000;
    border-radius: 38px;
    overflow: hidden;
    z-index: 160;
    box-shadow: 0 0 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* 壁纸铺满手机壳 */
.phone-wallpaper {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* 顶部刘海 */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 26px;
    background: #000;
    border-radius: 0 0 18px 18px;
    z-index: 20;
}

/* 状态栏 */
.phone-statusbar {
    position: relative;
    z-index: 15;
    height: 44px;
    flex: 0 0 44px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 26px 4px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
.phone-statusbar .phone-status-right {
    display: flex;
    gap: 5px;
    align-items: center;
    font-size: 11px;
    letter-spacing: 1px;
}

/* 主屏（App 网格，可滚动） */
.phone-home {
    position: relative;
    z-index: 10;
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 100px;
    scrollbar-width: none;
}
.phone-home::-webkit-scrollbar {
    display: none;
}
.phone-app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 10px;
    padding-top: 8px;
}
.phone-app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
}
.phone-app-icon img {
    width: 58px;
    height: 58px;
    border-radius: 15px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.phone-app-icon span {
    font-size: 11px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    max-width: 76px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dock 栏 */
.phone-dock {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 10px 34px;
    background: rgba(24, 24, 30, 0.42);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 26px 26px 0 0;
}
.phone-dock .phone-app-icon img {
    background: rgba(255, 255, 255, 0.24);
}
.phone-dock .phone-app-icon span {
    display: none;
}

/* 底部手势条 */
.phone-gesture {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.65);
    z-index: 30;
}

/* 窗口在 Phone 模式下全屏（手机画布内） */
body.phone-mode #windows-container {
    position: absolute;
    inset: 0;
    z-index: 40;
}
body.phone-mode .window {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    border-radius: 0 !important;
    border: none !important;
}
body.phone-mode .window-titlebar {
    padding-top: 8px;
}
body.phone-mode .window-controls .minimize,
body.phone-mode .window-controls .maximize,
body.phone-mode .window-resize-handle {
    display: none !important;
}
body.phone-mode .window-titlebar {
    cursor: default;
}

/* 手机设置页 */
.phone-settings {
    padding: 18px 16px;
}
.phone-settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.phone-settings-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}
.phone-settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-radius: 14px;
    background: var(--phone-item-bg, rgba(255, 255, 255, 0.9));
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.phone-settings-item img {
    width: 30px;
    height: 30px;
}
.phone-settings-item .phone-settings-item-copy {
    flex: 1;
}
.phone-settings-item .phone-settings-item-copy .phone-settings-item-title {
    font-size: 14px;
    font-weight: 600;
}
.phone-settings-item .phone-settings-item-copy .phone-settings-item-desc {
    font-size: 12px;
    opacity: 0.65;
}
.phone-settings-item .phone-settings-item-arrow {
    opacity: 0.4;
}
.phone-settings-value {
    font-size: 13px;
    opacity: 0.6;
}

/* 手机设置子页内容 */
.phone-settings-page {
    padding: 18px 16px;
}
.phone-settings-page h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 14px;
}
.phone-wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.phone-wallpaper-grid button {
    border: none;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    outline: 2px solid transparent;
}
.phone-wallpaper-grid button.selected {
    outline: 2px solid var(--accent-color, #6750a4);
}

.phone-settings-page-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.phone-settings-page-head h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}
.phone-back-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}
.phone-back-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}
.phone-settings-section-label {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.6;
    margin: 14px 0 8px;
}
.phone-settings-about {
    background: var(--phone-item-bg, rgba(255, 255, 255, 0.9));
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
/* 手机模式下隐藏电脑版设置侧栏 */
body.phone-mode .fw-sidebar { display: none !important; }
body.phone-mode .settings-app .fw-content,
body.phone-mode .settings-app .settings-content { width: 100% !important; }
.phone-settings-empty {
    margin-top: 24px;
    padding: 26px 16px;
    border-radius: 14px;
    background: var(--phone-item-bg, rgba(255, 255, 255, 0.9));
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.phone-settings-empty-desc {
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    opacity: 0.6;
}
/* ============ 手机模式：App 窗口无标题栏（手机 App 体验） ============ */
body.phone-mode .window-titlebar { display: none !important; }

/* ============ 灵动大陆（Dynamic Land，替换刘海） ============ */
.phone-dynamic-land {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 178px;
    height: 34px;
    border-radius: 0 0 20px 20px;
    background: #000;
    border: none;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 10px 2px;
    -webkit-tap-highlight-color: transparent;
}
.phone-dynamic-land .phone-dl-cam {
    width: 20px;
    height: 20px;
    opacity: 0.85;
    border-radius: 50%;
    object-fit: cover;
}
.phone-dynamic-land .phone-dl-time { letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.phone-dynamic-land .phone-dl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}
body.phone-mode .phone-notch { display: none !important; }

/* ============ 下拉面板（通知中心 + 控制中心） ============ */
.phone-panel {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 55;
    background: rgba(22, 22, 30, 0.86);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-radius: 0 0 28px 28px;
    transform: translateY(-110%);
    transition: transform 0.34s cubic-bezier(0.32, 0.72, 0.24, 1);
    color: #fff;
    padding: 56px 16px 20px;
    max-height: 76%;
    overflow-y: auto;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
    scrollbar-width: none;
}
body.phone-panel-open .phone-panel { transform: translateY(0); }
.phone-panel::-webkit-scrollbar { display: none; }
.phone-panel-toggle {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50px;
    z-index: 56;
    cursor: grab;
    display: flex;
    justify-content: center;
    padding-top: 12px;
}
.phone-panel-toggle .phone-panel-handle {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.5);
}
.phone-panel-section-label {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.75;
    margin: 16px 0 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.phone-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.phone-quick-tile {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 16px;
    padding: 12px 4px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.phone-quick-tile img { width: 22px; height: 22px; }
.phone-quick-tile.active { background: rgba(103, 80, 164, 0.8); }
.phone-quick-tile.disabled { opacity: 0.45; }
.phone-notif-list { display: flex; flex-direction: column; gap: 8px; }
.phone-notif-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 11px 13px;
    font-size: 12px;
    line-height: 1.45;
}
.phone-notif-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.phone-notif-empty { text-align: center; opacity: 0.55; font-size: 12px; padding: 18px 0; }

/* ============ 电源键 / 黑屏 / 长按关机重启 ============ */
.phone-power-btn {
    position: absolute;
    right: -4px;
    top: 36%;
    width: 6px;
    height: 116px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.38);
    border: none;
    z-index: 70;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}
.phone-power-btn:active { background: rgba(255, 255, 255, 0.6); }
.phone-power-off {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    gap: 10px;
    cursor: pointer;
}
.phone-power-off .phone-po-time { font-size: 52px; font-weight: 200; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.phone-power-off .phone-po-hint { font-size: 13px; opacity: 0.6; font-weight: 400; }
.phone-power-menu {
    position: absolute;
    inset: 0;
    z-index: 210;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 96px;
    color: #fff;
}
.phone-power-menu-title { font-size: 17px; font-weight: 600; margin-bottom: 26px; }
.phone-power-slide {
    width: 272px;
    height: 60px;
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.14);
    position: relative;
    margin: 9px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.phone-power-slide .phone-slide-thumb {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    z-index: 2;
    font-size: 20px;
    touch-action: none;
}
.phone-power-slide.hot { background: rgba(255, 59, 48, 0.35); }
.phone-power-slide.hot .phone-slide-thumb { background: #ff3b30; color: #fff; }
.phone-power-close {
    margin-top: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 22px;
    padding: 11px 30px;
    font-size: 14px;
    cursor: pointer;
}

/* ============ 平板模式（NyouOS Phone 识别为平板后自动调整） ============ */
body.phone-tablet #phone-shell {
    aspect-ratio: 3 / 4;
    max-width: 88vw;
}
body.phone-tablet .phone-app-grid { grid-template-columns: repeat(6, 1fr); }
body.phone-tablet .phone-app-icon img { width: 66px; height: 66px; }
body.phone-tablet .phone-app-icon span { max-width: 84px; font-size: 12px; }
body.phone-tablet .phone-dynamic-land { width: 210px; }
body.phone-tablet .phone-panel { max-height: 62%; }

/* ============ 手机版 App Shop（单列） ============ */
.phone-appshop {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    background: rgba(18, 18, 24, 0.9);
    color: #fff;
    scrollbar-width: none;
}
.phone-appshop::-webkit-scrollbar { display: none; }
.phone-appshop-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(18, 18, 24, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 16px 16px 10px;
}
.phone-appshop-header h1 { font-size: 24px; font-weight: 700; margin: 0; }
.phone-appshop-cats { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.phone-appshop-cats::-webkit-scrollbar { display: none; }
.phone-appshop-cat {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 16px;
    padding: 7px 16px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}
.phone-appshop-cat.active { background: #6750a4; font-weight: 600; }
.phone-appshop-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 110px; }
.phone-appshop-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 12px;
    border: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
}
.phone-appshop-card img { width: 52px; height: 52px; border-radius: 13px; }
.phone-appshop-card .pas-copy { flex: 1; min-width: 0; }
.phone-appshop-card .pas-name { font-size: 15px; font-weight: 600; }
.phone-appshop-card .pas-meta { font-size: 11px; opacity: 0.65; margin-top: 2px; }
.phone-appshop-card .pas-btn {
    border: none;
    background: #6750a4;
    color: #fff;
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.phone-appshop-card .pas-btn.blocked {
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}
.phone-appshop-card .pas-get { font-size: 12px; opacity: 0.7; text-align: right; min-width: 46px; }

/* 手机版相机（灵动大陆） */
.phone-camera {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000;
    color: #fff;
    z-index: 50;
}
.phone-camera .pc-stage {
    position: relative;
    width: 178px;
    height: 34px;
    margin-top: 0;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
    background: #000;
    transition: width 0.35s cubic-bezier(0.32, 0.72, 0.24, 1), height 0.35s cubic-bezier(0.32, 0.72, 0.24, 1), border-radius 0.35s;
    cursor: pointer;
    z-index: 62;
}
.phone-camera .pc-stage video { width: 100%; height: 100%; object-fit: cover; }
.phone-camera .pc-stage.expanded {
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin-top: 0;
}
.phone-camera .pc-stage .pc-hint {
    position: absolute;
    bottom: 8px;
    left: 0; right: 0;
    text-align: center;
    font-size: 11px;
    opacity: 0.75;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.phone-camera .pc-controls {
    position: absolute;
    bottom: 26px;
    left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 34px;
    z-index: 5;
}
.phone-camera .pc-shutter {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
}
.phone-camera .pc-shutter:active { transform: scale(0.94); }
.phone-camera .pc-btn {
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}
.phone-camera .pc-permission {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 4;
}
.phone-camera .pc-permission button {
    border: none;
    background: #6750a4;
    color: #fff;
    border-radius: 18px;
    padding: 10px 26px;
    font-size: 14px;
    cursor: pointer;
}

/* ============ 手机模式：窗口挂载进手机壳并全屏（无标题栏） ============ */
body.phone-mode #phone-shell .window {
    position: absolute;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none;
    box-shadow: none;
}
body.phone-mode #phone-shell .window-titlebar { display: none !important; }
body.phone-mode #phone-shell .window-content {
    position: absolute;
    inset: 0;
    height: 100% !important;
}
body.phone-mode #phone-shell .window-resize-handle { display: none !important; }

/* ============ 手机版 App Shop 详情页 ============ */
.phone-appshop-detail {
    position: relative;
    padding: 26px 18px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
}
.phone-appshop-detail .phone-back-btn {
    position: absolute;
    top: 14px;
    left: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.phone-appshop-detail .pas-d-icon { width: 96px; height: 96px; border-radius: 24px; margin-top: 16px; }
.phone-appshop-detail .pas-d-name { font-size: 22px; font-weight: 700; margin: 14px 0 4px; text-align: center; }
.phone-appshop-detail .pas-d-meta { font-size: 12px; opacity: 0.65; }
.phone-appshop-detail .pas-d-desc { font-size: 13px; opacity: 0.88; line-height: 1.65; margin-top: 14px; text-align: center; }
.phone-appshop-detail .pas-d-btn {
    margin-top: 20px;
    background: #6750a4;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px 36px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.phone-appshop-detail .pas-d-btn.blocked {
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.45);
}

/* ============ 修复 hidden 属性被 display 覆盖（电源遮罩/菜单默认显示 bug） ============ */
#phone-shell[hidden],
#phone-shell [hidden] { display: none !important; }

/* 手机版 App Shop：开发者名字 */
.phone-appshop-card .pas-developer {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 1px;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
    display: block;
}
.phone-appshop-card .pas-developer:hover { opacity: 1; text-decoration: underline; }
.phone-appshop-detail .pas-d-developer {
    font-size: 13px;
    opacity: 0.65;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    margin: 2px 0 0;
    display: block;
}
.phone-appshop-detail .pas-d-developer:hover { opacity: 1; text-decoration: underline; }
.phone-appshop-header .pas-dev-sub { font-size: 12px; opacity: 0.65; margin-top: 2px; }

/* 手机模式：窗口内容避开灵动大陆与状态栏（顶部安全区），灵动大陆不被 App 遮挡 */
body.phone-mode #phone-shell .window { padding-top: 92px; }
