/* ════════════════════════════════════════════════
   全局样式:把小程序的 rpx 设计搬到 web
   规则:1rpx = 0.5px(750rpx 设计宽,二分之一)
   ════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: #334155;
  background: linear-gradient(135deg, #e0f2fe 0%, #f0e7ff 100%);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App 容器:桌面端居中限宽,手机端铺满 */
#app {
  margin: 0 auto;
  max-width: 900px;
  min-height: calc(100vh - 44px);
  position: relative;
}

/* 顶部导航栏(简化版,可隐藏) */
.nav-bar {
  position: sticky; top: 0;
  width: 100%; max-width: 900px;
  margin: 0 auto;
  height: 44px; line-height: 44px;
  background: #1e3a8a; color: white;
  display: flex; align-items: center;
  padding: 0 12px;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.nav-back {
  display: inline-block; width: 32px; text-align: center;
  font-size: 28px; cursor: pointer; user-select: none;
  color: white;
}
.nav-back.disabled { opacity: 0.25; pointer-events: none; }
.nav-title {
  flex: 1; text-align: center; font-size: 16px;
  margin-right: 32px; font-weight: 500;
}

/* 通用动画 */
.slide-up { animation: slideUp 0.3s ease-out; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.loading-dot { display: inline-block; animation: blink 1.2s infinite; }
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* 状态色 */
.status-mastered  { color: #10b981; }
.status-vulnerable{ color: #f59e0b; }
.status-broken    { color: #ef4444; }
.bg-mastered  { background:#d1fae5; border-left:4px solid #10b981; }
.bg-vulnerable{ background:#fef3c7; border-left:4px solid #f59e0b; }
.bg-broken    { background:#fee2e2; border-left:4px solid #ef4444; }

/* ────────────────────────────────────────────────
   Modal / Toast / ActionSheet  — 替代 wx.showXxx
   ──────────────────────────────────────────────── */

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: white; border-radius: 16px;
  width: 100%; max-width: 320px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  animation: scaleIn 0.18s ease-out;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-title { padding: 20px 20px 8px; font-size: 17px; font-weight: bold; color: #1e293b; text-align: center; }
.modal-content { padding: 0 20px 20px; font-size: 14px; color: #475569; line-height: 1.7; text-align: center; white-space: pre-wrap; }
.modal-actions { display: flex; border-top: 1px solid #f1f5f9; }
.modal-btn {
  flex: 1; padding: 14px; text-align: center; cursor: pointer;
  font-size: 16px; user-select: none;
  background: white; border: none; transition: background 0.15s;
}
.modal-btn:hover { background: #f8fafc; }
.modal-btn.cancel { color: #64748b; border-right: 1px solid #f1f5f9; }
.modal-btn.confirm { color: #1e3a8a; font-weight: bold; }

.toast {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15,23,42,0.85); color: white;
  padding: 14px 22px; border-radius: 12px;
  font-size: 14px; line-height: 1.5;
  z-index: 1100; max-width: 80%;
  text-align: center; white-space: pre-wrap;
  pointer-events: none;
  animation: scaleIn 0.2s ease-out;
}
.toast .toast-icon { display: block; font-size: 32px; margin-bottom: 6px; text-align: center; }

/* Action Sheet */
.action-sheet-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}
.action-sheet-box {
  width: 100%; max-width: 900px;
  background: #f1f5f9; padding: 6px 6px 16px;
  animation: slideUp 0.25s ease-out;
}
.action-sheet-item {
  background: white; padding: 16px;
  text-align: center; font-size: 16px;
  cursor: pointer; user-select: none;
  margin-bottom: 1px; color: #1e293b;
}
.action-sheet-item:first-child { border-radius: 12px 12px 0 0; }
.action-sheet-item:last-of-type { border-radius: 0 0 12px 12px; margin-bottom: 8px; }
.action-sheet-item:only-of-type { border-radius: 12px; }
.action-sheet-cancel {
  background: white; padding: 16px;
  border-radius: 12px; text-align: center;
  font-size: 16px; cursor: pointer; user-select: none;
  color: #64748b; font-weight: bold;
}

/* ────────────────────────────────────────────────
   通用糖果按钮 / 卡片
   ──────────────────────────────────────────────── */

.candy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 1; min-width: 90px;
  padding: 10px 8px;
  border-radius: 14px;
  text-align: center;
  font-size: 14px; font-weight: bold;
  border: none;
  border-bottom: 3px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  color: white;
  line-height: 1.4;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
  white-space: pre-wrap;
}
.candy-btn:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.candy-blue   { background: linear-gradient(to bottom, #7dd3fc, #38bdf8); border-bottom-color:#0284c7; }
.candy-green  { background: linear-gradient(to bottom, #6ee7b7, #34d399); border-bottom-color:#059669; }
.candy-pink   { background: linear-gradient(to bottom, #f9a8d4, #f472b6); border-bottom-color:#db2777; }
.candy-option {
  background: white; color: #64748b;
  border: 1px solid #e2e8f0;
  border-bottom: 3px solid #cbd5e1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.btn-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* 按钮区(纵向堆叠) */
.action-row { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.back-btn {
  text-align: center; color: #94a3b8; font-size: 13px;
  padding: 8px; cursor: pointer; user-select: none;
}
.back-btn:hover { color: #475569; }

/* 通用气泡 */
.bubble-rabbit {
  background: white; border: 2px solid #bae6fd;
  border-radius: 16px; border-bottom-left-radius: 4px;
  padding: 12px 14px; margin-bottom: 12px;
}
.bubble-text {
  font-size: 14px; color: #334155;
  line-height: 1.7; white-space: pre-wrap;
  display: block;
}

.title-gradient {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: bold;
}

/* 通用 page wrapper */
.page-wrap { padding: 12px; }

/* 通用容器(双栏布局,小屏改单栏) */
.container {
  display: flex; flex-direction: row;
  min-height: calc(100vh - 44px);
  padding: 12px;
  gap: 12px;
}
.left-panel {
  width: 140px; flex-shrink: 0;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.right-panel {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}
.chat-card {
  flex: 1;
  background: rgba(255,255,255,0.92);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  border: 2px solid white;
}

@media (max-width: 600px) {
  .container { flex-direction: column; }
  .left-panel { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; }
}
