:root{
  /* Borrowed vibe (from your theme), simplified */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.10);
  --primary-color: #3b82f6;
  --accent-color: #e11d48;

  /* Chat page palette */
  --text:#eef2ff;
  --muted:rgba(255,255,255,.62);
  --danger:#ff4d6d;

  --shadow: 0 22px 70px rgba(0,0,0,.55);
  --radius: 22px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  width:100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;

  /* Dynamic gradient background (borrowed from your theme) */
  background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #020617);
  background-size: 400% 400%;
  animation: dynamicBG 20s ease infinite;
}

@keyframes dynamicBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Subtle grid mask (lightweight, chat-only) */
.bg{
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px) 0 0/34px 34px,
    linear-gradient(0deg, rgba(255,255,255,.04) 1px, transparent 1px) 0 0/34px 34px;
  mask-image: radial-gradient(520px 420px at 60% 24%, black, transparent 72%);
  opacity:.45;
}

.app{
  width:min(980px, 92vw);
  height:min(86vh, 860px);
  margin:6vh auto;
  display:flex;
  flex-direction:column;
  border-radius: var(--radius);
  overflow:hidden;

  /* Glass card */
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: 1px solid rgba(255,255,255,.18);
  border-left: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);

  /* Motion */
  transition: transform .22s cubic-bezier(.2,.8,.2,1),
              box-shadow .22s cubic-bezier(.2,.8,.2,1),
              border-color .22s ease,
              background .22s ease;
  will-change: transform, box-shadow;
  position: relative;
}

/* Sweep highlight (borrowed from your bento-card style) */
.app::after{
  content:"";
  position:absolute;
  inset:0;
  left:-140%;
  width:46%;
  height:100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.14), transparent);
  transform: skewX(-25deg);
  pointer-events:none;
  z-index: 2;
  opacity: .9;
}

.app:hover{
  transform: translateY(-3px);
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
  border-color: rgba(255,255,255,.16);
}

.app:hover::after{
  left: 210%;
  transition: left .65s ease-in-out;
}

@media (prefers-reduced-motion: reduce){
  .app, .app:hover{ transform:none; }
  .app::after{ display:none; }
  body{ animation:none; }
}

.header{
  padding:18px 20px;
  border-bottom:1px solid rgba(255,255,255,.10);
}

.brand{ display:flex; align-items:center; gap:14px; }
.logo{
  width:38px; height:38px; border-radius:14px;
  background:
    radial-gradient(12px 12px at 30% 30%, rgba(255,255,255,.65), transparent 60%),
    linear-gradient(135deg, rgba(109,40,217,1), rgba(59,130,246,1));
  box-shadow: 0 14px 40px rgba(109,40,217,.25);
}
.titles h1{ margin:0; font-size:18px; letter-spacing:.6px; }
.subtitle{ margin:2px 0 0; color:var(--muted); font-size:12px; }

.chat{ flex:1; overflow:auto; padding:18px 18px 8px; }
.messages{ display:flex; flex-direction:column; gap:12px; }

.msg{
  display:flex;
  align-items:flex-end;
  gap:10px;
  animation: pop .18s ease-out;
}
@keyframes pop{ from{ transform:translateY(6px); opacity:0;} to{ transform:translateY(0); opacity:1;} }

.bubble{
  max-width: 78%;
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  line-height:1.65;
  white-space:pre-wrap;
  word-break:break-word;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

/* DeepSeek 回复排版优化 */
.bubble .line{
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin: 6px 0;
}
.bubble .ln{
  flex:0 0 auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.72);
  font-variant-numeric: tabular-nums;
}
.bubble .bullet{
  flex:0 0 auto;
  width: 18px;
  height: 18px;
  display:grid;
  place-items:center;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.80);
  margin-top: 2px;
}
.bubble .lt{ flex: 1 1 auto; min-width: 0; }

.bubble pre.code{
  margin: 10px 0;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(2,6,23,.40);
  border: 1px solid rgba(255,255,255,.10);
  overflow:auto;
}
.bubble pre.code code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255,255,255,.92);
  white-space: pre;
}
.bubble code.inlineCode{
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(2,6,23,.34);
  border: 1px solid rgba(255,255,255,.10);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .92em;
}

/* [思考中] 气泡 */
.msg.ai[data-pending="1"] .bubble{
  display:flex;
  align-items:center;
  gap:10px;
  width: 240px;
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(2,6,23,.30);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 14px 40px rgba(0,0,0,.24);
}
.pendingLabel{
  color: rgba(255,255,255,.76);
  font-size: 12px;
  letter-spacing: .3px;
  margin: 0;
  white-space: nowrap;
}
.pendingDots{
  margin-left:auto;
  display:inline-flex;
  gap:5px;
}
.pendingDots span{
  width:7px; height:7px; border-radius:99px;
  background: rgba(255,255,255,.62);
  animation: bounce 1s infinite ease-in-out;
}
.pendingDots span:nth-child(2){ animation-delay: .15s; }
.pendingDots span:nth-child(3){ animation-delay: .3s; }

.msg.ai{ justify-content:flex-start; }
.msg.ai .bubble{
  background: rgba(255,255,255,.07);
}

.msg.user{ justify-content:flex-end; }
.msg.user .bubble{
  background: linear-gradient(135deg, rgba(109,40,217,.92), rgba(59,130,246,.86));
  border-color: rgba(147,197,253,.22);
}

.composer{
  padding:14px;
  border-top:1px solid rgba(255,255,255,.10);
  background: rgba(2,6,23,.18);
}

.inputWrap{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

.input{
  flex:1;
  resize:none;
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(2,6,23,.20);
  color:var(--text);
  outline:none;
  scrollbar-width: none; /* Firefox */
}
.input::-webkit-scrollbar{ width: 0; height: 0; }
.input:focus{
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 0 0 4px rgba(59,130,246,.18);
}

.send{
  padding:11px 16px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(109,40,217,.95), rgba(59,130,246,.90));
  color:#fff;
  font-weight:700;
  cursor:pointer;
  transition: transform .08s ease, filter .2s ease;
}
.send:hover{ filter:brightness(1.05); }
.send:active{ transform: translateY(1px); }
.send:disabled{ opacity:.55; cursor:not-allowed; }

.status{
  min-height: 18px;
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

.status.error{ color: var(--danger); }

.thinking{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.dots{ display:inline-flex; gap:4px; }
.dots span{
  width:6px; height:6px; border-radius:99px;
  background: rgba(255,255,255,.78);
  animation: bounce 1s infinite ease-in-out;
}
.dots span:nth-child(2){ animation-delay: .15s; }
.dots span:nth-child(3){ animation-delay: .3s; }
@keyframes bounce{ 0%,100%{ transform:translateY(0); opacity:.55;} 50%{ transform:translateY(-4px); opacity:1;} }

@media (max-width: 520px){
  .app{ height: 92vh; margin:4vh auto; }
  .bubble{ max-width: 88%; }
}
