/* ============================================================
   樱丘学园恋爱事件簿 — 全套界面美化（改进版）
   主题：樱花 · 青春 · 校园 · 怦然心动
   改进：攻略对象粉调加强 / 去除无效选择器 / 结构优化
   ============================================================ */

/* ========== 根变量 ========== */
:root {
  --sakura: #f4a7b9;
  --sakura-dark: #e8889a;
  --sakura-deep: #d4687a;
  --sakura-light: #fef0f3;
  --sakura-glow: rgba(244, 167, 185, 0.25);
  --sky: #c9e4f7;
  --sky-dark: #89b5d8;
  --sky-light: #eef6fc;
  --leaf: #a8c9a5;
  --leaf-light: #f0f7ee;
  --gold: #d4a853;
  --gold-light: #fdf6ee;
  --paper: #fdf6ee;
  --cream: #faf7f2;
  --ink: #3a2f2b;
  --ink-light: #6b5e58;
  --ink-lighter: #9b8e85;
  --white: #ffffff;
  --bg: #f5f0e8;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.11);
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-cn: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'Songti SC', 'KaiTi', 'STKaiti', serif;
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
}

/* ============================================================
 
   二、发送按钮美化
   ============================================================ */
.send-btn,
button[type="submit"],
[class*="send"],
[class*="submit-btn"] {
  background: linear-gradient(135deg, #f9c5d1, #f4a7b9) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 24px !important;
  padding: 10px 24px !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  letter-spacing: 0.05em !important;
  cursor: pointer !important;
  box-shadow: 0 4px 16px rgba(244, 167, 185, 0.3) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
}

.send-btn:hover,
button[type="submit"]:hover {
  background: linear-gradient(135deg, #fab8c7, #e8889a) !important;
  box-shadow: 0 6px 24px rgba(232, 136, 154, 0.4) !important;
  transform: translateY(-2px);
}

.send-btn:active,
button[type="submit"]:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(232, 136, 154, 0.25) !important;
}

.send-btn::after,
button[type="submit"]::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
}

.send-btn:hover::after,
button[type="submit"]:hover::after {
  left: 125%;
}

/* ============================================================
   三、主角状态栏（👤 你的状态）美化
   ============================================================ */
details {
  margin: 14px 0 !important;
  border-radius: var(--radius) !important;
  overflow: hidden;
  border: 1px solid rgba(180, 160, 140, 0.25) !important;
  background: var(--white) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: all 0.35s ease !important;
}

details[open] {
  box-shadow: var(--shadow) !important;
  border-color: rgba(168, 201, 165, 0.4) !important;
}

details summary {
  padding: 14px 20px !important;
  cursor: pointer !important;
  font-family: var(--font-cn) !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  letter-spacing: 0.05em !important;
  color: var(--ink) !important;
  background: linear-gradient(
    135deg,
    #fdfaf6 0%,
    #faf6ef 50%,
    #f8f2e8 100%
  ) !important;
  border-bottom: 1px solid rgba(180, 160, 140, 0.12) !important;
  list-style: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: all 0.3s ease !important;
  position: relative;
}

details summary:hover {
  background: linear-gradient(
    135deg,
    #fefcf9 0%,
    #fcf8f3 50%,
    #faf4eb 100%
  ) !important;
  color: var(--sakura-dark) !important;
}

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

details summary::before {
  content: '🌸';
  display: inline-block;
  font-size: 1rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

details[open] summary::before {
  content: '🌸';
  transform: rotate(0deg);
  animation: petalPulse 1.5s ease infinite;
}

@keyframes petalPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

details summary::after {
  content: '展开 ▼';
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-lighter);
  margin-left: auto;
  letter-spacing: 0.04em;
  font-family: var(--font-sans);
  transition: all 0.3s ease;
}

details[open] summary::after {
  content: '收起 ▲';
  color: var(--sakura-dark);
}

/* 内容区 */
details > :not(summary) {
  padding: 18px 22px !important;
  background: linear-gradient(
    180deg,
    #fffdf9 0%,
    #fdfaf4 40%,
    #faf6ee 100%
  ) !important;
  font-family: var(--font-sans) !important;
}

