/* ============================================================
   css/chat/chat-game-tests.css — 心理测试样式
   韩系法式花艺 · 暖米纸底 · 玫瑰金装饰 · 衬线花字
   跟随 [data-theme-mode] 深浅切换 · ≤370px 窄屏适配 · 2027 改版
   ============================================================ */

/* ===== 容器 ===== */
.game-tests {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0;                       /* flex 子项默认 min-height:auto 撑不出滚动，长内容被裁 */
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 12px calc(20px + var(--safe-bottom, 0px)); gap: 10px;
  background: radial-gradient(130% 60% at 50% 0%, var(--rose-light, rgba(201,168,168,0.12)), transparent 55%),
              radial-gradient(120% 100% at 50% 100%, var(--lavender-light, rgba(184,168,196,0.08)), transparent 50%),
              linear-gradient(180deg, var(--bg-primary), var(--bg-chat));
  font-family: var(--font-reading); color: var(--text-primary);
}
.tests-loading {
  text-align: center; padding: 60px 20px;
  font-family: var(--font-decorative); font-size: 15px; font-style: italic;
  color: var(--text-muted); opacity: 0.5;
}
/* 拿不到题目时：说清原因 + 给出口（不许停在「正在准备」）
   字不能再用 0.5 透明度那种「占位感」，要看得清是它在说话 */
