/* ==============================
   星月小窝 2.0 首页
   ============================== */

/* ---------- 基础 ---------- */

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
}

/* ---------- 首次进入的登录页（Pixiv 风格：整屏插画 + 右侧白卡片） ---------- */

.auth-screen {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;
    justify-content: flex-end; /* 卡片整体靠右 */

    padding-right: clamp(40px, 9vw, 150px);

    box-sizing: border-box;

    z-index: 1000;

    overflow: hidden;

    /* 登录页的文字 / 按钮 / 插画都不参与拖选；
       第二张卡里的输入框在下面单独用 user-select: text 放开 */
    user-select: none;

    /* 图片加载前的兜底底色 */
    background-color: #1c1c22;
}

/* 背景：星瑶与月瓷两张图叠在同一位置轮播 */
.auth-bg {
    position: absolute;

    inset: 0;

    z-index: 0;
}

.auth-bg-img {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    opacity: 0;

    user-select: none;
    -webkit-user-drag: none;
}

/* 第 1 张（星瑶）：0–4.5s 显示 → 淡出 → 9.5–10s 淡入 */
.auth-bg-img:first-child {
    animation: auth-bg-first 10s ease-in-out infinite;
}

/* 第 2 张（月瓷）：0–4.5s 隐藏 → 淡入 → 5.5–9.5s 显示 → 淡出 */
.auth-bg-img:last-child {
    animation: auth-bg-second 10s ease-in-out infinite;
}

