/* 线下模式设置 */
.offline-mode-home-card {
    display: flex;
    width: 100%;
    min-height: 86px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.48);
    color: #4f5672;
    text-align: left;
    box-shadow: 0 8px 22px rgba(70, 74, 108, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.46);
    cursor: pointer;
}

.offline-mode-home-card:active {
    transform: scale(0.99);
}

.offline-mode-home-title {
    font-size: 17px;
    font-weight: 800;
}

.offline-mode-home-sub {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(79, 86, 114, 0.76);
}

/* mobile-real-device-fix.css 的旧窄屏规则会在后加载时给气泡左右补 padding；
   新版卡片把留白交给 body 管理，使用页面 ID 提升优先级，避免顶部状态栏被挤出圆角。 */

/* 可选的杂志/邮票主题兼容结构。
   仅当美化文件声明 --nanchang-* 并由能力层激活时生效；默认新版车票与气泡不变。 */
/* ===== 文本设置 = 长文直出：气泡头部（左上角成员头像堆叠 + 第一位成员简约状态） ===== */
/* 头像堆叠在长文头部内改为常规文档流（基类为绝对定位的旧浮层方案） */
/* ===== 文本设置 = 区分台词：旁白不加气泡，按排版直接落在界面上 ===== */
/* 多选态下旁白块也要有可见的选中反馈（气泡消息的选中样式不覆盖它） */
/* 线下记录回看：旁白同样无气泡直落页面 */
.offline-record-msg--narration .offline-record-msg__body {
    width: 100%;
}

.offline-record-narration-block {
    padding: 2px 4px;
}

/* ===== 线下模式设置弹窗 ===== */
/* 编辑美化-选择线下美化方案 列表弹窗：滚动条隐形 */
#offline-beautify-preset-dialog .error-dialog {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

#offline-beautify-preset-dialog .error-dialog::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

.offline-npc-cast-entry-btn {
    min-width: 58px;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    font-size: 13px;
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 420px) {
}

#chat-page .chat-offline-modals-layer .offline-mode-home-content {
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    min-height: 0;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-page .chat-offline-modals-layer .offline-mode-home-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

/* =========================================================================
   线下模式主界面（设置 / 线下记录）
   ========================================================================= */
.offline-mode-home-body {
    padding-top: 6px;
}

.offline-mode-home-card {
    flex-direction: row !important;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    -webkit-tap-highlight-color: transparent;
}

.offline-mode-home-card__icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #5A6AE0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.12));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.offline-mode-home-card__icon svg {
    width: 24px;
    height: 24px;
}

.offline-mode-home-card__text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.offline-mode-home-card__chevron {
    flex: 0 0 auto;
    font-size: 22px;
    line-height: 1;
    color: rgba(79, 86, 114, 0.45);
    font-weight: 700;
}

/* =========================================================================
   线下记录列表页 + 票根详情页（整屏，尺寸与小手机屏幕一致）
   ========================================================================= */