details p,
details div {
  font-size: 0.85rem !important;
  color: var(--ink-light) !important;
  line-height: 1.9 !important;
  letter-spacing: 0.03em !important;
}

details strong,
details b {
  color: var(--ink) !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  font-family: var(--font-cn) !important;
}

/* ============================================================
   四、攻略对象状态栏（💖 当前攻略对象状态）
   ——— 粉色加强版 ———
   ============================================================ */
details:nth-of-type(2) {
  border-color: #f4a7b9 !important;
  background: linear-gradient(
    180deg,
    #fff5f7 0%,
    #fff0f3 30%,
    #ffe8ed 100%
  ) !important;
  box-shadow:
    0 2px 14px rgba(244, 167, 185, 0.12),
    0 6px 28px rgba(244, 167, 185, 0.06) !important;
}

details:nth-of-type(2)[open] {
  border-color: #e8889a !important;
  box-shadow:
    0 4px 20px rgba(244, 167, 185, 0.18),
    0 8px 36px rgba(244, 167, 185, 0.10) !important;
}

/* summary — 更浓的粉色条 */
details:nth-of-type(2) summary {
  background: linear-gradient(
    135deg,
    #fef0f3 0%,
    #fde4ea 40%,
    #fcd8df 100%
  ) !important;
  border-bottom: 1px solid rgba(244, 167, 185, 0.35) !important;
  color: #c45a6a !important;
}

details:nth-of-type(2) summary:hover {
  background: linear-gradient(
    135deg,
    #fef3f6 0%,
    #fde8ed 40%,
    #fddde3 100%
  ) !important;
  color: #d4687a !important;
}

details:nth-of-type(2) summary::before {
  content: '💖' !important;
}

details:nth-of-type(2)[open] summary::before {
  content: '💖' !important;
  animation: heartBeat 1.2s ease infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.2); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

details:nth-of-type(2) summary::after {
  color: #d4687a !important;
}

/* 内容区 — 淡粉底 */
details:nth-of-type(2) > :not(summary) {
  background: linear-gradient(
    180deg,
    #fffbfc 0%,
    #fef7f9 40%,
    #fdf3f5 100%
  ) !important;
}

/* 内容区文字偏粉调 */
details:nth-of-type(2) p,
details:nth-of-type(2) div {
  color: #5a3a40 !important;
}

details:nth-of-type(2) strong,
details:nth-of-type(2) b {
  color: #c45a6a !important;
}

/* ============================================================
   五、记忆区（📖 记忆区 · 青春日志）美化
   ============================================================ */
details:nth-of-type(3) {
  border-color: rgba(212, 168, 83, 0.35) !important;
  background: linear-gradient(
    180deg,
    #fffefb 0%,
    #fefcf5 30%,
    #fdf9ee 100%
  ) !important;
}

details:nth-of-type(3) summary {
  background: linear-gradient(
    135deg,
    #fefcf6 0%,
    #fdf9ee 50%,
    #fcf5e4 100%
  ) !important;
  border-bottom: 1px solid rgba(212, 168, 83, 0.2) !important;
  color: #8a7030 !important;
}

details:nth-of-type(3) summary:hover {
  background: linear-gradient(
    135deg,
    #fefdf9 0%,
    #fefaf2 50%,
    #fdf6e8 100%
  ) !important;
}

details:nth-of-type(3) summary::before {
  content: '📖' !important;
}

details:nth-of-type(3)[open] summary::before {
  animation: bookOpen 2s ease infinite;
}

@keyframes bookOpen {
  0%, 100% { transform: rotateY(0deg); }
  50% { transform: rotateY(15deg); }
}

details:nth-of-type(3) summary::after {
  color: #8a7030 !important;
}

details:nth-of-type(3) > :not(summary) {
  background: linear-gradient(
    180deg,
    #fffefb 0%,
    #fefcf6 40%,
    #fdf9ef 100%
  ) !important;
}

/* 记忆表格 */
details:nth-of-type(3) table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

