/* ========================================
   云音乐趣味工坊 - 样式（含战斗卡 + 歌单锐评）
   ======================================== */

/* ---------- CSS 变量（浅色/深色） ---------- */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #636366;
  --border: #e8e8ed;
  --border-hover: #c7c7cc;
  --primary: #0071e3;
  --primary-hover: #0066d6;
  --primary-light: #f0f7ff;
  --success: #34c759;
  --danger: #ff3b30;
  --shadow: rgba(0, 0, 0, 0.06);
  --overlay: rgba(255, 255, 255, 0.85);
  --code-bg: #f5f5f7;
  --ai-bg: #f0f7ff;
  --ai-border: #cce5ff;
  --footer-text: #86868b;
  --element-bg: #f0f0f5;
  --element-text: #1d1d1f;
  --rank-1: #ffd700;
  --rank-2: #c0c0c0;
  --rank-3: #cd7f32;
  --wave-stroke: #0071e3;
}

[data-theme="dark"] {
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #8e8e93;
  --border: #3a3a3c;
  --border-hover: #505052;
  --primary: #0a84ff;
  --primary-hover: #409cff;
  --primary-light: #1a2a3f;
  --success: #30d158;
  --danger: #ff453a;
  --shadow: rgba(0, 0, 0, 0.2);
  --overlay: rgba(28, 28, 30, 0.85);
  --code-bg: #1c1c1e;
  --ai-bg: #1a2a3f;
  --ai-border: #0a3a5f;
  --footer-text: #636366;
  --element-bg: #3a3a3c;
  --element-text: #f5f5f7;
  --rank-1: #ffd700;
  --rank-2: #c0c0c0;
  --rank-3: #cd7f32;
  --wave-stroke: #0a84ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ---------- Layout ---------- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
}

/* ---------- Header ---------- */
header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 4px var(--shadow);
}

.tab:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}

[data-theme="dark"] .tab.active {
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  transition: background 0.3s, box-shadow 0.3s;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card .desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Input group ---------- */
.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--surface);
  color: var(--text);
}

.input-group input:focus {
  border-color: var(--primary);
}

