/* ===== CSS Variables / Themes ===== */
:root {
    --bg-primary: #36393f;
    --bg-secondary: #2f3136;
    --bg-tertiary: #202225;
    --bg-accent: #4f545c;
    --bg-hover: #42464d;
    --text-primary: #dcddde;
    --text-secondary: #b9bbbe;
    --text-muted: #72767d;
    --blurple: #5865f2;
    --blurple-hover: #4752c4;
    --green: #3ba55c;
    --red: #ed4245;
    --yellow: #faa61a;
    --gold: #f1c40f;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 16px;
    --nav-height: 64px;
    --header-height: 56px;
    --bubble-me: linear-gradient(135deg, #5865f2, #7289da);
    --bubble-other: #3b3e45;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --glass-bg: rgba(47,49,54,0.55);
    --glass-border: rgba(255,255,255,0.1);
    --glass-blur: 16px;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f2f3f5;
    --bg-tertiary: #e3e5e8;
    --bg-accent: #d0d3d8;
    --bg-hover: #e3e5e8;
    --text-primary: #2e3338;
    --text-secondary: #5c6370;
    --text-muted: #949ba4;
    --bubble-other: #e9ebed;
    --glass-bg: rgba(255,255,255,0.5);
    --glass-border: rgba(0,0,0,0.12);
}

/* Ocean theme */
[data-theme="ocean"] {
    --bg-primary: #1a2332;
    --bg-secondary: #1e2d3f;
    --bg-tertiary: #15212e;
    --bg-accent: #2a3f56;
    --bg-hover: #28394d;
    --text-primary: #d1dce6;
    --text-secondary: #8fa5b8;
    --text-muted: #5a7088;
    --blurple: #00b4d8;
    --blurple-hover: #0096b7;
    --bubble-me: linear-gradient(135deg, #00b4d8, #0077b6);
    --bubble-other: #243b52;
    --glass-bg: rgba(30,45,63,0.55);
    --glass-border: rgba(255,255,255,0.1);
}

/* Sunset (彩霞) theme */
[data-theme="sunset"] {
    --bg-primary: #2d1b2e;
    --bg-secondary: #3a2540;
    --bg-tertiary: #241828;
    --bg-accent: #4a2e52;
    --bg-hover: #42334a;
    --text-primary: #f0e0f0;
    --text-secondary: #c0a8c0;
    --text-muted: #806080;
    --blurple: #e056a0;
    --blurple-hover: #c0458a;
    --bubble-me: linear-gradient(135deg, #e056a0, #ff6b6b);
    --bubble-other: #3a2540;
    --glass-bg: rgba(58,37,64,0.55);
    --glass-border: rgba(255,255,255,0.12);
}

/* Forest theme */
[data-theme="forest"] {
    --bg-primary: #1e2a1e;
    --bg-secondary: #283828;
    --bg-tertiary: #162016;
    --bg-accent: #3a503a;
    --bg-hover: #344834;
    --text-primary: #d8e8d8;
    --text-secondary: #a0c0a0;
    --text-muted: #608060;
    --blurple: #4caf50;
    --blurple-hover: #388e3c;
    --bubble-me: linear-gradient(135deg, #4caf50, #81c784);
    --bubble-other: #283828;
    --glass-bg: rgba(40,56,40,0.55);
    --glass-border: rgba(255,255,255,0.1);
}

/* 红锈 (Rust) theme - red/black tones */
[data-theme="rust"] {
    --bg-primary: #1a1214;
    --bg-secondary: #24181a;
    --bg-tertiary: #120a0c;
    --bg-accent: #3a1a1e;
    --bg-hover: #2e1a1e;
    --text-primary: #f0d8dc;
    --text-secondary: #c8a0a8;
    --text-muted: #886068;
    --blurple: #c0392b;
    --blurple-hover: #a93226;
    --bubble-me: linear-gradient(135deg, #c0392b, #e74c3c);
    --bubble-other: #24181a;
    --glass-bg: rgba(36,24,26,0.55);
    --glass-border: rgba(255,255,255,0.12);
}

/* Monochrome theme - minimalist B&W */
[data-theme="monochrome"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #eeeeee;
    --bg-accent: #d0d0d0;
    --bg-hover: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #999999;
    --blurple: #1a1a1a;
    --blurple-hover: #333333;
    --green: #333333;
    --red: #1a1a1a;
    --yellow: #777777;
    --bubble-me: #1a1a1a;
    --bubble-other: #f0f0f0;
    --glass-bg: rgba(255,255,255,0.65);
    --glass-border: rgba(0,0,0,0.1);
}

/* Morandi theme */
[data-theme="morandi"] {
    --bg-primary: #e8e0d8;
    --bg-secondary: #dfd6ce;
    --bg-tertiary: #d4cbc3;
    --bg-accent: #c4bab2;
    --bg-hover: #ccc2ba;
    --text-primary: #4a3f35;
    --text-secondary: #6b5d50;
    --text-muted: #9b8d80;
    --blurple: #8b7355;
    --blurple-hover: #6d5a43;
    --bubble-me: linear-gradient(135deg, #8b7355, #a08464);
    --bubble-other: #d4ccc5;
    --glass-bg: rgba(232,224,216,0.55);
    --glass-border: rgba(74,63,53,0.12);
}

/* Matcha theme - light green */
[data-theme="matcha"] {
    --bg-primary: #f4f7f0;
    --bg-secondary: #edf2e8;
    --bg-tertiary: #e3eae0;
    --bg-accent: #c8d5c0;
    --bg-hover: #dbe4d5;
    --text-primary: #3a4a30;
    --text-secondary: #5a6b50;
    --text-muted: #8a9a80;
    --blurple: #6b8f5e;
    --blurple-hover: #557548;
    --bubble-me: linear-gradient(135deg, #6b8f5e, #8aaa7a);
    --bubble-other: #e8eee5;
    --glass-bg: rgba(244,247,240,0.55);
    --glass-border: rgba(58,74,48,0.12);
}

/* Sakura theme - light pink */
[data-theme="sakura"] {
    --bg-primary: #fdf5f6;
    --bg-secondary: #fbeff1;
    --bg-tertiary: #f5e4e7;
    --bg-accent: #e8cfd3;
    --bg-hover: #f0dce0;
    --text-primary: #5a3a40;
    --text-secondary: #7a5a60;
    --text-muted: #a09094;
    --blurple: #d4878e;
    --blurple-hover: #b06d74;
    --bubble-me: linear-gradient(135deg, #d4878e, #e8a8ae);
    --bubble-other: #f8eeef;
    --glass-bg: rgba(253,245,246,0.55);
    --glass-border: rgba(90,58,64,0.12);
}

/* Glassmorphism mode */
[data-glass="true"] .profile-card,
[data-glass="true"] .status-section,
[data-glass="true"] .countdown-card,
[data-glass="true"] .photo-wall,
[data-glass="true"] .stat-card,
[data-glass="true"] .setting-group,
[data-glass="true"] .card-item,
[data-glass="true"] .sub-header,
[data-glass="true"] .cards-tab-bar,
[data-glass="true"] .cards-group-bar,
[data-glass="true"] .settings-tabs,
[data-glass="true"] .nav-bar,
[data-glass="true"] .music-player {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Disable transitions during theme switch (prevents mobile lag) */
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: none !important;
    animation: none !important;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    background: var(--bg-primary);
    overflow: hidden;
}

/* ===== Pages ===== */
.page {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
}

.page.active {
    display: flex;
    animation: pageIn 0.3s ease;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Home Page ===== */
#page-home {
    overflow: hidden auto;
    position: relative;
}

.home-bg {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--blurple), #7289da);
    background-size: cover;
    background-position: center;
    transition: background 0.5s ease;
}

.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px calc(var(--nav-height) + 20px);
    position: relative;
    z-index: 1;
    gap: 16px;
    overflow-y: auto;
    min-height: 100%;
}

/* Top row: profile card + right column */
.home-top-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 540px;
    align-items: flex-start;
    flex-shrink: 0;
}

/* Profile Card - 60% */
.profile-card {
    flex: 6;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.profile-card-bg {
    height: 70px;
    background: linear-gradient(135deg, var(--blurple), #7289da);
    background-size: cover;
    background-position: center;
}

.profile-card-body {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-avatar-wrap {
    margin-top: -32px;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid var(--bg-secondary);
    background: var(--blurple);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    font-weight: bold;
}

.profile-nickname {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.profile-nickname:hover { background: var(--bg-hover); }

.profile-bio {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 100%;
    word-break: break-word;
}
.profile-bio:hover { background: var(--bg-hover); }

.profile-location-weather {
    align-self: flex-end;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    border-radius: 4px;
    padding: 2px 4px;
}
.lw-part {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
}
.lw-part:hover { background: var(--bg-hover); }
.lw-sep {
    color: var(--text-muted);
    user-select: none;
    -webkit-user-select: none;
}

/* Right column - 40% */
.home-right-col {
    flex: 4;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

/* Inline edit input */
.inline-edit {
    position: fixed;
    background: var(--bg-tertiary);
    border: 2px solid var(--blurple);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: inherit;
    outline: none;
    z-index: 200;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ===== Status Section ===== */
.status-section {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 12px 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blurple);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}
.status-avatar:hover { opacity: 0.8; }

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

.status-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    transition: background 0.2s;
    display: inline-block;
}
.status-name:hover { background: var(--bg-hover); }

.status-text {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
}
.status-text:hover { background: var(--bg-hover); }

.status-wifi {
    color: var(--text-secondary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.status-battery {
    color: var(--text-secondary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ===== Countdown Card ===== */
.countdown-card {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    text-align: center;
}

.countdown-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.countdown-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--blurple);
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    display: inline-block;
}
.countdown-number:hover { background: var(--bg-hover); }

.countdown-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Photo Wall ===== */
.photo-wall {
    width: 100%;
    max-width: 540px;
    background: transparent;
    padding: 8px;
    flex-shrink: 0;
    flex: 1;
}

.photo-wall-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 60px;
}

.polaroid {
    position: relative;
    background: #fff;
    padding: 5px 5px 20px 5px;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.polaroid:hover {
    transform: scale(1.08) rotate(0deg) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    z-index: 10;
}

.polaroid img {
    width: 68px;
    height: 68px;
    object-fit: cover;
    display: block;
}

.polaroid .polaroid-date {
    font-size: 9px;
    color: #999;
    font-family: 'Georgia', serif;
    margin-top: 3px;
    text-align: center;
    opacity: 0.8;
}

.polaroid .polaroid-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--red);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.polaroid:hover .polaroid-delete {
    display: flex;
}

.photo-wall-add {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.photo-wall-add-btn {
    padding: 6px 16px;
    background: var(--blurple);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.photo-wall-add-btn:hover { background: var(--blurple-hover); }

.photo-wall-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px 0;
}

/* Home bottom row: Photo wall + Music player */
.home-bottom-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 540px;
    flex-shrink: 0;
}

/* ===== Music Player ===== */
.music-player {
    width: 140px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.music-disc-wrap {
    width: 80px;
    height: 80px;
    cursor: pointer;
    position: relative;
}

.music-disc {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #1a1a2e, #2d2d44, #1a1a2e, #2d2d44, #1a1a2e, #2d2d44, #1a1a2e, #2d2d44, #1a1a2e);
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: box-shadow 0.3s;
    border: 2px solid rgba(255,255,255,0.1);
}
.music-disc:hover {
    box-shadow: 0 0 16px rgba(88,101,242,0.3);
}

.music-disc.spinning {
    animation: discSpin 3s linear infinite;
}

@keyframes discSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.music-disc-hole {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid rgba(255,255,255,0.15);
    position: absolute;
}

.music-info {
    text-align: center;
    width: 100%;
}

.music-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.music-title:hover { background: var(--bg-hover); }

.music-artist {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.music-artist:hover { background: var(--bg-hover); }

.music-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--blurple);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.music-btn:hover { background: var(--blurple-hover); }
.music-btn svg { fill: currentColor; }

/* ===== Navigation Bar ===== */
.nav-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 12px;
    border-top: 1px solid rgba(0,0,0,0.2);
    z-index: 100;
    max-width: 720px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.nav-item.active {
    color: white;
    background: var(--blurple);
}

.nav-item.nav-home {
    width: 52px;
    height: 52px;
}

.nav-item svg {
    fill: currentColor;
}

/* ===== Sub Header ===== */
.sub-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.back-btn svg { fill: currentColor; }

.sub-header-title, .chat-peer-name {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-settings-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.chat-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== Chat Page ===== */
#page-chat {
    background: var(--bg-primary);
}

.chat-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.chat-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.chat-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-empty-hint p {
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-empty-hint .sub-hint {
    font-size: 13px;
    opacity: 0.7;
}

/* Message row */
.msg-row {
    display: flex;
    margin-bottom: 6px;
    animation: msgIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    align-items: flex-start;
    gap: 8px;
}

.msg-row.msg-other {
    justify-content: flex-start;
}

.msg-row.msg-me {
    justify-content: flex-end;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blurple);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    font-weight: bold;
}

.msg-avatar-time {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
    white-space: nowrap;
}

.msg-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.msg-content-wrap {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    padding-top: 4px;
}

/* Chat bubbles - style presets */
.msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.msg-other .msg-bubble {
    background: var(--bubble-other);
    color: var(--text-primary);
}

.msg-me .msg-bubble {
    background: var(--bubble-me);
    color: white;
}

/* Bubble style: rounded (default) */
[data-bubble-style="default"] .msg-other .msg-bubble {
    border-radius: var(--radius);
    border-top-left-radius: 4px;
}
[data-bubble-style="default"] .msg-me .msg-bubble {
    border-radius: var(--radius);
    border-top-right-radius: 4px;
}

/* Bubble style: pill */
[data-bubble-style="pill"] .msg-other .msg-bubble {
    border-radius: 20px 20px 20px 6px;
}
[data-bubble-style="pill"] .msg-me .msg-bubble {
    border-radius: 20px 20px 6px 20px;
}

/* Bubble style: square */
[data-bubble-style="square"] .msg-bubble {
    border-radius: 2px !important;
}

/* Bubble style: minimal */
[data-bubble-style="minimal"] .msg-bubble {
    border-radius: var(--radius);
    box-shadow: none;
}
[data-bubble-style="minimal"] .msg-other .msg-bubble {
    background: transparent;
    border: 1px solid var(--bg-accent);
}

.msg-other .msg-bubble:hover {
    filter: brightness(1.1);
}

[data-theme="light"] .msg-other .msg-bubble:hover {
    filter: brightness(0.95);
}

.msg-translation {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 14px;
    transition: var(--transition);
    overflow: hidden;
}

.msg-translation.hidden {
    display: none;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    padding: 0 4px;
}

.msg-me .msg-meta { justify-content: flex-end; }
.msg-other .msg-meta { justify-content: flex-start; }

.msg-read-status {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
}
.msg-read-status.read { color: var(--blurple); }
.msg-read-status.unread { color: var(--text-muted); }

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    animation: msgIn 0.3s ease;
}

.typing-dots {
    background: var(--bubble-other);
    padding: 12px 16px;
    border-radius: var(--radius);
    border-top-left-radius: 4px;
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Timestamp divider */
.msg-time-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 12px;
    position: relative;
}
.msg-time-divider::before,
.msg-time-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(128,128,128,0.2);
}
.msg-time-divider span {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 16px;
    font-weight: 500;
}

/* Chat input bar */
.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chat-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 22px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}
.chat-input:focus {
    box-shadow: 0 0 0 2px var(--blurple);
}

.chat-send-btn, .chat-play-btn, .chat-plus-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.chat-send-btn { background: var(--blurple); color: white; }
.chat-send-btn:hover { background: var(--blurple-hover); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-play-btn { background: var(--bg-accent); color: var(--text-primary); }
.chat-play-btn:hover { background: var(--bg-hover); }
.chat-plus-btn { background: var(--bg-accent); color: var(--text-primary); }
.chat-plus-btn:hover { background: var(--bg-hover); }
.chat-plus-btn svg, .chat-play-btn svg, .chat-send-btn svg { fill: currentColor; }

/* Scroll to bottom button */
.scroll-bottom-btn {
    position: absolute;
    bottom: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--blurple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: fadeInUp 0.3s ease;
}
.scroll-bottom-btn:hover { background: var(--blurple-hover); }
.scroll-bottom-btn svg { fill: currentColor; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message delete button */
.msg-bubble {
    position: relative;
}
.msg-delete-bubble {
    position: absolute;
    top: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
}
.msg-me .msg-delete-bubble { right: -8px; }
.msg-other .msg-delete-bubble { left: -8px; }
.msg-delete-bubble.visible { display: flex; }

/* Chat drawer */
.chat-drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.chat-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 65vh;
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    display: none;
    flex-direction: column;
    max-width: 720px;
    margin: 0 auto;
}
.chat-drawer.open {
    display: flex;
    animation: drawerUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes drawerUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.chat-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(128,128,128,0.1);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-drawer-close:hover { background: var(--bg-hover); }

.chat-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.drawer-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(128,128,128,0.08);
}
.drawer-section:last-child { border-bottom: none; margin-bottom: 0; }

.drawer-section-title {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.drawer-multi-msg {
    width: 100%;
    min-height: 80px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    padding: 10px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    margin-bottom: 8px;
}

/* Drawer icon grid */
.drawer-icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 8px 0;
}

.drawer-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.drawer-icon-item:hover {
    border-color: var(--blurple);
    background: var(--bg-hover);
    transform: scale(1.02);
}

.drawer-icon {
    font-size: 36px;
    line-height: 1;
}

.drawer-icon-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

/* Pat divider */
.pat-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    opacity: 0.7;
}
.pat-divider span {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* Disabled inputs in settings */
#chatSettingsContainer input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Call floating ball */
.call-float {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.call-float-ball {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--blurple);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(88,101,242,0.5);
    animation: callPulse 2s infinite;
}
.call-float-ball span { font-size: 24px; }

@keyframes callPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(88,101,242,0.5); }
    50% { box-shadow: 0 4px 24px rgba(88,101,242,0.8); }
}

.call-float-timer {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Call fullscreen */
.call-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-tertiary);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.call-full-header {
    text-align: center;
}

.call-full-header span:first-child {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.call-full-type {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.call-full-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--blurple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.call-full-timer {
    font-size: 24px;
    font-weight: 300;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.call-full-actions {
    display: flex;
    gap: 32px;
    margin-top: 20px;
}

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.call-action-btn svg { fill: white; }
.call-minimize { background: var(--bg-accent); }
.call-minimize:hover { background: var(--bg-hover); }
.call-end { background: var(--red); }
.call-end:hover { opacity: 0.85; }

/* ===== Cards Page ===== */
.cards-toolbar {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn svg { fill: currentColor; }

/* Cards tab bar */
.cards-tab-bar {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    padding: 0 16px;
    overflow-x: auto;
}
.cards-tab {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}
.cards-tab:hover { color: var(--text-secondary); }
.cards-tab.active {
    color: var(--blurple);
    border-bottom-color: var(--blurple);
}

.cards-group-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.cards-group-bar::-webkit-scrollbar { display: none; }

.group-tag {
    padding: 6px 14px;
    border-radius: 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}
.group-tag:hover { background: var(--bg-hover); }
.group-tag.active { background: var(--blurple); color: white; }
.group-tag .tag-edit { display: none; font-size: 14px; line-height: 1; }
.group-tag:hover .tag-edit { display: inline; }
.group-tag.tag-manage {
    background: transparent;
    border: 1px dashed var(--text-muted);
}

.cards-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 80px;
    -webkit-overflow-scrolling: touch;
}

.card-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: var(--transition);
    border-left: 3px solid transparent;
    animation: cardIn 0.3s ease;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}
.card-item:hover { background: var(--bg-hover); }
.card-item.blocked { opacity: 0.45; border-left-color: var(--yellow); }
.card-item.selected { border-left-color: var(--blurple); background: var(--bg-hover); }

/* Emoji cards - square style */
.card-item.emoji-card .card-content {
    font-size: 28px;
    text-align: center;
}
.card-item.emoji-card {
    min-height: 60px;
    justify-content: center;
}

/* Grid layout for emoji / status / gift tabs */
.cards-list.grid-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 10px 80px;
    align-content: start;
}
.cards-list.grid-layout .card-item {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 6px;
    margin-bottom: 0;
    border-left: none;
    min-height: 80px;
    gap: 4px;
    border-radius: var(--radius);
}
.cards-list.grid-layout .card-checkbox {
    display: none;
}
.cards-list.grid-layout .card-content-wrap {
    text-align: center;
    flex: none;
    min-width: 0;
    width: 100%;
}
.cards-list.grid-layout .card-content {
    font-size: 12px;
    white-space: normal;
    word-break: break-all;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cards-list.grid-layout .card-item.emoji-card .card-content {
    font-size: 32px;
    -webkit-line-clamp: 1;
}
.cards-list.grid-layout .card-actions {
    justify-content: center;
    flex-wrap: wrap;
}
.cards-list.grid-layout .card-action-btn {
    width: 22px;
    height: 22px;
}
/* Gift card in grid */
.cards-list.grid-layout .gift-card-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    width: 100%;
}
.cards-list.grid-layout .gift-card-emoji {
    font-size: 28px;
    width: auto;
    flex-shrink: 1;
}
.cards-list.grid-layout .gift-card-name {
    font-size: 11px;
    line-height: 1.2;
}
.cards-list.grid-layout .gift-card-desc {
    display: none;
}

.card-content-wrap {
    flex: 1;
    min-width: 0;
}
.card-content {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-translation {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions { display: flex; gap: 4px; flex-shrink: 0; }

.card-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    font-size: 16px;
}
.card-action-btn:hover { background: var(--bg-accent); color: var(--text-primary); }
.card-action-btn.blocked { color: var(--yellow); }
.card-action-btn.delete:hover { color: var(--red); }

/* Card checkbox uses SVG instead of text */
.card-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.card-checkbox.checked {
    background: var(--blurple);
    border-color: var(--blurple);
}
.card-checkbox.checked::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px, -1px);
}
.cards-list.multi-select .card-checkbox { display: flex; }
.cards-list.multi-select .card-actions { display: none; }

/* Multi-select bar */
.multi-select-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-tertiary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.2);
    z-index: 50;
}
.multi-select-bar span { color: var(--text-secondary); font-size: 14px; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 92%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.add-card-textarea {
    width: 100%;
    min-height: 160px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    line-height: 1.6;
}
.add-card-textarea:focus { box-shadow: 0 0 0 2px var(--blurple); }

.edit-card-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    margin-bottom: 10px;
}
.edit-card-input:focus { box-shadow: 0 0 0 2px var(--blurple); }

.add-card-group-select {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.add-card-group-select label { color: var(--text-secondary); font-size: 14px; }

/* Beautified select wrap */
.beautified-select-wrap {
    flex: 1;
    position: relative;
}
.beautified-select-wrap select,
.add-card-group-select select,
.beautified-select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-accent);
    border-radius: var(--radius);
    padding: 8px 32px 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2372767d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: var(--transition);
    width: 100%;
}
.beautified-select-wrap select:hover,
.add-card-group-select select:hover,
.beautified-select:hover { border-color: var(--blurple); }
.beautified-select-wrap select:focus,
.add-card-group-select select:focus,
.beautified-select:focus {
    border-color: var(--blurple);
    box-shadow: 0 0 0 2px rgba(88,101,242,0.2);
}

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

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary { background: var(--blurple); color: white; }
.btn-primary:hover { background: var(--blurple-hover); }
.btn-secondary { background: var(--bg-accent); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Group list edit */
.group-list-edit { margin-bottom: 16px; }
.group-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
.group-edit-row input {
    flex: 1;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}
.group-edit-row button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.group-edit-row button:hover { background: var(--bg-hover); color: var(--text-primary); }
.group-edit-row .delete-group:hover { color: var(--red); }
.group-add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.group-add-row input {
    flex: 1;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

/* ===== Stats Page ===== */
.stats-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.stat-card-title {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-card-value .unit { font-size: 14px; color: var(--text-muted); font-weight: normal; margin-left: 4px; }
.stat-card-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-row { display: flex; gap: 12px; }
.stat-row .stat-card { flex: 1; }

/* Heatmap */
.heatmap-wrapper { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; }
.heatmap-day-row { display: flex; align-items: center; gap: 4px; }
.heatmap-day-label { width: 36px; font-size: 11px; color: var(--text-muted); flex-shrink: 0; text-align: right; }
.heatmap-cells { flex: 1; display: flex; gap: 2px; }
.heatmap-cell { flex: 1; height: 16px; border-radius: 3px; background: var(--bg-tertiary); transition: var(--transition); min-width: 0; }

/* Heatmap levels use theme blurple for consistent color scheme */
.heatmap-cell.level-1 { background: color-mix(in srgb, var(--blurple) 25%, transparent); }
.heatmap-cell.level-2 { background: color-mix(in srgb, var(--blurple) 50%, transparent); }
.heatmap-cell.level-3 { background: color-mix(in srgb, var(--blurple) 75%, transparent); }
.heatmap-cell.level-4 { background: var(--blurple); }

.heatmap-hour-labels { display: flex; gap: 2px; margin-top: 4px; padding-left: 40px; }
.heatmap-hour-labels span { flex: 1; text-align: center; font-size: 9px; color: var(--text-muted); }

/* Daily chart - unified color */
.daily-chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin-top: 12px; padding: 0 4px; }
.daily-bar {
    flex: 1; min-width: 0;
    background: var(--blurple);
    border-radius: 2px 2px 0 0;
    opacity: 0.65;
    transition: var(--transition);
    position: relative;
    min-height: 2px;
}
.daily-bar:hover { opacity: 1; }
.daily-bar.peak { opacity: 1; background: var(--blurple); filter: brightness(1.2); }

.daily-labels { display: flex; gap: 2px; margin-top: 4px; padding: 0 4px; }
.daily-labels span { flex: 1; text-align: center; font-size: 8px; color: var(--text-muted); }

/* Most used cards */
.most-used-list { margin-top: 8px; }
.most-used-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(128,128,128,0.08); }
.most-used-rank {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
    color: var(--text-secondary); flex-shrink: 0;
}
.most-used-rank.top1 { background: var(--gold); color: #000; }
.most-used-rank.top2 { background: #c0c0c0; color: #000; }
.most-used-rank.top3 { background: #cd7f32; color: #fff; }
.most-used-content { flex: 1; min-width: 0; }
.most-used-text { font-size: 14px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.most-used-count { font-size: 12px; color: var(--text-muted); }

/* ===== Settings Page ===== */
.settings-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.settings-tab {
    flex: 1; text-align: center;
    padding: 14px 8px; font-size: 14px;
    color: var(--text-muted); cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}
.settings-tab:hover { color: var(--text-secondary); }
.settings-tab.active { color: var(--text-primary); border-bottom-color: var(--blurple); }

.settings-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.setting-group {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}
.setting-group-title {
    padding: 12px 16px 4px;
    font-size: 12px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.setting-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(128,128,128,0.06);
}
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 15px; color: var(--text-primary); }
.setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.setting-value { color: var(--text-secondary); font-size: 14px; }

/* Toggle switch */
.toggle {
    width: 44px; height: 24px;
    background: var(--bg-accent); border-radius: 12px;
    position: relative; cursor: pointer;
    transition: var(--transition); flex-shrink: 0;
}
.toggle.on { background: var(--green); }
.toggle::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 50%; background: white;
    transition: var(--transition);
}
.toggle.on::after { left: 22px; }

/* Chat settings checkbox - use SVG check */
.chat-checkbox {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
}
.chat-checkbox-box {
    width: 22px; height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    background: var(--bg-tertiary);
}
.chat-checkbox.checked .chat-checkbox-box {
    background: var(--blurple);
    border-color: var(--blurple);
}
.chat-checkbox.checked .chat-checkbox-box::after {
    content: '';
    display: inline-block;
    width: 10px; height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px, -1px);
}
.chat-checkbox-label { font-size: 14px; color: var(--text-primary); }

/* Theme picker */
.theme-picker {
    display: flex; gap: 12px;
    padding: 14px 16px; flex-wrap: wrap;
}
.theme-option {
    width: 60px; height: 60px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    display: flex; align-items: flex-end; justify-content: center;
    padding-bottom: 4px; position: relative;
}
.theme-option.active { border-color: var(--blurple); }
.theme-option .theme-name { font-size: 10px; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }

.theme-dark { background: linear-gradient(135deg, #36393f, #5865f2); }
.theme-light { background: linear-gradient(135deg, #ffffff, #f2f3f5); }
.theme-light .theme-name { color: #333; text-shadow: none; }
.theme-ocean { background: linear-gradient(135deg, #1a2332, #00b4d8); }
.theme-sunset { background: linear-gradient(135deg, #2d1b2e, #e056a0); }
.theme-forest { background: linear-gradient(135deg, #1e2a1e, #4caf50); }
.theme-rust { background: linear-gradient(135deg, #1a1214, #c0392b); }
.theme-monochrome { background: linear-gradient(135deg, #ffffff, #999999); }
.theme-monochrome .theme-name { color: #333; text-shadow: none; }
.theme-morandi { background: linear-gradient(135deg, #e8e0d8, #8b7355); }
.theme-morandi .theme-name { color: #4a3f35; text-shadow: none; }
.theme-matcha { background: linear-gradient(135deg, #f4f7f0, #6b8f5e); }
.theme-matcha .theme-name { color: #3a4a30; text-shadow: none; }
.theme-sakura { background: linear-gradient(135deg, #fdf5f6, #d4878e); }
.theme-sakura .theme-name { color: #5a3a40; text-shadow: none; }

/* Theme sections */
.theme-section-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 16px;
    margin: 8px 0 4px;
}

/* System theme follow */
.system-theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: var(--radius);
    margin: 0 16px;
    transition: background 0.2s;
}
.system-theme-option:hover { background: var(--bg-hover); }
.system-theme-option.active { background: var(--blurple); color: white; }
.system-theme-option.active .system-theme-label { color: white; }
.system-theme-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.system-theme-label {
    font-size: 14px;
    color: var(--text-primary);
}
.system-theme-desc {
    font-size: 11px;
    color: var(--text-muted);
}
.system-theme-option.active .system-theme-desc { color: rgba(255,255,255,0.7); }

/* Avatar picker */
.avatar-option {
    width: 48px; height: 48px;
    border-radius: 50%; cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white; font-weight: bold;
}
.avatar-option.active { border-color: var(--blurple); }

/* Avatar thumbnail */
.avatar-thumbnail {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 2px solid var(--bg-accent);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white;
    background-color: var(--blurple);
}
.avatar-thumbnail-pair {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 16px;
}
.avatar-thumbnail-pair span { font-size: 13px; color: var(--text-secondary); margin: 0 4px; }

/* Bubble style picker */
.bubble-style-picker {
    display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap;
}
.bubble-style-option {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid var(--bg-accent);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}
.bubble-style-option.active {
    border-color: var(--blurple);
    background: var(--blurple);
    color: white;
}
.bubble-style-option:hover { border-color: var(--blurple); }

/* File input button */
.file-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--blurple);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.file-btn:hover { background: var(--blurple-hover); }

/* Danger zone */
.danger-zone {
    border: 1px solid var(--red);
    border-radius: var(--radius);
    background: rgba(237,66,69,0.05);
}
.danger-zone .setting-group-title { color: var(--red); }
.danger-btn {
    padding: 8px 16px;
    background: var(--red);
    color: white;
    border: none; border-radius: var(--radius);
    cursor: pointer; font-size: 14px;
    transition: var(--transition);
}
.danger-btn:hover { opacity: 0.85; }

/* Chat bg preview & opacity slider */
.chat-bg-preview {
    width: 100%;
    height: 60px;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    margin-top: 6px;
    border: 2px solid var(--bg-accent);
}

.chat-opacity-slider {
    width: 100%;
    margin-top: 6px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-accent);
    outline: none;
}
.chat-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--blurple);
    cursor: pointer;
}

/* Polaroid date editable */
.polaroid-date {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background 0.2s;
}
.polaroid-date:hover { background: rgba(0,0,0,0.06); }

/* Data stats beautified */
.data-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 16px;
}

.data-stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    transition: var(--transition);
}
.data-stat-card:hover {
    background: var(--bg-hover);
}

.data-stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.data-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.data-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.data-stats-total {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px 14px;
    font-size: 14px;
    color: var(--text-secondary);
}

.data-stats-total strong {
    font-size: 16px;
    color: var(--blurple);
}

/* Emoji card pair display */
.emoji-card-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.emoji-card-pair .emoji-single {
    font-size: 32px;
    line-height: 1;
}

/* CSS textarea */
.css-textarea {
    width: 100%; min-height: 100px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-accent);
    border-radius: var(--radius);
    padding: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
    resize: vertical; outline: none; margin: 8px 0;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 80px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 22px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 2000; opacity: 0;
    transition: 0.3s ease;
    pointer-events: none; white-space: nowrap;
    max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.5); }

/* ===== Responsive ===== */
@media (max-width: 480px) {
    /* --- Home Page --- */
    .home-content {
        padding: 20px 12px calc(var(--nav-height) + 8px);
        gap: 8px;
        align-items: stretch;
    }
    .home-top-row {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        align-items: stretch;
    }
    .home-bottom-row {
        max-width: 100%;
        width: 100%;
        gap: 8px;
        align-items: stretch;
    }
    .home-right-col {
        flex: 1;
        flex-direction: row;
    }
    .profile-card {
        flex: 1;
        max-width: 100%;
    }
    .profile-avatar {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    .profile-avatar-wrap {
        margin-top: -26px;
    }
    .profile-nickname {
        font-size: 15px;
    }
    .status-section, .countdown-card {
        flex: 1;
    }
    .countdown-number {
        font-size: 22px;
    }
    /* Music player - 30% width alongside photo wall */
    .music-player {
        flex: 3;
        width: auto;
        flex-direction: column;
        gap: 6px;
        padding: 8px;
    }
    .music-disc-wrap {
        width: 56px;
        height: 56px;
    }
    .music-disc {
        width: 56px;
        height: 56px;
    }
    .music-disc-hole {
        width: 12px;
        height: 12px;
    }
    /* Photo wall - smaller polaroids */
    .polaroid img {
        width: 52px;
        height: 52px;
    }
    .polaroid {
        padding: 4px 4px 16px 4px;
    }
    /* Photo wall - 70% width alongside music player */
    .photo-wall {
        flex: 7;
        max-width: none;
        padding: 4px;
    }

    /* --- Cards: Emoji / Status / Gift tabs → 2 columns --- */
    .cards-list.grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px 8px 80px;
    }
    .cards-list.grid-layout .card-item {
        min-height: 90px;
        padding: 14px 8px;
    }

    /* --- Chat Drawer: icon grid → 4 columns (all in one row) --- */
    .drawer-icon-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .drawer-icon-item {
        padding: 12px 4px;
        gap: 4px;
    }
    .drawer-icon {
        font-size: 26px;
    }
    .drawer-icon-label {
        font-size: 10px;
    }

    /* --- Chat Messages --- */
    .msg-content-wrap {
        max-width: 78%;
    }

    /* --- Stats Page --- */
    .stat-card-value {
        font-size: 24px;
    }

    /* --- Chat Input --- */
    .chat-input {
        width: calc(100% - 130px);
    }
}

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

/* Confirm dialog */
.confirm-dialog { text-align: center; }
.confirm-dialog .confirm-text { font-size: 15px; color: var(--text-primary); margin-bottom: 8px; line-height: 1.5; }
.confirm-dialog .confirm-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ===== Number input styling - no stepper buttons ===== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ===== Red Packet (红包) Styles ===== */
.redpacket-send-wrap {
    padding: 8px 0;
}
.redpacket-send-header {
    text-align: center;
    margin-bottom: 16px;
}
.redpacket-send-icon {
    font-size: 48px;
    line-height: 1;
}
.redpacket-send-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.redpacket-send-amount-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}
.redpacket-currency {
    font-size: 20px;
    font-weight: 700;
    color: #e54d42;
}

/* Red packet in chat bubble */
.rp-bubble-wrap {
    width: 220px;
    max-width: 100%;
}
.rp-chat-card {
    background: #e54d42;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(229,77,66,0.3);
}
.rp-chat-card.accepted { background: #3ba55c; box-shadow: 0 2px 8px rgba(59,165,92,0.3); }
.rp-chat-card.rejected { opacity: 0.7; filter: grayscale(0.5); }
.rp-chat-card:hover { transform: translateY(-2px); }
.rp-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
}
.rp-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.rp-card-info {
    flex: 1;
    min-width: 0;
}
.rp-card-amount {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.rp-card-note {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rp-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(0,0,0,0.15);
    font-size: 12px;
    color: rgba(255,255,255,0.9);
}
.rp-card-arrow {
    font-size: 16px;
    opacity: 0.6;
}

/* Red packet modal (WeChat-style) */
.rp-overlay { z-index: 400; }
.rp-modal {
    width: 320px;
    max-width: 92%;
    background: #e54d42;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
.rp-modal-header {
    background: linear-gradient(135deg, #e54d42, #c0392b);
    padding: 24px 20px 16px;
    text-align: center;
}
.rp-modal-icon {
    font-size: 56px;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.rp-modal-body {
    background: #fff;
    padding: 20px;
    text-align: center;
}
.rp-modal-sender {
    font-size: 14px;
    color: #888;
    margin-bottom: 8px;
}
.rp-modal-amount {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.rp-modal-amount .rp-amount-num {
    font-size: 36px;
}
.rp-modal-note {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}
.rp-modal-status {
    font-size: 13px;
    color: #999;
    padding-top: 8px;
    border-top: 1px solid #eee;
}
.rp-modal-actions {
    background: #fff;
    padding: 0 20px 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}
.rp-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.rp-btn-accept { background: #e54d42; color: white; }
.rp-btn-accept:hover { background: #c0392b; }
.rp-btn-reject { background: #f0f0f0; color: #666; }
.rp-btn-reject:hover { background: #e0e0e0; }
.rp-btn-close { background: #e54d42; color: white; }
.rp-btn-close:hover { background: #c0392b; }

/* ===== Gift Card Styles ===== */
.gift-send-wrap {
    padding: 8px 0;
}
.gift-send-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}
.gift-pick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}
.gift-pick-item:hover { background: var(--bg-hover); }
.gift-pick-item.selected { border-color: var(--blurple); background: var(--bg-hover); }
.gift-pick-emoji {
    font-size: 32px;
    line-height: 1;
}
.gift-pick-name {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.gift-pick-custom {
    border-style: dashed !important;
    opacity: 0.8;
}
.gift-pick-custom .gift-pick-emoji {
    font-size: 24px;
    color: var(--text-muted);
}
.gift-custom-fields {
    padding: 4px 0;
}

/* Gift in chat bubble */
.gift-bubble-wrap {
    width: 220px;
    max-width: 100%;
}
.gift-chat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-accent);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.gift-chat-card.accepted { border-color: var(--green); }
.gift-chat-card.rejected { opacity: 0.7; }
.gift-chat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gift-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
}
.gift-card-emoji-lg {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}
.gift-card-info {
    flex: 1;
    min-width: 0;
}
.gift-card-title {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.3;
    font-weight: 600;
}
.gift-card-note-line {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gift-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-secondary);
}
.gift-card-arrow {
    font-size: 16px;
    opacity: 0.4;
}

/* Gift detail modal */
.gift-overlay { z-index: 400; }
.gift-modal {
    width: 320px;
    max-width: 92%;
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
.gift-modal-header {
    background: linear-gradient(135deg, var(--blurple), var(--blurple-hover));
    padding: 28px 20px 20px;
    text-align: center;
}
.gift-modal-emoji {
    font-size: 56px;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.gift-modal-body {
    padding: 20px;
    text-align: center;
}
.gift-modal-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.gift-modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}
.gift-modal-note {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
}
.gift-modal-sender {
    font-size: 13px;
    color: var(--text-muted);
}
.gift-modal-status {
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid var(--bg-accent);
    margin-top: 8px;
}
.gift-modal-actions {
    padding: 0 20px 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}
.gift-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.gift-btn-accept { background: var(--blurple); color: white; }
.gift-btn-accept:hover { background: var(--blurple-hover); }
.gift-btn-reject { background: var(--bg-accent); color: var(--text-primary); }
.gift-btn-reject:hover { background: var(--bg-hover); }
.gift-btn-close { background: var(--blurple); color: white; }
.gift-btn-close:hover { background: var(--blurple-hover); }

/* Gift card in card library */
.gift-card-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.gift-card-emoji {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}
.gift-card-info {
    flex: 1;
    min-width: 0;
}
.gift-card-name {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gift-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Call Summary Bubble ===== */
.call-summary-bubble {
    font-size: 14px !important;
    line-height: 1.4;
    opacity: 0.9;
}

/* ===== Video Call Fullscreen ===== */
.call-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.call-full-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
}
.call-full-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.call-full-top {
    position: absolute;
    top: 20px;
    left: 20px;
}
.call-minimize-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}
.call-minimize-btn:hover { background: rgba(255,255,255,0.25); }
.call-full-header {
    text-align: center;
    margin-top: 40px;
}
.call-full-header span:first-child {
    display: block;
    font-size: 22px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.call-full-type {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-top: 6px;
}
.call-full-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 20px 0;
}
.call-full-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--blurple);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    position: relative;
    z-index: 2;
    border: 4px solid rgba(255,255,255,0.2);
}
.call-ripple {
    position: absolute;
    top: 50%; left: 50%;
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    animation: callRipple 2s infinite;
    z-index: 1;
}
.call-ripple::before, .call-ripple::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    animation: callRipple 2s infinite;
}
.call-ripple::after { animation-delay: 0.6s; }
.call-ripple::before { animation-delay: 1.2s; }
@keyframes callRipple {
    0% { width: 100px; height: 100px; opacity: 0.8; }
    100% { width: 240px; height: 240px; opacity: 0; }
}
.call-full-timer {
    font-size: 28px;
    font-weight: 300;
    color: white;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.call-full-actions {
    display: flex;
    gap: 28px;
    margin-top: 24px;
    align-items: center;
}
.call-action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}
.call-action-btn svg { fill: white; }
.call-mic-btn {
    background: rgba(255,255,255,0.15);
    color: white;
}
.call-mic-btn:hover, .call-mic-btn.active { background: rgba(255,255,255,0.3); }
.call-camera-btn {
    background: rgba(255,255,255,0.15);
    color: white;
}
.call-camera-btn:hover, .call-camera-btn.active { background: rgba(255,255,255,0.3); }
.call-camera-btn svg { fill: none; stroke: white; }
.call-end {
    background: var(--red);
    width: 68px;
    height: 68px;
}
.call-end:hover { opacity: 0.85; transform: scale(1.05); }
.call-end svg { fill: white !important; }
.call-accept-btn {
    background: var(--green);
    width: 68px;
    height: 68px;
}
.call-accept-btn:hover { opacity: 0.85; transform: scale(1.05); }
.call-accept-btn svg { fill: white !important; }

/* Call float ball (draggable) */
.call-float {
    position: fixed;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.call-float-ball {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--blurple);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 4px 16px rgba(88,101,242,0.5);
    animation: callPulse 2s infinite;
}
.call-float-ball:active { cursor: grabbing; }
.call-float-ball span { font-size: 24px; }
@keyframes callPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(88,101,242,0.5); }
    50% { box-shadow: 0 4px 24px rgba(88,101,242,0.8); }
}
.call-float-timer {
    font-size: 11px;
    color: white;
    font-weight: 600;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ===== Chat Background Live Preview ===== */
.chat-bg-live-preview {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--bg-accent);
    background: var(--bg-primary);
}
.chat-bg-preview-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    transition: opacity 0.2s;
}
.chat-bg-preview-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
}
.chat-bg-preview-bubble {
    max-width: 60%;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.3;
}
.chat-bg-preview-bubble.other {
    background: var(--bubble-other);
    color: var(--text-primary);
    align-self: flex-start;
    border-top-left-radius: 4px;
}
.chat-bg-preview-bubble.me {
    background: var(--bubble-me);
    color: white;
    align-self: flex-end;
    border-top-right-radius: 4px;
}

/* ===== Reject Notice (centered) ===== */
.msg-reject-notice-row {
    display: flex !important;
    justify-content: center;
    padding: 6px 16px;
}
.reject-notice {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
    border: 1px solid rgba(220, 38, 38, 0.2);
}
