@import url('weixin.css');
:root {
    --phone-width: 375px;
    --phone-height: 812px;
    --app-vh: 100vh;
    --safe-top-raw: env(safe-area-inset-top, 0px);
    --safe-bottom-raw: env(safe-area-inset-bottom, 0px);
    --safe-bottom-compact: clamp(0px, var(--safe-bottom-raw), 14px);
    --status-bar-height: calc(44px + var(--safe-top-raw));
    --dock-bottom-offset: calc(8px + var(--safe-bottom-compact));
    --screen-bg: #e7e7e7;
    --text-color: #333;
    --accent-color: #007aff;
    --icon-gray: #e0e0e0;
    --theme-primary: #f3f4fb;
    --theme-primary-soft: rgba(243, 244, 251, 0.9);
    --theme-foreground: #555555;
    --theme-label: #333333;
    --dock-bg: #aeb0b2;
    --top-safe-inset: max(env(safe-area-inset-top), 44px);
    --app-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@supports (height: 100dvh) {
    :root {
        --app-vh: 100dvh;
    }
}

* {
    box-sizing: border-box;
    user-select: none;
}

html {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    background: var(--screen-bg);
    overscroll-behavior: none;
}

body {
    margin: 0;
    padding: 0;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: block;
    background-color: var(--screen-bg);
    font-family: var(--app-font-family);
    overflow: hidden;
    overscroll-behavior: none;
}

button,
input,
textarea,
select {
    font-family: var(--app-font-family);
}

/* 手机外壳 */
.phone-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: var(--app-vh, 100dvh);
    min-height: 100vh;
    min-height: var(--app-vh, 100dvh);
    background: var(--screen-bg);
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}
/* 屏幕区域 */
.screen {
    width: 100%;
    height: 100%;
    background: var(--screen-bg);
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 刘海 */
.notch {
    display: none;
}
/* --- 顶部状态栏 --- */
.status-bar {
    width: 100%;
    height: var(--status-bar-height);
    padding: var(--safe-top-raw) 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    margin-top: 0;
    z-index: 5300;
    pointer-events: none;
    box-sizing: border-box;
}

body.hide-status-info .status-bar {
    visibility: hidden;
    pointer-events: none;
}

body.moments-hide-status .status-bar {
    display: none;
}

body.moments-hide-status .notch {
    display: none;
}

body.chat-view-active .screen > .status-bar {
    display: none;
}

body.app-view-active .screen > .status-bar,
body.app-view-active .screen > .notch {
    display: none;
}

body.music-app-fullscreen .status-bar,
body.music-app-fullscreen .notch {
    display: none;
}

.status-time {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.battery-icon {
    width: 45px;
    height: 22px;
    border: 1.5px solid #333;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    padding: 2px;
}
.battery-icon::after {
    content: '';
    position: absolute;
    right: -5px;
    width: 3px;
    height: 10px;
    background: #333;
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}
.battery-level {
    flex: 1;
    width: 100%;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: #333;
}

/* --- 主界面布局 (图标网格) --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, auto);
    gap: 20px;
    padding: 20px;
    margin-top: 20px;
    flex: 1;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    cursor: pointer;
}

.app-icon-box {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.8);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.1s;
}

.app-item:active .app-icon-box {
    transform: scale(0.95);
    background: rgba(255,255,255,0.6);
}

.app-name {
    font-size: 12px;
    color: #333;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    font-weight: 500;
}

/* --- 底部Dock栏 --- */
.dock {
    margin: 0;
    height: 72px;
    background: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(240,240,250,0.4));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 26px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: var(--dock-bottom-offset);
    width: calc(100% - 60px);
    max-width: 320px;
    z-index: 150;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0;
    cursor: pointer;
    width: 56px;
}

.dock-icon-img {
    width: 44px;
    height: 44px;
    background: transparent;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--theme-foreground);
    transition: transform 0.1s, color 0.5s ease;
}
.dock-item:active .dock-icon-img {
    transform: scale(0.9);
}

.dock-item span {
    display: none;
}

/* --- App 窗口 (覆盖层) --- */
.character-reply-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 80px);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    z-index: 60000;
    display: none;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
}