.tests-loading.tests-load-fail {
  opacity: 1; font-style: normal; font-family: var(--font-reading);
  font-size: 13.5px; line-height: 1.7; color: var(--text-muted);
  padding: 48px 20px;
}
.tests-retry {
  display: block; margin: 14px auto 0;
  padding: 9px 22px; border-radius: 999px;
  border: 1px solid var(--border-soft, rgba(196, 160, 172, 0.4));
  background: var(--surface-solid, #fff); color: var(--text-primary);
  font-family: var(--font-reading); font-size: 13px;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: transform 0.16s ease, background 0.16s ease;
}
.tests-retry:active { transform: scale(0.97); }

/* ===== 测试列表卡片 ===== */
.test-list-item {
  position: relative;
  border-radius: var(--radius-lg, 14px);
  padding: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--gold-light);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    var(--shadow-xs), var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.22,0.61,0.36,1);
  cursor: default;
}
.test-list-item:hover {
  border-color: var(--rose);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, var(--shadow-sm), var(--shadow-md), var(--shadow-glow);
}
.test-list-item::after {
  content: ''; position: absolute; inset: 5px;
  border: 0.5px solid rgba(196,168,106,0.1);
  border-radius: calc(var(--radius-lg, 14px) - 5px); pointer-events: none;
}
[data-theme-mode="dark"] .test-list-item {
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, var(--shadow-xs), var(--shadow-sm);
}
.test-item-header {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.test-item-name {
  font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: 1px;
}
.test-item-en {
  font-family: var(--font-decorative); font-size: 10px; font-style: italic;
  color: var(--gold, #C4A86A); opacity: 0.7; flex: 1; min-width: 0;
}
.test-item-badge {
  font-family: var(--font-decorative); font-size: 10px; font-style: italic;
  color: var(--lavender); border: 1px solid var(--lavender-light);
  border-radius: 10px; padding: 2px 8px; letter-spacing: 0.5px; white-space: nowrap;
}
.test-item-desc {
  font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px;
}

/* ===== 双方结果块（各自独立金色块，点了进详情） ===== */
.test-results-row { display: flex; gap: 10px; margin-bottom: 12px; }
.test-gold-block {
  flex: 1; min-width: 0;
  padding: 12px 14px; border-radius: 12px;
  background: var(--bg-chat); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  transition: all 0.2s ease;
}
.test-gold-block.has {
  background: linear-gradient(160deg, rgba(196,168,106,0.16), var(--bg-chat) 70%);
  border-color: var(--gold-light);
  cursor: pointer;
}
.test-gold-block.has:hover {
  border-color: var(--gold);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, var(--shadow-sm);
}
.test-gold-label {
  font-size: 11px; color: var(--text-secondary); letter-spacing: 1px;
}
.test-gold-type {
  font-family: var(--font-decorative); font-size: 20px; font-style: italic;
  font-weight: 600; color: var(--gold, #C4A86A); letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.test-gold-hint { font-size: 10px; color: var(--text-muted); }
.test-gold-none {
  font-size: 12px; color: var(--text-muted); font-style: italic;
}

/* ===== 操作按钮（水平，不竖排） ===== */
.test-item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.test-item-btn {
  padding: 9px 14px; border-radius: 18px; cursor: pointer;
  font-family: var(--font-reading); font-size: 12px; letter-spacing: 0.5px;
  transition: all 0.2s ease; font-weight: 500; white-space: nowrap; flex: 0 1 auto;
}
.test-item-btn.primary {
  border: none; background: var(--rose); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, var(--shadow-sm);
}
.test-item-btn.primary:hover { background: var(--rose-hover); transform: translateY(-1px); }
.test-item-btn.primary:active { transform: scale(0.96); }
.test-item-btn.secondary {
  border: 1px solid var(--lavender-light); background: transparent; color: var(--lavender);
}
.test-item-btn.secondary:hover { background: var(--lavender-light); transform: translateY(-1px); }

/* ===== 答题界面 ===== */
/* 答题内容居中容器：内容短时上下均衡留白；超长时回落顶部、随 .game-tests 滚动不裁头
   （用 margin:auto 而非 justify-content:center —— 后者在内容溢出时会把顶部裁掉无法滚回） */
.test-qa-inner {
  display: flex; flex-direction: column; gap: 10px;
  margin: auto; width: 100%;
}
.test-question-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; margin-bottom: 2px;
}
.test-q-progress {
  font-family: var(--font-decorative); font-size: 12px; font-style: italic;
  color: var(--text-muted); letter-spacing: 1px;
}
.test-q-bar {
  height: 3px; border-radius: 2px; background: var(--border);
  margin-bottom: 14px; overflow: hidden;
}
.test-q-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--rose), var(--gold));
  border-radius: 2px; transition: width 0.4s cubic-bezier(0.22,0.61,0.36,1);
}
.test-question-card {
  background: var(--surface-solid);
  border: 1px solid var(--gold-light);
  border-radius: 14px; padding: 20px 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, var(--shadow-xs), var(--shadow-sm);
  margin-bottom: 10px;
}
.test-q-label {
  font-family: var(--font-decorative); font-size: 11px; font-style: italic;
  color: var(--rose); opacity: 0.7; letter-spacing: 2px; margin-bottom: 4px;
}
.test-q-text {
  font-size: 15px; color: var(--text-primary); line-height: 1.7; letter-spacing: 0.3px;
}
.test-options { display: flex; flex-direction: column; gap: 8px; }
.test-option {
  padding: 14px 16px; border-radius: 12px;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  font-family: var(--font-reading); font-size: 13px;
  color: var(--text-primary); line-height: 1.5;
  transition: all 0.2s cubic-bezier(0.22,0.61,0.36,1);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset;
  text-align: left;
}
.test-option:hover {
  border-color: var(--rose); transform: translateX(4px);
  background: var(--rose-light);
}
.test-option:active { transform: scale(0.98); }
.test-option-chosen {
  border-color: var(--rose);
  background: var(--rose-light);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 2px 12px rgba(201,168,168,0.2);
  font-weight: 500;
}
.test-nav {
  display: flex; justify-content: space-between; gap: 10px;
}
.test-nav-btn {
  flex: 1; padding: 11px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; font-family: var(--font-reading); font-size: 13px;
  color: var(--text-secondary); transition: all 0.2s ease; white-space: nowrap;
}
.test-nav-btn:hover { border-color: var(--rose); color: var(--rose); }
.test-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.test-nav-btn.submit {
  border-color: var(--rose); background: var(--rose); color: #fff;
  font-weight: 500; border: none;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, var(--shadow-sm);
}
.test-nav-btn.submit:hover { background: var(--rose-hover); transform: translateY(-1px); }

/* 一次一题：底部提示条（居中 + 线条小图标 + 淡色圆角底 + 细描边） */
.test-q-tip {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 4px; padding: 8px 12px;
  border-radius: 12px;
  background: var(--rose-light);
  border: 1px solid rgba(201,168,168,0.16);
  font-size: 10px; color: var(--text-secondary);
  letter-spacing: 0.4px; line-height: 1.5; text-align: center;
}
.test-q-tip-icon {
  flex-shrink: 0; color: var(--rose); opacity: 0.85;
  display: inline-flex;
}
.test-q-tip span { min-width: 0; }
[data-theme-mode="dark"] .test-q-tip {
  background: rgba(201,168,168,0.10);
  border-color: rgba(201,168,168,0.14);
}

