/* ========== 全局变量与基础样式 ========== */
:root {
  --primary: #4a90e2;
  --secondary: #f39c12;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
  --love: #ff6b9d;
  --corrupt: #9b59b6;
  --train: #e67e22;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-dark-glass: rgba(0, 0, 0, 0.05);
  --shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
  --border: rgba(255, 255, 255, 0.18);
}

/* 思维链隐藏 */
think {
  display: none;
}

/* ========== 场景氛围区 ========== */
scene {
  display: block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  font-size: 14px;
  line-height: 1.8;
}

scene::first-line {
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 1px;
}

/* ========== 正文区（毛玻璃效果） ========== */
text {
  display: block;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.9;
  color: #2c3e50;
  position: relative;
  overflow: hidden;
}

text::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.1) 0%, transparent 70%);
  animation: float 15s ease-in-out infinite;
  pointer-events: none;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

text p {
  margin: 12px 0;
  text-indent: 2em;
}

/* ========== 折叠面板通用样式 ========== */
details {
  background: var(--bg-glass);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

details:hover {
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.25);
  transform: translateY(-2px);
}

details[open] {
  background: rgba(255, 255, 255, 0.85);
}

details summary {
  padding: 16px 20px;
  font-weight: bold;
  font-size: 15px;
  color: #34495e;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  background: linear-gradient(90deg, transparent 0%, rgba(74, 144, 226, 0.08) 100%);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: '▶';
  margin-right: 10px;
  transition: transform 0.3s ease;
  color: var(--primary);
  font-size: 12px;
}

details[open] summary::before {
  transform: rotate(90deg);
}

details summary:hover {
  background: linear-gradient(90deg, rgba(74, 144, 226, 0.1) 0%, rgba(74, 144, 226, 0.15) 100%);
  padding-left: 24px;
}

/* ========== 面板内容区 ========== */
hero, quest, shop, npc, harem, forum, risk, memory, action {
  display: block;
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: #2c3e50;
}

/* ========== 通用组件 ========== */
.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-row:last-of-type {
  border-bottom: none;
}

.label {
  font-weight: 600;
  color: #555;
}

.value {
  font-weight: bold;
  color: var(--primary);
  font-size: 15px;
}

.section-title {
  font-weight: bold;
  color: var(--primary);
  margin: 16px 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  font-size: 14px;
}

/* ========== 进度条系统 ========== */
.progress-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--bg-dark-glass);
  border-radius: 12px;
  overflow: hidden;
  margin: 8px 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #5dade2 100%);
  border-radius: 12px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  color: #2c3e50;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* 体力条 */
