/* 主题变量 - 冬夜主题（默认）- 莫兰迪蓝紫 */
:root {
    --bg-base: #eef2f5;
    --bg-secondary: #f5f7f9;
    --bg-elevated: #f8fafb;
    --bg-hover: rgba(115, 140, 184, 0.08);
    --bg-card: #ffffff;
    --glass-panel: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --accent-color: #738CB8;
    --accent-soft: #B0CCD7;
    --accent-shadow: rgba(115, 140, 184, 0.3);
    --text-primary: #3a4a5c;
    --text-secondary: #8391a3;
    --text-tertiary: #a8b4c0;
    --border-light: #e8ecf0;
    --border-medium: #dce3e8;
    --border-dark: #cdd5dd;
    --bubble-me: #738CB8;
    --bubble-me-text: #ffffff;
    --bubble-ai: #f5f7f9;
    --bubble-ai-text: #3a4a5c;
    --summary-bg: #CDDFE9;
    --summary-text: #3a4a5c;
    --icon-bg: var(--accent-color);
    --app-icon-bg: rgba(255, 255, 255, 0.88);
    --app-icon-color: rgba(58, 74, 92, 0.7);
    /* 壁纸渐变 */
    --wallpaper-gradient: linear-gradient(135deg, #b8c8dd 0%, #c9d8e8 50%, #dae7f2 100%);
    /* 图标渐变色 */
    --icon-gradient-1: linear-gradient(135deg, #738CB8 0%, #9aafd0 100%);
    --icon-gradient-2: linear-gradient(135deg, #B0CCD7 0%, #cfe0e8 100%);
    /* 状态栏和桌面文字 */
    --desktop-text: #3a4a5c;
    /* 语义色 */
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --warning-color: #ff9500;
    /* 圆角层级 */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 20px;
    --radius-full: 50%;
    /* 过渡时长 */
    --transition-fast: 0.15s;
    --transition-base: 0.2s;
    --transition-slow: 0.3s;
    /* 字号层级 */
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 14px;
    --font-md: 15px;
    --font-lg: 17px;
    --font-xl: 20px;
    --font-2xl: 24px;
}

/* 春日主题 */
[data-theme="spring-day"] {
    --bg-base: #f9faf8;
    --bg-secondary: #f5f7f4;
    --bg-elevated: #f8f9f7;
    --bg-hover: rgba(169, 178, 152, 0.08);
    --bg-card: #ffffff;
    --glass-panel: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.6);
    --accent-color: #A9B298;
    --accent-soft: #BED5E2;
    --accent-shadow: rgba(169, 178, 152, 0.3);
    --text-primary: #3a4238;
    --text-secondary: #7a8a80;
    --text-tertiary: #a0afa5;
    --border-light: #e8ebe7;
    --border-medium: #dde3db;
    --border-dark: #d0d8ce;
    --bubble-me: #A9B298;
    --bubble-me-text: #ffffff;
    --bubble-ai: #f5f7f4;
    --bubble-ai-text: #3a4238;
    --summary-bg: #E3EACE;
    --summary-text: #3a4238;
    --icon-bg: var(--accent-color);
    --app-icon-bg: rgba(255, 255, 255, 0.90);
    --app-icon-color: rgba(58, 66, 56, 0.7);
    /* 壁纸渐变 */
    --wallpaper-gradient: linear-gradient(135deg, #d4dcc6 0%, #e2e8d8 50%, #f0f4eb 100%);
    /* 图标渐变色 */
    --icon-gradient-1: linear-gradient(135deg, #A9B298 0%, #c5cfb8 100%);
    --icon-gradient-2: linear-gradient(135deg, #BED5E2 0%, #d8e8ef 100%);
    /* 状态栏和桌面文字 */
    --desktop-text: #3a4238;
    /* 语义色 */
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --warning-color: #ff9500;
}

/* 夏雨主题 */
[data-theme="summer-rain"] {
    --bg-base: #f4f7f9;
    --bg-secondary: #f0f5f7;
    --bg-elevated: #f6f9fb;
    --bg-hover: rgba(137, 163, 186, 0.08);
    --bg-card: #ffffff;
    --glass-panel: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.55);
    --accent-color: #89A3BA;
    --accent-soft: #92C7CC;
    --accent-shadow: rgba(137, 163, 186, 0.3);
    --text-primary: #3d4e5e;
    --text-secondary: #7a8d9c;
    --text-tertiary: #a3b3c2;
    --border-light: #e6edf1;
    --border-medium: #d9e4ea;
    --border-dark: #cbd9e0;
    --bubble-me: #89A3BA;
    --bubble-me-text: #ffffff;
    --bubble-ai: #f0f5f7;
    --bubble-ai-text: #3d4e5e;
    --summary-bg: #95DE86;
    --summary-text: #3d4e5e;
    --icon-bg: var(--accent-color);
    --app-icon-bg: rgba(255, 255, 255, 0.90);
    --app-icon-color: rgba(61, 78, 94, 0.7);
    /* 壁纸渐变 */
    --wallpaper-gradient: linear-gradient(135deg, #c5d5e0 0%, #d5e3eb 50%, #e8f0f4 100%);
    /* 图标渐变色 */
    --icon-gradient-1: linear-gradient(135deg, #89A3BA 0%, #a8c0d3 100%);
    --icon-gradient-2: linear-gradient(135deg, #92C7CC 0%, #b8dce0 100%);
    /* 状态栏和桌面文字 */
    --desktop-text: #3d4e5e;
    /* 语义色 */
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --warning-color: #ff9500;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Serif SC', 'Noto Serif', 'Georgia', 'Times New Roman', serif;
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
    position: absolute;
    inset: 0;
    background: var(--bg-base);
    display: none;
    flex-direction: column;
    z-index: 10;
}

.screen.active {
    display: flex;
    z-index: 20;
}

/* 桌面 */
#desktop {
    background: var(--wallpaper-gradient);
    background-size: cover;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
}

.wallpaper {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    z-index: 0;
}

.status-bar {
    position: relative;
    z-index: 2;
    position: relative;
    z-index: 2;
    padding: calc(14px + env(safe-area-inset-top)) 24px 14px;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    color: var(--desktop-text);
}

.status-icons {
    display: flex;
    gap: 8px;
}

.desktop-widget {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
    color: var(--desktop-text);
}

.widget-time {
    font-size: 56px;
    font-weight: 200;
    letter-spacing: -1px;
    font-family: 'Georgia', serif;
}

.widget-date {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.7;
}

/* 桌面分页 */
.desktop-pages-wrapper {
    position: relative;
    z-index: 2;
    flex: 1;
    overflow: hidden;
}

.desktop-pages {
    display: flex;
    transition: transform 0.35s ease;
    height: 100%;
}

.desktop-pages>.app-grid {
    min-width: 100%;
    flex-shrink: 0;
}

.page-dots {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-bottom: 16px;
}

.page-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.25s;
}

.page-dots .dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.25);
}

.app-grid {
    padding: 20px 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px 20px;
    align-content: start;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.1s;
}

.app-item:active {
    transform: scale(0.9);
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.06),
        0 1px 4px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    background: var(--app-icon-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
}

.app-icon:hover {
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.1),
        0 2px 6px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.app-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.8;
}

.app-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--desktop-text);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* 修复pixiv图标颜色-使用主题色 */
.icon-pixiv-novel {
    background: var(--app-icon-bg) !important;
    color: var(--accent-color) !important;
}

.app-header.glass {
    height: calc(56px + env(safe-area-inset-top));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) 16px 0;
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
}

.app-header h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.nav-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--accent-color);
    padding: 8px;
    cursor: pointer;
}

.nav-btn.back-btn {
    font-weight: 400;
    font-size: 18px;
}

/* ========================================================
   LINE 容器 & 底部标签栏
   ======================================================== */
#line-container {
    flex-direction: column;
    height: 100%;
    position: relative;
}
#line-container.active { display: flex; }

.line-tab-screen {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: absolute;
    top: 0; left: 0; right: 0;
    bottom: 60px; /* 标签栏高度 */
}

.line-tab-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 底部标签栏 */
.line-tab-bar {
    display: flex;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-light);
    z-index: 100;
    /* safe-area-inset-bottom 已由 body padding 处理，此处不重复 */
}

.line-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.line-tab svg {
    width: 24px; height: 24px;
    fill: none;
    stroke: var(--text-tertiary);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.15s ease;
}

.line-tab span {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: color 0.15s ease;
}

.line-tab.active svg {
    fill: #06c755;
    stroke: #06c755;
}

.line-tab.active span {
    color: #06c755;
}

.line-tab-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(18px);
    background: #ff3b30;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* LINE 内部的聊天列表和对话需要适配 */
/* #line-talk 已通过 .line-tab-screen 获得 bottom:60px，无需重复 */

#line-talk-list,
#line-talk-conversation {
    position: absolute;
    top: 0; left: 0; right: 0;
    bottom: 0; /* 父级 .line-tab-screen 已留出标签栏空间 */
}

#line-talk-conversation .app-header,
#line-talk-conversation .messages-container,
#line-talk-conversation .chat-input-glass,
#line-talk-conversation .sticker-panel,
#line-talk-conversation .conversation-menu {
    /* 继承现有样式 */
}

/* ========================================================
   LINE Home — ホームタブ
   ======================================================== */

/* 個人資料エリア */
.lh-profile {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.lh-profile:active { background: var(--bg-hover); }
.lh-profile-avatar {
    width: 60px; height: 60px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium);
}
.lh-profile-name { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.lh-profile-status { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.lh-profile-switch { font-size: 11px; color: #06c755; margin-top: 4px; font-weight: 500; }

/* サービスグリッド */
.lh-service-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; padding: 16px;
    border-bottom: 1px solid var(--border-light);
}
.lh-service-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer;
}
.lh-service-item:active { opacity: 0.7; }
.lh-service-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.lh-service-label { font-size: 10px; color: var(--text-secondary); }

/* 友だちリスト */
.lh-group-label {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    padding: 14px 16px 6px; display: flex; align-items: center; gap: 6px;
}
.lh-friend-count {
    font-size: 11px; color: var(--text-tertiary); font-weight: 400;
}
.lh-friend-list { padding: 0; }
.lh-friend-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer;
}
.lh-friend-item:active { background: var(--bg-hover); }
.lh-friend-avatar-wrap {
    position: relative; flex-shrink: 0; cursor: pointer;
}
.lh-friend-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium);
}
.lh-online-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #06c755; border: 2px solid var(--bg-card);
    position: absolute; bottom: 0; right: 0;
}
.lh-friend-info { flex: 1; min-width: 0; }
.lh-friend-name { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.lh-friend-status {
    font-size: 12px; color: var(--text-tertiary); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* サブページヘッダー */
.lh-sub-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
    background: var(--bg-elevated); position: sticky; top: 0; z-index: 10;
}
.lh-sub-header h2 {
    flex: 1; font-size: 17px; font-weight: 700; color: var(--text-primary);
}
.lh-back-btn {
    background: none; border: none; font-size: 24px;
    color: var(--text-secondary); cursor: pointer; padding: 0 4px;
}
.lh-action-btn {
    background: none; border: none; font-size: 20px;
    color: #06c755; cursor: pointer; font-weight: 600;
}

/* 身份リスト */
.lh-persona-list {
    padding: 8px 16px; border-bottom: 1px solid var(--border-light);
}
.lh-persona-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px; cursor: pointer;
    margin-bottom: 4px;
}
.lh-persona-item:active, .lh-persona-item.selected { background: var(--bg-hover); }
.lh-persona-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium);
}
.lh-persona-info { flex: 1; min-width: 0; }
.lh-persona-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.lh-persona-desc {
    font-size: 12px; color: var(--text-tertiary); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lh-persona-badge {
    font-size: 10px; color: #06c755; font-weight: 600;
    border: 1px solid #06c755; border-radius: 4px;
    padding: 2px 6px;
}

/* ========================================================
   LINE Pay — ウォレットタブ
   ======================================================== */

/* 残高カード */
.lp-balance-card {
    background: linear-gradient(135deg, #06c755, #04a847);
    margin: 16px; border-radius: 16px; padding: 24px; color: #fff;
}
.lp-balance-label { font-size: 12px; opacity: 0.8; }
.lp-balance-amount { font-size: 32px; font-weight: 700; margin: 8px 0; }
.lp-balance-actions { display: flex; gap: 10px; margin-top: 16px; }
.lp-action-btn {
    flex: 1; background: rgba(255,255,255,0.2); border: none;
    border-radius: 10px; padding: 10px 4px; color: #fff;
    font-size: 12px; text-align: center; cursor: pointer;
}
.lp-action-btn:active { background: rgba(255,255,255,0.35); }
.lp-action-icon { font-size: 18px; display: block; margin-bottom: 2px; }

/* セクションタイトル */
.lp-section-title {
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    padding: 16px 16px 8px;
}

/* 取引リスト */
.lp-tx-list { padding: 0 16px; }
.lp-tx-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.lp-tx-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0; color: #fff;
}
.lp-tx-avatar-img {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0; background: var(--border-medium);
}
.lp-tx-info { flex: 1; min-width: 0; }
.lp-tx-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.lp-tx-desc { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.lp-tx-amount { font-size: 14px; font-weight: 600; flex-shrink: 0; }
.lp-tx-amount.minus { color: #ff3b30; }
.lp-tx-amount.plus { color: #06c755; }

/* 送金キャラ選択 */
.lp-transfer-char {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}
.lp-transfer-char:active { background: var(--bg-hover); }
.lp-transfer-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium);
}

/* ========================================================
   LINE VOOM
   ======================================================== */
.lv-feed { padding-bottom: 80px; }

.lv-post {
    padding: 16px; border-bottom: 8px solid var(--bg-base);
    background: var(--bg-card);
}
.lv-post-user { border-left: 3px solid #06c755; }

.lv-post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lv-post-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium); flex-shrink: 0;
}
.lv-post-author { flex: 1; }
.lv-post-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.lv-you-badge {
    font-size: 10px; color: #06c755; font-weight: 500;
    border: 1px solid #06c755; border-radius: 4px; padding: 1px 4px;
    margin-left: 4px;
}
.lv-post-time { font-size: 11px; color: var(--text-tertiary); }
.lv-post-text { font-size: 14px; color: var(--text-primary); line-height: 1.6; margin-bottom: 10px; }
.lv-post-image { margin-bottom: 10px; }
.lv-post-image img { width: 100%; border-radius: 8px; }
.lv-post-emoji { font-size: 48px; text-align: center; margin: 12px 0; }

.lv-post-actions { display: flex; gap: 20px; }
.lv-action {
    font-size: 14px; color: var(--text-secondary); background: none; border: none;
    cursor: pointer; padding: 4px 0; display: flex; align-items: center; gap: 4px;
}
.lv-action.liked { color: #ff3b30; }
.lv-action:active { opacity: 0.6; }

/* FAB */
.lv-fab {
    position: fixed; bottom: 80px; right: 20px;
    width: 52px; height: 52px; border-radius: 50%;
    background: #06c755; color: #fff; border: none;
    font-size: 24px; cursor: pointer; z-index: 50;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.lv-fab:active { transform: scale(0.93); }

.lv-refresh-btn {
    display: block; margin: 16px auto 80px; padding: 10px 20px;
    background: none; border: 1px solid var(--border-medium);
    border-radius: 20px; color: var(--text-secondary); font-size: 13px;
    cursor: pointer;
}
.lv-refresh-btn:active { background: var(--bg-hover); }

/* コメント */
.lv-comment-post {
    padding: 16px; background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}
.lv-comments-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.lv-comment {
    display: flex; gap: 10px; padding: 8px 16px;
}
.lv-comment-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover; background: var(--border-medium); flex-shrink: 0;
}
.lv-comment-body { flex: 1; }
.lv-comment-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-right: 6px; }
.lv-comment-text { font-size: 13px; color: var(--text-primary); }
.lv-comment-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.lv-comment-input {
    display: flex; gap: 8px; padding: 10px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}
.lv-comment-input input {
    flex: 1; border: 1px solid var(--border-medium);
    border-radius: 20px; padding: 8px 14px; font-size: 14px;
    background: var(--bg-base);
}

/* 共有カードバブル */
.share-card {
    border-radius: 12px; padding: 14px 18px; min-width: 180px;
    border: 1px solid var(--border-light); background: var(--bg-card);
}
.share-card-label { font-size: 10px; color: var(--text-tertiary); font-weight: 600; margin-bottom: 6px; }
.share-tweet .share-card-author { font-size: 12px; color: var(--accent-color); margin-bottom: 4px; }
.share-tweet .share-card-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.share-product { text-align: center; }
.share-product .share-card-emoji { font-size: 36px; margin: 8px 0; }
.share-product .share-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.share-product .share-card-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* 送金カードバブル */
.transfer-card {
    background: linear-gradient(135deg, #06c755, #04a847);
    color: #fff; border-radius: 12px; padding: 16px 20px;
    min-width: 160px; text-align: center;
}
.transfer-card-title { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.transfer-card-amount { font-size: 22px; font-weight: 700; }
.transfer-card-desc { font-size: 12px; opacity: 0.8; margin-top: 6px; }

/* 聊天部分 */
.chat-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    background: var(--bg-card);
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    margin-right: 15px;
    object-fit: cover;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-preview {
    font-size: 14px;
    color: var(--text-secondary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    display: flex;
    align-items: flex-end;
    width: 100%;
    position: relative;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bubble {
    position: relative;
    word-wrap: break-word;
}

.message.assistant .message-bubble {
    background: var(--bubble-ai);
    color: var(--bubble-ai-text);
    border-radius: 18px 18px 18px 4px;
}

.message.user .message-bubble {
    background: var(--bubble-me);
    color: var(--bubble-me-text);
    border-radius: 18px 18px 4px 18px;
}

.message-bubble img {
    max-width: 200px;
    border-radius: var(--radius-md);
    margin: 4px 0;
    display: block;
}

.message-actions {
    position: absolute;
    top: 50%;
    right: -45px;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 4px;
}

.message.user .message-actions {
    right: auto;
    left: -45px;
}

.message:hover .message-actions {
    display: flex;
}

.msg-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.msg-action-btn:active {
    transform: scale(0.9);
}

.chat-input-glass {
    margin: 10px 16px 20px;
    padding: 6px;
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    border: 1px solid var(--glass-border);
}

.chat-input-glass input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 16px;
    color: var(--text-primary);
}

.attachment-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    transition: transform 0.1s;
}

.attachment-btn svg {
    width: 20px;
    height: 20px;
}

.attachment-btn:active {
    transform: scale(0.9);
}

.send-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heart-fab {
    position: absolute;
    right: 0;
    top: -50px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: 3px solid var(--bg-card);
    box-shadow: 0 4px 12px var(--accent-shadow);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: scale(0);
    transition: transform 0.2s;
}

.heart-fab.visible {
    transform: scale(1);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 55px;
    left: 50px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 100;
    max-width: 280px;
}

.emoji-picker.active {
    display: block;
    animation: popIn 0.2s;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    text-align: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: var(--bg-secondary);
}

.emoji-item:active {
    transform: scale(0.9);
}

/* 设置 & 表单 */
.settings-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-base);
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.setting-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row label {
    font-size: var(--font-base);
    color: var(--text-primary);
    font-weight: 500;
}

.setting-row input,
.setting-row select,
.setting-row textarea {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-medium);
    background: var(--bg-secondary);
    font-size: var(--font-md);
    outline: none;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.setting-row input:focus,
.setting-row select:focus,
.setting-row textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-shadow);
}

