/* ============================================================
   AIX Society — AI 就緒度自評 Chatbot 樣式
   依附 site.css 的 CSS 變數（--panel/--ink/--gold/--line…），
   自動對應亮／暗模式；配色守則：金、灰、黑、白（禁用藍紫）。
   ============================================================ */

/* ---------- 懸浮按鈕 ---------- */
.rd-root { font-family: var(--font); }
.rd-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #141108;
  background: linear-gradient(140deg, var(--gold-lt), var(--gold));
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.rd-fab:hover { transform: translateY(-2px); }
.rd-fab svg { flex: 0 0 auto; }
.rd-fab-label { white-space: nowrap; }

/* ---------- 抽屜 ---------- */
.rd-drawer {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 9500;
  width: 100%;
  max-width: 400px;
  height: min(640px, 86vh);
  padding: 0 14px 14px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .25s ease, transform .25s ease;
}
.rd-drawer.open { pointer-events: auto; opacity: 1; transform: none; }
.rd-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rd-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--panel2);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.rd-close:hover { color: var(--ink); }

.rd-convo {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* ---------- 頭部 ---------- */
.rd-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 54px 16px 16px;
  border-bottom: 1px solid var(--line2);
  background: var(--panel2);
}
.rd-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #141108;
  background: linear-gradient(140deg, var(--gold-lt), var(--gold));
}
.rd-title { font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.rd-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.rd-head-meta { flex: 1; }
.rd-prog { height: 6px; border-radius: 999px; background: var(--line2); overflow: hidden; }
.rd-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-lt), var(--gold)); transition: width .25s ease; }
.rd-prog-label { font-size: 0.71875rem; color: var(--muted); margin-top: 6px; }

/* ---------- 對話流 ---------- */
.rd-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.rb-row { display: flex; }
.rb-row.bot { justify-content: flex-start; }
.rb-row.user { justify-content: flex-end; }
.rb-bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.84375rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--line2);
}
.rb-bubble p { margin: 0; }
.rb-bubble p + p { margin-top: 6px; }
.rd-dims { font-size: 0.78125rem; color: var(--muted); }
.rd-dimchip {
  display: inline-block;
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--gold-lt);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.rd-q { font-weight: 500; color: var(--ink); }

/* ---------- 選項 ---------- */
.rd-opts { display: flex; flex-direction: column; gap: 8px; }
.rd-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink2);
  font: inherit;
  font-size: 0.84375rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.rd-opt:hover { border-color: var(--line); background: var(--panel2); }
.rd-opt-dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--muted);
}

/* ---------- 按鈕 ---------- */
.rd-btn {
  display: inline-block;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.rd-btn-primary {
  color: #141108;
  background: linear-gradient(140deg, var(--gold-lt), var(--gold));
}
.rd-link {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.78125rem;
  cursor: pointer;
  padding: 0;
}
.rd-link:hover { color: var(--ink); }
.rd-backwrap { padding: 0 4px; }

/* ---------- 結果 ---------- */
.rd-score-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rd-score { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 4px; }
.rd-score b { font-size: 2.75rem; line-height: 1; color: var(--gold); font-weight: 600; }
.rd-score span { color: var(--muted); font-size: 0.875rem; }
.rd-tier { font-size: 0.9375rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.rd-tier-desc { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.rd-dims-title { font-size: 0.78125rem; font-weight: 600; letter-spacing: .03em; color: var(--ink); margin: 10px 0 8px; text-transform: uppercase; }
.rd-dims { display: flex; flex-direction: column; gap: 8px; }
.rd-dim-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.78125rem; margin-bottom: 4px; }
.rd-dim-top b { font-weight: 600; color: var(--gold-lt); font-size: 0.75rem; }
.rd-bar { height: 6px; border-radius: 999px; background: var(--line2); overflow: hidden; }
.rd-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-lt), var(--gold)); }
.rd-sw { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.rd-sw-item { padding: 10px 12px; border: 1px solid var(--line2); border-radius: 12px; }
.rd-sw-lbl { display: block; font-size: 0.71875rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rd-sw-item b { display: block; font-size: 0.875rem; color: var(--ink); margin: 3px 0; }
.rd-sw-item p { margin: 4px 0 0; font-size: 0.78125rem; color: var(--muted); line-height: 1.5; }
.rd-recs { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.rd-recs li { font-size: 0.8125rem; color: var(--ink2); line-height: 1.55; }
.rd-cta-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--muted); }

/* ---------- 內嵌（評估頁） ---------- */
.rd-inline {
  max-width: 640px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.rd-inline .rd-convo { max-height: 620px; }

/* ---------- 手機 ---------- */
@media (max-width: 640px) {
  .rd-fab { right: 14px; bottom: 14px; padding: 12px 15px; }
  .rd-fab-label { display: none; }
  .rd-drawer { max-width: none; height: min(600px, 92vh); padding: 0 0 0; }
  .rd-panel { border-radius: 18px 18px 0 0; }
}

/* ---------- 評估頁靜態內容 ---------- */
.rd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 6px; }
.rd-card { padding: 22px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--panel); }
.rd-card .rd-n { font-size: 0.6875rem; letter-spacing: .12em; color: var(--gold-lt); font-weight: 600; }
.rd-card h3 { font-size: 0.9375rem; margin: 8px 0 8px; color: var(--ink); }
.rd-card p { margin: 0; font-size: 0.84375rem; line-height: 1.7; color: var(--muted); }
.rd-sec { margin: 44px 0; }
.rd-faq details { border: 1px solid var(--line2); border-radius: 12px; background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.rd-faq summary { cursor: pointer; padding: 16px 44px 16px 18px; font-size: 0.90625rem; font-weight: 600; color: var(--ink); list-style: none; position: relative; }
.rd-faq summary::-webkit-details-marker { display: none; }
.rd-faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--gold-lt); font-size: 1.1rem; }
.rd-faq details[open] summary::after { content: "–"; }
.rd-faq details p { margin: 0; padding: 0 18px 16px; font-size: 0.84375rem; color: var(--muted); line-height: 1.7; }
.rd-cta { margin-top: 10px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
@media (max-width: 900px) { .rd-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .rd-cards { grid-template-columns: 1fr; } }
