/* ============================================================
   v2.2 视觉补丁：移动端修复 + 参考App美学 + 底图素材应用
   加载顺序在 enhanced.css 之后，覆盖生效
   ============================================================ */

/* ---- 关键修复：禁止手机浏览器自动放大字体（前两张图巨字的元凶） ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }

/* ---- 底图素材应用 ---- */
/* 开场画面：巴洛克相框 */
#intro-screen {
    background:
        linear-gradient(160deg, rgba(102,126,234,.45), rgba(118,75,162,.5)),
        url("../assets/bg-baroque.jpg") center / cover no-repeat,
        linear-gradient(135deg, #667eea, #764ba2);
}
/* 结局画面（ui.js 会加 ending-bg 类） */
.ending-bg {
    background:
        linear-gradient(rgba(28,28,52,.78), rgba(28,28,52,.78)),
        url("../assets/bg-forest.jpg") center / cover no-repeat !important;
}
/* 手机「我的」页：白框蝴蝶底图 + 白色渐变罩保证可读性 */
.phone-me {
    background:
        linear-gradient(rgba(255,255,255,.82), rgba(242,243,247,.95)),
        url("../assets/bg-frame.jpg") center top / cover no-repeat;
    min-height: 100%;
}

/* ---- 参考图美学：圆角白卡体系 ---- */
.panel, .scene-display, .action-panel {
    border-radius: 16px;
    box-shadow: 0 2px 14px rgba(50,50,93,.07);
}
.modal-container { border-radius: 18px; }
.panel h3 { font-weight: 600; letter-spacing: .02em; }

/* ============================================================
   移动端彻底修复（对应截图1/2的顶栏重叠、巨字、空白）
   ============================================================ */