.glass-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    background: var(--bg-card);
    color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: opacity 0.2s, transform 0.2s, filter 0.2s;
    font-family: inherit;
}

.glass-btn:hover:not(:disabled):not(.loading) {
    filter: brightness(1.05);
}

.glass-btn.primary {
    background: var(--accent-color);
    color: var(--bg-card);
}

.glass-btn.danger {
    background: var(--bg-card);
    color: var(--danger-color);
}

.glass-btn.outline {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    box-shadow: none;
}

.glass-btn.link {
    background: none;
    border: none;
    color: var(--text-secondary);
    box-shadow: none;
    font-size: 14px;
    font-weight: 400;
    padding: 8px;
    width: auto;
    margin-bottom: 0;
}

.glass-btn.link:hover:not(:disabled) {
    color: var(--accent-color);
}

.glass-btn.small {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
}

.glass-btn.mini {
    width: auto;
    padding: 3px 8px;
    font-size: 12px;
    margin-bottom: 0;
    box-shadow: none;
}

.glass-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.glass-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.glass-btn:active:not(:disabled):not(.loading) {
    transform: scale(0.98);
}

/* Writer App 布局 */
.writer-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.writer-body {
    flex: 1;
    padding: 20px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s;
}

.doc-title {
    font-size: 24px;
    font-weight: 700;
    border: none;
    outline: none;
    margin-bottom: 10px;
}

.doc-content {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    line-height: 1.6;
    resize: none;
    color: var(--text-primary);
}

/* 知识库侧边栏 */
.kb-drawer {
    width: 260px;
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: -260px;
    top: 0;
    bottom: 0;
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 50;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.08);
}

.kb-drawer.open {
    right: 0;
}

.kb-header {
    padding: 15px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.kb-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.kb-item {
    background: var(--bg-card);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
}

.kb-item:hover {
    border-color: var(--accent-color);
}

.kb-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.kb-preview {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kb-delete {
    position: absolute;
    right: 5px;
    top: 5px;
    color: #ff3b30;
    font-size: 16px;
    padding: 5px;
    display: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 14px;
    text-align: center;
}

.kb-item:hover .kb-delete {
    display: block;
}

.kb-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* 知识库配置区 */
.kb-section {
    background: var(--bg-card);
    padding: 15px;
    border-bottom: 1px solid var(--border-light);
}

.kb-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.kb-config-item {
    margin-bottom: 10px;
}

.kb-config-item:last-child {
    margin-bottom: 0;
}

.kb-config-item label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kb-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-secondary);
    outline: none;
    transition: border-color 0.2s;
    color: var(--text-primary);
}

.kb-input:focus {
    border-color: var(--accent-color);
    background: var(--bg-card);
}

/* 模态框 */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
}

.modal-window {
    background: var(--bg-card);
    width: 85%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s;
    display: flex;
    flex-direction: column;
}

.modal-window input,
.modal-window textarea,
.modal-window select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-window input:focus,
.modal-window textarea:focus,
.modal-window select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-shadow);
}
#officialInfoContent {
    resize: vertical;
    min-height: 120px;
    transition: height 0.15s;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

/* 宫格菜单 */
.grid-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 1px solid var(--border-light);
}

.grid-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-shadow);
    border-color: var(--accent-soft);
}

.grid-card:active {
    transform: scale(0.98);
}

.grid-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-gradient-1);
    border-radius: 14px;
    color: white;
    box-shadow: 0 4px 12px var(--accent-shadow);
}

.grid-icon svg {
    width: 26px;
    height: 26px;
    stroke: white;
}

.grid-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.avatar-upload {
    text-align: center;
    margin: 20px 0;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    background: var(--border-medium);
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 600;
}

.minimal-input {
    text-align: center;
    border: none;
    background: transparent;
    border-bottom: 1px solid var(--border-dark);
    width: 60%;
    color: var(--text-primary);
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 20px;
    font-size: 13px;
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.empty-state-hint {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 6px;
}

.empty-state-action {
    margin-top: 14px;
}

/* 1:1 方屏幕适配 */
@media (aspect-ratio: 1/1),
(max-aspect-ratio: 1/1) {
    .app-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px 15px;
        padding: 15px 20px;
    }

    .app-icon {
        width: 56px;
        height: 56px;
    }

    .app-icon svg {
        width: 24px;
        height: 24px;
    }

    .desktop-widget {
        margin-top: 15px;
        margin-bottom: 15px;
    }

    .widget-time {
        font-size: 48px;
    }

    .writer-layout {
        flex-direction: column;
    }

    .kb-drawer {
        width: 100%;
        height: 40%;
        right: auto;
        top: auto;
        bottom: -40%;
        left: 0;
        border-left: none;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.08);
    }

    .kb-drawer.open {
        bottom: 0;
        right: auto;
    }

    .writer-body {
        padding: 15px;
    }

    .doc-title {
        font-size: 20px;
    }

    .doc-content {
        font-size: 15px;
    }

    .message-bubble {
        max-width: 80%;
        font-size: 15px;
    }

    .settings-scroll {
        padding: 15px;
    }

    .setting-row {
        padding: 10px 14px;
    }

    .grid-menu {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .grid-card {
        padding: 18px;
    }

    .grid-icon {
        font-size: 28px;
    }

    .modal-window {
        width: 90%;
        max-width: 350px;
        max-height: 75vh;
    }

    .glass-btn {
        padding: 12px;
        font-size: 15px;
    }

    /* 台词校正页面底部留白 */
    #dialogue-polish .settings-scroll {
        padding-bottom: 80px;
    }

    /* LINE 方屏幕适配 */
    .line-tab-bar { height: 50px; }
    .line-tab-screen { bottom: 50px; }
    .line-tab svg { width: 22px; height: 22px; }
    .line-tab span { font-size: 9px; }
    .line-tab { gap: 1px; }

    /* Twitter 方屏幕适配 */
    .tw-profile-banner { height: 80px; }
    .tw-profile-avatar { width: 50px; height: 50px; font-size: 20px; }
    .tw-profile-avatar-row { margin-top: -26px; }
    .tw-profile-name { font-size: 16px; }
    .tw-fab { width: 46px; height: 46px; right: 12px; bottom: 54px; }
    .tw-card { padding: 10px 12px; }
    .tw-card-avatar { width: 34px; height: 34px; font-size: 14px; }
    .tw-thread-stats { gap: 10px; font-size: 12px; padding: 8px 0; }
    .tw-thread-actions .tw-action-btn { font-size: 16px; padding: 6px 8px; }
    .tw-dm-textarea { max-height: 80px; }
}

/* 总结消息样式 */
.message.summary-message {
    justify-content: center;
    margin: 16px 0;
}

.message.summary-message .message-bubble {
    max-width: 85%;
    background: var(--summary-bg);
    color: var(--summary-text);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px var(--accent-shadow);
    font-size: 14px;
    line-height: 1.6;
}

.message.summary-message .message-bubble::before {
    content: '';
    font-size: 18px;
    margin-right: 8px;
}

/* 对话菜单下拉 */
.conversation-menu {
    display: none;
    position: absolute;
    top: calc(56px + env(safe-area-inset-top));
    right: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    min-width: 160px;
    animation: popIn 0.2s ease;
}

.conversation-menu.active {
    display: block;
}

.conv-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.conv-menu-item:hover {
    background: var(--bg-secondary);
}

.conv-menu-item:active {
    background: var(--border-light);
}

/* Toast 提示 */
#toastContainer {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-size: var(--font-base);
    font-weight: 500;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    pointer-events: auto;
    white-space: nowrap;
}

.toast-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* 总结管理卡片 */
.summary-card {
    margin: 12px 16px;
    padding: 16px 18px !important;
}

.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.summary-card-index {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-color);
}

.summary-card-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.summary-card-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 12px;
    word-break: break-word;
    white-space: pre-wrap;
}

.summary-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.message.system {
    justify-content: center;
}

.message.system .message-bubble {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
    text-align: center;
}