.app-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #fff;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%); /* 默认隐藏在下方 */
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.app-window.active {
    transform: translateY(0);
}

.app-window.moments-fullscreen {
    /* 朋友圈全屏模式：可能需要调整顶部padding等，这里暂时留空，视具体需求而定 */
}

.app-header {
    height: calc(56px + var(--top-safe-inset));
    background: #f7f7f7;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: flex-end;
    justify-content: center; /* 标题居中 */
    padding: var(--top-safe-inset) 15px 10px 15px;
    box-sizing: border-box;
    font-weight: 600;
    color: #000;
    position: relative;
    z-index: 10;
}

.app-header .back-btn {
    position: absolute;
    left: 15px;
    bottom: 10px;
    font-size: 24px;
    color: #111;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.app-header .app-title,
.app-header #app-title-text {
    font-size: 17px;
}

.app-header #top-plus-btn {
    position: absolute;
    right: 15px;
    bottom: 10px;
    width: 40px;
    text-align: right;
}

.app-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
    /* padding: 15px;  <-- Removed global padding */
}

/* 通用隐藏滚动条但保留功能 */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 动画定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease-out;
}

@media screen and (min-width: 769px) and (hover: hover) and (pointer: fine) {
    html,
    body {
        position: static;
        width: 100%;
        height: 100%;
        min-height: 100%;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #2c3e50;
    }

    .phone-frame {
        position: relative;
        inset: auto;
        width: var(--phone-width);
        height: var(--phone-height);
        min-height: auto;
        background: #000;
        border-radius: 40px;
        padding: 12px;
        margin: 0;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    }

    .screen {
        border-radius: 32px;
    }

    .notch {
        display: block;
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 150px;
        height: 25px;
        background: #000;
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
        z-index: 5200;
    }

    .status-bar {
        top: 5px;
        height: 44px;
        padding: 0 25px;
    }

    .dock {
        bottom: 16px;
    }
}

.dynamic-island {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-6px) scale(0.92);
    height: 34px;
    width: 144px;
    padding: 6px 10px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
    z-index: 1200;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dynamic-island.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}

.dynamic-island:active {
    transform: translateX(-50%) translateY(0) scale(0.985);
}

.dynamic-island-cover {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    flex: 0 0 auto;
}

.dynamic-island-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dynamic-island-waves {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 3px;
    flex: 1;
}

.di-bar {
    width: 3px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    transform-origin: bottom;
}

.dynamic-island.is-playing .di-bar {
    animation: diWave 900ms ease-in-out infinite;
}

.dynamic-island.is-playing .di-bar:nth-child(2) {
    animation-delay: 120ms;
}

.dynamic-island.is-playing .di-bar:nth-child(3) {
    animation-delay: 240ms;
}

.dynamic-island.is-playing .di-bar:nth-child(4) {
    animation-delay: 360ms;
}

@keyframes diWave {
    0% { transform: scaleY(0.6); opacity: 0.7; }
    35% { transform: scaleY(1.7); opacity: 1; }
    70% { transform: scaleY(0.85); opacity: 0.85; }
    100% { transform: scaleY(0.6); opacity: 0.7; }
}

.global-music-float-ball {
    position: absolute;
    right: 16px;
    bottom: 106px;
    width: 64px;
    height: 64px;
    border: 0;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.94);
    transition: opacity 180ms ease, transform 220ms ease, background-color 220ms ease;
    z-index: 1200;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.global-music-float-ball.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.global-music-float-ball:active {
    transform: scale(0.96);
}

.global-music-float-ball.is-dragging {
    transition: none;
    cursor: grabbing;
}

.global-music-float-ball.is-dragging,
.global-music-float-ball.is-dragging:active {
    transform: scale(1);
}

.global-music-float-ball::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    background: inherit;
    z-index: -1;
    opacity: 0;
}

.global-music-float-ball.is-playing::after {
    opacity: 0.32;
    animation: globalFloatPulse 2s ease-out infinite;
}

.global-music-float-progress {
    position: absolute;
    inset: 0;
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
}

.global-music-float-ring {
    fill: none;
    stroke: #111111;
    stroke-width: 3;
    stroke-linecap: round;
}