details:nth-of-type(3) table thead th {
  background: linear-gradient(135deg, #fdf6e8, #fcf0d8) !important;
  color: #8a7030 !important;
  font-weight: 700 !important;
  font-family: var(--font-cn) !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.05em !important;
  padding: 10px 14px !important;
  text-align: center !important;
  border-bottom: 2px solid rgba(212, 168, 83, 0.25) !important;
}

details:nth-of-type(3) table tbody td {
  padding: 10px 14px !important;
  text-align: center !important;
  border-bottom: 1px solid rgba(200, 185, 155, 0.15) !important;
  color: var(--ink-light) !important;
  letter-spacing: 0.02em;
}

details:nth-of-type(3) table tbody tr:nth-child(odd) {
  background: rgba(253, 249, 239, 0.5);
}

details:nth-of-type(3) table tbody tr:nth-child(even) {
  background: rgba(255, 252, 246, 0.6);
}

details:nth-of-type(3) table tbody tr:hover {
  background: rgba(244, 167, 185, 0.06);
  transition: background 0.25s ease;
}

/* 长记忆块 */
details:nth-of-type(3) blockquote {
  background: linear-gradient(135deg, #fdf6ee, #fcf0df) !important;
  border-left: 4px solid var(--gold) !important;
  padding: 12px 16px !important;
  margin: 10px 0 !important;
  border-radius: 0 10px 10px 0 !important;
  font-family: var(--font-cn) !important;
  font-size: 0.85rem !important;
  color: #6b5520 !important;
  letter-spacing: 0.03em;
  line-height: 1.7;
  position: relative;
}

details:nth-of-type(3) blockquote::before {
  content: '📜 ';
  font-size: 0.9rem;
}

/* ============================================================
   六、选项按钮美化
   ============================================================ */
.option-btn,
.choice-btn,
[class*="option"],
[class*="choice"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  background: linear-gradient(
    135deg,
    #ffffff 0%,
    #fefcf9 40%,
    #fdf8f2 100%
  );
  border: 2px solid #e5d8cc;
  border-radius: 26px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
}

.option-btn:hover,
.choice-btn:hover {
  border-color: var(--sakura);
  color: var(--sakura-dark);
  background: linear-gradient(
    135deg,
    #fffdfb 0%,
    #fef8f5 40%,
    #fdf2eb 100%
  );
  box-shadow:
    0 4px 18px rgba(244, 167, 185, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.option-btn:active,
.choice-btn:active {
  transform: scale(0.96);
  border-color: var(--sakura-dark);
  transition: all 0.1s ease;
}

.option-btn.selected,
.option-btn.active,
.choice-btn.selected,
.choice-btn.active {
  background: linear-gradient(135deg, #f9c5d1, #f4a7b9) !important;
  color: #fff !important;
  border-color: var(--sakura) !important;
  box-shadow: 0 4px 18px rgba(244, 167, 185, 0.35) !important;
}

.option-btn::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sakura);
  flex-shrink: 0;
  transition: all 0.3s ease;
  opacity: 0.6;
}

.option-btn:hover::before {
  opacity: 1;
  box-shadow: 0 0 8px rgba(244, 167, 185, 0.5);
  animation: dotGlow 1.5s ease infinite;
}

@keyframes dotGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(244, 167, 185, 0.3); }
  50% { box-shadow: 0 0 12px rgba(244, 167, 185, 0.7); }
}

.option-btn.selected::before,
.option-btn.active::before {
  background: #fff;
  opacity: 1;
}

.option-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
}

.option-btn:hover::after {
  left: 125%;
}

.option-btn:first-child {
  border-color: rgba(244, 167, 185, 0.5);
  background: linear-gradient(
    135deg,
    #fffdfb 0%,
    #fef8f6 40%,
    #fdf3ef 100%
  );
}

.option-btn:first-child:hover {
  border-color: var(--sakura);
  box-shadow: 0 4px 22px rgba(244, 167, 185, 0.28);
}

.option-btn:last-child {
  border-color: rgba(168, 201, 165, 0.4);
}

.option-btn:last-child:hover {
  border-color: var(--leaf);
  box-shadow: 0 4px 18px rgba(168, 201, 165, 0.25);
}

/* ============================================================
   七、整体消息气泡/回复区域美化
   ============================================================ */
