  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  :root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --bg-text: #1e293b;
    --muted: #64748b;
    --radius: 18px;
  }
  html, body { height: 100%; }
  body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #0f172a;
    color: var(--bg-text);
    overflow: hidden;
  }
  /* ===== 背景动画 ===== */
  .bg-wrap {
    position: fixed; inset: 0; z-index: -1;
    background: linear-gradient(135deg, #eef2ff 0%, #ecfeff 50%, #f0f9ff 100%);
    overflow: hidden;
  }
  .blob {
    position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
    animation: float 14s ease-in-out infinite alternate;
  }
  .blob1 { width: 420px; height: 420px; background: #a5b4fc; top: -120px; left: -100px; }
  .blob2 { width: 380px; height: 380px; background: #67e8f9; bottom: -100px; right: -80px; animation-delay: -5s; }
  .blob3 { width: 260px; height: 260px; background: #f0abfc; top: 40%; left: 60%; opacity: .35; animation-delay: -9s; }
  @keyframes float {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(50px, 40px) scale(1.12); }
  }

  .screen { display: none; height: 100dvh; width: 100%; }
  .screen.active { display: flex; }

  /* ===== 主页 ===== */
  #homeScreen { align-items: center; justify-content: center; flex-direction: column; padding: 24px; }
  .home-card {
    width: 100%; max-width: 400px;
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 28px;
    padding: 44px 32px;
    box-shadow: 0 24px 60px rgba(79,70,229,.15);
    text-align: center;
    animation: cardIn .6s cubic-bezier(.2,.9,.3,1.2);
    position: relative;
  }
  @keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }
  .logo {
    width: 84px; height: 84px; margin: 0 auto 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 12px 30px rgba(99,102,241,.4);
    animation: pulse 3s ease-in-out infinite;
  }
  @keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.05);} }
  .logo svg { width: 44px; height: 44px; }
  .home-card h1 { font-size: 26px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
  .home-card p.desc { font-size: 14px; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }
  .btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 16px 20px;
    border: none; border-radius: 16px;
    font-size: 16px; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: all .25s ease;
    user-select: none;
  }
  .btn svg { width: 22px; height: 22px; flex-shrink: 0; }
  .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 10px 24px rgba(99,102,241,.35);
  }
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(99,102,241,.45); }
  .btn-primary:active { transform: translateY(0) scale(.98); }
  .btn-ghost {
    background: rgba(255,255,255,.8);
    color: var(--primary-dark);
    border: 2px solid #c7d2fe;
    margin-top: 14px;
  }
  .btn-ghost:hover { background: #eef2ff; border-color: var(--primary); transform: translateY(-2px); }
  .btn-ghost:active { transform: scale(.98); }
  .btn-scan {
    background: #ecfeff; color: #0891b2;
    border: 2px solid #a5f3fc;
    margin-top: 12px;
  }
  .btn-scan:hover { background: #cffafe; border-color: var(--accent); }
  .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff; box-shadow: 0 8px 20px rgba(239,68,68,.3);
  }
  .btn-danger:hover { transform: translateY(-2px); }
  .home-tip { margin-top: 22px; font-size: 12px; color: #94a3b8; display: flex; align-items: center; justify-content: center; gap: 6px; }

  /* 本机名称胶囊（主页） */
  .name-chip {
    margin-top: 14px;
    display: inline-flex; align-items: center; gap: 8px;
    border: 1.5px dashed #c7d2fe; background: rgba(238,242,255,.7);
    color: var(--primary-dark); font-size: 13px; font-family: inherit; font-weight: 700;
    padding: 8px 16px; border-radius: 999px; cursor: pointer;
    max-width: 100%; transition: all .2s;
  }
  .name-chip:hover { background: #e0e7ff; border-color: var(--primary); }
  .name-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
  .name-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

  /* ===== 弹窗 ===== */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15,23,42,.5); backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center; padding: 24px;
  }
  .modal-overlay.show { display: flex; animation: fadeIn .25s ease; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  .modal {
    width: 100%; max-width: 380px;
    background: #fff; border-radius: 24px; padding: 32px 26px;
    box-shadow: 0 30px 80px rgba(0,0,0,.3);
    animation: modalIn .35s cubic-bezier(.2,.9,.3,1.2);
  }
  @keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
  .modal h2 { font-size: 20px; text-align: center; margin-bottom: 6px; color: #0f172a; }
  .modal .sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 22px; line-height: 1.6; }
  .code-input {
    width: 100%; padding: 6px 9px;
    font-size: 24px; font-weight: 700; letter-spacing: 6px; text-align: center;
    font-family: inherit; color: var(--primary-dark);
    border: 2px solid #e2e8f0; border-radius: 14px; outline: none;
    transition: border-color .2s, box-shadow .2s;
    background: #f8fafc; text-transform: uppercase;
  }
  .code-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.15); background:#fff; }
  .code-input::placeholder { letter-spacing: 2px; font-size: 14px; font-weight: 400; color: #cbd5e1; text-transform: none; }
  .name-input {
    width: 100%; padding: 14px 16px;
    font-size: 16px; font-weight: 700; text-align: center;
    font-family: inherit; color: var(--primary-dark);
    border: 2px solid #e2e8f0; border-radius: 14px; outline: none;
    transition: border-color .2s, box-shadow .2s;
    background: #f8fafc;
  }
  .name-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.15); background:#fff; }
  .modal-actions { display: flex; gap: 12px; margin-top: 22px; }
  .modal-actions .btn { padding: 13px; font-size: 15px; }
  .modal-actions .btn-ghost { margin-top: 0; }
  .btn-cancel { background: #f1f5f9; color: var(--muted); }
  .btn-cancel:hover { background: #e2e8f0; }
  .charset-hint { margin-top: 10px; font-size: 11px; color: #94a3b8; text-align: center; }
  .divider-or {
    display: flex; align-items: center; gap: 10px;
    margin-top: 16px; color: #cbd5e1; font-size: 12px;
  }
  .divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

  /* 二维码弹窗 */
  .qr-box { display: flex; justify-content: center; padding: 6px 0 4px; }
  .qr-box svg, .qr-box img { width: 220px; height: 220px; }
  .qr-code-text { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
  .qr-code-text b { font-size: 20px; letter-spacing: 4px; color: var(--primary-dark); margin-left: 4px; }

  /* 邀请弹窗（二维码 + 连接地址） */
  .invite-link-box {
    margin-top: 16px;
    background: #f8fafc;
    border: 1.5px dashed #c7d2fe;
    border-radius: 14px;
    padding: 10px 12px;
  }
  .invite-link-label { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }
  .invite-link {
    font-size: 12px;
    color: var(--primary-dark);
    word-break: break-all;
    line-height: 1.5;
    user-select: all;
    cursor: pointer;
  }

  /* ===== 扫一扫全屏界面 ===== */
  #scanScreen {
    position: fixed; inset: 0; z-index: 300;
    background: #0f172a;
    display: none; align-items: center; justify-content: center;
    overflow: hidden;
  }
  #scanScreen.show { display: flex; }
  #scanVideo {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; background: #000;
  }
  .scan-frame {
    position: relative; z-index: 2;
    width: min(250px, 68vw); height: min(250px, 68vw);
    border: 2px solid rgba(34,211,238,.9); border-radius: 18px;
    box-shadow: 0 0 0 9999px rgba(10,15,30,.55);
    overflow: hidden;
  }
  .scan-line {
    position: absolute; left: 10px; right: 10px; top: 10px;
    height: 3px; border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: scanmove 2.2s ease-in-out infinite;
  }
  @keyframes scanmove {
    0% { top: 10px; } 50% { top: calc(100% - 14px); } 100% { top: 10px; }
  }
  .scan-hint {
    position: absolute; z-index: 3;
    top: calc(50% + min(160px, 42vw));
    left: 0; right: 0; padding: 0 32px;
    color: #e2e8f0; font-size: 14px; text-align: center; line-height: 1.7;
  }
  .scan-title {
    position: absolute; z-index: 3; top: calc(20px + env(safe-area-inset-top));
    left: 0; right: 0; text-align: center;
    color: #fff; font-size: 17px; font-weight: 700;
  }
  .scan-close {
    position: absolute; z-index: 3;
    bottom: calc(36px + env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,.16); color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    padding: 12px 44px; border-radius: 999px;
    font-size: 15px; font-weight: 700; font-family: inherit;
    cursor: pointer; backdrop-filter: blur(8px);
    transition: background .2s;
  }
  .scan-close:hover { background: rgba(255,255,255,.28); }

  /* ===== 聊天界面 ===== */
  #chatScreen { flex-direction: column; }
  .chat-header {
    flex-shrink: 0;
    display: flex; align-items: center; gap: 11px;
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(226,232,240,.8);
    z-index: 10;
  }
  .avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700; color: #fff;
    background: #cbd5e1; transition: background .3s;
    overflow: hidden;
  }
  .avatar.known { background: linear-gradient(135deg, #f59e0b, #f97316); }
  .me-avatar {
    border: none; cursor: pointer; font-family: inherit;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    transition: transform .2s;
    padding: 0;
  }
  .me-avatar:hover { transform: scale(1.08); }
  .header-info { flex: 1; min-width: 0; }
  .header-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
  .peer-name {
    font-size: 16px; font-weight: 700; color: #0f172a;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .status-line { display: flex; align-items: center; gap: 5px; margin-top: 3px; min-width: 0; }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; transition: background .3s; flex-shrink: 0; }
  .status-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); animation: breathe 2s infinite; }
  .status-dot.offline { background: #ef4444; animation: none; box-shadow:none; }
  @keyframes breathe { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
  .status-text { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dot-sep { color: #cbd5e1; font-size: 12px; flex-shrink: 0; }
  .room-inline { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
  .room-inline b { color: var(--primary-dark); letter-spacing: 1px; font-size: 12.5px; }
  .copy-btn {
    border: none; background: #eef2ff; color: var(--primary-dark);
    width: 22px; height: 22px; border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; flex-shrink: 0; padding: 0;
  }
  .copy-btn:hover { background: #e0e7ff; transform: scale(1.1); }
  .copy-btn svg { width: 12px; height: 12px; }
  .exit-btn {
    border: none; background: #fee2e2; color: #dc2626;
    padding: 9px 13px; border-radius: 12px; font-size: 13px; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: all .2s; flex-shrink: 0;
  }
  .exit-btn:hover { background: #fecaca; }

  .chat-body {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 20px 16px;
    display: flex; flex-direction: column; gap: 14px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  .chat-body::-webkit-scrollbar { width: 5px; }
  .chat-body::-webkit-scrollbar-thumb { background: rgba(148,163,184,.4); border-radius: 3px; }

  .sys-msg {
    align-self: center; max-width: 82%;
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(226,232,240,.9);
    color: var(--muted); font-size: 12px;
    padding: 6px 14px; border-radius: 999px; text-align: center;
    backdrop-filter: blur(8px);
    animation: msgIn .3s ease;
  }
  @keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  .msg-row { display: flex; width: 100%; animation: msgIn .3s ease; }
  .msg-row.mine { justify-content: flex-end; }
  .msg-row.theirs { justify-content: flex-start; }
  .msg-col { display: flex; flex-direction: column; gap: 4px; max-width: min(80%, 500px); min-width: 0; }
  .mine .msg-col { align-items: flex-end; }
  .theirs .msg-col { align-items: flex-start; }
  .msg-sender {
    font-size: 12px; color: var(--muted); font-weight: 700;
    padding-left: 4px; max-width: 220px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .bubble {
    max-width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 15px; line-height: 1.55;
    word-break: break-word; white-space: pre-wrap;
    box-shadow: 0 4px 14px rgba(15,23,42,.08);
  }
  .mine .bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; border-bottom-right-radius: 6px;
  }
  .theirs .bubble {
    background: #fff; color: var(--bg-text); border-bottom-left-radius: 6px;
    border: 1px solid rgba(226,232,240,.9);
  }

  /* 文件气泡 */
  .file-card { display: flex; flex-direction: column; gap: 10px; min-width: 230px; max-width: min(80vw, 340px); }
  .file-top { display: flex; align-items: center; gap: 12px; }
  .file-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.22);
  }
  .theirs .file-icon { background: #eef2ff; }
  .file-icon svg { width: 24px; height: 24px; }
  .mine .file-icon svg { color: #fff; }
  .theirs .file-icon svg { color: var(--primary); }
  .file-meta { min-width: 0; flex: 1; }
  .file-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-size { font-size: 12px; opacity: .75; margin-top: 2px; }
  .progress-track { height: 6px; border-radius: 3px; overflow: hidden; background: rgba(148,163,184,.25); }
  .mine .progress-track { background: rgba(255,255,255,.28); }
  .progress-fill {
    height: 100%; width: 0%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #a5f3fc);
    transition: width .2s ease;
  }
  .theirs .progress-fill { background: linear-gradient(90deg, var(--primary), var(--accent)); }
  .file-status { font-size: 12px; opacity: .85; display: flex; justify-content: space-between; gap: 8px; }
  .dl-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 14px; border-radius: 11px; border: none;
    font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; text-decoration: none;
    transition: transform .2s, box-shadow .2s;
  }
  .dl-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,.4); }
  .dl-btn:disabled { opacity: .62; cursor: default; transform: none; box-shadow: none; }
  .save-tip { margin-top: 6px; font-size: 11px; opacity: .7; text-align: center; line-height: 1.5; }
  .diag-copy {
    margin-top: 10px; align-self: center;
    padding: 8px 16px; border-radius: 999px;
    border: 1.5px solid #c7d2fe; background: #eef2ff; color: #4f46e5;
    font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer;
  }
  .diag-report {
    align-self: center; max-width: 92%;
    white-space: pre-wrap; word-break: break-all;
    font-size: 11px; line-height: 1.55; text-align: left;
    background: #f8fafc; border: 1px solid #e2e8f0; color: #475569;
    padding: 10px 12px; border-radius: 12px;
  }
  .save-area { display: flex; flex-direction: column; gap: 8px; }
  .part-list {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px 12px; border-radius: 12px;
    background: rgba(99,102,241,.08); border: 1px dashed #c7d2fe;
  }
  .part-head { width: 100%; font-size: 12px; font-weight: 700; color: var(--primary-dark); line-height: 1.5; }
  .part-item {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 12px; border-radius: 10px; border: 1.5px solid #c7d2fe;
    background: #fff; color: var(--primary-dark);
    font-size: 13px; font-weight: 700; font-family: inherit;
    text-decoration: none; cursor: pointer; transition: all .2s;
  }
  .part-item:active { transform: scale(.96); }
  .part-item.done { opacity: .5; }
  .part-merge { width: 100%; font-size: 11px; color: var(--muted); line-height: 1.6; word-break: break-all; }
  .part-size-row { width: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .part-size-label { font-size: 11px; color: var(--muted); }
  .part-size-opt {
    padding: 4px 12px; border-radius: 999px; border: 1.5px solid #c7d2fe;
    background: #fff; color: var(--primary-dark); font-size: 11px; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: all .15s;
  }
  .part-size-opt.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .part-diag { width: 100%; font-size: 10px; color: #94a3b8; line-height: 1.6; word-break: break-all; }
  .dl-btn svg { width: 15px; height: 15px; }
  .img-preview {
    max-width: 100%; max-height: 200px; border-radius: 10px; display: block;
    cursor: pointer; object-fit: cover;
  }

  /* 图片全屏查看器：点空白/×/ESC 返回聊天（替代新标签页，免去关标签再切回） */
  .img-viewer {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(2,6,23,.94); backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
  }
  .img-viewer.show { display: flex; animation: fadeIn .25s ease; }
  .img-viewer img {
    max-width: 100vw; max-height: 100vh; object-fit: contain;
    cursor: zoom-out;
    user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  }
  .img-viewer-close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
    width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.32); border-radius: 50%;
    background: rgba(2,6,23,.62); color: #fff; /* 深色底：白色图片上也能看见（原白圈白字在浅色图上隐形） */
    font-size: 20px; line-height: 1; cursor: pointer; transition: background .2s;
  }
  .img-viewer-close:hover { background: rgba(2,6,23,.88); }
  .img-viewer-back {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    padding: 11px 30px; border: 1px solid rgba(255,255,255,.32); border-radius: 999px;
    background: rgba(2,6,23,.66); color: #fff;
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background .2s;
  }
  .img-viewer-back:hover { background: rgba(2,6,23,.88); }

  /* 输入区 */
  .chat-input-bar {
    flex-shrink: 0;
    display: flex; align-items: flex-end; gap: 10px;
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226,232,240,.8);
  }
  .icon-btn {
    width: 46px; height: 46px; border-radius: 14px; border: none; flex-shrink: 0;
    background: #eef2ff; color: var(--primary-dark); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; font-family: inherit;
  }
  .icon-btn:hover:not(:disabled) { background: #e0e7ff; transform: translateY(-2px); }
  .icon-btn:disabled { opacity: .4; cursor: not-allowed; }
  .icon-btn svg { width: 22px; height: 22px; }
  .text-input {
    flex: 1; min-width: 0;
    padding: 12px 16px;
    border: 2px solid #e2e8f0; border-radius: 14px;
    font-size: 15px; font-family: inherit; outline: none;
    background: #f8fafc; resize: none;
    max-height: 110px; line-height: 1.45;
    transition: border-color .2s, box-shadow .2s;
  }
  .text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.12); background: #fff; }
  .text-input:disabled { opacity: .5; }
  .send-btn {
    width: 46px; height: 46px; border-radius: 14px; border: none; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
    box-shadow: 0 6px 16px rgba(99,102,241,.35);
  }
  .send-btn:hover:not(:disabled) { transform: translateY(-2px); }
  .send-btn:active:not(:disabled) { transform: scale(.94); }
  .send-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
  .send-btn svg { width: 20px; height: 20px; }

  /* ===== Toast ===== */
  #toast {
    position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
    background: rgba(15,23,42,.92); color: #fff;
    padding: 11px 22px; border-radius: 999px; font-size: 14px;
    z-index: 999; opacity: 0; pointer-events: none;
    transition: all .3s ease; max-width: 86vw; text-align: center;
    backdrop-filter: blur(8px);
  }
  #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  @media (max-width: 480px) {
    .home-card { padding: 38px 20px; border-radius: 24px; }
    .bubble { max-width: 100%; }
    .file-card { min-width: 200px; }
    .msg-col { max-width: 86%; }
    .exit-btn { padding: 9px 10px; font-size: 12px; }
    .chat-header { gap: 8px; }
  }
  @media (min-width: 768px) {
    .chat-body { padding: 26px max(24px, calc((100% - 760px) / 2)); }
  } 