.global-music-float-cover {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(0, 0, 0, 0.82);
    animation: globalFloatRotate 8s linear infinite;
    animation-play-state: paused;
}

.global-music-float-ball.is-playing .global-music-float-cover {
    animation-play-state: running;
}

.global-music-float-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.global-music-float-bars {
    position: absolute;
    bottom: 8px;
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 12px;
    opacity: 0;
    transition: opacity 180ms ease;
}

.global-music-float-ball.is-playing .global-music-float-bars {
    opacity: 1;
}

.gmf-bar {
    width: 2px;
    background: #111111;
    border-radius: 999px;
    animation: globalFloatBarGrow 0.8s ease-in-out infinite alternate;
}

.gmf-bar:nth-child(2) {
    animation-delay: 0.2s;
}

.gmf-bar:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes globalFloatRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes globalFloatBarGrow {
    0% { height: 2px; opacity: 0.45; }
    100% { height: 10px; opacity: 1; }
}

@keyframes globalFloatPulse {
    0% { transform: scale(1); opacity: 0.32; }
    100% { transform: scale(1.3); opacity: 0; }
}

.ios-notification-banner {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%) translateY(-140%);
    max-width: 92%;
    width: 320px;
    padding: 10px 12px;
    border-radius: 20px;
    background: rgba(248, 248, 250, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    z-index: 12000;
    transition:
        transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
        opacity 200ms ease;
}

.ios-notification-banner.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.ios-notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #ddd;
}

.ios-notification-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ios-notification-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ios-notification-name {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

.ios-notification-message {
    font-size: 13px;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-barrage-layer {
    position: fixed;
    top: 20%;
    left: 0;
    width: 100vw;
    height: 62vh;
    pointer-events: none;
    z-index: 900000;
    overflow: hidden;
    display: none;
}

.ai-barrage-layer.is-visible {
    display: block;
}

.ai-barrage-item {
    position: absolute;
    left: 0;
    top: var(--top, 0px);
    transform: translateX(100vw);
    white-space: nowrap;
    user-select: none;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(140, 0, 0, 0.78);
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.22),
        0 0 12px rgba(40, 0, 0, 0.45),
        0 0 28px rgba(140, 0, 0, 0.22);
    animation: aiBarrageMove var(--dur, 12s) linear infinite;
    animation-delay: var(--delay, 0s);
    will-change: transform;
}

@keyframes aiBarrageMove {
    0% { transform: translateX(100vw); opacity: 0; }
    6% { opacity: 1; }
    92% { opacity: 1; }
    100% { transform: translateX(-120%); opacity: 0; }
}

.ui-toast {
    position: fixed;
    left: 50%;
    bottom: calc(12px + var(--safe-bottom-compact));
    transform: translateX(-50%) translateY(10px);
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    padding: 10px 12px;
    max-width: min(86vw, 340px);
    font-size: 13px;
    line-height: 1.3;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
    opacity: 0;
    pointer-events: none;
    z-index: 200000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: opacity 180ms ease, transform 180ms ease;
    text-align: center;
}

.ui-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ui-dialog-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 210000;
}

.ui-dialog-mask.is-visible {
    display: flex;
}

.ui-dialog {
    width: min(92vw, 320px);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.ui-dialog-body {
    padding: 14px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-dialog-title {
    font-size: 14px;
    font-weight: 800;
    color: #111;
    text-align: center;
}

.ui-dialog-message {
    font-size: 13px;
    color: #222;
    text-align: center;
    line-height: 1.4;
    white-space: pre-wrap;
}

.ui-dialog-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(245, 245, 247, 0.9);
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    color: #111;
}

.ui-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.ui-dialog-actions.is-single {
    grid-template-columns: 1fr;
}

.ui-dialog-btn {
    appearance: none;
    border: 0;
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 800;
    background: transparent;
    color: #111;
    cursor: pointer;
}

.ui-dialog-btn + .ui-dialog-btn {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.ui-dialog-actions.is-single .ui-dialog-btn + .ui-dialog-btn {
    border-left: 0;
}

.ui-dialog-btn.primary {
    color: #111;
}