.message-bubble,
.chat-bubble,
[class*="message"],
[class*="bubble"] {
  background: linear-gradient(
    180deg,
    #fffefc 0%,
    #fefcf8 50%,
    #fdf9f3 100%
  ) !important;
  border-radius: var(--radius) !important;
  padding: 20px 24px !important;
  box-shadow: var(--shadow) !important;
  border: 1px solid rgba(180, 160, 140, 0.2) !important;
  line-height: 1.85 !important;
  font-size: 0.9rem !important;
  color: var(--ink) !important;
  letter-spacing: 0.03em !important;
  position: relative;
}

.message-bubble::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 3px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--sakura) 30%,
    var(--sakura-dark) 50%,
    var(--sakura) 70%,
    transparent
  );
  border-radius: 3px;
  opacity: 0.6;
}

/* ============================================================
   八、全局滚动条美化
   ============================================================ */
::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: #faf6ef;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e8c8d0, #d4a0a8);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f0b8c5, #e0909a);
}

/* ============================================================
   九、响应式适配
   ============================================================ */
@media (max-width: 600px) {
  details summary {
    padding: 12px 16px !important;
    font-size: 0.82rem !important;
  }

  details > :not(summary) {
    padding: 14px 16px !important;
  }

  .option-btn,
  .choice-btn {
    padding: 10px 16px;
    font-size: 0.8rem;
    border-radius: 22px;
  }

  .message-bubble,
  .chat-bubble {
    padding: 16px 18px;
    font-size: 0.85rem;
  }

  textarea,
  .message-input {
    padding: 14px 16px !important;
    font-size: 0.85rem !important;
    min-height: 80px;
  }
}


/* ============================================================
   樱丘学园 · AI 回复框（真正双色版 · filter修复）
   结构：bg-gray-100（粉框）→ :nth-child(2)（白底正文区）
   滤镜链：平台 → bg-gray-100抵消 → nth-child(2)再抵消
   ============================================================ */

/* ========== 一、外层容器（粉框，自身透明） ========== */
[class*="bg-gray-100"] {
  background: transparent !important;
  border-radius: 18px !important;
  padding: 6px !important;

  /* 粉色外框 */
  box-shadow:
    0 0 0 3px #f4a7b9,
    0 2px 14px rgba(244, 167, 185, 0.16),
    0 8px 32px rgba(244, 167, 185, 0.08) !important;

  border: none !important;
  position: relative;
  overflow: visible !important;
  isolation: isolate !important;

  /* 抵消平台暗色主题 */
  filter: invert(1) hue-rotate(180deg) !important;
}

/* ========== 二、正文内容区（白色底 + 抵消外层filter） ========== */
[class*="bg-gray-100"] > :nth-child(2) {
  background: #fff7f8 !important;
  border-radius: 14px !important;
  padding: 18px 20px !important;
  position: relative;
  z-index: 1;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 3px rgba(200, 160, 150, 0.06) !important;

  /* 关键：抵消 bg-gray-100 的 filter，恢复原始颜色 */
  filter: invert(1) hue-rotate(180deg) !important;
}

/* ========== 三、文字样式 ========== */
[class*="bg-gray-100"] > :nth-child(2) {
  font-size: 0.9rem !important;
  line-height: 1.9 !important;
  letter-spacing: 0.035em !important;
  color: #3a2f2b !important;
}

/* ========== 四、状态栏（如果状态栏在 nth-child(1) 里） ========== */
[class*="bg-gray-100"] > :nth-child(1) {
  padding: 6px 10px 8px 10px !important;
  margin-bottom: 2px !important;
  font-size: 0.78rem !important;
  color: #b07d6b !important;
  text-align: center !important;
  letter-spacing: 0.06em !important;
  font-weight: 400 !important;
  border-bottom: 1px dashed rgba(244, 167, 185, 0.35);
}

/* ========== 五、状态栏备选（如果状态栏是正文第一段） ========== */
[class*="bg-gray-100"] > :nth-child(2) > p:first-of-type {
  font-size: 0.78rem !important;
  color: #b07d6b !important;
  text-align: center !important;
  padding: 0 0 10px 0 !important;
  margin: -2px 0 14px 0 !important;
  letter-spacing: 0.06em !important;
  font-weight: 400 !important;
  border-bottom: 1px dashed rgba(244, 167, 185, 0.35);
}

