/**
 * css/views/topic.css
 * ─────────────────────────────────────────────────────────────
 * 专题训练视图样式（topicDetail / topicQuiz / topicCompose 三页共用）
 * 风格：奶白马卡龙 · 液态玻璃 · iOS 26 图标风
 * ─────────────────────────────────────────────────────────────
 */

/* ═══════════════════════════════════════════════════════════
   训练营专题卡片补充（扩展 style.css 里已有的 .topic-card）
═══════════════════════════════════════════════════════════ */

.topic-card-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-card-clickable:hover,
.topic-card-clickable:active {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.25);
}

.topic-card-locked {
  filter: saturate(0.7) brightness(1.02);
  opacity: 0.85;
}

.topic-available-badge {
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

/* ═══════════════════════════════════════════════════════════
   topicDetail（子内容列表页）
═══════════════════════════════════════════════════════════ */

.topic-detail-page {
  padding: 8px 16px 32px;
}

.topic-intro-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12);
}

.sub-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px;
  border-radius: 22px;
  animation: tcFadeUp 0.4s ease both;
}

@keyframes tcFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sub-card-unlocked {
  cursor: pointer;
  color: #fff;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sub-card-unlocked:hover,
.sub-card-unlocked:active {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.22);
}

.sub-card-locked {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  color: #9CA3AF;
}

.sub-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.sub-card-num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.35);
  color: #9CA3AF;
  flex-shrink: 0;
}

.sub-card-num-unlocked {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  backdrop-filter: blur(8px);
}

.sub-card-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}

.sub-card-title-locked {
  color: #9CA3AF;
}

.sub-card-sub {
  font-size: 11px;
  color: #B8BCC9;
  margin-top: 2px;
  line-height: 1.4;
}

.sub-card-sub-light {
  color: rgba(255, 255, 255, 0.8);
}

.sub-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.sub-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sub-card-coming {
  font-size: 11px;
  font-weight: 700;
  color: #9CA3AF;
  background: rgba(156, 163, 175, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(156, 163, 175, 0.22);
}

.sub-card-arrow {
  color: #fff;
  opacity: 0.85;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   topicQuiz（答题页）
═══════════════════════════════════════════════════════════ */

.topic-quiz-page {
  padding: 8px 16px 32px;
}

/* 16:9 图片框 —— 始终置顶 */
.tq-image-box {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #FDE7F0, #F3E8FF);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.9);
  margin-bottom: 14px;
  position: relative;
}

.tq-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tq-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #7C3AED;
  background: rgba(124, 58, 237, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  border: 1px solid rgba(124, 58, 237, 0.18);
}

/* ─── 排序题专属 ─── */
.tq-sort-panel {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  padding: 12px 14px;
  border-radius: 18px;
  margin-top: 10px;
}

.tq-sort-label {
  font-size: 12px;
  font-weight: 700;
  color: #6B5FC7;
  margin-bottom: 8px;
}

.tq-sort-chosen-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.tq-sort-empty {
  align-items: center;
  justify-content: center;
}

.tq-sort-placeholder {
  font-size: 12px;
  color: #B8BCC9;
  text-align: center;
  padding: 8px 0;
  width: 100%;
}

.tq-sort-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #F5E1F0, #E9DEF7);
  border-radius: 14px;
  font-size: 13px;
  color: #4C3A7A;
  animation: tcFadeUp 0.25s ease;
}

.tq-sort-chosen.tq-sort-correct {
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  color: #065F46;
}

.tq-sort-chosen.tq-sort-wrong {
  background: linear-gradient(135deg, #FECACA, #FECDD3);
  color: #991B1B;
}

.tq-sort-idx {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: #6B5FC7;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tq-sort-chosen .tq-sort-text {
  flex: 1;
  line-height: 1.4;
  font-weight: 600;
}

.tq-sort-remove {
  border: none;
  background: rgba(255, 255, 255, 0.6);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 900;
  color: #9CA3AF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tq-sort-available {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tq-sort-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  font-size: 13px;
  color: #1F1040;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  font-family: inherit;
}

.tq-sort-item:hover:not(:disabled) {
  border-color: #C4B5FD;
  background: #fff;
}

.tq-sort-item-chosen {
  opacity: 0.4;
  cursor: not-allowed;
}

.tq-sort-item:disabled {
  cursor: not-allowed;
}

.tq-sort-letter {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  color: #7C3AED;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tq-sort-item .tq-sort-text {
  flex: 1;
  line-height: 1.4;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   topicCompose（连句成段页）
═══════════════════════════════════════════════════════════ */

.topic-compose-page {
  padding: 8px 16px 32px;
}

.tc-recap {
  background: rgba(124, 58, 237, 0.08);
  color: #6B5FC7;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.tc-recap b {
  color: #7C3AED;
  font-weight: 900;
}

.tc-page-title {
  font-size: 20px;
  font-weight: 900;
  color: #1F1040;
  margin: 14px 0 10px;
  line-height: 1.3;
}

/* ─── 写作要求卡 ─── */
.tc-requirements {
  margin-bottom: 14px;
}

.tc-req-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  color: #6B5FC7;
  margin: 0 0 10px;
}

.tc-req-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-req-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: #4B5563;
  line-height: 1.6;
  margin-bottom: 4px;
}

.tc-req-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #A78BFA;
}