/* 两个动画互补，10 秒一个循环，交界处不会闪 */
@keyframes auth-bg-first {
    0%,
    45% {
        opacity: 1;
    }

    55%,
    95% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes auth-bg-second {
    0%,
    45% {
        opacity: 0;
    }

    55%,
    95% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* 压暗一层：整体偏暗，白卡片才跳得出来 */
.auth-overlay {
    position: absolute;

    inset: 0;

    z-index: 1;

    background: linear-gradient(180deg, rgba(18, 20, 28, 0.34), rgba(18, 20, 28, 0.58));
}

.auth-box {
    position: relative;

    z-index: 2;

    width: 340px;
    max-width: calc(100vw - 40px);

    /* 上下留白加大，整块卡片更修长 */
    padding: 46px 30px 40px;

    box-sizing: border-box;

    text-align: center;

    background-color: rgba(255, 255, 255, 0.97);

    border-radius: 18px;

    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.auth-box h1 {
    margin: 0 0 22px;

    font-size: 24px;
    letter-spacing: 2px;

    color: var(--main-color);
}

/* 卡片里的按钮：整体收小一圈 */
.auth-box button {
    display: block;

    width: 100%;

    margin: 0 0 10px;
    padding: 10px;

    border: none;
    border-radius: 9px;

    font-size: 14px;

    cursor: pointer;

    transition: filter 0.2s ease, background-color 0.2s ease;
}

.auth-box button:last-child {
    margin-bottom: 0;
}

/* 主按钮：登录 / 注册 / 重置密码 */
.auth-btn-primary {
    background-color: var(--main-color);

    color: #ffffff;

    font-weight: bold;
}

.auth-btn-primary:hover {
    filter: brightness(1.06);
}

.auth-btn-primary:disabled {
    opacity: 0.65;

    cursor: default;
}

/* 次按钮：发送验证码（小圆角，和输入框同一行） */
.auth-btn-soft {
    background-color: rgba(102, 204, 255, 0.16);

    color: #2b93c9;

    font-weight: bold;
}

.auth-btn-soft:hover {
    background-color: rgba(102, 204, 255, 0.26);
}

.auth-btn-soft:disabled {
    opacity: 0.65;

    cursor: default;
}

/* 验证码 + 发送按钮：同一行、高度一致 */
.auth-row {
    display: flex;
    align-items: stretch;

    gap: 8px;

    margin-bottom: 12px;
}

.auth-row .auth-input,
.auth-row .auth-btn-inline {
    height: 40px;

    box-sizing: border-box;
}

.auth-row .auth-input {
    flex: 1;

    margin-bottom: 0;
}

.auth-btn-inline {
    width: auto !important;

    min-width: 64px;

    margin: 0 !important;
    padding: 0 14px;

    flex-shrink: 0;

    font-size: 13px;
}

/* ---------- 密码框：右侧小眼睛（显示 / 隐藏密码） ---------- */

.auth-pwd {
    position: relative;

    margin-bottom: 12px;
}

.auth-pwd .auth-input {
    padding-right: 44px;

    margin-bottom: 0;
}

.auth-box .auth-eye {
    position: absolute;

    right: 6px;
    top: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    margin: 0;
    padding: 0;

    border: none;
    border-radius: 0;

    background: transparent;

    line-height: 0;

    color: #9aa3ad;

    cursor: pointer;

    transform: translateY(-50%);
}

.auth-box .auth-eye svg {
    display: block;
}

/* ---------- 密码实时提示：不符合才出现，符合时整行隐藏 ---------- */

.auth-hint {
    margin: -6px 0 12px;

    font-size: 12px;
    line-height: 1.4;

    text-align: left;

    color: #e05b5b;
}

.auth-hint[hidden] {
    display: none;
}

.auth-hint-bad {
    color: #e05b5b;
}

/* 输入框状态：符合 = 绿框，不符合 = 红框（覆盖聚焦时的蓝色） */
.auth-box .auth-input-ok,
.auth-box .auth-input-ok:focus {
    border-color: #3aa76d;
}

.auth-box .auth-input-bad,
.auth-box .auth-input-bad:focus {
    border-color: #e05b5b;
}

/* ---------- 两个文字链接并排一行（改用验证码登录 ｜ 忘记密码？） ---------- */

.auth-links-row {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    margin: 10px 0 4px;
}

.auth-links-row .auth-link {
    display: inline-block;

    width: auto;

    margin: 0;
    padding: 0;
}

/* 两个链接之间的竖线分隔 */
.auth-links-row .auth-link + .auth-link::before {
    content: "|";

    margin-right: 10px;

    color: #d8dde3;
}

/* 起始屏的输入框：之间留点空隙（登录 / 注册 / 找回密码三张卡通用） */
.auth-box .auth-input {
    margin-bottom: 12px;

    /* 整屏是禁选的，但输入框必须能选中 / 编辑 */
    user-select: text;
}

/* 密码 / 验证码两种模式的容器（本身不需要额外间距） */
#login-mode-password,
#login-mode-code {
    margin: 0;
}

/* ==============================
   首页
   ============================== */

.home-screen {
    display: none;

    position: relative; /* 侧边栏改成浮层后（见下），用它当定位基准 */

    width: 100%;
    height: 100vh;

    /* 显示时整块淡入：侧边栏、左下角用户区、主空间同步出现，
       不会出现"某一个元素比别人先冒出来"的闪动 */
    animation: homeScreenIn 0.22s ease-out;
}

@keyframes homeScreenIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}

/* ==============================
   侧边栏（白色，可折叠，默认收起）
   ============================== */

/* 侧边栏浮在主区域之上、不占布局宽度：
   展开 / 收起只改变它盖住多少背景，不会推挤右侧对话栏 ——
   主区域宽度与内部元素（对话栏、背景图、登录面板）的位置都不再变动 */
.sidebar {
    position: absolute;

    left: 0;
    top: 0;

    display: flex;
    flex-direction: column;

    width: 90px;
    height: 100vh;

    box-sizing: border-box;

    background-color: var(--surface-color);

    flex-shrink: 0;

    z-index: 100;

    transition: width 0.25s ease;
}

/* ---------- 侧边栏顶部 ---------- */

.sidebar-header {
    display: flex;
    align-items: center;

    height: 56px;

    padding: 0 10px;

    box-sizing: border-box;

    /* 网站图标**跟着侧边栏一起平滑滑动**，不瞬移 ——
       和左下角头像同一套做法：位置只靠 padding-left 控制（长度值能过渡），
       时长与 .sidebar 那条 width 0.25s 对齐。
       展开态 padding-left 10px ⇒ 图标 left = 10 + (40 − 34) / 2 = 13px。 */
    transition: padding 0.25s ease;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    flex-shrink: 0;

    padding: 0;

    border: none;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;

    transition: background-color 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: rgba(102, 204, 255, 0.12);
}

.sidebar-toggle img {
    display: block;

    width: 34px;
    height: 34px;

    border-radius: 8px;

    /* 网站图标不参与拖选，也不能被拖出去 */
    user-select: none;
    -webkit-user-drag: none;
}

/* ---------- 菜单（每个按钮整行可点击，点击范围占满侧边栏宽度） ---------- */

.sidebar-menu {
    display: flex;
    flex-direction: column;

    gap: 4px;

    padding: 8px 0;

    /* 导航文字不可选中：鼠标从「关于」滑向右侧子菜单时不会把文字刷蓝
       （子菜单项是这里面的后代，一起生效；用户区的昵称 / 邮箱仍可复制） */
    user-select: none;
}

.sidebar-item {
    display: flex;
    align-items: center;

    height: 44px;

    padding: 0 25px;

    box-sizing: border-box;

    border-radius: 8px;

    color: var(--text-color);

    text-decoration: none;

    font-size: 16px;

    white-space: nowrap;

    cursor: pointer;

    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-item:hover {
    background-color: rgba(102, 204, 255, 0.12);

    color: var(--main-color);
}

.sidebar-item.active {
    background-color: rgba(102, 204, 255, 0.18);

    color: var(--main-color);

    font-weight: bold;
}

/* Live2D 的文字比"首页 / 插画 / 周边"长：
   左右内边距对称收窄 + 文字居中，保证完整显示同时保持居中 */
#menu-live2d {
    justify-content: center;

    padding: 0 8px;
}

/* ---------- "关于"：hover 展开子菜单 ---------- */

.sidebar-item-parent {
    position: relative;

    cursor: default;
}

.sidebar-submenu {
    display: none;
    flex-direction: column;

    gap: 2px;

    position: absolute;

    left: calc(100% + 6px);
    top: 0;

    min-width: 96px;

    padding: 8px;

    background-color: #ffffff;

    border-radius: 12px;

    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);

    z-index: 300;
}