@media (max-width: 768px) {
    /* 游戏主界面允许纵向滚动，不再锁死100vh */
    #game-screen { height: auto; min-height: 100vh; overflow: visible; }
    .game-main { flex-direction: column; padding: .6rem; gap: .6rem; overflow: visible; }
    .game-right-panel { width: 100%; flex-direction: column; overflow: visible; }
    .game-right-panel .panel { min-width: 0; }

    /* 顶栏：禁止换行错位，文字过长省略 */
    .game-header { flex-wrap: nowrap; padding: .55rem .7rem; gap: .35rem; }
    .header-left { min-width: 0; }
    .player-name {
        display: block; font-size: .95rem;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        max-width: 32vw;
    }
    .player-info {
        display: block; font-size: .68rem;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        max-width: 32vw;
    }
    .header-center { flex: 0 0 auto; min-width: 0; }
    .game-time { font-size: .72rem; padding: .3rem .55rem; white-space: nowrap; }
    .weather-icon { font-size: .9rem; margin-left: .2rem; }
    .header-right { margin-left: auto; flex-shrink: 0; }
    .icon-btn { width: 33px; height: 33px; font-size: .95rem; }

    /* 场景区紧凑化 */
    .scene-display { padding: .85rem .9rem; }
    .scene-location { font-size: 1rem; }
    .scene-time { font-size: .78rem; }
    .scene-narrative { font-size: .9rem; line-height: 1.7; }
    .scene-dialogue { font-size: .88rem; padding: .6rem .8rem; }

    /* 行动按钮：两列网格，不再挤成一团 */
    .action-list { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
    .action-btn { padding: .55rem .3rem; font-size: .82rem; text-align: center; border-radius: 14px; }

    /* 底部输入区吸底 */
    .game-input-area { position: sticky; bottom: 0; padding: .55rem; gap: .4rem; }
    #custom-command { padding: .55rem .7rem; font-size: .88rem; }
    .game-input-area .btn { padding: .55rem .8rem; font-size: .85rem; }

    /* 状态面板字号收敛 */
    .status-label { min-width: 32px; font-size: .76rem; }
    .status-value { font-size: .8rem; }
    .qs-value { font-size: .95rem; }
    .npc-name { font-size: .85rem; }
    .goal-text { font-size: .8rem; }

    /* 弹窗适配 */
    .modal-container { width: 94%; max-height: 88vh; }
    .npc-detail-avatar { width: 60px; height: 60px; font-size: 1.8rem; }
}

@media (max-width: 480px) {
    .game-title { font-size: 2.1rem; }
    .btn { min-width: 160px; }
    .quick-stats { gap: .3rem; }
}

/* ============================================================
   手机界面美学（学 Lunara / 小红书参考图）
   ============================================================ */
.phone-content { background: #f2f3f7; }

/* 底部导航 → 悬浮Dock */
.phone-nav {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: 0 10px 8px;
    border-radius: 22px;
    box-shadow: 0 4px 16px rgba(0,0,0,.09);
    border-top: none;
}
.phone-nav-btn span { font-size: .64rem; margin-top: 1px; }

/* 发现页 → App图标网格（圆角色块+淡彩渐变） */
.discover-grid { gap: .7rem; }
.discover-card {
    background: rgba(255,255,255,.92);
    border-radius: 18px;
    padding: 1rem .5rem .85rem;
    box-shadow: 0 2px 10px rgba(50,50,93,.05);
}
.discover-icon {
    width: 50px; height: 50px;
    margin: 0 auto .45rem;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #f5f7ff, #ece9ff);
}
.discover-card:nth-child(4n+1) .discover-icon { background: linear-gradient(135deg, #ffe9f0, #ffd6e5); }
.discover-card:nth-child(4n+2) .discover-icon { background: linear-gradient(135deg, #e9f5ff, #d6ebff); }
.discover-card:nth-child(4n+3) .discover-icon { background: linear-gradient(135deg, #eafff4, #d2f7e5); }
.discover-card:nth-child(4n+4) .discover-icon { background: linear-gradient(135deg, #fff6e0, #ffedc4); }
.discover-title { font-size: .85rem; }

/* 动态 → 小红书风白卡 */
.feed-post { border-radius: 16px; box-shadow: 0 2px 10px rgba(50,50,93,.05); }
.feed-post-actions { border-top: none; padding-top: .5rem; }
.feed-comments {
    background: #f7f8fa;
    border-radius: 10px;
    padding: .6rem .7rem;
    border-top: none;
    margin-top: .5rem;
}
.feed-composer { border-radius: 16px; box-shadow: 0 2px 8px rgba(50,50,93,.04); }

/* 我的页 → 情侣主题风：头像描边、菜单卡 */
.me-header { border-radius: 18px; box-shadow: 0 6px 18px rgba(108,92,231,.28); }
.me-avatar { border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.me-stats { border-radius: 16px; box-shadow: 0 2px 8px rgba(50,50,93,.04); }
.me-menu { border-radius: 16px; box-shadow: 0 2px 8px rgba(50,50,93,.04); }
.me-menu-item { padding: .85rem 1rem; }

/* 聊天列表行 */
.phone-chat-item { border-radius: 12px; }
.chat-bubble { box-shadow: 0 1px 3px rgba(0,0,0,.04); }

/* 开场按钮毛玻璃感 */
.btn-secondary { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }


/* ============================================================
   v2.3 全局纹理应用：所有界面启用自定义底图
   ============================================================ */

/* ---- 游戏主背景：灰白石膏纹理 ---- */
body, #game-screen {
    background:
        linear-gradient(rgba(245,246,250,.88), rgba(245,246,250,.88)),
        url("../assets/bg-plaster1.jpg") center / cover fixed;
}

/* ---- 左侧场景区：米白笔触纹理 + 高透明白罩保证可读 ---- */
.scene-display {
    background:
        linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.94)),
        url("../assets/bg-plaster2.jpg") center / cover;
}

/* ---- 行动面板：暖白石膏 ---- */
.action-panel {
    background:
        linear-gradient(rgba(255,255,255,.92), rgba(255,255,255,.95)),
        url("../assets/bg-plaster3.jpg") center / cover;
}

/* ---- 右侧全部面板：星星纹理（淡） ---- */
.game-right-panel .panel {
    background:
        linear-gradient(rgba(255,255,255,.93), rgba(255,255,255,.96)),
        url("../assets/bg-stars.jpg") center / cover;
}

/* ---- 角色创建页：整页石膏纹理 ---- */
#character-create-screen {
    background:
        linear-gradient(rgba(245,246,250,.9), rgba(245,246,250,.9)),
        url("../assets/bg-plaster1.jpg") center / cover fixed;
}
.create-container {
    background:
        linear-gradient(rgba(255,255,255,.93), rgba(255,255,255,.96)),
        url("../assets/bg-plaster2.jpg") center / cover;
    box-shadow: 0 8px 32px rgba(50,50,93,.14);
}

/* ---- 所有弹窗（背包/NPC/商店/设置/帮助/菜单/成就/统计）：统一暖白石膏 ---- */
.modal-container {
    background:
        linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.97)),
        url("../assets/bg-plaster3.jpg") center / cover;
}

/* ---- 帮助/设置里的分区卡 ---- */
.help-section, .form-group input[type="text"], .form-group input[type="number"],
.form-group input[type="password"], .form-group select {
    background-color: rgba(255,255,255,.75);
}

/* ---- 手机内部各页 ---- */
/* 手机内容区底色：米白笔触 */
.phone-content {
    background:
        linear-gradient(rgba(242,243,247,.9), rgba(242,243,247,.94)),
        url("../assets/bg-plaster2.jpg") center / cover;
}
/* 聊天列表页卡片：星星淡纹 */
.phone-chat-item { background: transparent; }
.phone-chat-item:hover { background: rgba(255,255,255,.85); }
/* 动态页帖子卡：暖白石膏 */
.feed-post, .feed-composer, .tree-hole-item, .vote-item, .market-item {
    background:
        linear-gradient(rgba(255,255,255,.94), rgba(255,255,255,.96)),
        url("../assets/bg-plaster3.jpg") center / cover;
}
/* 发现页入口卡：星星纹理 */
.discover-card {
    background:
        linear-gradient(rgba(255,255,255,.94), rgba(255,255,255,.96)),
        url("../assets/bg-stars.jpg") center / cover;
}
/* 我的页：保留白框蝴蝶主图（原 v2.2 设置），菜单条加石膏 */
.me-menu, .me-stats {
    background:
        linear-gradient(rgba(255,255,255,.94), rgba(255,255,255,.96)),
        url("../assets/bg-plaster1.jpg") center / cover;
}
/* 手机内聊天/树洞等子页头 */
.phone-chat-header {
    background:
        linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.97)),
        url("../assets/bg-plaster2.jpg") center / cover;
}
/* 聊天输入栏 */
.phone-chat-input {
    background:
        linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.97)),
        url("../assets/bg-plaster1.jpg") center / cover;
}
/* 投票条/进度条容器底色 */
.vote-option { background: rgba(255,255,255,.8); }

/* ---- 菜单按钮与背包格子：不再死板纯色 ---- */
.menu-btn {
    background:
        linear-gradient(rgba(245,246,250,.9), rgba(245,246,250,.94)),
        url("../assets/bg-plaster2.jpg") center / cover;
}
.backpack-item {
    background:
        linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.94)),
        url("../assets/bg-stars.jpg") center / cover;
}

