/* WKAI 工作台样式 site/wk.css — 金黑体系，手机优先，iOS12 保底 */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0a0a0a;
  color: #eaeaea;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: rgba(230, 198, 135, 0.12);
}

/* 视图控制器 */
.wk-view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}
.wk-view.active {
  display: flex;
  flex-direction: column;
}

/* 通用隐藏 */
.wk-hidden { display: none !important; }

/* 微信发码登录 */
.wk-wx-code {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 8px;
  color: #E6C687;
  margin: 18px 0 10px;
  font-variant-numeric: tabular-nums;
}
/* 邮箱登录 */
#email-login-box .wk-input { margin-bottom: 10px; }
#email-code-row { margin-top: 4px; }
.wk-code-input { letter-spacing: 6px; text-align: center; }
.wk-btn.wk-btn-secondary {
  background: none;
  border: 1px solid #544326;
  color: #E6C687;
  font-weight: 600;
}
.wk-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  color: #5a5a5a;
  font-size: 12px;
}
.wk-divider:before, .wk-divider:after {
  content: '';
  flex: 1;
  height: 1px;
  background: #242424;
}
.wk-divider:before { margin-right: 10px; }
.wk-divider:after { margin-left: 10px; }

.wk-wx-code-small {
  font-size: 22px;
  letter-spacing: 4px;
  margin: 12px 0 8px;
  color: #a08a55;
}
.wk-wx-tip {
  font-size: 14px;
  color: #b9b9b9;
  line-height: 1.7;
}
.wk-wx-tip b { color: #E6C687; font-weight: 600; }
.wk-wx-alt { font-size: 12px; color: #6f6f6f; }
.wk-wx-status {
  margin-top: 12px;
  font-size: 13px;
  color: #8a8a8a;
  min-height: 18px;
}
.wk-link-btn {
  display: inline-block;
  margin-top: 22px;
  padding: 10px 14px;
  border: none;
  background: none;
  color: #6f6f6f;
  font-size: 13px;
  text-decoration: underline;
}

/* Gate 视图 & Login 页面共享样式 */
.wk-gate-body {
  background-color: #0a0a0a;
  color: #eaeaea;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.wk-gate-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
  margin: auto;
}
.wk-brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #f5e3b8, #E6C687, #c9a55e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}
.wk-sub {
  font-size: 14px;
  color: #8a8a8a;
  margin-bottom: 32px;
}
.wk-gate-form {
  display: flex;
  flex-direction: column;
}
.wk-input {
  width: 100%;
  height: 48px;
  background: #161616;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  color: #eaeaea;
  font-size: 16px;
  padding: 0 16px;
  outline: none;
  margin-bottom: 14px;
  -webkit-appearance: none;
}
.wk-input:focus {
  border-color: #E6C687;
}
.wk-btn {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #f5e3b8, #E6C687, #c9a55e);
  border: none;
  border-radius: 10px;
  color: #1a1305;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
}
.wk-btn:active {
  opacity: 0.9;
}
.wk-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.wk-error-line {
  min-height: 24px;
  margin-top: 12px;
  font-size: 13px;
  color: #ff6b6b;
}

/* Header 顶栏 */
.wk-header {
  height: 52px;
  min-height: 52px;
  background: rgba(12, 12, 12, 0.95);
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  z-index: 100;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.wk-icon-btn {
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #E6C687;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
}
.wk-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #f5e3b8;
  letter-spacing: 1px;
}
.wk-header-actions {
  display: flex;
  align-items: center;
}

/* Chat 时间线 */
.wk-timeline {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}
.wk-msg-row {
  display: flex;
  margin-bottom: 16px;
  width: 100%;
}
.wk-msg-row.user {
  justify-content: flex-end;
}
.wk-msg-row.assistant {
  justify-content: flex-start;
}

.wk-bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  word-wrap: break-word;
  word-break: break-word;
}
.wk-msg-row.user .wk-bubble {
  white-space: pre-wrap; /* 用户消息保留换行（textContent 渲染） */
  background: linear-gradient(135deg, #2b2316, #3d311c);
  color: #f5e3b8;
  border: 1px solid #544326;
  border-bottom-right-radius: 4px;
}
.wk-msg-row.assistant .wk-bubble {
  background: #181818;
  color: #e0e0e0;
  border: 1px solid #282828;
  border-bottom-left-radius: 4px;
}

/* Markdown 渲染在气泡内的结构 */
.wk-bubble p { margin-bottom: 8px; }
.wk-bubble p:last-child { margin-bottom: 0; }
.wk-bubble h1, .wk-bubble h2, .wk-bubble h3 {
  color: #E6C687;
  margin: 12px 0 6px 0;
  font-size: 16px;
}
.wk-bubble ul, .wk-bubble ol {
  margin: 6px 0 8px 20px;
}
.wk-bubble blockquote {
  border-left: 3px solid #E6C687;
  padding-left: 10px;
  color: #a0a0a0;
  margin: 8px 0;
}
.wk-bubble hr {
  border: none;
  border-top: 1px solid #333;
  margin: 12px 0;
}
.wk-bubble code {
  background: #252525;
  color: #e6c687;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13.5px;
}
.wk-code-wrap {
  position: relative;
  margin: 8px 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
}
.wk-code-wrap pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
}
.wk-code-wrap pre code {
  background: none;
  padding: 0;
  color: #d4d4d4;
  font-size: 13px;
  display: block;
}
.wk-copy-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  background: #222;
  border: 1px solid #333;
  color: #8a8a8a;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}
.wk-copy-btn:active {
  background: #333;
  color: #E6C687;
}

.wk-retry-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: #261e12;
  border: 1px solid #544326;
  color: #E6C687;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* 底部输入框固定组件 */
.wk-input-bar {
  background: #121212;
  border-top: 1px solid #222;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  z-index: 100;
}
.wk-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  color: #eaeaea;
  font-size: 15px;
  line-height: 1.4;
  padding: 9px 12px;
  resize: none;
  outline: none;
  margin-right: 8px;
  -webkit-appearance: none;
}
.wk-textarea:focus {
  border-color: #E6C687;
}
.wk-send-btn {
  width: 44px;
  height: 40px;
  background: linear-gradient(135deg, #f5e3b8, #E6C687, #c9a55e);
  border: none;
  border-radius: 10px;
  color: #1a1305;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
}
.wk-send-btn.stop {
  background: #8b0000;
  color: #ffffff;
}

/* History 视图列表 */
.wk-history-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}
.wk-history-item {
  background: #141414;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.wk-history-item:active {
  background: #1c1a15;
  border-color: #544326;
}
.wk-history-title {
  font-size: 15.5px;
  font-weight: 600;
  color: #eaeaea;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wk-history-meta {
  font-size: 12px;
  color: #777;
  display: flex;
  justify-content: space-between;
}
.wk-load-more {
  width: 100%;
  height: 44px;
  background: #181818;
  border: 1px solid #282828;
  color: #E6C687;
  font-size: 14px;
  border-radius: 8px;
  margin: 12px 0 24px;
  cursor: pointer;
}

.wk-empty-tip {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-top: 40px;
}