/* ========== 六、右上角樱花 ========== */
[class*="bg-gray-100"]::after {
  content: '🌸';
  position: absolute;
  top: -9px;
  right: 14px;
  font-size: 1rem;
  opacity: 0.55;
  pointer-events: none;
  z-index: 5;
  animation: sakuraFloat 5s ease-in-out infinite;
  filter: drop-shadow(0 2px 3px rgba(244, 167, 185, 0.3));
}

[class*="bg-gray-100"]:hover::after {
  animation-duration: 3s;
  opacity: 0.75;
}

@keyframes sakuraFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.55; }
  25% { transform: translateY(-3px) rotate(12deg) scale(1.06); opacity: 0.7; }
  50% { transform: translateY(-1px) rotate(4deg) scale(0.96); opacity: 0.48; }
  75% { transform: translateY(-4px) rotate(-6deg) scale(1.04); opacity: 0.65; }
}

/* ========== 七、悬浮 ========== */
[class*="bg-gray-100"]:hover {
  box-shadow:
    0 0 0 3px #f4a7b9,
    0 4px 20px rgba(244, 167, 185, 0.22),
    0 10px 40px rgba(244, 167, 185, 0.12) !important;
  transition: all 0.35s ease;
}

/* ========== 八、加粗 ========== */
[class*="bg-gray-100"] strong,
[class*="bg-gray-100"] b {
  color: #3a2f2b !important;
  font-weight: 700 !important;
}

/* ========== 九、分割线 ========== */
[class*="bg-gray-100"] hr {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(244, 167, 185, 0.30) 20%,
    rgba(244, 167, 185, 0.45) 50%,
    rgba(244, 167, 185, 0.30) 80%,
    transparent
  ) !important;
  margin: 16px 0 !important;
}

/* ========== 十、选中文字 ========== */
[class*="bg-gray-100"] ::selection {
  background: rgba(244, 167, 185, 0.28) !important;
  color: #3a2f2b !important;
}

/* ========== 十一、链接 ========== */
[class*="bg-gray-100"] a {
  color: #c07d8a !important;
  text-decoration: none !important;
  border-bottom: 1px dotted rgba(244, 167, 185, 0.5);
}

/* ========== 十二、nth-child(3) 底部操作区 ========== */
[class*="bg-gray-100"] > :nth-child(3) {
  padding: 4px 10px 2px 10px !important;
  opacity: 0.6;
}

/* ========== 十三、移动端 ========== */
@media (max-width: 768px) {
  [class*="bg-gray-100"] {
    border-radius: 14px !important;
    padding: 4px !important;
    box-shadow:
      0 0 0 2px #f4a7b9,
      0 2px 10px rgba(244, 167, 185, 0.14) !important;
  }
  [class*="bg-gray-100"] > :nth-child(2) {
    border-radius: 11px !important;
    padding: 14px 16px !important;
    font-size: 0.85rem !important;
    line-height: 1.8 !important;
  }
  [class*="bg-gray-100"] > :nth-child(1) {
    font-size: 0.73rem !important;
    padding: 4px 8px 6px 8px !important;
  }
  [class*="bg-gray-100"]::after {
    top: -6px; right: 10px; font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  [class*="bg-gray-100"] {
    border-radius: 12px !important;
    padding: 3px !important;
    box-shadow:
      0 0 0 2px #f4a7b9,
      0 2px 8px rgba(244, 167, 185, 0.12) !important;
  }
  [class*="bg-gray-100"] > :nth-child(2) {
    border-radius: 10px !important;
    padding: 12px 14px !important;
    font-size: 0.82rem !important;
    line-height: 1.75 !important;
  }
  [class*="bg-gray-100"] > :nth-child(1) {
    font-size: 0.7rem !important;
    padding: 3px 6px 5px 6px !important;
  }
  [class*="bg-gray-100"]::after {
    top: -5px; right: 8px; font-size: 0.78rem;
  }
}