.progress-bar.stamina .progress-fill {
  background: linear-gradient(90deg, #2ecc71 0%, #27ae60 100%);
}

/* 好感度进度条 */
.progress-bar.love .progress-fill {
  background: linear-gradient(90deg, var(--love) 0%, #ff8fab 100%);
}

/* 堕落度进度条 */
.progress-bar.corrupt .progress-fill {
  background: linear-gradient(90deg, var(--corrupt) 0%, #bb6bd9 100%);
}

/* 调教度进度条 */
.progress-bar.train .progress-fill {
  background: linear-gradient(90deg, var(--train) 0%, #f39c12 100%);
}

/* ========== 主角面板特殊样式 ========== */
.skills {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-dark-glass);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.skills p {
  margin: 6px 0;
}

/* ========== 任务系统样式 ========== */
.quest-item {
  background: var(--bg-dark-glass);
  padding: 16px;
  border-radius: 10px;
  margin: 12px 0;
  border-left: 4px solid var(--warning);
  transition: all 0.3s ease;
}

.quest-item:hover {
  background: rgba(243, 156, 18, 0.1);
  transform: translateX(4px);
}

.quest-name {
  font-weight: bold;
  font-size: 15px;
  color: var(--warning);
  margin-bottom: 8px;
}

.deadline {
  color: var(--danger);
  font-weight: bold;
  margin-top: 8px;
}

.system-tip {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-style: italic;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ========== 商城样式 ========== */
.old-price {
  text-decoration: line-through;
  color: #95a5a6;
  margin-right: 8px;
}

.sale-price {
  color: var(--danger);
  font-weight: bold;
  font-size: 16px;
}

.recommend {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-weight: bold;
}

/* ========== NPC面板样式 ========== */
.npc-name {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
  text-align: center;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--bg-dark-glass);
  border-radius: 8px;
}

.score {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: var(--warning);
  margin-bottom: 12px;
}

.score-detail {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.score-detail span {
  background: var(--bg-dark-glass);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.stat-row {
  margin: 12px 0;
}

.stat-row > span {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 13px;
}

/* ========== 后宫面板样式 ========== */
.harem-item {
  background: var(--bg-dark-glass);
  padding: 14px;
  border-radius: 10px;
  margin: 10px 0;
  border-left: 4px solid var(--love);
  transition: all 0.3s ease;
}

.harem-item:hover {
  background: rgba(255, 107, 157, 0.1);
  transform: translateX(4px);
}

.harem-name {
  font-weight: bold;
  color: var(--love);
  margin-bottom: 6px;
}

/* ========== 论坛样式 ========== */
.heat {
  font-weight: bold;
  color: var(--danger);
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg-dark-glass);
  border-radius: 6px;
  text-align: center;
}

.post {
  background: var(--bg-dark-glass);
  padding: 14px;
  border-radius: 10px;
  margin: 10px 0;
  border-left: 4px solid var(--primary);
  transition: all 0.3s ease;
}

.post:hover {
  background: rgba(74, 144, 226, 0.1);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.post-user {
  font-weight: bold;
  color: #555;
  margin-bottom: 8px;
  font-size: 13px;
}

.post-content {
  color: #2c3e50;
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.6;
}

.post-stats {
  color: #95a5a6;
  font-size: 12px;
  margin-top: 8px;
}

.opinion {
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-weight: bold;
  color: #2d3436;
  text-align: center;
}

/* ========== 风险评估样式 ========== */
.risk-level {
  font-size: 16px;
  font-weight: bold;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 16px;
}

.risk-level.low {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: white;
}

.risk-level.medium {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
}

.risk-level.high {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

.risk-level.critical {
  background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
  color: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3); }
  50% { transform: scale(1.02); box-shadow: 0 6px 20px rgba(142, 68, 173, 0.5); }
}

/* ========== 记忆区样式 ========== */
memory p {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}

/* ========== 推荐行动样式 ========== */
action p {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

action p:hover {
  background: var(--bg-dark-glass);
  padding-left: 16px;
}

.special {
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-weight: bold;
  color: #2d3436;
  border-left: 4px solid var(--warning);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  text {
    padding: 18px;
    font-size: 15px;
  }
  
  scene {
    padding: 16px;
    font-size: 13px;
  }
  
  details summary {
    font-size: 14px;
    padding: 14px 16px;
  }
  
  hero, quest, shop, npc, harem, forum, risk, memory, action {
    padding: 16px;
    font-size: 13px;
  }
  
  .npc-name {
    font-size: 16px;
  }
  
  .score-detail {
    gap: 6px;
  }
  
  .score-detail span {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* ========== 特殊动画效果 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

details[open] > *:not(summary) {
  animation: fadeIn 0.4s ease-out;
}

/* ========== 滚动条美化 ========== */
text::-webkit-scrollbar,
hero::-webkit-scrollbar,
quest::-webkit-scrollbar,
shop::-webkit-scrollbar,
npc::-webkit-scrollbar,
harem::-webkit-scrollbar,
forum::-webkit-scrollbar,
risk::-webkit-scrollbar,
memory::-webkit-scrollbar,
action::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

text::-webkit-scrollbar-track,
hero::-webkit-scrollbar-track,
quest::-webkit-scrollbar-track,
shop::-webkit-scrollbar-track,
npc::-webkit-scrollbar-track,
harem::-webkit-scrollbar-track,
forum::-webkit-scrollbar-track,
risk::-webkit-scrollbar-track,
memory::-webkit-scrollbar-track,
action::-webkit-scrollbar-track {
  background: var(--bg-dark-glass);
  border-radius: 10px;
}

text::-webkit-scrollbar-thumb,
hero::-webkit-scrollbar-thumb,
quest::-webkit-scrollbar-thumb,
shop::-webkit-scrollbar-thumb,
npc::-webkit-scrollbar-thumb,
harem::-webkit-scrollbar-thumb,
forum::-webkit-scrollbar-thumb,
risk::-webkit-scrollbar-thumb,
memory::-webkit-scrollbar-thumb,
action::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary) 0%, #5dade2 100%);
  border-radius: 10px;
}

text::-webkit-scrollbar-thumb:hover,
hero::-webkit-scrollbar-thumb:hover,
quest::-webkit-scrollbar-thumb:hover,
shop::-webkit-scrollbar-thumb:hover,
npc::-webkit-scrollbar-thumb:hover,
harem::-webkit-scrollbar-thumb:hover,
forum::-webkit-scrollbar-thumb:hover,
risk::-webkit-scrollbar-thumb:hover,
memory::-webkit-scrollbar-thumb:hover,
action::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5dade2 0%, var(--primary) 100%);
}

/* ========== 额外点缀效果 ========== */
details summary::after {
  content: '';
  position: absolute;
  right: 20px;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

details[open] summary::after {
  opacity: 1;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ========== Emoji与图标优化 ========== */
scene::first-line,
.section-title,
.quest-name,
.npc-name,
.harem-name {
  letter-spacing: 0.5px;
}

/* ========== 文本选中效果 ========== */
text::selection,
hero::selection,
quest::selection,
shop::selection,
npc::selection,
harem::selection,
forum::selection,
risk::selection,
memory::selection,
action::selection {
  background: rgba(74, 144, 226, 0.3);
  color: #2c3e50;
}