/* ─── 思维导图 ─── */
.tc-mindmap {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  padding: 18px 14px;
  border-radius: 22px;
  margin-bottom: 14px;
}

.tc-mm-root {
  background: linear-gradient(135deg, #A78BFA, #EC4899);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  padding: 10px 20px;
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto 16px;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.3);
}

.tc-mm-branches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tc-mm-branch {
  border-left: 3px solid var(--branch-color, #A78BFA);
  padding-left: 12px;
}

.tc-mm-branch-title {
  font-size: 14px;
  font-weight: 800;
  color: #1F1040;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tc-mm-branch-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--branch-color, #A78BFA);
}

.tc-mm-children {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tc-mm-leaf {
  font-size: 12px;
  color: #4B5563;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* ─── 写作区 ─── */
.tc-write-area {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  padding: 14px;
  border-radius: 20px;
}

.tc-write-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tc-write-label {
  font-size: 14px;
  font-weight: 800;
  color: #6B5FC7;
}

.tc-write-count {
  font-size: 12px;
  color: #9CA3AF;
  font-weight: 600;
}

.tc-write-count #tc-char-count {
  color: #7C3AED;
  font-weight: 900;
}

/* ─── 写作区工具栏（拍照/相册/字数） ─── */
.tc-write-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1.5px solid rgba(124, 58, 237, 0.18);
  background: rgba(124, 58, 237, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.tc-tool-btn:hover,
.tc-tool-btn:active {
  background: rgba(124, 58, 237, 0.14);
  transform: translateY(-1px);
}

.tc-tool-btn:active {
  transform: translateY(0);
}

/* ─── OCR 识别状态提示 ─── */
.tc-ocr-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  animation: tcFadeUp 0.25s ease;
}

.tc-ocr-loading {
  background: rgba(124, 58, 237, 0.08);
  color: #6B5FC7;
  border: 1px solid rgba(124, 58, 237, 0.18);
}

.tc-ocr-success {
  background: rgba(16, 185, 129, 0.08);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.22);
}

.tc-ocr-error {
  background: rgba(239, 68, 68, 0.08);
  color: #B91C1C;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

.tc-essay-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid rgba(196, 181, 253, 0.5);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: #1F1040;
  background: rgba(255, 255, 255, 0.7);
  resize: vertical;
  min-height: 180px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.tc-essay-input:focus {
  border-color: #A78BFA;
  background: #fff;
}

.tc-essay-input::placeholder {
  color: #B8BCC9;
  line-height: 1.7;
}

.tc-submit-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.28);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.tc-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tc-submit-btn:not(:disabled):active {
  transform: translateY(1px);
}

.tc-loading-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin: 0 2px;
  animation: tcLoading 1.2s infinite ease-in-out;
}

.tc-loading-dot:nth-child(1) { animation-delay: 0s; }
.tc-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.tc-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes tcLoading {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ─── 评分结果页 ─── */
.topic-compose-result {
  padding: 8px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tc-result-card {
  padding: 24px 20px 22px;
  border-radius: 24px;
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.18);
}

.tc-result-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.tc-result-stars svg {
  width: 32px;
  height: 32px;
  color: #FBBF24;
}

.tc-result-stars .star-empty {
  color: rgba(255, 255, 255, 0.4);
}

.quiz-result-star {
  animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes starPop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.tc-result-total {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 6px;
}

.tc-result-num {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}

.tc-result-unit {
  font-size: 16px;
  opacity: 0.85;
}

.tc-result-encourage {
  font-size: 14px;
  opacity: 0.95;
  margin: 8px 0 12px;
  line-height: 1.5;
}

.tc-result-bonus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* 各维度得分条 */
.tc-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  color: #1F1040;
  margin: 0 0 12px;
}

.tc-score-row {
  margin-bottom: 10px;
}

.tc-score-row:last-child {
  margin-bottom: 0;
}

.tc-score-dim {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #4B5563;
  font-weight: 600;
  margin-bottom: 4px;
}

.tc-score-num {
  color: #7C3AED;
  font-weight: 900;
}

.tc-score-max {
  color: #B8BCC9;
  font-weight: 500;
}

.tc-score-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  overflow: hidden;
}

.tc-score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #A78BFA, #EC4899);
  transition: width 0.6s ease;
}

/* 亮点 & 建议 */
.tc-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tc-result-list li {
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  padding: 8px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px dashed rgba(124, 58, 237, 0.08);
}

.tc-result-list li:last-child {
  border-bottom: none;
}

.tc-essay-text {
  font-size: 14px;
  line-height: 1.8;
  color: #4B5563;
  margin: 0;
  white-space: pre-wrap;
}

/* 结果操作按钮 */
.tc-result-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.tc-btn-secondary,
.tc-btn-primary {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease;
}

.tc-btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(196, 181, 253, 0.5);
  color: #6B5FC7;
}

.tc-btn-primary {
  color: #fff;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.28);
}

.tc-btn-secondary:active,
.tc-btn-primary:active {
  transform: translateY(1px);
}