/* ===== 结果面板 ===== */
.test-result-section {
  background: var(--surface-solid);
  border: 1px solid var(--gold-light);
  border-radius: 14px; padding: 20px 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, var(--shadow-xs), var(--shadow-sm);
  text-align: center;
}
.test-result-big-type {
  font-family: var(--font-decorative); font-size: 36px; font-style: italic;
  font-weight: 600; letter-spacing: 3px;
  background: linear-gradient(160deg, var(--rose) 20%, var(--gold) 70%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  white-space: nowrap;
}
.test-result-label {
  font-size: 11px; color: var(--text-muted); letter-spacing: 3px; margin-top: 2px;
}
.test-result-type-name {
  font-size: 16px; color: var(--text-primary); font-weight: 600; margin-top: 8px; letter-spacing: 1px;
}
.test-result-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.8;
  margin-top: 12px; padding: 12px; border-radius: 10px;
  background: var(--rose-light); border: 1px solid rgba(201,168,168,0.1);
}
.test-analysis { margin-top: 4px; }
.test-analysis p {
  font-size: 13px; color: var(--text-secondary); line-height: 1.9; margin: 0 0 12px; letter-spacing: 0.2px;
}
.test-result-scales {
  margin-top: 14px; display: flex; flex-direction: column; gap: 8px;
}
.test-scale-row {
  display: flex; align-items: center; gap: 8px;
}
.test-scale-label-l, .test-scale-label-r {
  font-size: 11px; font-family: var(--font-decorative); font-style: italic;
  font-weight: 600; min-width: 24px; text-align: center;
}
.test-scale-label-l { color: var(--rose); }
.test-scale-label-r { color: var(--gold); }
.test-scale-bar {
  flex: 1; height: 6px; border-radius: 3px; background: var(--bg-chat);
  position: relative; overflow: hidden;
}
.test-scale-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transition: width 0.8s cubic-bezier(0.22,0.61,0.36,1);
}
.test-score-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  font-size: 13px; border-bottom: 1px solid var(--border);
}
.test-score-row:last-child { border-bottom: none; }
.test-score-val { font-weight: 600; color: var(--rose); }

/* ===== 查看答案 ===== */
.test-answer-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow-y: auto;
}
.test-answer-item {
  background: var(--surface-solid);
  border: 1px solid var(--gold-light);
  border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, var(--shadow-xs);
}
.test-answer-q {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 4px;
}
.test-answer-a { font-size: 11px; }
.test-answer-a .chosen { color: var(--rose); font-weight: 500; }
.test-answer-a .not-chosen { color: var(--text-muted); }

/* ===== 分享/查看按钮区 ===== */
.test-share-actions {
  display: flex; gap: 10px; justify-content: center; padding: 8px 0; flex-wrap: wrap;
}
.test-share-btn {
  padding: 10px 20px; border-radius: 20px; cursor: pointer;
  font-family: var(--font-reading); font-size: 12px; letter-spacing: 1px;
  transition: all 0.2s ease; white-space: nowrap;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
}
.test-share-btn:hover { border-color: var(--rose); color: var(--rose); transform: translateY(-1px); }
.test-share-btn.rose-btn { border-color: var(--rose); color: var(--rose); }
.test-share-btn.rose-btn:hover { background: var(--rose-light); }

/* ===== 聊天里的测试结果卡（可点击进详情） ===== */
.test-result-card-click {
  max-width: 280px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-solid), var(--bg-chat) 60%, var(--bg-primary));
  border: 1.5px solid var(--gold-light);
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, var(--shadow-sm), var(--shadow-md);
  cursor: pointer; transition: all 0.2s ease;
}
.test-result-card-click:hover { border-color: var(--gold); transform: translateY(-1px); }
.test-result-bubble { background: transparent; border: none; box-shadow: none; padding: 4px 0; }
.trs-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px 6px; }
.trs-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.trs-sub { font-family: var(--font-decorative); font-size: 10px; font-style: italic; color: var(--gold); opacity: 0.8; margin-left: auto; }
.trs-divider { height: 1px; background: rgba(196,168,106,0.25); margin: 4px 0; }
.trs-body { text-align: center; padding: 12px 18px 6px; }
.trs-type {
  font-family: var(--font-decorative); font-size: 30px; font-style: italic; font-weight: 600;
  letter-spacing: 3px; color: var(--rose); white-space: nowrap;
}
.trs-typename { font-size: 13px; color: var(--text-primary); margin-top: 4px; }
.trs-preview {
  font-size: 12px; color: var(--text-secondary); line-height: 1.7; margin-top: 8px;
}
.trs-foot {
  padding: 8px 16px 12px; text-align: center;
  font-size: 11px; color: var(--gold); letter-spacing: 0.5px;
}

