:root{
  --bg: #0b0f14;
  --panel: #0f1620;
  --panel2: #0c121b;
  --line: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.60);
  --muted2: rgba(255,255,255,0.45);
  --accent: #7aa2f7;
  --accent2: #64d2ff;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft Yahei", Arial, sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background: url('/bg.jpg') no-repeat center center fixed;
  background-size: cover;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 20, 0.75); /* Dark overlay to keep text readable */
  z-index: -1;
}

a{color: var(--accent)}

.app{
  height:100%;
  display:flex;
}

.sidebar{
  width: 320px;
  min-width: 280px;
  max-width: 380px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  display:flex;
  flex-direction: column;
}

.sidebar__header{
  padding: 18px 16px 14px;
  display:flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.brand{
  display:flex;
  gap: 10px;
  align-items:center;
}
.brand__dot{
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 20px rgba(122,162,247,0.35);
}
.brand__title{
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand__subtitle{
  color: var(--muted2);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar__list{
  padding: 10px;
  overflow:auto;
  flex:1;
}

.chatItem{
  padding: 12px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.chatItem:hover{background: rgba(255,255,255,0.04)}
.chatItem.active{
  background: rgba(122,162,247,0.10);
  border-color: rgba(122,162,247,0.22);
}
.chatItem__title{font-size: 14px; line-height: 1.2}
.chatItem__meta{font-size: 12px; color: var(--muted2)}

.sidebar__footer{
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content: space-between;
}

.main{flex:1; display:flex; flex-direction: column; min-width: 0;}

.topbar{
  display: none !important;
}

.composer__hint {
  display: none !important;
}
.topbar__title{
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}
.topbar__actions { display: none !important; }

.messages{
  flex:1;
  overflow:auto;
  padding: 10px 18px 10px;
}

.msg{
  display:flex;
  margin: 12px 0;
}
.msg.user{justify-content: flex-end;}
.msg.assistant{justify-content: flex-start;}

.msg__bubble{
  max-width: min(720px, 92%);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user .msg__bubble{
  background: linear-gradient(180deg, rgba(122,162,247,0.22), rgba(122,162,247,0.10));
  border-color: rgba(122,162,247,0.28);
}
.msg.assistant .msg__bubble{
  background: rgba(255,255,255,0.04);
}

.dots{letter-spacing: 2px; color: var(--muted)}

/* markdown tweaks */
.msg__bubble p{margin: 0.55em 0}
.msg__bubble p:first-child{margin-top: 0}
.msg__bubble p:last-child{margin-bottom: 0}
.msg__bubble code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.95em; background: rgba(255,255,255,0.1); padding: 2px 4px; border-radius: 4px;}
.msg__bubble pre{position: relative; padding: 12px; border-radius: 12px; background: rgba(0,0,0,0.35); overflow:auto; border: 1px solid rgba(255,255,255,0.10); margin: 12px 0;}
.msg__bubble pre code{white-space: pre; background: transparent; padding: 0;}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}
.msg__bubble pre:hover .copy-btn {
  opacity: 1;
}
.copy-btn:hover {
  background: rgba(255,255,255,0.2);
  color: var(--text);
}
.copy-btn.copied {
  color: var(--accent2);
}
.msg__bubble blockquote{margin: 0.7em 0; padding-left: 12px; border-left: 3px solid rgba(255,255,255,0.18); color: var(--muted)}
.msg__bubble ul{margin: 0.5em 0 0.5em 1.2em}
.msg__bubble ol{margin: 0.5em 0 0.5em 1.2em}

.composer{
  padding: 12px 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.10);
}

.composer__inner{
  display:flex;
  gap: 10px;
  align-items: flex-end;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 10px 10px 12px;
}

textarea{
  flex:1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  max-height: 180px;
}

.composer__hint{padding: 8px 6px 0; color: var(--muted2)}

.btn{
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  display:inline-flex;
  gap: 8px;
  align-items:center;
  justify-content:center;
}
.btn:hover{background: rgba(255,255,255,0.07)}

.btn--primary{
  background: linear-gradient(135deg, rgba(122,162,247,0.32), rgba(100,210,255,0.18));
  border-color: rgba(122,162,247,0.30);
}

.btn--send{
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(122,162,247,0.42), rgba(100,210,255,0.22));
  border-color: rgba(122,162,247,0.35);
  font-weight: 600;
}

.btn--ghost{
  background: transparent;
  border-color: rgba(255,255,255,0.10);
}

.iconBtn{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor:pointer;
}
.iconBtn:hover{background: rgba(255,255,255,0.07)}

.tiny{font-size: 12px; color: var(--muted2)}

.mobileOnly{display:none}

@media (max-width: 860px){
  .sidebar{display:none;} 
  .mobileOnly{display:none}
  .messages{padding: 18px 12px 8px}
}

.sidebar { display: none !important; }
.mobileOnly { display: none !important; }

/* small helpers */
.loadingDots::after{
  content: '…';
  animation: dots 1.2s steps(4,end) infinite;
}
@keyframes dots{
  0%{content: ''}
  25%{content: '.'}
  50%{content: '..'}
  75%{content: '...'}
  100%{content: ''}
}