/* 词汇本样式 */
.word-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.word-item {
    background: var(--bg-card);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.word-item:active {
    transform: scale(0.98);
}

.word-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.word-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.word-reading {
    font-size: 14px;
    color: var(--text-secondary);
}

.word-meaning {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Pixiv 小说内联翻译块美化 */
.pixiv-reader-body .tl {
    font-size: inherit;
    /* 完美继承小说动态字体大小 */
    margin-top: 10px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    padding: 4px 8px;
}

.pixiv-reader-body .tl summary {
    font-size: 0.85em;
    /* 按钮字稍微小一点点显示即可 */
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.pixiv-reader-body .tl span {
    font-size: inherit;
    /* 翻译正文与日语正文字体大小严格相同 */
    color: var(--text-secondary);
    line-height: 1.6;
    display: block;
    margin-top: 6px;
}

/* 题库样式 */
.quiz-display {
    padding: 20px 0;
}

.quiz-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.quiz-progress {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 15px;
}

.quiz-question {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.quiz-option:hover {
    background: var(--bg-base);
    border-color: var(--accent-color);
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 15px;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.quiz-input:focus {
    border-color: var(--accent-color);
}

.quiz-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

/* 身份管理样式 */
.persona-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.persona-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.persona-item:active {
    transform: scale(0.98);
}

.persona-item.active {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

.persona-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--border-medium);
}

.persona-info {
    flex: 1;
}

.persona-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.persona-preview {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.persona-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 绑定标签 */
.binding-tag {
    display: inline-flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 20px;
    padding: 6px 12px 6px 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.binding-tag:hover {
    border-color: var(--accent-color);
    background: var(--bg-card);
}

.binding-tag.has-extra {
    border-color: var(--accent-soft);
}

.binding-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    background: var(--border-medium);
}

.binding-tag span {
    font-size: 14px;
    color: var(--text-primary);
    margin-right: 8px;
}

.binding-remove {
    background: rgba(255, 59, 48, 0.1);
    border: none;
    color: #ff3b30;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.binding-remove:hover {
    background: #ff3b30;
    color: white;
}

.binding-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px dashed var(--border-medium);
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--accent-color);
    font-weight: 600;
}

.binding-add-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

/* 角色选择项 */
.char-select-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    background: var(--bg-secondary);
}

.char-select-item:hover {
    background: var(--bg-base);
}

.char-select-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.char-select-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    background: var(--border-medium);
}

.char-select-item span {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 激活按钮状态 */
#setActivePersonaBtn.active {
    background: var(--accent-soft);
    color: var(--text-primary);
    cursor: default;
    opacity: 0.7;
}

/* ========== 抽签/骰子功能样式 ========== */

/* 主题列表项 */
.fortune-theme-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.fortune-theme-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fortune-theme-item:active {
    transform: scale(0.98);
}

.fortune-theme-item .theme-name {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.fortune-theme-item .theme-count {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 12px;
}

/* 主题操作按钮组 */
.fortune-theme-item .theme-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* 编辑按钮 */
.fortune-theme-item .theme-edit-btn {
    background: rgba(0, 122, 255, 0.1);
    border: none;
    color: var(--accent-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fortune-theme-item .theme-edit-btn:hover {
    background: var(--accent-color);
}

.fortune-theme-item .theme-edit-btn:hover svg {
    stroke: white;
}

/* 删除按钮 */
.fortune-theme-item .theme-delete-btn {
    background: rgba(255, 59, 48, 0.1);
    border: none;
    color: var(--danger-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fortune-theme-item .theme-delete-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* 抽签结果显示 */
.fortune-result {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-soft));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-align: center;
    padding: 20px;
    box-shadow: 0 10px 40px var(--accent-shadow);
    transition: all 0.3s ease;
    word-break: break-word;
    line-height: 1.3;
}

.fortune-result.spinning {
    animation: fortuneSpin 0.1s linear infinite;
    box-shadow: 0 10px 60px var(--accent-shadow);
}

.fortune-result.revealed {
    animation: fortuneReveal 0.5s ease-out;
    background: var(--icon-gradient-1);
    transform: scale(1.1);
    box-shadow: 0 0 40px var(--accent-shadow), 0 10px 30px rgba(0,0,0,0.1);
}

@keyframes fortuneSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fortuneReveal {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* 选项芯片 */
.fortune-option-chip {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.fortune-option-chip:hover {
    background: var(--accent-soft);
    border-color: var(--accent-color);
}

/* 历史记录项 */
.history-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 4px solid var(--accent-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.history-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.history-item .history-theme {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    margin-right: 12px;
    flex-shrink: 0;
}

.history-item .history-result {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item .history-time {
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* 抽签按钮特殊样式 */
#drawBtn {
    background: var(--icon-gradient-1);
    border: none;
    color: white;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px var(--accent-shadow);
    transition: all 0.3s ease;
}

#drawBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-shadow);
}

#drawBtn:active {
    transform: translateY(0);
}

#drawBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== 论坛 5ch 风格 ========== */

/* 板块选择栏 */
.forum-slot-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.forum-slot-bar select {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    min-width: 0;
}

.forum-slot-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 论坛标签栏 */
.forum-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    /* position: sticky;  Removed to fix overlap issues */
    /* top: 56px; */
    /* z-index: 10; */
}

.forum-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.forum-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* 论坛搜索栏 */
.forum-search-bar {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}
.forum-search-bar input {
    width: 100%;
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
}
.forum-search-bar input:focus {
    border-color: var(--accent-color);
}

/* 帖子列表项 */
.fch-thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}

.fch-thread-item:hover {
    background: var(--bg-secondary);
}

.fch-thread-item:active {
    background: var(--border-light);
}

.fch-thread-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #0000EE;
    margin-right: 12px;
    line-height: 1.4;
}

.fch-thread-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fch-reply-count {
    background: #789922;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.fch-thread-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.fch-new-badge {
    background: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    animation: fch-new-pulse 1.5s ease-in-out infinite;
}

@keyframes fch-new-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.fch-fav-mark {
    display: flex;
    align-items: center;
}

/* 5ch 帖子详情 */
.fch-thread-body {
    background: #efefef;
}

.fch-post {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid #ddd;
    background: #efefef;
}

.fch-post-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.5;
}

.fch-post-num {
    font-weight: 700;
    color: #000;
    margin-right: 2px;
}

.fch-post-label {
    color: #666;
}

.fch-post-author {
    color: #008000;
    font-weight: 700;
}

.fch-op-badge {
    background: #c0392b;
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
}

.fch-user-badge {
    background: var(--accent-color, #6c63ff);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
}

.fch-legend-mark {
    font-size: 14px;
    cursor: pointer;
    color: #9b59b6;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
}

.fch-legend-mark:hover {
    opacity: 1;
}

/* Part 制度 CSS */
.fch-thread-ended {
    text-align: center;
    padding: 16px 8px;
    color: #999;
    font-size: 12px;
    line-height: 2;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
    margin: 8px 0;
}

.fch-thread-limit-warn {
    text-align: center;
    padding: 6px 12px;
    color: #e67e22;
    font-size: 12px;
    background: rgba(230, 126, 34, 0.08);
    border-radius: 6px;
    margin: 4px 8px 8px;
}

.fch-part-badge {
    background: #6c5ce7;
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 2px;
    vertical-align: middle;
}

.fch-full-badge {
    font-size: 11px;
    opacity: 0.55;
    margin-left: 2px;
}

/* ── 连载：系列 › 入口（infoDiv 内） ── */
.pixiv-series-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.pixiv-series-name {
    font-size: 12px;
    color: var(--text-secondary, #888);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pixiv-series-link {
    font-size: 12px;
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    white-space: nowrap;
    opacity: 0.85;
    flex-shrink: 0;
}
.pixiv-series-link:hover { opacity: 1; text-decoration: underline; }
.pixiv-chapter-main-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 4px;
}

/* ── 系列目录 Modal ── */
.pixiv-toc-window {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 82vh;
    background: var(--bg-card, #fff);
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    animation: slideUp 0.25s ease;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.pixiv-toc-header {
    position: sticky;
    top: 0;
    background: var(--bg-card, #fff);
    padding: 16px 16px 8px;
    border-bottom: 1px solid var(--border-light, #eee);
    z-index: 2;
}
.pixiv-toc-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.pixiv-toc-series-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    padding-right: 28px;
}
.pixiv-toc-stats {
    font-size: 12px;
    color: var(--text-secondary, #888);
}
.pixiv-toc-latest-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 4px;
    padding: 12px;
    background: var(--text-primary, #1a1a2e);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.pixiv-toc-list {
    padding: 4px 0 20px;
}
.pixiv-toc-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
    cursor: pointer;
    transition: background 0.15s;
}
.pixiv-toc-item:hover,
.pixiv-toc-item.active { background: var(--bg-secondary, #f5f7f9); }
.pixiv-toc-item-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.pixiv-toc-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 28px;
    flex-shrink: 0;
    padding-top: 1px;
}
.pixiv-toc-item.active .pixiv-toc-num { color: var(--accent-color); }
.pixiv-toc-item-info { flex: 1; min-width: 0; }
.pixiv-toc-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pixiv-toc-item.active .pixiv-toc-item-title { font-weight: 700; }
.pixiv-toc-item-meta {
    font-size: 11px;
    color: var(--text-secondary, #888);
}

/* 连载小说：底部"続きを生成"按钮（用于非AI连载） */
.pixiv-next-chapter-wrap {
    text-align: center;
    padding: 24px 0 8px;
    border-top: 1px dashed var(--accent-soft, #ccc);
    margin-top: 16px;
}
.pixiv-next-chapter-btn {
    font-size: 14px;
    padding: 10px 28px;
    letter-spacing: 0.05em;
}
/* 连载操作按钮组（续章 / 重写 / 删除） */
.pixiv-chapter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 20px 0 8px;
    border-top: 1px dashed var(--accent-soft, #ccc);
    margin-top: 16px;
}
.pixiv-chapter-controls .glass-btn {
    font-size: 13px;
    padding: 8px 18px;
}
/* 章节底部导航 */
.pixiv-chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light, #e8ecf0);
}
.pixiv-chapter-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    background: var(--bg-secondary, #f5f7f9);
    border: 1px solid var(--border-light, #e8ecf0);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 48%;
}
.pixiv-chapter-nav-btn:hover {
    background: var(--bg-card, #fff);
}
.pixiv-chapter-nav-btn.prev { align-items: flex-start; }
.pixiv-chapter-nav-btn.next { align-items: flex-end; }
.pixiv-chapter-nav-label {
    font-size: 12px;
    color: var(--accent-color, #738CB8);
    margin-bottom: 4px;
}
.pixiv-chapter-nav-title {
    font-size: 13px;
    color: var(--text-primary, #3a4a5c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.pixiv-chapter-nav-spacer { flex: 1; }

.glass-btn.danger-text {
    color: var(--danger-color);
}
/* 章节摘要折叠块（AI内部记忆，用户可展开查看） */
.pixiv-chapter-synopsis {
    margin: 20px 0 0;
    background: var(--bg-secondary, #f5f7f9);
    border-radius: 8px;
    border: 1px solid var(--border-light, #e0e4ea);
    font-size: 12px;
}
.pixiv-chapter-synopsis summary {
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary, #888);
    user-select: none;
    list-style: none;
}
.pixiv-chapter-synopsis summary::-webkit-details-marker { display: none; }
.pixiv-chapter-synopsis summary::before { content: '▸ '; font-size: 10px; }
.pixiv-chapter-synopsis[open] summary::before { content: '▾ '; }
.pixiv-synopsis-content {
    padding: 8px 14px 12px;
    color: var(--text-primary, #333);
    line-height: 1.7;
    border-top: 1px solid var(--border-light, #e0e4ea);
}

.fch-post-date {
    color: #666;
    margin-left: 4px;
}

.fch-post-id {
    color: #999;
    margin-left: 4px;
}

.fch-post-content {
    font-size: var(--fch-font-size, 15px);
    line-height: 1.7;
    color: #333;
    padding-left: 8px;
    word-break: break-word;
    white-space: pre-wrap;
}

.fch-tl-block {
    margin-top: 8px;
    border-top: 1px solid #ddd;
    padding-top: 4px;
}

.fch-tl-btn {
    display: inline-block;
    font-size: calc(var(--fch-font-size, 15px) - 2px);
    color: #0070c9;
    cursor: pointer;
    list-style: none;
    padding: 2px 0;
}

.fch-tl-btn::-webkit-details-marker {
    display: none;
}

.fch-tl-content {
    font-size: var(--fch-font-size, 15px);
    line-height: 1.65;
    color: #555;
    margin-top: 6px;
    padding: 6px 8px;
    background: #f5f5f5;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 论坛编辑模式操作栏 */
.forum-edit-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

/* 多选复选框 */
.fch-select-box {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-dark);
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.fch-select-box.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
    position: relative;
}

.fch-select-box.checked::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: 700;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.fch-thread-item.selected {
    background: var(--bg-secondary);
}

/* 官方情报分类徽章 */
.official-cat-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 3px;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* 剧情进展条目 */
.plot-entry {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--accent-color);
}

.plot-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.plot-entry-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-color);
}

.plot-entry-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.plot-entry-edit {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 15px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.plot-entry-del {
    background: none;
    border: none;
    color: #ff3b30;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.plot-entry-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 已总结条目：半透明淡化 */
.plot-entry-covered {
    opacity: 0.45;
}

/* NPC 多选 checkbox 组（访谈受访者选择） */
.npc-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 10px;
    max-height: 140px;
    overflow-y: auto;
}

.npc-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.3;
}

.npc-checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

/* 已总结标记小徽章 */
.plot-summary-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent-color);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
    opacity: 0.8;
    flex-shrink: 0;
}

/* 总结管理 modal 列表项 */
.summary-list-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.summary-list-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.summary-list-label {
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-color);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.summary-list-range {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-list-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 论坛帖子翻译标签 */
.fch-post-content details {
    display: inline;
}

.fch-post-content details summary {
    display: inline;
    list-style: none;
    cursor: pointer;
}

.fch-post-content details summary::-webkit-details-marker {
    display: none;
}

.fch-thread-title details {
    display: inline;
}

.fch-thread-title details summary {
    display: inline;
    list-style: none;
    cursor: pointer;
}

.fch-thread-title details summary::-webkit-details-marker {
    display: none;
}

/* ========== 翻译标签通用样式 (tl = translation) ========== */
details.tl {
    display: inline;
    margin: 0;
    padding: 2px 0;
}

details.tl>summary {
    display: inline;
    list-style: none;
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0.5;
}

details.tl>summary::-webkit-details-marker {
    display: none;
}

details.tl>span {
    font-size: inherit;
    opacity: 0.8;
}

/* ========== Pixiv 样式 ========== */

/* 主Tab栏 (插画·漫画 / 小说 / 用户) */
.pixiv-main-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-light);
}

.pixiv-main-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s;
}

.pixiv-main-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* 分区标题 (#小説 novel) */
.pixiv-section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 12px;
    background: var(--bg-card);
}

.pixiv-section-hash {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.pixiv-section-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: lowercase;
}

/* 页面容器 */
.pixiv-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 占位页面 */
.pixiv-illust-placeholder,
.pixiv-user-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* 插画网格 */
.pixiv-illust-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px;
    padding: 4px;
    overflow-y: auto;
}

.pixiv-illust-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pixiv-illust-card:hover {
    opacity: 0.9;
}

.pixiv-illust-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pixiv-illust-overlay {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pixiv-illust-card:hover .pixiv-illust-overlay {
    opacity: 1;
}

.pixiv-illust-delete-btn {
    background: rgba(255, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.pixiv-illust-delete-btn:hover {
    background: rgba(255, 0, 0, 1);
}

.pixiv-illust-fav-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ccc;
    font-size: 15px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.pixiv-illust-fav-btn.active,
.pixiv-illust-fav-btn:hover {
    color: #FFD700;
    background: rgba(0, 0, 0, 0.65);
}

/* 收藏图片左上角固定星标（不需要 hover 即可见） */
.pixiv-illust-card.is-favorite::after {
    content: '★';
    position: absolute;
    top: 5px;
    left: 7px;
    color: #FFD700;
    font-size: 13px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

/* 搜索栏 */
.pixiv-search-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    gap: 0;
    border-radius: 24px;
    margin: 8px 12px;
    border: 1px solid var(--border-medium);
}

.pixiv-search-bar input {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
    outline: none;
}

.pixiv-search-bar input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.pixiv-search-bar:focus-within {
    border-color: var(--accent-color);
}

.pixiv-search-icon {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 4px;
    display: none;
}

/* 标签滚动栏 */
.pixiv-tag-row {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    /* Increased padding */
    overflow-x: auto;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    scrollbar-width: none;
    align-items: center;
    /* Center items vertically */
    min-height: 52px;
    /* Ensure sufficient height */
    flex-shrink: 0;
}

.pixiv-tag-row::-webkit-scrollbar {
    display: none;
}

.pixiv-tag-chip {
    display: inline-flex;
    /* Changed from inline-block to inline-flex for better centering */
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    /* Slightly increased padding */
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    font-size: 13px;
    /* Slightly increased font size */
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    /* Prevent shrinking */
    height: 32px;
    /* Fixed height to ensure consistency */
    box-sizing: border-box;
}

.pixiv-tag-chip.active,
.pixiv-tag-chip:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* 排序栏 (Pixiv风格) */
.pixiv-sort-bar {
    padding: 8px 16px;
    background: var(--bg-card);
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-light);
}

.pixiv-sort-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.pixiv-sort-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
    border-color: var(--text-primary);
}

.pixiv-sort-btn:not(.active):hover {
    border-color: var(--text-secondary);
}

/* 小说列表（Pixiv风格 - 垂直布局） */
.pixiv-novel-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.pixiv-novel-card {
    display: flex;
    flex-direction: row;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
    cursor: pointer;
    transition: background 0.15s;
    padding: 12px;
    gap: 12px;
}

.pixiv-novel-card:hover {
    background: var(--bg-secondary);
}

.pixiv-novel-card:active {
    opacity: 0.8;
}

/* 封面缩略图 */
.pixiv-card-cover {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

/* 封面默认米色背景（不再用渐变色） */
.pixiv-card-cover {
    background: #f5efe6;
}

/* 封面内标题文字 */
.pixiv-cover-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    color: #5a4a3a;
    word-break: break-all;
    overflow: hidden;
}

.pixiv-cover-serial-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 600;
    z-index: 1;
}

.pixiv-cover-user-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 150, 250, 0.9);
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 600;
    z-index: 1;
}

.pixiv-cover-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 卡片内容 */
.pixiv-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.pixiv-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pixiv-card-author {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.pixiv-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.pixiv-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.pixiv-card-tag {
    color: #0096fa;
    font-size: 11px;
}

.pixiv-card-tag::before {
    content: '#';
}

.pixiv-card-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pixiv-card-hearts {
    font-size: 12px;
    color: #ff4060;
}

.pixiv-card-bookmark {
    font-size: 16px;
    color: #ffb800;
}

/* 阅读器 - 小说信息 */
.pixiv-novel-info {
    padding: 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.pixiv-novel-info .novel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
    line-height: 1.4;
}

.pixiv-novel-info .novel-author {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pixiv-novel-info .novel-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.pixiv-novel-info .novel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 章节选择栏 */
.pixiv-chapter-list {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.pixiv-chapter-list::-webkit-scrollbar {
    display: none;
}

.pixiv-chapter-tab {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.pixiv-chapter-tab.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* 阅读器正文 */
.pixiv-reader-body {
    padding: 20px 16px 100px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--bg-card);
}

.pixiv-chapter-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.pixiv-chapter-text p {
    margin-bottom: 1.2em;
    text-indent: 2em;
    line-height: 1.9;
    text-align: justify;
}

.pixiv-chapter-text details {
    display: block;
    margin: 4px 0;
    padding: 2px 0;
}

.pixiv-chapter-text details summary {
    display: inline;
    list-style: none;
    cursor: pointer;
}

.pixiv-chapter-text details summary::-webkit-details-marker {
    display: none;
}

/* 底部操作栏 */
.pixiv-action-bar {
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    /* safe-area-inset-bottom 已由 body padding 处理 */
}

/* 图标颜色 */
.icon-pixiv-novel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* App图标自定义样�?*/
.icon-config-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.icon-config-item:hover {
    background: var(--bg-base);
}

.icon-preview {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    border: 2px solid var(--border-light);
    position: relative;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.default-icon-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-gradient-1);
    color: white;
    font-size: 20px;
    font-weight: 700;
}

/* ===== Dialogue Polish ===== */
.dp-section-label {
    display: inline-block;
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 10px;
    margin-bottom: 4px;
}

.icon-config-info {
    flex: 1;
    min-width: 0;
}

.icon-app-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.icon-config-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
}

.icon-url-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: var(--bg-base);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.icon-url-input:focus {
    border-color: var(--accent-color);
}

.icon-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-upload-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.icon-save-btn,
.icon-reset-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-save-btn {
    background: var(--accent-color);
    color: white;
}

.icon-save-btn:hover {
    opacity: 0.8;
}

.icon-reset-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

/* 论坛分页控制 */
.forum-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    margin-top: 8px;
}

.forum-page-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--app-icon-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.forum-page-btn:not([disabled]):hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

.forum-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.forum-page-info {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
}

/* 回复删除按钮 */
.fch-reply-delete {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    font-size: 18px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    user-select: none;
}

.fch-reply-delete:hover {
    opacity: 1;
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.1);
}

/* TTS 喇叭按钮 */
.fch-tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 2px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 3px;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
    vertical-align: middle;
    user-select: none;
}

.fch-tts-btn:hover {
    opacity: 1;
}

.icon-reset-btn:hover {
    background: #ff3b30;
    color: white;
}

/* 论坛图片上传和显示 */
.forum-image-upload {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px dashed var(--glass-border);
}

.forum-image-preview {
    margin-top: 8px;
}

.forum-image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    display: block;
}

.fch-post-images {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fch-post-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--glass-border);
}

.fch-post-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 全屏图片查看 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.image-modal img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Pixiv用户创作标记 */
.pixiv-cover-user-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 创作模式选择菜单（类似对话菜单） */
.creation-menu {
    display: none;
    position: absolute;
    top: 56px;
    right: 50px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    min-width: 180px;
    animation: popIn 0.2s ease;
    border: 1px solid var(--border-light);
}

.creation-menu.active {
    display: block;
}

.creation-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.creation-menu-item:hover {
    background: var(--bg-secondary);
}

.creation-menu-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

/* Pixiv Vertical Layout */
.pixiv-chapter-text {
    line-height: 1.8;
    font-size: var(--pixiv-font-size, 16px);
    color: var(--text-primary);
    padding: 0 20px 80px 20px;
    /* Bottom padding for action bar */
    max-width: 800px;
    margin: 0 auto;
}

/* 底部阅读操作栏 */
.pixiv-reader-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    /* safe-area-inset-bottom 已由 body padding 处理 */
}

.pixiv-reader-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
    gap: 4px;
    cursor: pointer;
    width: 60px;
}

.pixiv-reader-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
}