/* ----  toast 保持纯深色（可读性优先，不应用纹理） ---- */


/* ============================================================
   v2.4 手机「我的」主页（学习参考图排版：胶囊/组件卡/App网格）
   ============================================================ */
.phone-me {
    background:
        linear-gradient(rgba(255,255,255,.55), rgba(240,241,246,.78)),
        url("../assets/bg-marble.jpg") center / cover;
    min-height: 100%;
    padding: .9rem .9rem 1.2rem;
}

/* 顶栏 */
.me-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.me-chip {
    display: flex; align-items: center; gap: .45rem;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: .3rem .9rem .3rem .35rem;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.me-chip-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg,#ece9ff,#dcd6ff);
    display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.me-chip-name { font-weight: 600; font-size: .82rem; line-height: 1.2; }
.me-chip-sub { font-size: .64rem; color: #999; line-height: 1.2; }
.me-bell {
    position: relative; width: 36px; height: 36px;
    border: none; border-radius: 50%;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font-size: .95rem; cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.me-bell-badge {
    position: absolute; top: -3px; right: -4px;
    min-width: 15px; height: 15px; padding: 0 3px;
    background: #e17055; color: #fff;
    font-size: .6rem; border-radius: 8px; line-height: 15px; text-align: center;
}

/* 组件卡 */
.me-widget {
    display: flex; align-items: center; gap: .8rem;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-radius: 20px; padding: .8rem .9rem; margin-bottom: .9rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.07);
}
.me-wx { display: flex; align-items: center; gap: .45rem; cursor: pointer; }
.me-wx-icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg,#6c5ce7,#a29bfe);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; box-shadow: 0 3px 8px rgba(108,92,231,.35);
}
.me-wx-text { font-size: .72rem; font-weight: 600; color: #555; line-height: 1.25; }
.me-widget-stats { flex: 1; display: flex; justify-content: space-around; }
.me-stat { text-align: center; }
.me-stat-value { font-size: 1rem; font-weight: 700; color: #6c5ce7; }
.me-stat-label { font-size: .62rem; color: #999; margin-top: 1px; }

/* App 网格 */
.me-appgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem .4rem; }
.me-app { text-align: center; cursor: pointer; }
.me-app-icon {
    width: 52px; height: 52px; margin: 0 auto .3rem;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 3px 10px rgba(50,50,93,.10);
    transition: transform .15s ease;
}
.me-app:active .me-app-icon { transform: scale(.9); }
.me-app-name { font-size: .68rem; color: #555; }

/* ============================================================
   NPC 档案卡：头像压住卡片上沿（学参考图层次，非抄袭）
   ============================================================ */
.npc-profile-card {
    background:
        linear-gradient(rgba(255,255,255,.93), rgba(255,255,255,.96)),
        url("../assets/bg-marble.jpg") center / cover;
    border-radius: 18px;
    padding: 0 1rem 1rem;
    margin: 1.3rem 0 1rem;
    box-shadow: 0 4px 16px rgba(50,50,93,.10);
}
.npc-profile-card .npc-detail-header { padding-top: 0; margin-bottom: .8rem; }
.npc-profile-card .npc-detail-avatar {
    margin-top: -22px;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,.15);
    background: linear-gradient(135deg,#ece9ff,#dcd6ff);
    flex-shrink: 0;
}


/* ============================================================
   v2.5 手机App组件样式
   ============================================================ */
.app-section-title { font-size: .78rem; font-weight: 600; color: #999; margin: .9rem .2rem .55rem; letter-spacing: .03em; }

/* 微信群聊 */
.app-btnbar { display: flex; gap: .4rem; padding: .45rem .7rem; background: rgba(255,255,255,.9); border-bottom: 1px solid #eee; }
.app-mini-btn { border: none; background: #f0f2f8; border-radius: 14px; padding: .32rem .7rem; font-size: .72rem; cursor: pointer; color: #555; }
.app-mini-btn:active { background: #e3e7f5; }
.g-who { font-size: .66rem; color: #999; margin-bottom: 2px; }
.g-vote { background: #f5f6fa; border-radius: 8px; padding: .3rem .55rem; margin-top: .3rem; font-size: .75rem; display: flex; justify-content: space-between; cursor: pointer; }
.g-vote.voted { background: #e8f5e9; }

/* 通用App卡片 */
.app-card { background: rgba(255,255,255,.95); border-radius: 14px; padding: .85rem; margin-bottom: .7rem; box-shadow: 0 2px 8px rgba(50,50,93,.05); }
.app-card-title { font-weight: 600; font-size: .85rem; margin-bottom: .55rem; }
.app-full-btn { display: block; width: 100%; min-width: auto !important; margin-bottom: .6rem; padding: .6rem !important; font-size: .85rem !important; }

/* 教务 */
.jw-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.jw-table th { text-align: left; color: #999; font-weight: 500; padding: .3rem .2rem; border-bottom: 1px solid #eee; }
.jw-table td { padding: .35rem .2rem; border-bottom: 1px solid #f5f5f5; }
.jw-done { color: #999; } .jw-soon { color: #e17055; font-weight: 600; }
.jw-rank { margin-top: .5rem; font-size: .8rem; color: #555; }

/* 抖音 */
.dy-stats { display: flex; justify-content: space-around; text-align: center; }
.dy-stats div { display: flex; flex-direction: column; }
.dy-stats b { font-size: 1.05rem; color: #2d3436; }
.dy-stats span { font-size: .65rem; color: #999; }
.dy-card { display: flex; gap: .6rem; background: rgba(255,255,255,.95); border-radius: 12px; padding: .6rem; margin-bottom: .55rem; box-shadow: 0 2px 8px rgba(50,50,93,.05); }
.dy-cover { width: 76px; height: 100px; border-radius: 10px; background: linear-gradient(135deg,#dfe6e9,#b2bec3); display: flex; align-items: center; justify-content: center; font-size: 2rem; flex-shrink: 0; }
.dy-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.dy-cap { font-size: .8rem; line-height: 1.4; } .dy-like { font-size: .72rem; color: #e17055; }

/* 小红书 */
.xhs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; padding: .8rem; }
.xhs-note { background: rgba(255,255,255,.95); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(50,50,93,.05); }
.xhs-cover { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: linear-gradient(135deg,#fff0f3,#ffe0e8); }
.xhs-title { font-size: .74rem; padding: .4rem .5rem .2rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xhs-meta { display: flex; justify-content: space-between; padding: 0 .5rem .45rem; font-size: .66rem; color: #999; }
.xhs-tag { background: #ffe4e9; color: #d63031; border-radius: 8px; padding: 1px 6px; }

/* 支付宝 */
.zfb-balance { background: linear-gradient(135deg,#1677ff,#69b1ff); border-radius: 16px; padding: 1.1rem; margin-bottom: .7rem; color: #fff; box-shadow: 0 4px 14px rgba(22,119,255,.3); }
.zfb-label { font-size: .72rem; opacity: .85; }
.zfb-num { font-size: 1.7rem; font-weight: 700; letter-spacing: .02em; }
.bill-row { display: flex; justify-content: space-between; align-items: center; padding: .45rem 0; border-bottom: 1px solid #f5f5f5; }
.bill-note { font-size: .78rem; } .bill-time { font-size: .64rem; color: #aaa; }
.bill-amt { font-weight: 600; font-size: .82rem; }
.bill-amt.b-pos { color: #00b894; } .bill-amt.b-neg { color: #2d3436; }
.bill-empty { text-align: center; color: #bbb; font-size: .78rem; padding: .8rem 0; }

/* 外卖/点评 */
.wm-banner { background: linear-gradient(135deg,#ffd6c2,#ffb99a); border-radius: 12px; padding: .55rem .8rem; font-size: .74rem; color: #8d4a1f; margin-bottom: .6rem; }
.food-row { display: flex; align-items: center; gap: .6rem; background: rgba(255,255,255,.95); border-radius: 12px; padding: .6rem .7rem; margin-bottom: .5rem; box-shadow: 0 2px 8px rgba(50,50,93,.05); }
.food-icon { width: 44px; height: 44px; border-radius: 10px; background: #f7f8fa; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.food-info { flex: 1; min-width: 0; }
.food-name { font-size: .8rem; font-weight: 600; }
.food-desc { font-size: .66rem; color: #999; }
.food-price { font-size: .74rem; color: #e17055; font-weight: 700; }
.dp-star { color: #ff9f43; font-size: .68rem; }
.food-order { border: none; background: linear-gradient(135deg,#ff9f43,#ff7f27); color: #fff; border-radius: 999px; padding: .35rem .8rem; font-size: .74rem; cursor: pointer; flex-shrink: 0; }

/* 备忘录 */
.todo-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid #f5f5f5; font-size: .8rem; }
.todo-text { flex: 1; cursor: pointer; }
.todo-del { border: none; background: none; color: #ccc; cursor: pointer; font-size: .8rem; }
.todo-add { display: flex; gap: .4rem; margin-top: .5rem; }
.todo-add input { flex: 1; border: 1px solid #eee; border-radius: 10px; padding: .4rem .6rem; font-size: .78rem; }
.todo-add button { border: none; background: #6c5ce7; color: #fff; border-radius: 10px; width: 34px; cursor: pointer; }
.course-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.course-chip { background: #f0edff; color: #6c5ce7; border-radius: 8px; padding: .2rem .55rem; font-size: .72rem; }
.memo-money { display: flex; justify-content: space-around; font-size: .82rem; }
.memo-money b { font-size: 1rem; }

/* 校园墙发帖框 */
.wall-composer { display: flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.95); border-radius: 16px; padding: .55rem .6rem; margin-bottom: .7rem; box-shadow: 0 2px 8px rgba(50,50,93,.05); }
.wall-composer input { flex: 1; border: none; background: none; font-size: .8rem; min-width: 0; }
.wall-composer input:focus { outline: none; }
.anon-toggle { border: 1px solid #ddd; background: #fff; border-radius: 999px; padding: .25rem .6rem; font-size: .68rem; color: #999; cursor: pointer; flex-shrink: 0; }
.anon-toggle.on { background: #2d3436; color: #fff; border-color: #2d3436; }
.wall-send { border: none; background: linear-gradient(135deg,#6c5ce7,#a29bfe); color: #fff; border-radius: 999px; padding: .3rem .8rem; font-size: .72rem; cursor: pointer; flex-shrink: 0; }
