*{ box-sizing:border-box; }
[hidden]{ display:none !important; }
:root{
  --bg:#ffffff; --bg-soft:#f7f8fa; --line:#e8e9ee; --text:#1b1c1f; --muted:#8a8f98;
  --brand:#4d6bfe; --brand-soft:#eef2ff; --user-bubble:#eef2ff; --shadow:0 2px 12px rgba(0,0,0,.06);
  --radius:14px; --sidebar-w:248px;
  --panel:#ffffff; --panel-2:#f2f3f5;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#151619; --bg-soft:#1c1d21; --line:#2a2c31; --text:#e8e9ee; --muted:#8b909a;
         --brand:#6f8bff; --brand-soft:#1f2540; --user-bubble:#232a44; --shadow:0 2px 12px rgba(0,0,0,.4);
         --panel:#1a1b1f; --panel-2:#23242a; }
}

html,body{ height:100%; margin:0; }
body{
  background:var(--bg); color:var(--text);
  font:15px/1.7 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
}
.app{ display:flex; height:100vh; overflow:hidden; }

/* 侧栏 */
.sidebar{
  width:var(--sidebar-w); flex:0 0 var(--sidebar-w); background:var(--bg-soft);
  border-right:1px solid var(--line); display:flex; flex-direction:column; padding:14px 12px;
}
.brand{ display:flex; align-items:center; gap:10px; padding:4px 6px 14px; }
.brand-mark{
  width:34px; height:34px; border-radius:10px; background:var(--brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; letter-spacing:.5px;
}
.brand-title{ font-weight:600; font-size:14px; }
.brand-sub{ font-size:11px; color:var(--muted); }
.new-chat{
  width:100%; padding:9px 12px; border-radius:10px; border:1px solid var(--line);
  background:var(--bg); color:var(--text); cursor:pointer; font-size:13.5px; transition:.15s;
}
.new-chat:hover{ border-color:var(--brand); color:var(--brand); }
.chat-list{ flex:1; overflow-y:auto; margin-top:12px; display:flex; flex-direction:column; gap:4px; }
.chat-item{
  display:flex; align-items:center; gap:6px; padding:8px 10px; border-radius:9px; cursor:pointer;
  font-size:13.5px; color:var(--text); opacity:.86;
}
.chat-item:hover{ background:var(--brand-soft); }
.chat-item.active{ background:var(--brand-soft); color:var(--brand); opacity:1; }
.chat-title{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-del{ border:none; background:transparent; color:var(--muted); cursor:pointer; font-size:13px; opacity:0; }
.chat-item:hover .chat-del{ opacity:1; }
.sidebar-foot{ display:flex; align-items:center; gap:7px; font-size:12px; color:var(--muted); padding:10px 6px 2px; border-top:1px solid var(--line); }
.dot{ width:7px; height:7px; border-radius:50%; background:#c9cbd1; }
.dot.ok{ background:#2fbf71; }
.dot.bad{ background:#e2574c; }

/* 主区 */
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar{ height:56px; flex:0 0 56px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; padding:0 22px; }
.model-chip{ display:flex; align-items:center; gap:8px; }
.chip-name{ font-weight:600; font-size:14.5px; }
.chip-tag{ font-size:11px; color:var(--brand); background:var(--brand-soft); padding:2px 7px; border-radius:99px; }
.hint{ font-size:12px; color:var(--muted); }
.messages{ flex:1; overflow-y:auto; padding:26px 22px 8px; }
.messages-inner{ max-width:820px; margin:0 auto; }

.empty{ max-width:820px; margin:12vh auto 0; text-align:center; }
.empty-mark{ width:56px; height:56px; border-radius:16px; background:var(--brand); color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center; margin:0 auto 18px; }
.empty h1{ font-size:20px; font-weight:600; margin:0 0 8px; }
.empty p{ color:var(--muted); margin:0; font-size:14px; }

.msg{ display:flex; gap:12px; margin-bottom:22px; }
.msg .avatar{
  width:30px; height:30px; border-radius:9px; flex:0 0 30px; display:flex; align-items:center; justify-content:center;
  font-size:11.5px; font-weight:700; color:#fff; background:var(--brand); margin-top:2px;
}
.msg.user{ flex-direction:row-reverse; }
.msg.user .avatar{ background:#c2c7d4; color:#fff; }
.avatar{ overflow:hidden; }
.avatar img{ width:100%; height:100%; object-fit:cover; border-radius:9px; display:block; }
.bubble{ max-width:calc(100% - 46px); }
.msg.user .bubble{ background:var(--user-bubble); padding:10px 14px; border-radius:var(--radius); }
.msg.assistant .bubble{ padding:2px 0; }
.bubble p{ margin:0 0 10px; }
.bubble p:last-child{ margin-bottom:0; }
.bubble h3{ font-size:15.5px; margin:16px 0 8px; }
.bubble h2{ font-size:17px; margin:18px 0 8px; }
.bubble ul,.bubble ol{ margin:6px 0 10px; padding-left:22px; }
.bubble li{ margin:3px 0; }
.bubble hr{ border:none; border-top:1px solid var(--line); margin:16px 0; }
.bubble strong{ font-weight:650; }
.bubble blockquote{ margin:10px 0; padding:6px 12px; border-left:3px solid var(--line); color:var(--muted); }

/* 输入区 */
.composer-wrap{ padding:10px 22px 18px; }
.composer{
  max-width:820px; margin:0 auto; display:flex; align-items:flex-end; gap:8px;
  background:var(--bg); border:1px solid var(--line); border-radius:16px; padding:10px 10px 10px 14px;
  box-shadow:var(--shadow); transition:border-color .15s;
}
.composer:focus-within{ border-color:var(--brand); }
#input{
  flex:1; resize:none; border:none; outline:none; background:transparent; color:var(--text);
  font:15px/1.6 inherit; max-height:180px; padding:4px 0;
}
.send{
  width:34px; height:34px; border-radius:10px; border:none; background:var(--brand); color:#fff;
  cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center; transition:.15s;
}
.send:disabled{ background:#c9cbd1; cursor:not-allowed; }
.composer-foot{ max-width:820px; margin:6px auto 0; display:flex; justify-content:space-between; font-size:11.5px; color:var(--muted); }
.typing{ display:inline-flex; gap:4px; align-items:center; }
.typing i{ width:5px; height:5px; border-radius:50%; background:var(--muted); display:inline-block; animation:blink 1.2s infinite; }
.typing i:nth-child(2){ animation-delay:.2s; }
.typing i:nth-child(3){ animation-delay:.4s; }
@keyframes blink{ 0%,80%,100%{opacity:.25} 40%{opacity:1} }

@media (max-width:760px){
  .sidebar{ display:none; }
  .messages,.composer-wrap{ padding-left:14px; padding-right:14px; }
}
.caret{ display:inline-block; width:7px; height:16px; background:var(--brand); vertical-align:-2px; animation:blink 1s infinite; }

.composer-foot .right{ display:flex; gap:12px; align-items:center; }

/* 附件 */
.attach{
  width:32px; height:32px; border-radius:10px; border:1px solid var(--line); background:transparent;
  color:var(--muted); cursor:pointer; font-size:18px; line-height:1; display:flex; align-items:center; justify-content:center;
}
.attach:hover{ border-color:var(--brand); color:var(--brand); }
.chip-bar{
  max-width:820px; margin:0 auto 8px; display:flex; align-items:center; gap:8px;
  font-size:12.5px; color:var(--text); background:var(--brand-soft); border-radius:10px; padding:6px 10px;
}
.chip-file{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chip-clear{ border:none; background:transparent; color:var(--muted); cursor:pointer; font-size:15px; }
.chip-thumb{ width:22px; height:22px; border-radius:5px; object-fit:cover; display:block; }

/* 多附件 chips */
.chip-bar{ flex-wrap:wrap; }
.chip-item{
  display:inline-flex; align-items:center; gap:6px; background:var(--bg); border:1px solid var(--line);
  border-radius:999px; padding:3px 8px 3px 4px; max-width:260px;
}
.chip-item .chip-file{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.msg-img{ max-width:240px; max-height:240px; border-radius:10px; display:block; margin:0 0 8px; box-shadow:var(--shadow); }
.msg.user .bubble .msg-img{ margin-left:auto; }



/* 推理等级滑条 */
.gear{ display:flex; align-items:center; gap:10px; }
.gear-name{
  font-size:12.5px; font-weight:600; padding:3px 10px; border-radius:999px;
  color:#fff; background:var(--gear,#8a8f98); min-width:64px; text-align:center;
  transition:background .2s;
}
.gear-name.rainbow{
  background:linear-gradient(90deg,#ff5f6d,#ffc371,#47d16c,#4d9cff,#a855f7,#ff5f6d);
  background-size:300% 100%;
  animation:rainbowMove 4s linear infinite;
}
@keyframes rainbowMove{ 0%{background-position:0% 50%} 100%{background-position:300% 50%} }
#gear{
  -webkit-appearance:none; appearance:none; width:150px; height:6px; border-radius:999px; outline:none;
  background:linear-gradient(90deg,#2fbf71 0%,#e2574c 14%,#4d6bfe 28%,#8a5cf6 42%,#e0b400 57%,#f0821e 71%,#8a8f98 85%,#ff5f6d 100%);
  cursor:pointer;
}
#gear::-webkit-slider-thumb{
  -webkit-appearance:none; width:16px; height:16px; border-radius:50%;
  background:var(--gear,#8a8f98); border:2px solid #fff; box-shadow:0 1px 4px rgba(0,0,0,.25); cursor:pointer;
}
#gear::-moz-range-thumb{
  width:14px; height:14px; border-radius:50%; background:var(--gear,#8a8f98); border:2px solid #fff;
  box-shadow:0 1px 4px rgba(0,0,0,.25); cursor:pointer;
}
.gear-tok{
  font-size:11.5px; color:var(--muted); min-width:38px; text-align:right; font-variant-numeric:tabular-nums;
}
@media (max-width:760px){ .gear{ display:none; } }
/* 登录注册 */
.auth{ position:fixed; inset:0; z-index:90; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; }
.auth-card{
  width:340px; background:var(--bg); border:1px solid var(--line); border-radius:18px;
  padding:24px 22px; box-shadow:0 18px 60px rgba(0,0,0,.28);
}
.auth-logo{
  width:44px; height:44px; border-radius:13px; background:var(--brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; margin-bottom:12px;
}
.auth-title{ margin:0 0 14px; font-size:17px; }
.auth-tabs{ display:flex; gap:6px; margin-bottom:14px; }
.auth-tab{
  flex:1; padding:7px 0; border-radius:9px; border:1px solid var(--line); background:transparent;
  color:var(--muted); cursor:pointer; font-size:13.5px;
}
.auth-tab.active{ background:var(--brand-soft); color:var(--brand); border-color:var(--brand); }
.auth-form{ display:flex; flex-direction:column; gap:9px; }
.auth-form input{
  padding:9px 12px; border-radius:10px; border:1px solid var(--line); background:var(--bg);
  color:var(--text); font-size:14px; outline:none;
}
.auth-form input:focus{ border-color:var(--brand); }
.auth-submit{
  margin-top:4px; padding:10px 0; border:none; border-radius:10px; background:var(--brand);
  color:#fff; font-size:14px; cursor:pointer;
}
.auth-submit:hover{ filter:brightness(1.05); }
.auth-msg{ min-height:18px; margin-top:10px; font-size:12.5px; color:#e2574c; }
.auth-note{ margin-top:6px; font-size:11.5px; color:var(--muted); }

/* 侧栏用户条 */
.userbar{
  display:flex; align-items:center; gap:8px; padding:8px 6px; margin-top:6px;
  border-top:1px solid var(--line);
}
.user-avatar{ width:28px; height:28px; border-radius:9px; object-fit:cover; background:var(--brand); }
.user-meta{ flex:1; min-width:0; }
.user-nick{ font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-uuid{ font-size:10.5px; color:var(--muted); letter-spacing:.4px; }
.user-logout{ border:none; background:transparent; color:var(--muted); cursor:pointer; font-size:14px; }
/* 设置按钮 */
.gear-btn{
  margin-left:auto; border:none; background:transparent; color:var(--muted);
  cursor:pointer; font-size:14px; line-height:1; padding:2px 4px; border-radius:6px;
}
.gear-btn:hover{ color:var(--brand); background:var(--brand-soft); }

/* 通用弹窗 */
.modal{ position:fixed; inset:0; z-index:95; background:rgba(0,0,0,.42); display:flex; align-items:center; justify-content:center; }
.modal-card{
  width:380px; max-height:86vh; overflow:auto; background:var(--bg); border:1px solid var(--line);
  border-radius:16px; padding:18px 20px; box-shadow:0 20px 60px rgba(0,0,0,.3);
}
.modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.modal-title{ font-size:16px; font-weight:600; }
.modal-close{ border:none; background:transparent; color:var(--muted); font-size:18px; cursor:pointer; }
.modal-tabs{ display:flex; gap:6px; margin-bottom:14px; }
.modal-tab{
  flex:1; padding:7px 0; border-radius:9px; border:1px solid var(--line); background:transparent;
  color:var(--muted); cursor:pointer; font-size:13.5px;
}
.modal-tab.active{ background:var(--brand-soft); color:var(--brand); border-color:var(--brand); }
.modal-body{ display:flex; flex-direction:column; gap:10px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field-label{ font-size:12.5px; color:var(--muted); }
.field input, .field select, .subpanel input{
  padding:9px 12px; border-radius:10px; border:1px solid var(--line); background:var(--bg);
  color:var(--text); font-size:14px; outline:none;
}
.field input:focus, .field select:focus, .subpanel input:focus{ border-color:var(--brand); }
.gear-row{ display:flex; align-items:center; gap:8px; }
.gear-row #gear2{ flex:1; }
.btn-primary{
  padding:10px 0; border:none; border-radius:10px; background:var(--brand); color:#fff;
  font-size:14px; cursor:pointer;
}
.btn-primary.danger{ background:#e2574c; }
.btn-line{
  padding:10px 12px; border-radius:10px; border:1px solid var(--line); background:transparent;
  color:var(--text); font-size:13.5px; text-align:left; cursor:pointer;
}
.btn-line:hover{ border-color:var(--brand); color:var(--brand); }
.btn-line.danger{ color:#e2574c; border-color:rgba(226,87,76,.4); }
.subpanel{ display:flex; flex-direction:column; gap:8px; padding:10px; border:1px dashed var(--line); border-radius:12px; }
.warn{ font-size:12.5px; color:#e2574c; line-height:1.6; }
.field-note{ font-size:11.5px; color:var(--muted); line-height:1.6; }
/* 测试期门禁（左右分栏版） */
.gate{ position:fixed; inset:0; z-index:999; display:flex; background:#fff; }
.gate-left{
  flex:1 1 auto; min-width:0;
  background:#dfe8f2 url("/static/gate.jpg") center center / cover no-repeat;
}
.gate-right{
  flex:0 0 32%; min-width:360px; max-width:560px;
  background:#fff; color:#111;
  padding:9vh 3.2vw 6vh;
  display:flex; flex-direction:column; justify-content:flex-start;
}
.gate-company{
  font-size:13px; color:#8a8f98; letter-spacing:.8px; margin-bottom:26px;
}
.gate-text{
  white-space:nowrap;
  font-size:clamp(18px, 1.45vw, 26px); font-weight:800; line-height:1.6;
  letter-spacing:.5px; color:#111;
}
.gate-form{ display:flex; gap:10px; width:100%; margin-top:38px; }
#inviteInput{
  flex:1 1 auto; min-width:0; width:100%;
  padding:12px 14px; border-radius:10px; border:1px solid #dcdfe6;
  background:#fff; color:#111; font-size:14px; outline:none;
}
#inviteInput::placeholder{ color:#b4b8c0; }
#inviteInput:focus{ border-color:#4d6bfe; }
#inviteBtn{
  padding:0 22px; border:none; border-radius:10px; background:#4d6bfe;
  color:#fff; font-size:14px; cursor:pointer; white-space:nowrap;
}
#inviteBtn:hover{ filter:brightness(1.06); }
.gate-msg{ min-height:18px; margin-top:12px; font-size:12.5px; color:#e2574c; }

@media (max-width:860px){
  .gate{ flex-direction:column; }
  .gate-left{ flex:1 1 40%; min-height:220px; }
  .gate-right{ flex:0 0 auto; max-width:none; min-width:0; padding:28px 22px 34px; }
  .gate-text{ white-space:normal; font-size:22px; }
}
/* 封禁横幅 */
.ban-banner{
  margin:0 22px; padding:10px 14px; border-radius:10px; font-size:13px;
  background:#fdecea; color:#b3261e; border:1px solid #f5c6c2;
}
@media (prefers-color-scheme: dark){
  .ban-banner{ background:#3a1d1b; color:#ffb4a8; border-color:#5a2a26; }
}
.user-sub{ display:flex; align-items:center; gap:6px; }
.user-group{
  font-size:10px; padding:1px 6px; border-radius:999px;
  background:var(--brand-soft); color:var(--brand); letter-spacing:.3px;
}
/* 未成年人模式提示条（淡绿渐变） */
.minor-banner{
  margin:10px 22px 0; padding:10px 16px; border-radius:12px;
  font-size:13.5px; font-weight:600; text-align:center; letter-spacing:.4px;
  color:#1b7a46; border:1px solid rgba(46,160,92,.28);
  background:linear-gradient(100deg,#eafaf0 0%,#d8f5e3 28%,#eafaf0 55%,#d3f3e0 80%,#eafaf0 100%);
  background-size:220% 100%;
  animation:minorFlow 9s ease-in-out infinite;
  box-shadow:0 2px 10px rgba(46,160,92,.10);
}
@keyframes minorFlow{
  0%   { background-position:0% 50%; }
  50%  { background-position:100% 50%; }
  100% { background-position:0% 50%; }
}
@media (prefers-color-scheme: dark){
  .minor-banner{
    color:#9ce6bb; border-color:rgba(90,210,140,.25);
    background:linear-gradient(100deg,#12301f 0%,#163b26 28%,#12301f 55%,#173d28 80%,#12301f 100%);
    background-size:220% 100%;
  }
}
/* 封禁提示过长时滚动 */
.ban-banner.scroll{ overflow:hidden; white-space:nowrap; }
.ban-banner.scroll span{
  display:inline-block; padding-left:100%;
  animation:banMarquee 14s linear infinite;
}
@keyframes banMarquee{
  from { transform:translateX(0); }
  to   { transform:translateX(-100%); }
}
/* 永久封禁弹窗 */
.ban-card{ max-width:460px; text-align:left; }
.ban-title{ font-size:16px; font-weight:700; margin-bottom:12px; color:#b3261e; }
.ban-body{ white-space:pre-wrap; font-size:13.5px; line-height:1.85; color:var(--text); margin-bottom:16px; }
/* 封禁时输入区灰化 */
.composer.locked{ opacity:.55; filter:grayscale(.35); }
.composer.locked textarea{ cursor:not-allowed; }
.composer.locked .send{ pointer-events:none; }
/* ===== 彩色字：品牌名渐变流光 ===== */
.brand-title,
.chip-name,
.gate-company,
.empty h1 {
  background-image: linear-gradient(90deg,#ff5f6d 0%,#ffc371 18%,#3ee6b0 36%,#4facfe 54%,#a17fe0 72%,#ff5f6d 100%);
  background-size: 300% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: brandFlow 9s linear infinite;
}
@keyframes brandFlow{
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@media (prefers-reduced-motion: reduce){
  .brand-title,.chip-name,.gate-company,.empty h1{ animation:none; }
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)){
  .brand-title,.chip-name,.gate-company,.empty h1{ color:#4facfe; -webkit-text-fill-color:currentColor; }
}
/* 协议勾选 */
.agree-row{ display:flex; align-items:flex-start; gap:8px; font-size:12px; color:var(--muted); margin:10px 0 4px; line-height:1.6; }
.agree-row input{ margin-top:2px; }
.agree-row a{ color:var(--brand); text-decoration:none; }
.agree-row a:hover{ text-decoration:underline; }

/* 协议弹窗 */
.doc-card{ max-width:640px; width:min(92vw,640px); display:flex; flex-direction:column; max-height:80vh; }
.doc-body{
  flex:1; overflow:auto; white-space:pre-wrap; font-size:13px; line-height:1.85;
  background:var(--panel-2); border-radius:10px; padding:14px 16px; margin-bottom:12px;
  color:var(--text);
}


/* ===== 页脚：正常文档流，滚到最底部才看到 ===== */
html, body{ height:auto; min-height:100%; }
body{ overflow-y:auto; }
.app{ height:100vh; min-height:100vh; }

.site-foot-wrap{
  min-height:18vh;
  padding:16px 24px 20px;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg-soft);
  border-top:1px solid var(--line);
}
.site-foot{
  display:flex; flex-wrap:wrap; gap:5px 16px; justify-content:center; align-items:center;
  max-width:1040px; margin:0 auto;
  font-size:11.5px; line-height:1.7; color:var(--muted); text-align:center;
}
.site-foot a{ color:var(--muted); text-decoration:none; }
.site-foot a:hover{ color:var(--brand); text-decoration:underline; }
.site-foot .footer-disclaimer{ flex-basis:100%; font-size:11px; opacity:.7; line-height:1.6; margin:0; }
.site-foot .footer-extra{ display:none; }

.foot-handle{
  display:block; margin:2px auto 0; padding:2px 10px; border:0; background:transparent;
  font-size:11px; color:var(--muted); cursor:pointer; opacity:.5; border-radius:6px;
}
.foot-handle:hover{ opacity:1; background:var(--panel-2); }

/* 头像设置 */
.avatar-row{ display:flex; align-items:center; gap:14px; margin:6px 0 12px; }
.avatar-preview{
  width:64px; height:64px; border-radius:50%; object-fit:cover;
  border:1px solid var(--line); background:var(--panel-2);
}
.avatar-actions{ display:flex; flex-direction:column; gap:6px; }
/* 页脚赞助方 */
.footer-sponsor{
  display:flex; align-items:center; gap:8px;
  font-size:11.5px; color:var(--muted);
}
.footer-sponsor-link{ flex:0 0 auto; }
.site-foot{ row-gap:8px; }
.footer-sponsor img{ height:22px; width:auto; opacity:.9; }
.footer-sponsor:hover img{ opacity:1; }
.footer-sponsor-link{ text-decoration:none; color:inherit; display:block; }
.footer-sponsor-link:hover .footer-sponsor span{ color:var(--brand); text-decoration:underline; }
/* 页脚学校 logo */
.footer-school{ display:inline-flex; align-items:center; gap:6px; text-decoration:none; color:var(--muted); font-size:11.5px; }
.footer-school img{ height:18px; width:auto; opacity:.9; }
.footer-school:hover img{ opacity:1; }
.footer-school:hover span{ color:var(--brand); text-decoration:underline; }
.footer-break{ flex-basis:100%; height:0; }
/* 页脚行容器（由 config.ini [footer] rows 驱动） */
.site-foot{ flex-direction:column; gap:6px; }
.footer-row{ display:flex; flex-wrap:wrap; gap:6px 18px; justify-content:center; align-items:center; }
.footer-row .footer-disclaimer{ text-align:center; }