.hint-text {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 8px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

/* ---------- Select ---------- */
.select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.select:focus {
  border-color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.secondary {
  background: var(--border);
  color: var(--text);
}

.btn.secondary:hover:not(:disabled) {
  background: var(--border-hover);
}

.btn.icon-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 10px;
}

.btn.icon-btn:hover {
  border-color: var(--border-hover);
}

.btn.small-btn {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.ai-btn {
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  font-weight: 600;
}

.ai-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.result-actions {
  margin-top: 12px;
}

/* ---------- Badge ---------- */
.count-badge {
  background: var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- Result meta ---------- */
.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.playlist-name-display {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   战斗 BGM 属性卡
   ======================================== */

.battle-card {
  border-top: 4px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.battle-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, var(--primary-light), transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}

.battle-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.element-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--element-bg);
  color: var(--element-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 4px 12px var(--shadow);
  flex-shrink: 0;
}

.battle-song-info {
  flex: 1;
  min-width: 0;
}

.battle-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.battle-artist {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.battle-tags {
  font-size: 12px;
  color: var(--text-tertiary);
}

.battle-cooldown {
  text-align: center;
  padding: 10px 16px;
  background: var(--primary-light);
  border-radius: 12px;
  flex-shrink: 0;
}

.cd-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.cd-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.cd-countdown {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---------- 属性条 ---------- */
.stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-label {
  width: 90px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.stat-bar {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: 5px;
  transition: width 0.6s ease;
}

.stat-fill.stat-fire { background: linear-gradient(90deg, #ff6b35, #ff453a); }
.stat-fill.stat-charge { background: linear-gradient(90deg, #a2845e, #cd7f32); }
.stat-fill.stat-bpm { background: linear-gradient(90deg, #5e5ce6, #0a84ff); }
.stat-fill.stat-chorus { background: linear-gradient(90deg, #34c759, #30d158); }
.stat-fill.stat-section { background: linear-gradient(90deg, #64d2ff, #0a84ff); }

.stat-value {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
}

/* ---------- 波形图 ---------- */
.wave-container {
  background: var(--code-bg);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.wave-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.wave-badge {
  background: var(--success);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
}

.wave-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 20px 0;
}

#waveformSvg path {
  stroke: var(--wave-stroke);
}

/* ---------- 技能 ---------- */
.skill-box {
  background: var(--primary-light);
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  padding: 16px;
}

/* ---------- 战力锐评（LLM 生成） ---------- */
.review-box {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.08), transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.review-actions {
  display: flex;
  gap: 6px;
}

.review-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.review-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.skill-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.skill-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.element-evidence {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px dashed var(--ai-border);
  padding-top: 10px;
}

/* ---------- 排面 ---------- */
.rank-card {
  border-left: 4px solid var(--rank-1);
}

.rank-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.rank-overall {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--primary-light), transparent);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.rank-overall-score {
  font-size: 42px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.rank-overall-meta {
  font-size: 14px;
  color: var(--text);
}

.rank-overall-meta strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.rank-dims {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.rank-dim-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.rank-dim-label {
  color: var(--text-secondary);
  text-align: right;
}

.rank-dim-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.rank-dim-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd700, #ff9500);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.rank-dim-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-weight: 500;
}

.rank-dim-best {
  grid-column: 2 / -1;
  font-size: 11px;
  color: var(--text-tertiary);
}

.element-dist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.element-chip {
  background: var(--element-bg);
  color: var(--element-text);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}

/* ---------- 排行榜 ---------- */
.board-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.board-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--code-bg);
  font-size: 14px;
}

.board-rank {
  width: 34px;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.board-row:nth-child(1) .board-rank { color: var(--rank-1); }
.board-row:nth-child(2) .board-rank { color: var(--rank-2); }
.board-row:nth-child(3) .board-rank { color: var(--rank-3); }

.board-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.board-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.board-artist {
  color: var(--text-secondary);
  font-size: 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-value {
  font-weight: 700;
  color: var(--primary);
  width: 54px;
  text-align: right;
  flex-shrink: 0;
}
/* ---------- 候选歌曲选择 ---------- */
.candidate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--code-bg);
  font-size: 14px;
}

.candidate-main {
  flex: 1;
  min-width: 0;
}

.candidate-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-artist {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  flex-shrink: 0;
}

.candidate-pick {
  flex-shrink: 0;
}



/* ========================================
   歌单品味锐评（继承原有样式）
   ======================================== */

.step {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  transition: background 0.3s, box-shadow 0.3s;
}

.step h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ---------- User info bar ---------- */
.user-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  transition: background 0.3s;
}

.user-info-bar .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.user-info-bar .user-detail {
  flex: 1;
}

.user-info-bar .user-name {
  font-weight: 600;
}

.user-info-bar .user-uid {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- User select items (radio) ---------- */
.user-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-select-item:hover {
  border-color: var(--border-hover);
}

.user-select-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.user-select-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.user-select-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.user-select-info {
  flex: 1;
  min-width: 0;
}

.user-select-name {
  font-weight: 600;
  font-size: 14px;
}

.user-select-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Playlist items (radio style - single select) ---------- */
.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.playlist-item:hover {
  border-color: var(--border-hover);
}

.playlist-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.playlist-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.playlist-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
}

.playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Prompt Preview ---------- */
.prompt-preview {
  margin-top: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.preview-text {
  background: var(--code-bg);
  padding: 14px;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  color: var(--text);
  transition: background 0.3s;
}

/* ---------- Full Review Section ---------- */
.full-review-section {
  margin-bottom: 12px;
}

.full-review-btn {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 24px;
  width: 100%;
  text-align: center;
  margin-top: 8px;
}

.full-review-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
}

.full-review-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.full-review-divider::before,
.full-review-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Action Cards (Step 3) ---------- */
.action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  .action-cards {
    grid-template-columns: 1fr;
  }
}

.action-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  background: var(--surface);
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow);
}

.action-card-ai:hover {
  border-color: #0a84ff;
  background: var(--primary-light);
}

.action-card-export:hover {
  border-color: var(--success);
  background: #f0faf0;
}

[data-theme="dark"] .action-card-export:hover {
  background: #1a2f1a;
  border-color: var(--success);
}

.action-card-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.action-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.action-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Step Header (back button) ---------- */
.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.step-header h2 {
  margin-bottom: 0;
}

/* ---------- AI Prompt Summary Bar ---------- */
.ai-prompt-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  flex-wrap: wrap;
}

/* ---------- Markdown Body ---------- */
.markdown-body {
  line-height: 1.75;
  font-size: 14px;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: 600;
  color: var(--text);
}

.markdown-body h1 { font-size: 18px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 14px; }

.markdown-body p {
  margin-bottom: 0.75em;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 20px;
  margin-bottom: 0.75em;
}

.markdown-body li {
  margin-bottom: 0.25em;
}

.markdown-body strong {
  font-weight: 700;
  color: var(--text);
}

.markdown-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
}

.markdown-body pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin-bottom: 1em;
  border: 1px solid var(--border);
}

.markdown-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  margin: 0 0 1em 0;
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

/* ---------- AI Review ---------- */
.ai-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: 12px 12px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.ai-review-content {
  padding: 16px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--ai-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------- Loading overlay ---------- */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 16px;
  transition: background 0.3s;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loadingText {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--footer-text);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

#copyHint {
  min-height: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .container {
    padding: 20px 12px 60px;
  }

  header h1 {
    font-size: 22px;
  }

  .card {
    padding: 20px;
  }

  .step {
    padding: 20px;
  }

  .input-group {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
    text-align: center;
  }

  .result-meta {
    flex-wrap: wrap;
  }

  .theme-toggle {
    top: 10px;
    right: 10px;
  }

  .battle-card-head {
    flex-wrap: wrap;
  }

  .battle-cooldown {
    width: 100%;
  }

  .elem-icon {
    width: 56px;
    height: 56px;
    font-size: 30px;
  }

  .stat-label {
    width: 70px;
    font-size: 12px;
  }

  .stat-value {
    width: 42px;
    font-size: 12px;
  }

  .rank-dim-row {
    grid-template-columns: 70px 1fr 90px;
    font-size: 12px;
  }

  .board-artist {
    display: none;
  }
}