.sidebar-item-parent:hover .sidebar-submenu {
    display: flex;
}

/* 鼠标从「关于」移向右侧子菜单时必须越过那 6px 空隙：
   :hover 会在空隙里断掉 → 子菜单闪退 → 侧边栏跟着收起。
   这条不可见的伪元素把空隙铺满，让两边的 hover 区域连成一片 */
.sidebar-submenu::before {
    content: "";

    position: absolute;

    left: -6px;
    top: 0;
    bottom: 0;

    width: 6px;
}

.sidebar-submenu-item {
    display: block;

    padding: 8px 12px;

    border-radius: 8px;

    text-decoration: none;

    font-size: 14px;

    color: var(--text-color);

    white-space: nowrap;

    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-submenu-item:hover {
    background-color: rgba(102, 204, 255, 0.12);

    color: var(--main-color);
}

/* ---------- 用户区域（点击进入用户设置） ---------- */

/* 只显示头像（名字已去掉）。头像位置**跟着侧边栏一起平滑滑动**：
     · 展开（桌面 90px）：padding-left 14px —— 与上方网站图标的左边缘对齐（图标 left=13）
     · 收起（桌面 44px）：在窄条里居中 ⇒ (44 − 34) / 2 = 5px
   ⚠️ 关键是「怎么过渡」：**不能靠 justify-content: center ↔ flex-start 切换** ——
      justify-content 是离散值、不参与过渡，切换瞬间会「瞬移」；
      改成过渡 padding-left（长度值可以过渡），时长与侧边栏那条 width 0.25s 对齐，滑过去就是连贯的。
   宽度也不再需要 max-content / max-width / overflow —— 那一套是为了把名字"露"到侧边栏外面
   （hover 时延长成蓝卡），现在没名字了，让它在纵向 flex 里自然撑满即可
   （.sidebar 默认 align-items: stretch）。 */
.sidebar-user {
    display: flex;
    align-items: center;

    justify-content: flex-start;

    margin-top: auto;

    padding: 14px;

    box-sizing: border-box;

    cursor: pointer;

    /* 头像不参与拖选（与左侧菜单保持一致） */
    user-select: none;

    background-color: transparent;

    transition: padding 0.25s ease;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    border-radius: 50%;

    background-color: rgba(102, 204, 255, 0.15);

    font-size: 18px;
}

/* ---------- 收起状态（44px：图标两侧各留 5px） ---------- */

.home-screen.sidebar-collapsed .sidebar {
    width: 44px;
}

/* 收起时头像在窄条里居中：(44 − 34) / 2 = 5px。
   展开时这条不生效 → padding-left 回到 14px，头像会**平滑地往右滑 9px**
   （靠上面的 transition: padding 过渡，和侧边栏变宽同步）。 */
.home-screen.sidebar-collapsed .sidebar-user {
    padding-left: 5px;
    padding-right: 5px;
}

/* 收起时网站图标在窄条里居中：(44 − 40) / 2 = 2px ⇒ 图标 left = 2 + 3 = 5px，
   和以前 justify-content: center 的位置**一模一样**。
   展开时这条不生效 → padding-left 回到 10px，图标会**平滑地往右滑 8px**。
   ⚠️ 不能用 justify-content: center ↔ flex-start 切换：那是离散值、不参与过渡，
      切换瞬间会「瞬移」（头像那边踩过同一个坑）。 */
.home-screen.sidebar-collapsed .sidebar-header {
    justify-content: flex-start;

    padding-left: 2px;
    padding-right: 0;
}

.home-screen.sidebar-collapsed .sidebar-text {
    display: none;
}

.home-screen.sidebar-collapsed .sidebar-menu {
    padding: 8px 0;
}

.home-screen.sidebar-collapsed .sidebar-item {
    justify-content: center;

    padding: 0;
}

/* 收起状态不需要再给用户区单独定位：上面的基础样式已经让头像稳在同一个 x
   （padding 左右 5px + 左对齐），侧边栏变宽变窄它都不动 */

/* ==============================
   主空间
   ============================== */

.app-space {
    position: relative;

    flex: 1;

    /* 给浮层侧边栏留出「收起时」的宽度 44px：
       收起状态下与改动前完全一致；展开时侧边栏盖住左侧多出的 46px 背景，
       对话栏等靠右的内容不再跟着位移 */
    margin-left: 44px;

    min-width: 0;
    height: 100vh;

    overflow: hidden;
}

/* ---------- 背景 ---------- */

.background {
    position: absolute;

    inset: 0;

    background-image: url("../../images/zhushitu.jpg");

    background-size: cover;
    background-position: center;

    z-index: 0;
}

/* ---------- Live2D ---------- */

.live2d-stage {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 1;
}

.live2d-placeholder {
    display: none;
}

/* 模型容器 = Live2D 窗口：固定尺寸，fixed 定位在整个网页正中间；
   SDK 在容器内渲染画布，我们只操作容器本身（拖动/缩放/旋转），互不干扰 */
.live2d-container {
    position: fixed;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    width: 1050px;
    height: 1500px;
}

/* ⚠️ SDK 初始化时会自己建一个舞台元素 #oml2d-stage，内联样式是
   `position: fixed; left: 0; bottom: 0;` + 宽高等同模型尺寸 —— 它是本容器的子元素，
   而本容器带 transform，**fixed 会改以这个容器为参照**，于是模型被摆到了容器的「左下角」，
   看起来就偏左下、不在主页正中心（实测：容器矩形 262,-346.5 1050x1500，
   画布却在 262,483.5，正好是容器左下角）。
   这里把它拉回容器正中心 —— 桌面端容器本身就居中，所以模型也就落在主页正中心；
   手机上容器按媒体查询上移，模型随之居中于容器，行为照旧。
   ⚠️ 必须连 animation 一起覆盖：SDK 的滑入动画用的是 transform 且 fill-mode: forwards，
      而动画在层叠里的优先级高于普通声明（连 !important 都压不住），
      不覆盖的话我们写的位移会被动画整个吃掉。这里换成自己的滑入动画。 */
#live2d-container #oml2d-stage {
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;

    animation: xingyue-live2d-in 700ms ease-out both !important;
}