/* ===== 聊天里的测试邀请卡（发出去固定展示） ===== */
.test-invite-bubble { background: transparent; border: none; box-shadow: none; padding: 4px 0; }
.test-invite-card {
  max-width: 280px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-solid), var(--bg-chat) 55%, var(--bg-primary));
  border: 1.5px solid var(--gold-light);
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, var(--shadow-sm), var(--shadow-md);
}
.tic-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 2px; }
.tic-title { font-size: 14px; font-weight: 600; color: var(--text-primary); letter-spacing: 0.5px; }
.tic-badge {
  margin-left: auto; font-size: 10px; color: var(--rose);
  border: 1px solid var(--rose-light); background: var(--rose-light);
  border-radius: 20px; padding: 2px 8px; letter-spacing: 0.5px;
}
.tic-en {
  font-family: var(--font-decorative); font-size: 11px; font-style: italic;
  color: var(--gold); opacity: 0.85; padding: 0 16px; letter-spacing: 0.8px;
}
.tic-divider { height: 1px; background: rgba(196,168,106,0.25); margin: 6px 14px; }
.tic-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.75; padding: 0 16px 4px; }
.tic-foot {
  padding: 6px 16px 14px; font-size: 12px; color: var(--rose);
  font-weight: 500; letter-spacing: 0.3px;
}

/* ===== 聊天详情浮层（#app 内全屏） ===== */
.test-detail-overlay {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(16px);
  top: 0; bottom: 0; width: 100%; max-width: 480px;
  background: var(--bg-chat); display: flex; flex-direction: column;
  z-index: 1000; opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
}
.test-detail-overlay.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.test-detail-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top, 0px) + 10px) 12px 10px;
  border-bottom: 1px solid var(--border); background: var(--surface-solid);
}
/* 聊天详情浮层顶栏左右占位等宽，标题真正居中（.game-spacer 不继承 .game-topbar 的 34px 宽度，会塌成 0） */
.test-detail-topbar .game-spacer { width: 34px; flex-shrink: 0; }
.test-detail-scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; padding-bottom: calc(24px + var(--safe-bottom, 0px)); display: flex; flex-direction: column; gap: 10px;
}

/* ===== 详情页精致小标题（游戏内详情 / 聊天浮层共用）：小字两行，不再用游戏大标题 ===== */
.test-detail-title {
  flex: 1; min-width: 0; text-align: center;
  display: flex; flex-direction: column; align-items: center; line-height: 1.3;
  padding: 0 6px;
}
.tdt-cn {
  font-family: var(--font-reading); font-size: 14px; font-weight: 600;
  color: var(--text-primary); letter-spacing: 0.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.tdt-en {
  font-family: var(--font-decorative); font-size: 10px; font-style: italic;
  color: var(--gold); letter-spacing: 0.8px; opacity: 0.85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
/* 游戏内详情也套这套小标题（game-topbar 复用） */
.game-topbar.test-detail-top { padding-top: calc(var(--safe-top, 0px) + 8px); }
.test-detail-top .test-detail-title { text-align: center; }

/* 详情浮层底部：分享给他 */
.test-detail-share-row { padding: 4px 2px 8px; }
.test-share-detail-btn { width: 100%; }

/* ===== 窄屏适配 ===== */
@media (max-width: 370px) {
  .game-tests { padding: 6px 8px 14px; gap: 8px; }
  .test-item-name { font-size: 14px; }
  .test-result-big-type { font-size: 26px; }
  .test-option { padding: 12px 14px; font-size: 12px; }
  .test-item-btn { padding: 8px 10px; font-size: 11px; flex: 1 1 40%; }
  .test-gold-type { font-size: 17px; }
  .trs-type { font-size: 26px; }
  .test-invite-card, .test-result-card-click { max-width: 100%; }
  .tic-title { font-size: 13px; }
  .test-detail-topbar .game-back { width: 30px; height: 30px; }
  .test-detail-topbar .game-spacer { width: 30px; }
  .test-q-tip { padding: 6px 10px; font-size: 9px; }
}

/* ===== 深色模式 ===== */
[data-theme-mode="dark"] .test-option { background: rgba(255,255,255,0.03); }
[data-theme-mode="dark"] .test-option-chosen { background: rgba(201,168,168,0.12); }
[data-theme-mode="dark"] .test-result-section,
[data-theme-mode="dark"] .test-list-item,
[data-theme-mode="dark"] .test-question-card,
[data-theme-mode="dark"] .test-answer-item,
[data-theme-mode="dark"] .test-gold-block {
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, var(--shadow-xs), var(--shadow-sm);
}

/* ===== iOS standalone 铺满层 ===== */
@media (display-mode: standalone) and (max-width: 767px) {
  .test-detail-overlay { bottom: 0; height: 100vh; }
}