.offline-records-page,
.offline-record-detail-page {
    flex-direction: column;
    position: relative;
    overflow: hidden;
    color: #2D2B55;
    background:
        radial-gradient(circle at 86% 12%, rgba(102, 126, 234, 0.20) 0, transparent 32%),
        radial-gradient(circle at 8% 80%, rgba(118, 75, 162, 0.16) 0, transparent 34%),
        linear-gradient(135deg, #E8E0F0 0%, #D4E4F7 34%, #C8E6F5 64%, #E0D8F0 100%);
}

.offline-records-page.active,
.offline-record-detail-page.active {
    display: flex;
}

.offline-records-page .status-bar,
.offline-record-detail-page .status-bar,
.offline-records-header,
.offline-record-detail-header {
    background: rgba(255, 255, 255, 0.40) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    backdrop-filter: blur(18px) saturate(1.08);
}

.offline-records-header,
.offline-record-detail-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.offline-records-header h1,
.offline-record-detail-header h1 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.offline-records-header .back-btn,
.offline-record-detail-header .back-btn {
    background: rgba(255, 255, 255, 0.55) !important;
    border: 1px solid rgba(255, 255, 255, 0.66) !important;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 16px rgba(45, 43, 85, 0.10);
    -webkit-tap-highlight-color: transparent;
}

.offline-records-header .back-btn:active,
.offline-record-detail-header .back-btn:active {
    transform: scale(0.96);
}

.offline-records-header-spacer {
    width: 40px;
    flex: 0 0 auto;
}

.offline-record-detail-sub {
    font-size: 11px;
    line-height: 1.2;
    margin-top: 2px;
    color: rgba(45, 43, 85, 0.6);
    text-align: center;
}

.offline-records-list {
    flex: 1 1 auto;
    min-height: 0;
    z-index: 1;
    padding: 14px 14px calc(20px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.offline-records-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.offline-records-hint {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(45, 43, 85, 0.56);
    margin: 0 2px 12px;
}

/* 票根卡片（登机牌票根样式） */
.offline-record-stub {
    display: block;
    width: 100%;
    margin: 0 0 14px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}

.offline-record-stub:active {
    transform: scale(0.985);
}

.offline-record-stub__pass {
    display: flex;
    align-items: stretch;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 26px rgba(70, 74, 108, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.offline-record-stub__left {
    flex: 0 0 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 8px;
    color: #fff;
    text-align: center;
    background: linear-gradient(150deg, #667eea 0%, #764ba2 100%);
}

.offline-record-stub__brand {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    opacity: 0.95;
    line-height: 1.3;
}

.offline-record-stub__plane {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.95;
}

.offline-record-stub__route {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.9;
}

.offline-record-stub__perforation {
    flex: 0 0 2px;
    width: 2px;
    background-image: radial-gradient(circle, rgba(118, 75, 162, 0.32) 0 1.6px, transparent 2px);
    background-size: 2px 9px;
    background-repeat: repeat-y;
    background-position: center;
}

.offline-record-stub__main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 14px 12px;
}

.offline-record-stub__title {
    font-size: 16px;
    font-weight: 900;
    color: #2D2B55;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-record-stub__time {
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(45, 43, 85, 0.62);
}

.offline-record-stub__names {
    font-size: 11.5px;
    color: rgba(45, 43, 85, 0.66);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-record-stub__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
    font-size: 11px;
    color: rgba(45, 43, 85, 0.55);
}

.offline-record-stub__go {
    font-weight: 800;
    color: #5A6AE0;
    white-space: nowrap;
}

/* 空状态 */
.offline-records-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 28px;
    text-align: center;
}

.offline-records-empty__icon {
    font-size: 46px;
    opacity: 0.7;
}

.offline-records-empty__text {
    font-size: 13.5px;
    line-height: 1.7;
    color: rgba(45, 43, 85, 0.6);
}

/* 票根详情：只读回看内容 */
.offline-record-detail-content {
    flex: 1 1 auto;
    min-height: 0;
    z-index: 1;
    padding: 16px 12px calc(24px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.offline-record-detail-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.offline-record-msg {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0 0 16px;
}

.offline-record-msg__meta {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 2px;
}

.offline-record-msg.is-user .offline-record-msg__meta {
    flex-direction: row-reverse;
}

.offline-record-msg__avatar {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.offline-record-msg__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.offline-record-msg__name {
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(45, 43, 85, 0.6);
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-record-msg__body {
    display: flex;
    flex-direction: column;
}

.offline-record-msg__body .chat-message {
    margin: 0 !important;
}

.offline-record-msg__body .chat-message-content {
    display: flex;
    flex-direction: column;
}

/* 小屏机型适配（窄屏 / 矮屏：华为/小米/魅族等老机型浏览器） */
@media (max-width: 360px), (max-height: 680px) {
    .offline-record-stub__left {
        flex-basis: 84px;
    }
    .offline-record-stub__title {
        font-size: 15px;
    }
    .offline-mode-home-card__icon {
        width: 42px;
        height: 42px;
    }
}

/* ==================== 线下模式 · NPC参演 设定菜单（私聊全量 / 群聊仅AI创立NPC） ==================== */

.offline-npc-cast-content {
    display: flex;
    flex-direction: column;
    max-height: 82vh;
}

/*
 * NPC参演弹窗挂在 #chat-page 内的线下弹窗层时，必须与 love咪 小手机可视区等高。
 * 上面的 82vh 只保留给极端兜底场景（模块脱离 chat-page 挂到 body 时）；
 * 若不在这里解除上限，height:100% 仍会被 max-height:82vh 截短，导致弹窗底部
 * 留出一截聊天背景，视觉上像一个没有铺满手机屏幕的浮动卡片。
 */
#chat-page .chat-offline-modals-layer .offline-npc-cast-content {
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    min-height: 0;
    max-height: none;
}

/* 群聊作用域：世界观NPC开关与档案区块整体隐藏（群组仅开放 AI 创立 NPC） */
.offline-npc-cast-modal.is-group-scope .offline-npc-cast-world-only {
    display: none;
}

.offline-npc-cast-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.offline-npc-cast-toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.offline-npc-cast-toggle-row .toggle-switch {
    flex-shrink: 0;
    margin-top: 2px;
}

.offline-npc-cast-toggle-text {
    flex: 1;
    min-width: 0;
}

.offline-npc-cast-roster-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.offline-npc-cast-mini-btn {
    padding: 3px 12px;
    font-size: 12px;
    line-height: 1.6;
}

.offline-npc-cast-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.offline-npc-cast-empty {
    font-size: 12px;
    color: #8a8fa8;
    background: rgba(120, 126, 160, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    line-height: 1.6;
}

.offline-npc-cast-card {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(120, 126, 160, 0.22);
    border-radius: 12px;
    padding: 9px 11px;
}

.offline-npc-cast-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.offline-npc-cast-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #2D2B55;
}

.offline-npc-cast-card-alias {
    font-size: 11px;
    color: #8a8fa8;
}

.offline-npc-cast-card-badge {
    font-size: 10px;
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.45);
    border-radius: 999px;
    padding: 0 7px;
    line-height: 1.7;
    white-space: nowrap;
}

.offline-npc-cast-card-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.offline-npc-cast-card-actions button {
    border: none;
    background: rgba(102, 126, 234, 0.12);
    color: #5a63c8;
    border-radius: 8px;
    font-size: 11px;
    padding: 3px 9px;
    cursor: pointer;
}

.offline-npc-cast-card-actions button.danger {
    background: rgba(235, 87, 87, 0.10);
    color: #d15252;
}

.offline-npc-cast-card-body {
    margin-top: 6px;
    font-size: 12px;
    color: #4a4e6d;
    line-height: 1.65;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.offline-npc-cast-card-body .k {
    display: inline-block;
    color: #8a8fa8;
    margin-right: 6px;
    flex-shrink: 0;
}

.offline-npc-cast-edit-form {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.offline-npc-cast-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    color: #8a8fa8;
}

.offline-npc-cast-edit-form input,
.offline-npc-cast-edit-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(120, 126, 160, 0.3);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    color: #2D2B55;
    background: #fff;
    resize: vertical;
}

.offline-npc-cast-edit-form textarea {
    min-height: 44px;
}

.offline-npc-cast-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}