.pixiv-reader-btn.active {
    color: var(--accent-color);
}

/* Pixiv 文风预设样式 */
.pixiv-style-preset {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
    transition: all 0.2s;
}

.pixiv-style-preset.disabled {
    opacity: 0.5;
    background: #f0f0f0;
}

.pixiv-style-preset .preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pixiv-style-preset .preset-actions {
    flex-shrink: 0;
}

/* 论坛板块管理栏 */
.forum-slot-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.forum-slot-bar select {
    flex: 1;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
}

.forum-slot-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.forum-slot-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent-color);
}

/* ========================================================
   雑誌モジュール（Magazine）
   ======================================================== */

.icon-magazine svg { stroke: var(--accent-color); }

.magazine-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* 文章卡片 */
.magazine-card {
    background: #faf6f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform 0.15s;
}
.magazine-card:active { transform: scale(0.98); }
.magazine-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.magazine-card-type {
    font-size: 10px;
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.magazine-card-saved { font-size: 11px; color: #5856d6; }
.magazine-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}
.magazine-card-npc { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.magazine-card-meta { font-size: 11px; color: var(--text-secondary); opacity: 0.6; }

/* NPC 多选 */
.magazine-npc-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
    cursor: pointer;
    font-size: 13px;
}
.magazine-npc-option input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* 阅读器（settings-scroll 提供 flex:1 + overflow-y:auto，这里只补充视觉样式） */
.magazine-reader-body {
    padding: 20px 16px 120px;
    background: #faf6f0;
}
.magazine-article-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}
.magazine-article-npc {
    font-size: 13px;
    color: var(--accent-color);
    margin-bottom: 20px;
    font-weight: 600;
}
.magazine-qa-body {
    font-size: 15px;
    line-height: 1.85;
    color: var(--text-primary);
}
.magazine-qa-question {
    color: #555;
    font-size: 13.5px;
    font-style: italic;
    margin: 18px 0 4px;
    padding-left: 8px;
    border-left: 3px solid var(--accent-color);
}
.magazine-qa-answer { margin: 0 0 4px 12px; }
.magazine-qa-name { font-weight: 700; color: var(--text-primary); }
.magazine-qa-gap { height: 10px; }

/* 底部操作栏 */
.magazine-reader-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass, rgba(255,255,255,0.85));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 16px;
    z-index: 100;
}

/* 类型选择器行 */
.magazine-type-row {
    margin: 8px 0 12px;
}
.magazine-type-select {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
}

/* 杂志全文翻译折叠块 */
.magazine-tl-block {
    margin-top: 24px;
    border-top: 1px dashed var(--border-light);
    padding-top: 16px;
}
.magazine-tl-btn {
    font-size: 13px;
    color: var(--accent-color);
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 4px 0;
}
.magazine-tl-btn::-webkit-details-marker { display: none; }
.magazine-tl-content {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* ========================================================
   人気投票（Poll）
   ======================================================== */
.magazine-poll-body {
    padding: 4px 0 20px;
}
.magazine-poll-card {
    background: #faf6f0;
    border: 1.5px solid #e8dcc8;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.magazine-poll-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}
.magazine-poll-rank-num {
    font-size: 22px;
    font-weight: 800;
    color: #8b6914;
    min-width: 44px;
}
/* 投票前三名强调 */
.magazine-poll-card.poll-top3 {
    border-width: 2px;
    border-color: #c9942a;
}
.magazine-poll-medal {
    font-size: 24px;
    line-height: 1;
}
.magazine-poll-rank-num.poll-rank-large {
    font-size: 28px;
    color: #c9942a;
}
.magazine-poll-card:first-child .magazine-poll-rank-num { color: #c9942a; font-size: 26px; }
.magazine-poll-char-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}
.magazine-poll-pct {
    font-size: 15px;
    font-weight: 600;
    color: #8b6914;
}
.magazine-poll-bar-wrap {
    background: #e8dcc8;
    border-radius: 4px;
    height: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}
.magazine-poll-bar {
    background: linear-gradient(90deg, #c9942a, #8b6914);
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.magazine-poll-comments {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.magazine-poll-comment {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-style: italic;
}

/* ========================================================
   キャラクター企画（Feature）
   ======================================================== */
.magazine-feature-body {
    padding: 4px 0 20px;
}
.magazine-feature-char-header {
    font-size: 16px;
    font-weight: 700;
    color: #1d9bf0;
    border-left: 3px solid #1d9bf0;
    padding-left: 10px;
    margin: 18px 0 6px;
    line-height: 1.4;
}
.magazine-feature-line {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 2px;
    padding-left: 13px;
}
/* 角色企划卡片样式 */
.magazine-feature-card {
    background: rgba(29, 155, 240, 0.04);
    border: 1px solid rgba(29, 155, 240, 0.15);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
}
.magazine-feature-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid rgba(29, 155, 240, 0.1);
}
.magazine-feature-card-emoji {
    font-size: 20px;
    line-height: 1;
}
.magazine-feature-card-name {
    font-size: 16px;
    font-weight: 700;
    color: #1d9bf0;
}
.magazine-feature-card-body {
    padding: 8px 16px 12px;
}
.magazine-feature-card-body .magazine-feature-line {
    padding-left: 0;
}

/* ========================================================
   読者コーナー
   ======================================================== */
.magazine-reader-corner { padding: 4px 0 20px; }
.magazine-reader-letter-header {
    font-size: 14px; font-weight: 700; color: #f59e0b;
    margin: 16px 0 4px; padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08); border-radius: 6px;
}
.magazine-reader-letter {
    font-size: 14px; line-height: 1.8; color: var(--text-primary);
    padding: 2px 10px 2px 16px; margin-bottom: 2px;
}
.magazine-reader-reply-header {
    font-size: 13px; font-weight: 700; color: var(--accent-color, #738CB8);
    margin: 8px 0 2px; padding-left: 10px;
}
.magazine-reader-reply {
    font-size: 14px; line-height: 1.8; color: var(--text-secondary);
    padding: 2px 10px 2px 16px; margin-bottom: 2px;
    border-left: 2px solid var(--accent-color, #738CB8);
}

/* ========================================================
   キャラ対談
   ======================================================== */
.magazine-charatalk-body { padding: 4px 0 20px; }
.magazine-charatalk-line {
    font-size: 14px; line-height: 1.8; color: var(--text-primary);
    margin-bottom: 4px; padding: 2px 0;
}
.magazine-charatalk-name {
    font-weight: 700; color: #ec4899; margin-right: 2px;
}
.magazine-charatalk-narration {
    font-size: 13px; line-height: 1.7; color: var(--text-secondary);
    font-style: italic; margin: 8px 0; padding: 4px 10px;
    border-left: 2px solid var(--border-light);
}

/* ========================================================
   相関図
   ======================================================== */
.magazine-chart-body { padding: 4px 0 20px; }
.magazine-chart-entry {
    background: var(--bg-secondary); border-radius: 8px;
    padding: 10px 14px; margin: 8px 0;
    border: 1px solid var(--border-light);
}
.magazine-chart-pair {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px; flex-wrap: wrap;
}
.magazine-chart-char {
    font-size: 15px; font-weight: 700; color: var(--text-primary);
}
.magazine-chart-arrow {
    font-size: 16px; color: #06b6d4; flex-shrink: 0;
}
.magazine-chart-desc {
    font-size: 14px; line-height: 1.7; color: var(--text-secondary);
}
.magazine-chart-note {
    font-size: 13px; color: var(--text-secondary);
    margin: 12px 0 4px; padding: 6px 10px;
    background: var(--bg-secondary); border-radius: 6px;
    font-style: italic;
}

/* ========================================================
   メロンブックス (Melonbooks)
   ======================================================== */
.icon-melonbooks svg { stroke: var(--accent-color); }

/* タブバー */
.melon-tabs {
    display: flex; border-bottom: 1px solid var(--border-light);
    background: var(--bg-elevated);
}
.melon-tab {
    flex: 1; padding: 10px 4px; text-align: center;
    font-size: 13px; font-weight: 500; border: none; background: none;
    color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent; transition: all var(--transition-fast, 0.15s);
}
.melon-tab.active {
    color: #e8530e; border-bottom-color: #e8530e; font-weight: 600;
}

/* 空状態 */
.melon-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; text-align: center;
}

/* 商品グリッド */
.melon-product-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.melon-product-card {
    background: var(--bg-elevated); border-radius: var(--radius-md, 12px);
    overflow: hidden; cursor: pointer;
    transition: transform var(--transition-fast, 0.15s);
    border: 1px solid var(--border-light);
}
.melon-product-card:active { transform: scale(0.97); }

.melon-cover {
    position: relative; background: linear-gradient(135deg, #fff5f0 0%, #ffe8dc 100%);
    height: 100px; display: flex; align-items: center; justify-content: center;
}
.melon-cover-emoji { font-size: 40px; }
.melon-new-badge {
    position: absolute; top: 6px; right: 6px;
    background: #e8530e; color: #fff; font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: var(--radius-xs, 4px);
}
.melon-r18-badge {
    position: absolute; top: 6px; left: 6px;
    background: #dc3545; color: #fff; font-size: 9px; font-weight: 700;
    padding: 2px 5px; border-radius: var(--radius-xs, 4px);
}

.melon-product-info { padding: 8px 10px 10px; }
.melon-product-title {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    line-height: 1.3; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.melon-product-circle { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; }
.melon-product-meta { display: flex; align-items: center; justify-content: space-between; }
.melon-price {
    font-size: 13px; font-weight: 700; color: #e8530e;
}
.melon-type-tag {
    font-size: 10px; color: var(--text-secondary);
    background: var(--bg-secondary); padding: 2px 6px;
    border-radius: var(--radius-xs, 4px);
}

/* ランキング */
.melon-ranking-header { padding: 12px 0 8px; }
.melon-ranking-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.melon-ranking-date { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.melon-ranking-list { display: flex; flex-direction: column; gap: 8px; }
.melon-ranking-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); cursor: pointer;
    border: 1px solid var(--border-light);
}
.melon-ranking-item:active { transform: scale(0.98); }
.melon-rank { font-size: 22px; min-width: 32px; text-align: center; }
.melon-rank-num { font-size: 16px; font-weight: 700; color: var(--text-secondary); }
.melon-ranking-cover { font-size: 28px; }
.melon-ranking-info { flex: 1; min-width: 0; }
.melon-ranking-item-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.melon-ranking-item-circle { font-size: 12px; color: var(--text-secondary); }
.melon-ranking-comment { font-size: 12px; color: #e8530e; margin-top: 2px; font-style: italic; }

/* イベントカード */
.melon-event-card {
    background: var(--bg-elevated); border-radius: var(--radius-md, 12px);
    overflow: hidden; margin-bottom: 10px; cursor: pointer;
    border: 1px solid var(--border-light);
    transition: transform var(--transition-fast, 0.15s);
}
.melon-event-card:active { transform: scale(0.98); }
.melon-event-date-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: linear-gradient(135deg, #e8530e, #f47a3e); color: #fff;
}
.melon-event-type-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    background: rgba(255,255,255,0.25); border-radius: var(--radius-pill, 20px);
}
.melon-event-date { font-size: 12px; font-weight: 500; }
.melon-event-info { padding: 10px 12px; }
.melon-event-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.melon-event-venue { font-size: 12px; color: var(--text-secondary); }
.melon-event-circles { font-size: 12px; color: #e8530e; font-weight: 500; margin-top: 4px; }

/* サークルリスト */
.melon-circle-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); margin-bottom: 8px;
    cursor: pointer; border: 1px solid var(--border-light);
}
.melon-circle-item:active { transform: scale(0.98); }
.melon-circle-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.melon-circle-avatar-sm {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 11px; flex-shrink: 0;
}
.melon-circle-avatar-lg {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 24px; flex-shrink: 0;
}
.melon-circle-info { flex: 1; min-width: 0; }
.melon-circle-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.melon-circle-author { font-size: 12px; color: var(--text-secondary); }
.melon-circle-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.melon-circle-tag {
    font-size: 10px; padding: 1px 6px; border-radius: var(--radius-xs, 4px);
    background: rgba(232,83,14,0.1); color: #e8530e;
}
.melon-circle-count { font-size: 11px; color: var(--text-secondary); }

/* フォローボタン */
.melon-follow-btn {
    margin-top: 6px; padding: 4px 12px; border: 1px solid #e8530e;
    border-radius: var(--radius-pill, 20px); background: transparent;
    color: #e8530e; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all var(--transition-fast, 0.15s);
}
.melon-follow-btn.following {
    background: #e8530e; color: #fff; border-color: #e8530e;
}

/* フィルターバー */
.melon-filter-bar { margin-bottom: 10px; }
.melon-filter-btn {
    padding: 6px 14px; border: 1px solid var(--border-light);
    border-radius: var(--radius-pill, 20px); background: var(--bg-elevated);
    color: var(--text-secondary); font-size: 12px; cursor: pointer;
    transition: all var(--transition-fast, 0.15s);
}
.melon-filter-btn.active {
    background: #e8530e; color: #fff; border-color: #e8530e;
}

/* 商品詳細 */
.melon-detail-cover {
    position: relative; background: linear-gradient(135deg, #fff5f0 0%, #ffe8dc 100%);
    height: 160px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md, 12px); margin-bottom: 12px;
}
.melon-detail-cover-emoji { font-size: 64px; }
.melon-detail-info-card {
    background: var(--bg-elevated); border-radius: var(--radius-md, 12px);
    padding: 16px; margin-bottom: 12px; border: 1px solid var(--border-light);
}
.melon-detail-product-title { font-size: 18px; font-weight: 700; margin: 0 0 8px; color: var(--text-primary); }
.melon-detail-circle {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: #e8530e; cursor: pointer; margin-bottom: 12px;
}
.melon-detail-specs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.melon-spec {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px; background: var(--bg-secondary); border-radius: var(--radius-sm, 8px);
}
.melon-spec-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; }
.melon-spec-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.melon-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.melon-tag {
    font-size: 12px; padding: 3px 10px; border-radius: var(--radius-pill, 20px);
    background: rgba(232,83,14,0.1); color: #e8530e;
}

/* ステータスバッジ */
.melon-status-badge {
    font-size: 9px; font-weight: 600; padding: 2px 6px;
    border-radius: var(--radius-xs, 4px); color: #fff;
}
.melon-status-badge-lg {
    font-size: 12px; font-weight: 600; padding: 4px 10px;
    border-radius: var(--radius-xs, 4px); color: #fff;
}
.melon-detail-status-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.melon-status-hint {
    font-size: 11px; color: var(--text-secondary); font-style: italic;
}

/* セクション */
.melon-detail-section { margin-bottom: 16px; }
.melon-section-title {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light);
}
.melon-sample-text {
    font-size: 14px; line-height: 1.7; color: var(--text-primary);
    padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-sm, 8px);
}

/* サークルページヘッダー */
.melon-circle-header-card {
    display: flex; align-items: center; gap: 16px;
    padding: 16px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); margin-bottom: 12px;
    border: 1px solid var(--border-light);
}
.melon-circle-header-name { font-size: 18px; font-weight: 700; margin: 0; color: var(--text-primary); }
.melon-circle-header-author { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.melon-circle-header-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.melon-circle-desc {
    font-size: 14px; line-height: 1.6; color: var(--text-primary);
    padding: 12px; background: var(--bg-secondary);
    border-radius: var(--radius-sm, 8px); margin-bottom: 12px;
}

/* イベントページヘッダー */
.melon-event-header-card {
    padding: 16px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); margin-bottom: 16px;
    border: 1px solid var(--border-light);
}
.melon-event-header-name { font-size: 18px; font-weight: 700; margin: 8px 0; color: var(--text-primary); }
.melon-event-header-meta { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.melon-event-desc {
    font-size: 14px; line-height: 1.6; color: var(--text-primary);
    margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light);
}