@keyframes xingyue-live2d-in {
    from {
        transform: translate(-50%, -50%) translateY(130%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* 画布铺满窗口（尺寸由 SDK 按容器计算，不变形） */
.live2d-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* 隐藏 SDK 官方默认 UI（对话框、按钮等）：只隐藏不含画布的容器，保留舞台 */
.live2d-container > div:not(:has(canvas)) {
    display: none !important;
}

.live2d-container > div:has(canvas) :not(canvas) {
    display: none !important;
}

/* ==============================
   聊天（右侧窄栏，与输入框左沿对齐）
   ============================== */

.chat-area {
    position: absolute;

    top: 0;
    right: 20px;

    width: 21%;
    height: calc(100% - 70px);

    padding: 16px 0 0;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    z-index: 2;

    overflow: hidden;
}

.message-list {
    display: flex;
    flex-direction: column;

    justify-content: flex-end;

    gap: 10px;

    flex: 1;

    min-height: 0;

    width: 100%;

    overflow-y: auto;

    padding: 0;

    box-sizing: border-box;

    scrollbar-width: none;
}

.message-list::-webkit-scrollbar {
    display: none;
}

/* ---------- 消息（出现动画：上滑 + 由小变大） ---------- */

.message {
    display: flex;
    flex-direction: column;

    max-width: 95%;

    opacity: 0;

    animation: bubbleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 手机端气泡 10 秒后上滑淡出 */
.message-fade-out {
    animation: bubbleOut 0.4s ease forwards;
}

@keyframes bubbleOut {

    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-14px);
    }

}

.message-character {
    align-self: flex-start;

    transform-origin: left bottom;
}

.message-user {
    align-self: flex-end;

    text-align: right;

    transform-origin: right bottom;
}

/* 气泡入场：从下方平滑上滑（不再有缩放弹跳） */
@keyframes bubbleIn {

    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

/* 更早的对话：静止显示，不播入场动画 */
.message-static {
    opacity: 1;

    animation: none;
}

.message-name {
    margin-bottom: 3px;

    font-size: 13px;

    opacity: 0.7;
}

.message-bubble {
    padding: 6px 10px;

    border-radius: 12px;

    background-color: rgba(255, 255, 255, 0.8);

    backdrop-filter: blur(8px);

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);

    font-size: 15px;
    line-height: 1.5;

    text-align: left;
}

/* ==============================
   输入框（上下压缩，与聊天区左沿对齐）
   ============================== */

.chat-input {
    position: absolute;

    right: 20px;
    bottom: 25px;

    width: 21%;
    height: 40px;

    display: flex;

    z-index: 5;

    border-radius: 12px;

    background-color: rgba(255, 255, 255, 0.75);

    backdrop-filter: blur(10px);

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);

    overflow: hidden;
}

/* ---------- 角色选择按钮（输入框左侧小圆圈，hover 轻微上移） ---------- */

.chat-role-btn {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    flex-shrink: 0;

    padding: 0;

    border: none;
    border-radius: 50%;

    background: transparent;

    cursor: pointer;

    transition: transform 0.2s ease, background-color 0.2s ease;
}

.chat-role-btn img {
    width: 24px;
    height: 24px;

    border-radius: 50%;

    /* 角色按钮图标不参与拖选，也不能被拖出去 */
    user-select: none;
    -webkit-user-drag: none;
}

.chat-role-btn:hover {
    transform: translateY(-2px);

    background-color: rgba(102, 204, 255, 0.12);
}

.chat-input input {
    flex: 1;

    min-width: 0;

    padding: 0 14px;

    border: none;
    outline: none;

    background: transparent;

    font-size: 16px;
}

.chat-input button {
    width: 44px;

    border: none;

    background: transparent;

    cursor: pointer;

    font-size: 18px;
}

/* ==============================
   角色选择面板（与主页风格一致）
   ============================== */

.role-picker {
    position: absolute;

    /* 宽度恢复固定大小；right 用 calc 让左边缘与输入框左边缘保持一条直线 */
    right: calc(21% + 20px - min(180px, 21%));
    bottom: 75px;

    width: min(180px, 21%);

    z-index: 8;

    padding: 6px;

    background-color: #ffffff;

    border-radius: 14px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);

    animation: pickerIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pickerIn {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

.role-picker-group-title {
    padding: 8px 12px 4px;

    font-size: 12px;

    color: #999999;
}

.role-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    padding: 9px 12px;

    border: none;
    border-radius: 8px;

    background: transparent;

    font-size: 14px;

    color: var(--text-color);

    text-align: left;

    cursor: pointer;

    transition: background-color 0.15s ease, color 0.15s ease;
}

.role-picker-item:hover {
    background-color: rgba(102, 204, 255, 0.12);

    color: var(--main-color);
}

.role-picker-item.active {
    background-color: rgba(102, 204, 255, 0.18);

    color: var(--main-color);

    font-weight: bold;
}

/* "添加人物"行：加号在右边 */
.role-picker-add {
    margin-top: 6px;

    padding-top: 10px;

    border-top: 1px solid #f0f0f0;

    border-radius: 0 0 8px 8px;

    color: var(--main-color);
}

.role-picker-add-icon {
    font-size: 16px;

    font-weight: bold;
}

/* 角色头像：排在名字左边，把名字往右推（不加边框） */
.role-picker-avatar {
    display: block;

    width: 22px;
    height: 22px;

    margin-right: 8px;

    border: none;
    border-radius: 50%;

    object-fit: cover;

    flex-shrink: 0;
}

/* 名字之后自动填充空白：「✓」等标记因此始终靠右 */
.role-picker-name {
    margin-right: auto;
}

.auth-input {
    display: block;

    width: 100%;

    padding: 9px 12px;

    box-sizing: border-box;

    border: 1px solid #e6e6e6;
    border-radius: 9px;

    outline: none;

    font-size: 16px; /* 小于 16px 时 iOS 会自动放大页面 */

    color: var(--text-color);

    transition: border-color 0.2s ease;
}

.auth-input:focus {
    border-color: var(--main-color);
}

.auth-link {
    display: block;

    width: 100%;

    margin-top: 8px;
    padding: 0;

    border: none;

    background: transparent;

    font-size: 12.5px;

    color: #999999;

    cursor: pointer;
}

.auth-link:hover {
    color: var(--main-color);
}

.auth-msg {
    margin: 10px 0 0;

    font-size: 12.5px;
    line-height: 1.6;

    color: #999999;
}

.auth-msg-error {
    color: #e05b5b;
}

.auth-msg-ok {
    color: #3aa76d;
}

/* ==============================
   手机端适配（首页）
   ============================== */

@media (max-width: 768px) {

    /* ---------- 背景：手机端换成竖版背景图 ---------- */

    .background {
        background-image: url("../../images/supingbeijing.jpg");
    }

    /* ---------- 侧边栏：更窄（展开 104px / 收起 50px） ---------- */

    .sidebar {
        /* 手机端回到并排布局：屏幕窄，浮层会压住正文 */
        position: relative;

        left: auto;
        top: auto;

        width: 50px;
    }

    .home-screen:not(.sidebar-collapsed) .sidebar {
        width: 104px;
    }

    /* 主区域不再预留浮层宽度 */
    .app-space {
        margin-left: 0;
    }

    .sidebar-header {
        height: 48px;

        padding: 0 8px;
    }

    .sidebar-toggle {
        width: 34px;
        height: 34px;
    }

    .sidebar-toggle img {
        width: 30px;
        height: 30px;
    }

    .sidebar-item {
        height: 40px;

        padding: 0 16px;

        font-size: 14px;
    }

    .home-screen.sidebar-collapsed .sidebar-item {
        padding: 0;
    }

    .sidebar-user {
        /* 只改纵向间距；横向与桌面一致（展开 14px、收起 5px），不需要再单独覆盖。
           ⚠️ 别看上面那条 `.sidebar { width: 50px }` —— 收起时它会被
              `.home-screen.sidebar-collapsed .sidebar { width: 44px }` 盖掉，
              所以手机端收起同样是 44px（实测确认），居中位置一样是 5px */
        padding: 10px 14px;
    }

    /* 收起状态不再覆盖（继承上面的 5px） */

    .home-screen.sidebar-collapsed .sidebar-header {
        /* 手机端收起是 50px 窄条、按钮 34px ⇒ 居中位置 (50 − 34) / 2 = 8px，
           和展开态的 padding-left 8px 恰好相同 —— 手机上图标本来就不会动，
           这里只是把桌面那条 2px 覆盖掉，别让它跟着桌面规则跑。 */
        padding-left: 8px;
    }

    /* ---------- 登录框（手机端回到居中：屏幕窄，靠右会挤） ---------- */

    .auth-screen {
        justify-content: center;

        padding-right: 0;
    }

    .auth-box {
        width: calc(100vw - 48px);

        max-width: 340px;

        padding: 28px 22px 22px;
    }

    /* ---------- Live2D 窗口：改为屏幕比例 ----------
       容器的 (left, top) 因为带着 translate(-50%, -50%)，**就是容器中心点的位置**。
       桌面端是 50% / 50% ⇒ 中心正好落在屏幕正中心；
       这里原来写 32%（480px 以下 30%）想「居中偏上，给聊天让出下半屏」，
       但手机端模型是按固定像素渲染的（scale 0.13 → 框高 871px），
       中心压到 30% 会把模型框顶推到屏幕外 —— 实测推算：角色头顶会被切掉约 85px。
       所以跟桌面统一成 50%，让模型真正落在正中心（下半身本来就会被聊天区盖住，不影响）。 */
    .live2d-container {
        top: 50%;

        width: 86vw;
        height: 46vh;
    }

    /* ---------- 聊天区：铺满下半屏 ---------- */

    .chat-area {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 64px;

        width: auto;
        height: 40vh;

        padding: 6px 0 0;
    }

    .message-bubble {
        font-size: 14px;
    }

    .message-name {
        font-size: 12px;
    }

    /* ---------- 输入框：贴底全宽 ---------- */

    .chat-input {
        left: 8px;
        right: 8px;
        bottom: 12px;

        width: auto;
        height: 44px;
    }

    .chat-input input {
        font-size: 16px; /* 小于 16px 时 iOS 会自动放大页面 */
    }

    /* ---------- 角色选择面板：贴着输入框上方全宽 ---------- */

    .role-picker {
        left: 8px;
        right: 8px;
        bottom: 64px;

        width: auto;

        max-height: 46vh;

        overflow-y: auto;
    }
}

@media (max-width: 480px) {

    .live2d-container {
        /* 与 768px 断点一致：容器中心 = 屏幕正中心（理由见上面那段的注释） */
        top: 50%;

        width: 92vw;
        height: 42vh;
    }

    .chat-area {
        height: 42vh;
    }
}