/* ボトムバー */
.melon-detail-bar {
    position: sticky; bottom: 0; padding: 10px 16px;
    background: var(--bg-elevated); border-top: 1px solid var(--border-light);
    display: flex; gap: 8px; justify-content: center;
}

/* 生成モーダル */
.melon-modal-overlay {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.5); display: flex;
    align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
.melon-modal {
    background: var(--bg-elevated); border-radius: var(--radius-lg, 16px);
    padding: 20px; width: 90%; max-width: 320px;
}
.melon-modal-title {
    font-size: 17px; font-weight: 700; text-align: center;
    margin-bottom: 16px; color: var(--text-primary);
}
.melon-modal-buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.melon-gen-btn {
    display: flex; flex-direction: column; align-items: flex-start;
    padding: 14px !important; text-align: left; gap: 2px;
}
.melon-gen-btn span { font-size: 16px; }
.melon-gen-btn small { font-size: 11px; color: var(--text-secondary); font-weight: 400; }
.melon-modal-close {
    width: 100%; color: var(--text-secondary) !important;
}

/* 特集バナー */
.melon-features-banner {
    display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.melon-features-banner::-webkit-scrollbar { display: none; }
.melon-feature-banner-card {
    flex-shrink: 0; display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: linear-gradient(135deg, #fff5f0, #ffe8dc);
    border-radius: var(--radius-md, 12px); cursor: pointer;
    border: 1px solid rgba(232,83,14,0.2);
}
.melon-feature-banner-emoji { font-size: 18px; }
.melon-feature-banner-title { font-size: 12px; font-weight: 600; color: #e8530e; white-space: nowrap; }

/* 特集ページ */
.melon-feature-header {
    text-align: center; padding: 20px 16px; margin-bottom: 16px;
    background: linear-gradient(135deg, #fff5f0, #ffe8dc);
    border-radius: var(--radius-md, 12px);
}
.melon-feature-emoji { font-size: 40px; }
.melon-feature-title { font-size: 18px; font-weight: 700; margin: 8px 0 6px; color: var(--text-primary); }
.melon-feature-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.melon-feature-meta { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

.melon-feature-item {
    display: flex; gap: 12px; padding: 12px;
    background: var(--bg-elevated); border-radius: var(--radius-md, 12px);
    margin-bottom: 8px; cursor: pointer; border: 1px solid var(--border-light);
}
.melon-feature-item:active { transform: scale(0.98); }
.melon-feature-item-cover { font-size: 32px; flex-shrink: 0; }
.melon-feature-item-info { flex: 1; min-width: 0; }
.melon-feature-item-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.melon-feature-item-circle { font-size: 12px; color: var(--text-secondary); }
.melon-feature-item-price { font-size: 13px; font-weight: 600; color: #e8530e; margin-top: 2px; }
.melon-feature-comment {
    font-size: 12px; color: #e8530e; margin-top: 4px;
    font-style: italic; line-height: 1.4;
}

/* カート */
.melon-cart-badge {
    position: absolute; top: -4px; right: -2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #dc3545; color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.melon-cart-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); margin-bottom: 8px;
    border: 1px solid var(--border-light);
}
.melon-cart-item-cover { font-size: 28px; flex-shrink: 0; }
.melon-cart-item-info { flex: 1; min-width: 0; }
.melon-cart-item-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.melon-cart-item-circle { font-size: 12px; color: var(--text-secondary); }
.melon-cart-item-price { font-size: 13px; font-weight: 600; color: #e8530e; margin-top: 2px; }
.melon-cart-remove {
    width: 28px; height: 28px; border: none; background: var(--bg-secondary);
    border-radius: 50%; font-size: 12px; cursor: pointer; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
}
.melon-cart-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px; margin-top: 8px; background: var(--bg-elevated);
    border-radius: var(--radius-md, 12px); font-size: 16px; font-weight: 700;
    border: 1px solid var(--border-light);
}
.melon-purchase-history-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; background: var(--bg-elevated);
    border-radius: var(--radius-sm, 8px); margin-bottom: 6px;
    border: 1px solid var(--border-light);
}
.melon-purchase-date { font-size: 12px; color: var(--text-secondary); flex: 1; }
.melon-purchase-items { font-size: 12px; color: var(--text-secondary); }
.melon-purchase-total { font-size: 14px; font-weight: 600; color: #e8530e; }

/* ========================================================
   周边 AI 生成候选卡
   ======================================================== */
#goodsAiCandidates {
    max-height: 220px;
    overflow-y: auto;
}
.goods-candidate-card {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.goods-candidate-card:active { opacity: 0.8; }
.goods-candidate-card.selected {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, var(--bg-secondary));
}
.goods-candidate-type {
    font-size: 10px;
    color: #fff;
    background: var(--accent-color);
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-weight: 600;
}
.goods-candidate-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.goods-candidate-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
}
.goods-candidate-hint {
    font-size: 11px;
    color: var(--accent-color);
    margin-top: 5px;
    text-align: right;
}

/* ========================================================
   录入剧情后的周边快速入口 Banner
   ======================================================== */
.goods-quick-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-glass, rgba(255,255,255,0.92));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9000;
    white-space: nowrap;
}
.goods-quick-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.goods-quick-text { font-size: 13px; color: var(--text-primary); }
.goods-quick-btn { font-size: 12px; padding: 5px 12px; }
.goods-quick-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

/* ===========================
   X 样式
   =========================== */

.tw-header-title {
    display: flex;
    align-items: center;
    font-size: 17px;
}

/* 时间线卡片 */
.tw-card {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}
.tw-card:active { background: var(--bg-secondary); }

.tw-card-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.tw-avatar-large {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 18px;
}

.tw-card-body { flex: 1; min-width: 0; }

.tw-card-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.tw-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}
.tw-handle {
    font-size: 13px;
    color: var(--text-secondary);
}
.tw-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}
.tw-content {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}
/* ツイート画像カード */
.tw-image-card {
    margin-top: 10px;
    border-radius: 12px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    gap: 8px;
}
.tw-image-emoji { font-size: 42px; }
.tw-image-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 80%;
}
/* 投票ツイート */
.tw-poll { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tw-poll-option {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}
.tw-poll-clickable {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.tw-poll-clickable:active { background: var(--bg-secondary); }
.tw-poll-voted {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tw-poll-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--accent-color);
    opacity: 0.12;
    border-radius: 8px;
    transition: width 0.4s ease;
}
.tw-poll-winner .tw-poll-bar { opacity: 0.2; }
.tw-poll-winner .tw-poll-text { font-weight: 700; }
.tw-poll-text { position: relative; z-index: 1; }
.tw-poll-pct { position: relative; z-index: 1; font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.tw-poll-total { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* スレッド（連投）表示 */
.tw-thread-group { position: relative; }
.tw-thread-connected { border-bottom: none; }
.tw-thread-connected .tw-card-avatar { position: relative; }
.tw-thread-connected .tw-card-avatar::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    width: 2px;
    height: 24px;
    background: var(--border-medium);
}
/* インライン引用ツイート */
.tw-inline-quote {
    margin-top: 10px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    cursor: pointer;
}
.tw-inline-quote:active { background: var(--bg-base); }
.tw-iq-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.tw-iq-avatar {
    width: 20px; height: 20px; min-width: 20px;
    border-radius: 50%;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px;
}
.tw-iq-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tw-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    max-width: 100%;
}
.tw-action-btn {
    background: none; border: none; cursor: pointer; padding: 4px 2px;
    color: var(--text-secondary); font-size: 13px; display: inline-flex; align-items: center; gap: 4px;
    transition: color 0.15s; line-height: 1; border-radius: 50px;
}
.tw-action-btn span { font-size: 12px; }
.tw-action-btn:hover { color: var(--accent-color); }
.tw-action-reply:hover { color: #1d9bf0; }
.tw-action-rt:hover { color: #17bf63; }
.tw-action-like:hover { color: #e0245e; }
.tw-action-like.tw-liked { color: #e0245e; }
.tw-action-bm:hover { color: #1d9bf0; }
.tw-action-bm.tw-bookmarked { color: var(--accent-color); }
.tw-action-share:hover { color: #1d9bf0; }
/* 时间分隔符 */
.tw-time-sep { color: var(--text-secondary); font-size: 13px; margin: 0 1px; }
.tw-saved-badge {
    font-size: 11px;
    color: var(--accent-color);
}

/* 翻訳ブロック */
.tw-translation {
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 2px solid var(--accent-color);
    padding: 5px 10px;
    margin: 6px 0 4px;
    border-radius: 0 6px 6px 0;
    line-height: 1.6;
    background: var(--bg-secondary);
    word-break: break-word;
}

/* 线程视图 */
.tw-thread-scroll {
    padding-bottom: 80px;
}
.tw-thread-op {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}
.tw-thread-op-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.tw-thread-content {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 12px;
}
.tw-thread-time {
    font-size: 13px;
    color: var(--text-secondary);
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}
.tw-thread-stats {
    display: flex; gap: 16px; padding: 12px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px; color: var(--text-secondary);
}
.tw-thread-stats strong { color: var(--text-primary); }
.tw-thread-stat-clickable { cursor: pointer; }
.tw-thread-stat-clickable:hover { text-decoration: underline; }
.tw-thread-actions {
    display: flex; justify-content: space-around; padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}
.tw-thread-actions .tw-action-btn { font-size: 18px; padding: 8px 12px; }
/* 引用页返回按钮 */
.tw-back-inline {
    background: none; border: none; color: var(--accent-color); cursor: pointer;
    font-size: 14px; padding: 0;
}
/* 身份编辑 tab */
.tw-identity-tab {
    flex: 1; padding: 8px 0; text-align: center; font-size: 13px; font-weight: 600;
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
}
.tw-identity-tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }

.tw-replies-divider {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.tw-reply {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}
.tw-reply-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.tw-reply-body { flex: 1; min-width: 0; }

/* 底部操作栏 — flex子元素，不用position:fixed防止逃逸 */
.tw-thread-bar {
    background: var(--bg-glass, rgba(255,255,255,0.85));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 16px;
    flex-shrink: 0;
}

/* ===== Twitter リニューアル UI ===== */

/* 全屏容器 */
/* display 不设置，由 .screen { display:none } / .screen.active { display:flex } 统一管控
   否则后置的 display:flex 会覆盖 .screen 的 display:none，导致所有 tw-screen 永远可见 */
.tw-screen {
    background: var(--bg-base);
    flex-direction: column;
    overflow: hidden;
}

/* 颜色色板 */
.tw-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tw-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    outline: none;
}
.tw-color-swatch:active { transform: scale(0.9); }
.tw-color-swatch.tw-swatch-active {
    border-color: var(--text-primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--bg-base);
}

/* 顶部栏 — flex子元素，不需要sticky（tw-timeline自身滚动）*/
.tw-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-glass, rgba(255,255,255,0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    z-index: 5;
}
.tw-top-bar-back {
    justify-content: space-between;
}

/* 用户头像按钮（左上角）*/
.tw-user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tw-avatar-xl {
    width: 52px;
    height: 52px;
    font-size: 20px;
}

/* X 图标 */
.tw-logo {
    color: var(--text-primary);
}

/* 透明图标按钮 */
.tw-icon-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.tw-icon-btn:active { background: var(--bg-secondary); }

/* 后退按钮 */
.tw-back-btn {
    background: none;
    border: none;
    font-size: 26px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0 8px 0 0;
    line-height: 1;
}

/* 标签栏 — flex子元素 */
.tw-tabs-bar {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-glass, rgba(255,255,255,0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
}
.tw-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tw-tab-btn.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: #1d9bf0;
}

/* 时间线滚动区 */
.tw-timeline {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* NPC 角标 */
.tw-npc-badge {
    font-size: 10px;
    background: #794bc4;
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

/* 蓝色 FAB（发推按钮）— position:absolute 在 screen 内，不逃逸 */
.tw-fab {
    position: absolute;
    right: 18px;
    bottom: 62px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #1d9bf0;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(29,155,240,0.45);
    z-index: 10;
    transition: transform 0.15s, box-shadow 0.15s;
}
.tw-fab:active {
    transform: scale(0.94);
    box-shadow: 0 2px 8px rgba(29,155,240,0.35);
}

/* 底部导航栏 — flex子元素，不用position:fixed */
.tw-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-glass, rgba(255,255,255,0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    padding: 10px 0;
    flex-shrink: 0;
}
.tw-nav-btn {
    background: none;
    border: none;
    padding: 6px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
.tw-nav-btn.active { color: var(--text-primary); }
.tw-nav-btn:active { opacity: 0.7; }

/* 发推按钮（蓝色 pill）*/
.tw-post-btn {
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.tw-post-btn:hover { opacity: 0.88; }
.tw-post-btn:disabled { opacity: 0.5; cursor: default; }

/* 刷新旋转动画 */
@keyframes tw-spin { to { transform: rotate(360deg); } }
.spinning svg { animation: tw-spin 0.8s linear infinite; }

/* ===== DM 界面 ===== */
.tw-dm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tw-dm-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tw-dm-msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
}
.tw-dm-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}
.tw-dm-msg-npc {
    align-self: flex-start;
    align-items: flex-start;
}

.tw-dm-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.tw-dm-msg-user .tw-dm-bubble {
    background: #1d9bf0;
    color: white;
    border-bottom-right-radius: 4px;
}
.tw-dm-msg-npc .tw-dm-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.tw-dm-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 3px;
    padding: 0 4px;
}

.tw-dm-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-glass, rgba(255,255,255,0.92));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.tw-dm-textarea {
    flex: 1;
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    resize: none;
    overflow: hidden;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
}
.tw-dm-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1d9bf0;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.tw-dm-send-btn:disabled { opacity: 0.5; cursor: default; }

/* 推文折叠翻译块 */
.tw-tl-block { margin: 4px 0 0 0; }
.tw-tl-btn { font-size: 12px; color: var(--accent-color); cursor: pointer; list-style: none; display: inline-block; }
.tw-tl-btn::-webkit-details-marker { display: none; }
.tw-tl-content { font-size: 12px; color: var(--text-secondary); padding: 4px 0; line-height: 1.5; }

/* --- プロフィール内サービスリンク --- */
.tw-profile-services {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.tw-service-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.tw-service-btn:hover { background: var(--bg-card); }
.tw-service-badge {
    background: #e0245e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* --- マシュマロ --- */
.tw-marshmallow-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}
.tw-marshmallow-card:hover { background: var(--bg-secondary); }
.tw-marshmallow-unread { background: rgba(224, 36, 94, 0.04); }
.tw-marshmallow-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.tw-marshmallow-body { flex: 1; min-width: 0; }
.tw-marshmallow-q {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}
.tw-marshmallow-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.tw-marshmallow-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 20px;
}
.tw-marshmallow-detail-q {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
}
.tw-marshmallow-answer {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

/* --- Poipiku --- */
.tw-poipiku-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
}
.tw-poipiku-card {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: transform 0.15s;
}
.tw-poipiku-card:active { transform: scale(0.97); }
.tw-poipiku-thumb {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tw-poipiku-info { padding: 10px; }
.tw-poipiku-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tw-poipiku-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.tw-poipiku-detail-cover {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tw-poipiku-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    white-space: pre-wrap;
}
.tw-poipiku-tags {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tw-poipiku-tag {
    font-size: 12px;
    color: var(--accent-color);
    background: rgba(29, 155, 240, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 未読角标 */
.tw-badge { position: absolute; top: 0; right: 0; background: #e0245e; color: #fff; border-radius: 10px; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 3px; }

/* 通知页 */
.tw-notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-light); display: flex; gap: 12px; cursor: pointer; }
.tw-notif-item.tw-notif-unread { background: color-mix(in srgb, var(--accent-color) 5%, transparent); }
.tw-notif-icon { font-size: 18px; min-width: 24px; text-align: center; }
.tw-notif-body { flex: 1; min-width: 0; }
.tw-notif-from { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.tw-notif-content { color: var(--text-secondary); font-size: 13px; line-height: 1.4; }

/* 私信列表页 */
.tw-dm-list-item { padding: 12px 16px; display: flex; gap: 12px; border-bottom: 1px solid var(--border-light); cursor: pointer; align-items: center; }
.tw-dm-list-body { flex: 1; min-width: 0; }
.tw-dm-list-name { font-weight: 600; font-size: 14px; }
.tw-dm-list-preview { color: var(--text-secondary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-dm-inbox-btn { margin: 12px 16px; padding: 14px 16px; background: var(--bg-secondary); border-radius: 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.tw-dm-inbox-count { background: #1d9bf0; color: #fff; border-radius: 10px; font-size: 11px; padding: 2px 7px; }
.tw-dm-unread-dot { width: 8px; height: 8px; background: #1d9bf0; border-radius: 50%; flex-shrink: 0; }

/* NPC互@ ヘッダー */
.tw-mention-header { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }

/* いいね/RT 互動数字 */
/* legacy - kept for search tweet cards */
.tw-engage-count { font-size: 12px; color: var(--text-secondary); margin-left: 10px; }

/* トレンドカード */
.tw-trends-block { border-bottom: 1px solid var(--border-light); }
.tw-trends-block[open] { border-bottom: 6px solid var(--border-light); }
.tw-trends-header { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; font-weight: 700; font-size: 15px; cursor: pointer; user-select: none; }
.tw-trends-header::-webkit-details-marker { display: none; }
.tw-trends-refresh { font-size: 12px; font-weight: 400; color: #1d9bf0; background: none; border: 1px solid #1d9bf0; border-radius: 14px; padding: 2px 10px; cursor: pointer; margin-left: 8px; }
.tw-trends-refresh:disabled { opacity: 0.5; cursor: default; }
.tw-trends-empty { padding: 12px 16px; font-size: 13px; color: var(--text-secondary); }
.tw-trend-item { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--border-light); }
.tw-trend-rank { font-size: 14px; font-weight: 700; color: var(--text-secondary); min-width: 16px; text-align: center; }
.tw-trend-info { flex: 1; min-width: 0; }
.tw-trend-tag { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tw-trend-count { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

/* 検索ページ */
.tw-search-bar-wrap { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); background: var(--bg-base); position: sticky; top: 0; z-index: 10; }
.tw-search-input { flex: 1; padding: 8px 12px; border-radius: 20px; border: 1.5px solid var(--border-medium); background: var(--bg-secondary); color: var(--text-primary); font-size: 15px; outline: none; }
.tw-search-input:focus { border-color: #1d9bf0; }
.tw-search-go { padding: 8px 14px; border-radius: 20px; background: #1d9bf0; color: #fff; font-size: 14px; font-weight: 600; border: none; cursor: pointer; white-space: nowrap; }
.tw-search-tabs { display: flex; border-bottom: 1px solid var(--border-light); }
.tw-search-tab { flex: 1; padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--text-secondary); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: color 0.15s; }
.tw-search-tab.active { color: var(--text-primary); border-bottom-color: #1d9bf0; }
.tw-search-section-title { padding: 10px 16px 6px; font-size: 18px; font-weight: 700; }
.tw-search-results-label { padding: 10px 16px 6px; font-size: 13px; color: var(--text-secondary); }
.tw-trend-clickable { cursor: pointer; }
.tw-trend-clickable:active { background: var(--bg-secondary); }

/* ブックマークボタン */
.tw-bookmark-btn { background: none; border: none; font-size: 15px; cursor: pointer; padding: 2px 4px; opacity: 0.4; transition: opacity 0.15s, color 0.15s; color: var(--text-secondary); line-height: 1; }
.tw-bookmark-btn:hover { opacity: 0.8; color: var(--accent-color); }
.tw-bookmark-btn.tw-bookmarked { opacity: 1; color: var(--accent-color); }
.tw-bookmark-btn.tw-bookmarked svg path { fill: currentColor; }

/* ===== スペース（Twitter Spaces）スタイル ===== */
.tw-spaces-section { border-bottom: 1px solid var(--border-light); padding-bottom: 4px; }
.tw-spaces-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.tw-spaces-manage-link { font-size: 12px; font-weight: 400; color: var(--accent-color); cursor: pointer; }
.tw-spaces-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; }
.tw-spaces-row::-webkit-scrollbar { display: none; }

.tw-space-pill { flex: 0 0 160px; border-radius: 16px; border: 1px solid var(--border-light); padding: 12px; cursor: pointer; background: var(--bg-card); transition: opacity 0.15s; }
.tw-space-pill:active { opacity: 0.7; }
.tw-space-pill-live { border-color: #e0245e; background: color-mix(in srgb, #e0245e 6%, var(--bg-card)); }
.tw-space-live-badge { font-size: 11px; color: #e0245e; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.tw-space-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #e0245e; flex-shrink: 0; animation: twLivePulse 1.4s ease-in-out infinite; }
@keyframes twLivePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.tw-space-archived-badge { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; }
.tw-space-pill-title { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tw-space-pill-hosts { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-space-pill-stats { font-size: 11px; color: var(--text-secondary); }

.tw-space-create-pill { flex: 0 0 76px; border-radius: 16px; border: 2px dashed var(--border-light); padding: 12px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-secondary); font-size: 11px; background: transparent; transition: border-color 0.15s, color 0.15s; }
.tw-space-create-pill:hover { border-color: var(--accent-color); color: var(--accent-color); }
.tw-space-more-pill { flex: 0 0 72px; border-radius: 16px; border: 1px solid var(--border-light); padding: 12px 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--accent-color); background: var(--bg-card); text-align: center; }

/* スペース詳細画面 */
.tw-space-status-bar { padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-light); background: color-mix(in srgb, #e0245e 4%, var(--bg-card)); }
.tw-space-status-live { color: #e0245e; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tw-space-status-archived { color: var(--text-secondary); font-size: 13px; }
.tw-space-listeners { font-size: 13px; color: var(--text-secondary); margin-left: auto; }
.tw-space-speakers-bar { padding: 10px 16px; border-bottom: 1px solid var(--border-light); }
.tw-space-speakers-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.tw-space-speakers-row { display: flex; gap: 14px; flex-wrap: wrap; }
.tw-space-speaker-chip { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.tw-space-speaker-host { font-size: 10px; color: #e0245e; font-weight: 600; }

.tw-space-messages { padding: 0; }
.tw-space-msg { padding: 12px 16px; border-bottom: 1px solid var(--border-light); display: flex; gap: 10px; }
.tw-space-msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; }
.tw-space-msg-body { flex: 1; min-width: 0; }
.tw-space-msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.tw-space-msg-name { font-weight: 600; font-size: 13px; }
.tw-space-msg-elapsed { font-size: 11px; color: var(--text-secondary); }
.tw-space-msg-content { font-size: 14px; line-height: 1.55; color: var(--text-primary); }

.tw-space-actions { padding: 14px 16px; display: flex; gap: 10px; border-top: 1px solid var(--border-light); }

/* ===== プロフィール（X スタイル）===== */
#twitter-npc-profile, #twitter-user-profile {
    overflow-y: auto;
    top: calc(-1 * env(safe-area-inset-top, 0px));
}
.tw-profile-banner { height: calc(130px + env(safe-area-inset-top, 0px)); width: 100%; flex-shrink: 0; position: relative; padding-top: env(safe-area-inset-top, 0px); }
.tw-profile-banner-role { position: absolute; bottom: 8px; right: 12px; font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 600; letter-spacing: 0.5px; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.tw-profile-dm-btn { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--text-primary); background: transparent; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tw-profile-dm-btn:hover { background: var(--bg-secondary); }
.tw-npc-reply-card { border-bottom: 1px solid var(--border-light); padding: 8px 12px 4px; }
.tw-profile-info { padding: 0 16px 4px; }
.tw-profile-avatar-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: -34px; margin-bottom: 10px; }
.tw-profile-avatar-wrap { padding: 4px; background: var(--bg-base); border-radius: 50%; display: inline-block; }
.tw-profile-avatar { width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; }
.tw-profile-follow-btn { padding: 7px 18px; border-radius: 20px; font-size: 14px; font-weight: 700; border: 1.5px solid var(--text-primary); background: transparent; color: var(--text-primary); cursor: pointer; white-space: nowrap; }
.tw-profile-followed { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }
.tw-profile-name { font-size: 19px; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 5px; line-height: 1.25; }
.tw-profile-verified { color: #1d9bf0; font-size: 15px; font-weight: 700; }
.tw-profile-handle { font-size: 14px; color: var(--text-secondary); margin: 1px 0 10px; }
.tw-profile-bio { font-size: 14px; color: var(--text-primary); line-height: 1.6; margin-bottom: 10px; }
.tw-profile-bio-gen { margin-bottom: 10px; }
.tw-profile-meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.tw-profile-counts { display: flex; gap: 18px; font-size: 14px; color: var(--text-secondary); margin-bottom: 2px; }
.tw-profile-counts strong { color: var(--text-primary); font-weight: 700; }
.tw-profile-tabs { display: flex; border-bottom: 1px solid var(--border-light); margin-top: 12px; }
.tw-profile-tab { flex: 1; text-align: center; padding: 13px 0; font-size: 14px; font-weight: 500; color: var(--text-secondary); cursor: pointer; position: relative; }
.tw-profile-tab-active { color: var(--text-primary); font-weight: 700; }
.tw-profile-tab-active::after { content: ''; position: absolute; bottom: 0; left: 20%; right: 20%; height: 3px; background: var(--accent-color); border-radius: 2px; }

/* Fan type badge on profile */
.tw-fan-type-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px; border: 1px solid; margin-top: 4px; }

/* LINE invite button */
.tw-profile-line-btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 20px; background: #06c755; color: #fff; font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
.tw-profile-line-btn:hover { filter: brightness(1.08); }
.tw-profile-line-btn:disabled { opacity: 0.5; cursor: default; filter: none; }

/* Twitter friend tag in LINE */
.lh-friend-tag-twitter { display: inline-block; font-size: 9px; padding: 1px 5px; border-radius: 6px; margin-left: 4px; vertical-align: middle; background: rgba(29, 155, 240, 0.08); color: #1d9bf0; border: 1px solid rgba(29, 155, 240, 0.2); }

/* 舅舅党 leak permit card */
.leak-permit-card { background: var(--bg-secondary); border-radius: 12px; padding: 12px 16px; margin: 8px auto; max-width: 260px; text-align: center; }
.leak-permit-text { font-size: 13px; color: var(--text-primary); margin-bottom: 8px; }
.leak-permit-actions { display: flex; gap: 8px; justify-content: center; }

/* NPC名/アバター クリッカブル */
.tw-avatar-link { cursor: pointer; }
.tw-avatar-link:hover { opacity: 0.82; }
.tw-name-link { cursor: pointer; }
.tw-name-link:hover { text-decoration: underline; }

/* フォロー中NPC行（フォロー中タブ先頭）*/
.tw-following-npc-section { border-bottom: 1px solid var(--border-light); padding: 8px 0 4px; }
.tw-following-npc-section .tw-spaces-row { display: flex; flex-direction: row; gap: 0; }
.tw-following-npc-chip { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; padding: 4px 10px 8px; cursor: pointer; min-width: 68px; flex-shrink: 0; }
.tw-following-npc-chip:active { opacity: 0.7; }
.tw-following-npc-name { font-size: 10px; color: var(--text-secondary); max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }

/* ===== 引用ツイート（QT）===== */
.tw-qt-card { margin: 0 12px 10px; border: 1px solid var(--border-light); border-radius: 12px; padding: 12px; background: var(--bg-secondary); }
.tw-qt-author { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tw-qt-original { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--bg-base); }
.tw-qt-preview { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ===== 世界書 条目トグルスイッチ ===== */
.wb-toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.wb-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.wb-toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-medium); border-radius: 24px; transition: background 0.2s; }
.wb-toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.wb-toggle input:checked + .wb-toggle-slider { background: var(--accent-color); }
.wb-toggle input:checked + .wb-toggle-slider::before { transform: translateX(18px); }

/* ========================================================
   Forum — 骨架屏(Skeleton Loading)
   ======================================================== */
/* ===== 通用骨架屏系统 ===== */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.85; }
}

.skeleton-card {
    padding: 14px 16px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.skeleton-circle {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--border-light);
    flex-shrink: 0;
}

.skeleton-line {
    height: 14px;
    background: var(--border-light);
    border-radius: var(--radius-xs);
    margin-bottom: 8px;
}

.skeleton-line.short { width: 30%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.long { width: 90%; }

.skeleton-block {
    height: 80px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* Forum 骨架屏（兼容旧类名） */
.forum-skeleton-reply {
    padding: 14px 16px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.forum-skeleton-reply .skel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.forum-skeleton-reply .skel-circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--border-light);
}
.forum-skeleton-reply .skel-line {
    height: 14px;
    background: var(--border-light);
    border-radius: 6px;
    margin-bottom: 8px;
}

/* Forum — Part ナビゲーション */
.forum-part-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}
.forum-part-link {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s;
}
.forum-part-link:active {
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
}
.forum-part-label {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
}

/* ========================================================
   Magazine — 相関図ビジュアルカード
   ======================================================== */
.mag-chart-pair {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: 8px 0;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-light);
}
.mag-chart-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 56px;
    flex-shrink: 0;
}
.mag-chart-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--node-color, var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.mag-chart-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mag-chart-edge {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
    min-width: 0;
}
.mag-chart-edge::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    border-top: 2px dashed var(--border-medium);
    z-index: 0;
}
.mag-chart-arrow {
    font-size: 18px;
    color: #06b6d4;
    font-weight: 700;
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    padding: 0 6px;
}
.mag-chart-desc {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    padding: 0 4px;
    word-break: break-word;
}
.mag-chart-editorial {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 12px 0 4px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-style: italic;
    border-left: 3px solid var(--accent-color);
}
/* SVG Relationship Chart */
.mag-chart-svg {
    width: 100%;
    max-height: 360px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-secondary);
}
.mag-chart-svg-label {
    pointer-events: none;
}
.mag-chart-detail-list {
    border-top: 1px dashed var(--border-medium);
    padding-top: 12px;
}

/* ========================================================
   Magazine — Cover Visual (Animage/Newtype 風)
   ======================================================== */
.magazine-cover {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 0 20px;
    aspect-ratio: 148 / 210;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25), inset 0 0 60px rgba(0,0,0,0.15);
}
/* corner deco lines */
.magazine-cover::before,
.magazine-cover::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(255,215,0,0.45);
    pointer-events: none;
    z-index: 1;
}
.magazine-cover::before {
    top: 12px; left: 12px;
    width: 40px; height: 40px;
    border-right: none; border-bottom: none;
}
.magazine-cover::after {
    bottom: 12px; right: 12px;
    width: 40px; height: 40px;
    border-left: none; border-top: none;
}
.magazine-cover-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 14px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid rgba(255,215,0,0.3);
    z-index: 2;
}
.magazine-cover-magname {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffd700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    text-transform: uppercase;
    font-style: italic;
}
.magazine-cover-vol {
    font-size: 11px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}
.magazine-cover-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 3px;
    background: rgba(255,215,0,0.25);
    border: 1px solid rgba(255,215,0,0.5);
    color: #ffd700;
    margin-bottom: 8px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}
.magazine-cover-title {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.35;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    z-index: 2;
    position: relative;
}
.magazine-cover-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 2;
    position: relative;
}
.magazine-cover-date {
    position: absolute;
    bottom: 16px; right: 20px;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
    z-index: 2;
}
/* bottom decorative line */
.magazine-cover-line {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.6), transparent);
}
/* type-specific gradient backgrounds */
.magazine-cover[data-type="seiyuu"]   { background: linear-gradient(145deg, #1a0a3e 0%, #2d1b69 40%, #4a2c8a 100%); }
.magazine-cover[data-type="staff"]    { background: linear-gradient(145deg, #1a2a0a 0%, #2b4a15 40%, #3d6b22 100%); }
.magazine-cover[data-type="roundtable"]{ background: linear-gradient(145deg, #0a1a2e 0%, #15355a 40%, #1e4f7a 100%); }
.magazine-cover[data-type="poll"]     { background: linear-gradient(145deg, #3a0a1a 0%, #6b1530 40%, #8a2040 100%); }
.magazine-cover[data-type="feature"]  { background: linear-gradient(145deg, #0a1a3e 0%, #152b69 40%, #1e3c8a 100%); }
.magazine-cover[data-type="column"]   { background: linear-gradient(145deg, #1a2a1a 0%, #2b4a2b 40%, #3d6b3d 100%); }
.magazine-cover[data-type="reader"]   { background: linear-gradient(145deg, #2a1a0a 0%, #4a3015 40%, #6b4520 100%); }
.magazine-cover[data-type="charatalk"]{ background: linear-gradient(145deg, #2a0a2a 0%, #4a154a 40%, #6b206b 100%); }
.magazine-cover[data-type="chart"]    { background: linear-gradient(145deg, #0a2a2a 0%, #154a4a 40%, #206b6b 100%); }

/* ========================================================
   Magazine — List card left color stripe
   ======================================================== */
.magazine-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 14px 14px 18px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    overflow: hidden;
}
.magazine-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--mag-stripe-color, var(--accent-color));
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.magazine-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.magazine-card:active {
    transform: scale(0.98);
}
.magazine-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.magazine-card-type {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
}
.magazine-card-saved {
    font-size: 10px;
    color: var(--text-secondary);
}
.magazine-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}
.magazine-card-npc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.magazine-card-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}
/* ========================================================
   Magazine — Reader body & Q&A styles
   ======================================================== */
.magazine-reader-body {
    padding: 16px !important;
}
.magazine-reader-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
}
.magazine-reader-bar .glass-btn {
    flex: 1;
    margin: 0;
    padding: 10px;
    font-size: 13px;
}
.magazine-article-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.35;
}
.magazine-article-npc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.magazine-type-row {
    margin-bottom: 12px;
}
.magazine-type-select {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}
.magazine-qa-body {
    line-height: 1.7;
}
.magazine-qa-gap {
    height: 10px;
}
.magazine-qa-question {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 12px 0 4px;
}
.magazine-qa-answer {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.magazine-qa-name {
    font-weight: 700;
    color: var(--accent-color);
}
.magazine-empty {
    text-align: center;
    padding: 60px 20px;
}
.magazine-tl-block {
    margin-top: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
.magazine-tl-btn {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--accent-color);
    background: var(--bg-secondary);
}
.magazine-tl-content {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}
/* poll cards */
.magazine-poll-body {
    padding: 4px 0;
}
.magazine-poll-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
}
.magazine-poll-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}
.magazine-poll-rank-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-color);
    min-width: 40px;
}
.magazine-poll-char-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.magazine-poll-pct {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: auto;
}
.magazine-poll-bar-wrap {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.magazine-poll-bar {
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
    transition: width 0.5s;
}
.magazine-poll-comment {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 3px;
    line-height: 1.5;
}
/* feature cards */
.magazine-feature-section {
    margin-bottom: 14px;
}
.magazine-feature-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 4px;
}
.magazine-feature-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}
/* feature card (themed variant) */
.magazine-feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
}
.magazine-feature-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border-light);
}
.magazine-feature-card-emoji { font-size: 20px; line-height: 1; }
.magazine-feature-card-name { font-size: 16px; font-weight: 700; color: var(--accent-color); }
.magazine-feature-card-body { padding: 8px 16px 12px; }
.magazine-feature-card-body .magazine-feature-line { padding-left: 0; }
/* poll top3 (themed variant) */
.magazine-poll-card.poll-top3 { border-width: 2px; border-color: var(--accent-color); }
.magazine-poll-medal { font-size: 24px; line-height: 1; }
.magazine-poll-rank-num.poll-rank-large { font-size: 28px; }
/* reader corner — mail icons */
.magazine-reader-mail {
    font-size: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.magazine-reader-mail:last-child {
    border-bottom: none;
}
/* chara talk */
.magazine-chara-line {
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.7;
}
.magazine-chara-narrator {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 6px;
}
.magazine-npc-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
}

/* === Fan Tweet Subtype Labels === */
.tw-fan-subtype {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    opacity: 0.8;
    font-weight: 500;
}
.tw-fan-subtype.event_promo { background: rgba(52,199,89,0.15); color: #34c759; }
.tw-fan-subtype.event_haul { background: rgba(255,149,0,0.15); color: #ff9500; }
.tw-fan-subtype.event_repo { background: rgba(88,86,214,0.15); color: #5856d6; }
.tw-fan-subtype.cosplay_share { background: rgba(236,72,153,0.15); color: #ec4899; }
.tw-fan-subtype.fanart_share { background: rgba(29,155,240,0.15); color: #1d9bf0; }
.tw-fan-subtype.radio_drama { background: rgba(139,92,246,0.15); color: #8b5cf6; }

/* ==========================================================
   LINE Chat — 深度仿真样式
   ========================================================== */

/* --- LINE 配色变量 --- */
:root {
    --line-green: #06c755;
    --line-bg-default: #8cabd9;
    --line-bubble-me: #06c755;
    --line-bubble-me-text: #fff;
    --line-bubble-ai: #fff;
    --line-bubble-ai-text: #111;
    --line-read-color: #06c755;
}

/* --- 聊天列表页 --- */
.chat-list-container {
    background: var(--bg-card);
    padding: 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.chat-item:active {
    background: var(--bg-secondary);
}

/* 头像 + 在线点 */
.chat-avatar-wrap {
    position: relative;
    margin-right: 14px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-secondary);
    object-fit: cover;
    margin-right: 0;
}
/* グループアバター（2x2モザイク） */
.chat-avatar-wrap.group-avatar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 14px;
    flex-shrink: 0;
}
.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* グループ送信者名 */
.group-sender-name {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.msg-body-wrap { display: flex; flex-direction: column; }

.chat-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--line-green);
    border: 2px solid var(--bg-card);
    display: none;
}

.chat-online-dot.visible { display: block; }

/* 聊天信息区 */
.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.chat-pin-icon,
.chat-mute-icon {
    font-size: 12px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.chat-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.chat-unread {
    background: var(--line-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

.chat-pin-separator {
    padding: 6px 16px;
    background: var(--bg-secondary);
    text-align: center;
}

.chat-pin-separator span {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

/* --- 对话界面顶栏 --- */
#conversation .app-header {
    gap: 10px;
}

#conversation .app-header .header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#conversation .app-header .header-info h1 {
    font-size: 16px;
    margin: 0;
}

.line-status {
    font-size: 11px;
    color: var(--line-green);
    display: flex;
    align-items: center;
    gap: 4px;
}

.line-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line-green);
}

.line-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.line-header-icons {
    display: flex;
    gap: 16px;
    align-items: center;
}

.line-header-icons svg {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* --- 消息区域 --- */
.messages-container {
    background: var(--line-bg-default);
    gap: 4px;
    padding: 12px 16px;
}

/* --- 日期分隔线 --- */
.line-date-sep {
    text-align: center;
    margin: 12px 0 8px;
}

.line-date-sep span {
    background: rgba(0,0,0,0.15);
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 12px;
}

/* --- 消息行 --- */
.message {
    display: flex;
    align-items: flex-end;
    width: 100%;
    gap: 8px;
    margin-bottom: 2px;
    animation: none;
    position: relative;
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* 头像 */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 0;
    flex-shrink: 0;
    align-self: flex-end;
}

.message-avatar.hidden-avatar {
    visibility: hidden;
}

/* 气泡 */
.message-bubble {
    max-width: 65%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: none;
}

.message.assistant .message-bubble {
    background: var(--line-bubble-ai);
    color: var(--line-bubble-ai-text);
    border-radius: 18px 18px 18px 4px;
}

.message.user .message-bubble {
    background: var(--line-bubble-me);
    color: var(--line-bubble-me-text);
    border-radius: 18px 18px 4px 18px;
}

/* 主题色模式覆盖 */
.messages-container.theme-color .message.assistant .message-bubble {
    background: var(--bubble-ai);
    color: var(--bubble-ai-text);
}

.messages-container.theme-color .message.user .message-bubble {
    background: var(--bubble-me);
    color: var(--bubble-me-text);
}

/* --- 时间戳 + 既読 --- */
.msg-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 1px;
    flex-shrink: 0;
}

.message:not(.user) .msg-meta {
    align-items: flex-start;
}

.msg-read {
    font-size: 10px;
    color: var(--line-read-color);
    font-weight: 500;
}

.msg-time {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
}

/* 主题色模式下时间颜色 */
.messages-container.theme-color .msg-time {
    color: var(--text-tertiary);
}

/* --- 贴纸消息 --- */
.message .sticker-content {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message .sticker-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.message .sticker-content .sticker-emoji {
    font-size: 80px;
    line-height: 1;
}

/* --- 打字指示器 --- */
.typing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
}

.typing-dots {
    background: var(--line-bubble-ai);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 18px;
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    animation: line-typing-blink 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes line-typing-blink {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* --- 输入栏 LINE 风格 --- */
.chat-input-glass {
    border-radius: 0;
    background: var(--bg-card);
    border: none;
    border-top: 1px solid var(--border-light);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    margin: 0;
    padding: 8px 12px;
    gap: 10px;
}

.chat-input-glass input {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    font-size: 14px;
    background: var(--bg-secondary);
}

.chat-input-glass input:focus {
    border-color: var(--line-green);
}

.send-icon-btn {
    background: var(--line-green);
}

/* スタンプ按钮激活态 */
#stickerBtn.active {
    color: var(--line-green);
}

/* --- 贴纸面板 --- */
.sticker-panel {
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    display: none;
}

.sticker-panel.active {
    display: block;
}

.sticker-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    padding: 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.sticker-tabs::-webkit-scrollbar { display: none; }

.sticker-tab {
    flex: 0 0 auto;
    min-width: 60px;
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
}

.sticker-tab.active {
    color: var(--line-green);
    border-bottom-color: var(--line-green);
    font-weight: 600;
}

.sticker-tab .tab-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 2px;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
}

.sticker-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    transition: background var(--transition-fast);
    background: var(--bg-secondary);
}

.sticker-cell:hover { background: #e8f5e9; }
.sticker-cell:active { transform: scale(0.9); }

.sticker-cell img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.sticker-manage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid var(--border-light);
}

.sticker-pack-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.sticker-manage-btn {
    font-size: 12px;
    color: var(--line-green);
    background: none;
    border: 1px solid var(--line-green);
    border-radius: 14px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
}

.sticker-manage-btn:hover {
    background: var(--line-green);
    color: #fff;
}

/* --- 聊天设置：背景色選択 --- */
.chat-bg-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
    flex-shrink: 0;
}

.chat-bg-dot:hover { transform: scale(1.05); }

.chat-bg-dot.selected {
    border-color: var(--line-green);
    transform: scale(1.1);
}

/* --- 总结消息（保留现有样式但适配 LINE 背景）--- */
.message.system.summary-message {
    justify-content: center;
}

.message.system.summary-message .message-bubble {
    background: rgba(255,255,255,0.85);
    color: var(--text-primary);
    max-width: 85%;
}

/* ========================================================
   Music (Spotify風 Lyric Lab)
   ======================================================== */

/* アイコン */
.icon-spotify { background: var(--app-icon-bg); }
.icon-spotify svg { stroke: var(--accent-color); }

/* 暗テーマオーバーライド */
#lyric-lab .settings-scroll { background: #121212; }
#lyric-lab .app-header.glass {
    background: rgba(18, 18, 18, 0.95);
    border-bottom-color: #282828;
}
#lyric-lab .app-header h1 { color: #fff; }
#lyric-lab .nav-btn { color: #b3b3b3; }

/* プレイリストグリッド */
.sp-playlist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.sp-playlist-card {
    cursor: pointer;
    transition: transform 0.15s;
}
.sp-playlist-card:active { transform: scale(0.96); }
.sp-playlist-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.sp-cover-text {
    font-size: 28px;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sp-playlist-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}
.sp-playlist-meta {
    font-size: 12px;
    color: #b3b3b3;
    margin-top: 2px;
}

/* セクションタイトル */
.sp-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}

/* 戻るボタン */
.sp-back-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #b3b3b3;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}
.sp-back-btn:hover { background: rgba(255,255,255,0.15); }

/* プレイリストヘッダー */
.sp-playlist-header {
    padding: 40px 16px 20px;
    position: relative;
}
.sp-playlist-header-inner { position: relative; z-index: 1; }

/* 関係タグ */
.sp-relationship-tag {
    font-size: 12px;
    color: #b3b3b3;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* 曲目リスト */
.sp-track-list { display: flex; flex-direction: column; }
.sp-track-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.sp-track-item:hover { background: rgba(255,255,255,0.08); }
.sp-track-num {
    width: 24px;
    text-align: center;
    font-size: 14px;
    color: #b3b3b3;
    flex-shrink: 0;
}
.sp-track-info { flex: 1; min-width: 0; }
.sp-track-title {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-track-artist {
    font-size: 12px;
    color: #b3b3b3;
    margin-top: 1px;
}
.sp-track-duration {
    font-size: 14px;
    color: #b3b3b3;
    flex-shrink: 0;
}

/* Now Playing */
.sp-now-playing {
    padding: 16px;
    text-align: center;
}
.sp-np-cover {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    margin: 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.sp-np-cover-text {
    font-size: 48px;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sp-np-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-top: 16px;
}
.sp-np-artist {
    font-size: 14px;
    color: #b3b3b3;
    margin-top: 4px;
}

/* プログレスバー */
.sp-progress-bar {
    width: 100%;
    height: 4px;
    background: #404040;
    border-radius: 2px;
    margin: 20px 0 6px;
    overflow: hidden;
}
.sp-progress-fill {
    height: 100%;
    background: #1DB954;
    border-radius: 2px;
}
.sp-progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #b3b3b3;
}

/* コントロール */
.sp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 20px 0;
    color: #fff;
}

/* 歌詞セクション */
.sp-lyrics-section {
    text-align: left;
    margin-top: 24px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 16px;
}
.sp-lyrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.sp-lyrics-textarea {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.8;
    color: #e0e0e0;
    resize: vertical;
    font-family: inherit;
    outline: none;
}
.sp-lyrics-textarea:focus { border-color: #1DB954; }
.sp-save-btn {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    background: #1DB954;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.sp-save-btn:hover { opacity: 0.9; }

/* 曲情報 */
.sp-song-meta {
    margin-top: 16px;
    font-size: 12px;
    color: #666;
    line-height: 1.8;
    text-align: left;
}

/* 空状態 */
.sp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* ========================================================
   ニコニコ動画
   ======================================================== */

/* アイコン */
.icon-niconico { background: var(--app-icon-bg); color: var(--accent-color); }
.icon-niconico svg { stroke: var(--accent-color); }

/* タブバー */
.nico-tabs {
    display: flex;
    background: #1a1a1a;
    border-bottom: 2px solid #333;
    flex-shrink: 0;
}
.nico-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}
.nico-tab.active {
    color: #fff;
    border-bottom-color: #e0e0e0;
}

/* メインコンテンツ — ニコニコは暗背景 */
#niconico .settings-scroll,
#niconico-detail .settings-scroll,
#niconico-channel .settings-scroll,
#niconico-search .settings-scroll {
    background: #1a1a1a;
}
#niconico .app-header.glass,
#niconico-detail .app-header.glass,
#niconico-channel .app-header.glass,
#niconico-search .app-header.glass {
    background: rgba(26, 26, 26, 0.95);
    border-bottom-color: #333;
    color: #e0e0e0;
}
#niconico .app-header h1,
#niconico-detail .app-header h1,
#niconico-channel .app-header h1,
#niconico-search .app-header h1 {
    color: #e0e0e0;
}
#niconico .nav-btn,
#niconico-detail .nav-btn,
#niconico-channel .nav-btn,
#niconico-search .nav-btn {
    color: #e0e0e0;
}

/* 動画カードグリッド */
.nico-video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.nico-video-card {
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #252525;
    transition: transform 0.15s, box-shadow 0.15s;
}
.nico-video-card:active { transform: scale(0.97); }

/* サムネイル */
.nico-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    overflow: hidden;
}
.nico-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
}

/* 動画情報 */
.nico-video-info {
    padding: 8px 10px 10px;
}
.nico-video-title {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.nico-video-uploader {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}
.nico-video-stats {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #666;
}

/* ランキング */
.nico-ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #333;
    cursor: pointer;
}
.nico-rank-num {
    font-size: 18px;
    font-weight: 700;
    color: #666;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.nico-rank-num.gold { color: #ffd700; }
.nico-rank-num.silver { color: #c0c0c0; }
.nico-rank-num.bronze { color: #cd7f32; }
.nico-ranking-thumb {
    width: 100px;
    aspect-ratio: 16/9;
    background: #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.nico-ranking-info { flex: 1; min-width: 0; }
.nico-ranking-title {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nico-ranking-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* チャンネルカード */
.nico-channel-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #252525;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 8px;
}
.nico-channel-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.nico-channel-info { flex: 1; min-width: 0; }
.nico-channel-name {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}
.nico-channel-subs {
    font-size: 12px;
    color: #888;
}

/* プレイヤーエリア */
.nico-player-area {
    position: relative;
}
.nico-player-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}
.nico-player-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: pointer;
}
.nico-danmaku-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #aaa;
    font-size: 14px;
    z-index: 1;
    pointer-events: none;
}

/* 弾幕エリア */
.nico-danmaku-track {
    position: relative;
    width: 100%;
    height: 200px;
    background: #0d0d0d;
    overflow: hidden;
    border-bottom: 1px solid #333;
}
.nico-danmaku-track .nico-danmaku-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    opacity: 0.3;
    z-index: 0;
}
.nico-danmaku {
    position: absolute;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    z-index: 1;
    animation: nico-scroll linear forwards;
    pointer-events: none;
}
@keyframes nico-scroll {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

/* 動画詳細ページ */
.nico-detail-section {
    padding: 12px 16px;
    border-bottom: 1px solid #333;
}
.nico-detail-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.4;
    margin-bottom: 8px;
}
.nico-detail-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}
.nico-detail-meta span { display: flex; align-items: center; gap: 4px; }
.nico-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.nico-tag {
    padding: 3px 8px;
    background: #333;
    color: #aaa;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.nico-tag:hover { background: #444; }
.nico-detail-desc {
    font-size: 13px;
    color: #aaa;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* アクションボタン */
.nico-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #333;
}
.nico-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: #333;
    border: none;
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.nico-action-btn:hover { background: #444; }
.nico-action-btn.active { background: #e0245e; color: #fff; }

/* コメント */
.nico-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #333;
}
.nico-comments-header h3 {
    font-size: 14px;
    color: #e0e0e0;
    margin: 0;
}
.nico-comment-item {
    padding: 8px 16px;
    border-bottom: 1px solid #2a2a2a;
}
.nico-comment-author {
    font-size: 12px;
    color: #888;
    margin-bottom: 2px;
}
.nico-comment-text {
    font-size: 14px;
    color: #ddd;
    line-height: 1.5;
}
.nico-comment-time {
    font-size: 11px;
    color: #555;
    margin-top: 2px;
}

/* コメント入力 */
.nico-comment-input {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #1a1a1a;
    border-top: 1px solid #333;
}
.nico-comment-input input {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    color: #e0e0e0;
    outline: none;
}
.nico-comment-input input:focus { border-color: #666; }
.nico-comment-input button {
    background: #666;
    border: none;
    color: #fff;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
}

/* 関連動画 */
.nico-related-section { padding: 12px 16px; }
.nico-related-section h3 {
    font-size: 14px;
    color: #e0e0e0;
    margin: 0 0 10px;
}
.nico-related-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
}
.nico-related-thumb {
    width: 120px;
    aspect-ratio: 16/9;
    background: #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.nico-related-info { flex: 1; min-width: 0; }
.nico-related-title {
    font-size: 12px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nico-related-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* 生成モーダル */
.nico-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nico-modal {
    background: #2a2a2a;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 360px;
    color: #e0e0e0;
}
.nico-modal-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}
.nico-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nico-gen-btn {
    background: #333 !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
    padding: 12px !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
}
.nico-gen-btn:hover { background: #444 !important; }
.nico-gen-btn:disabled { opacity: 0.4; cursor: default; }

/* 空状態 */
.nico-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.nico-empty .empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.nico-empty .empty-state-text { font-size: 15px; color: #888; }
.nico-empty .empty-state-hint { font-size: 13px; color: #666; margin-top: 4px; }

/* チャンネル詳細 */
.nico-channel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #252525;
    border-bottom: 1px solid #333;
}
.nico-channel-header-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}
.nico-channel-header-info { flex: 1; }
.nico-channel-header-name { font-size: 18px; font-weight: 700; color: #e0e0e0; }
.nico-channel-header-subs { font-size: 13px; color: #888; margin-top: 2px; }
.nico-channel-header-desc { font-size: 13px; color: #aaa; margin-top: 6px; line-height: 1.5; }
.nico-follow-btn {
    background: #e0245e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.nico-follow-btn.following { background: #333; color: #888; }

/* セクション見出し */
.nico-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #e0e0e0;
    padding: 12px 0 8px;
}