/* codex: 2026-09-29 modal.css 弹窗对话框、多主题色彩适配、数学标签与祝贺特效 */

/* 模态弹窗遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* 弹窗卡片本体 */
.modal-card {
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #1e293b);
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.15));
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.02);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.08);
}

body.theme-dark .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.68;
  color: var(--text-main);
}

.modal-footer {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.02);
  gap: 10px;
}

/* 规则排版 */
.rule-section {
  margin-bottom: 18px;
}

.rule-section h3 {
  font-size: 1.05rem;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.rule-section ul {
  padding-left: 20px;
}

.rule-section li {
  margin-bottom: 6px;
}

/* 数学原理选项卡与公式排版 */
.math-tab-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.math-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.math-tab-btn.active {
  color: #fff;
  background: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.math-tab-content {
  display: none;
}

.math-tab-content.active {
  display: block;
}

.math-tab-content h4 {
  font-size: 1.1rem;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.math-formula {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "Georgia", "Times New Roman", serif;
  font-size: 1.08rem;
  color: var(--text-main);
  margin: 12px 0;
  display: block;
  text-align: center;
  letter-spacing: 0.5px;
}

.math-formula em {
  font-style: italic;
  font-family: "Cambria Math", "Latin Modern Math", "Georgia", serif;
  padding: 0 1px;
}

.math-highlight {
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--accent-gold);
  font-weight: 600;
  margin: 14px 0;
}

/* 祝贺庆祝弹窗特效 */
.congrat-card {
  text-align: center;
  max-width: 480px;
}

.congrat-stars {
  font-size: 2.8rem;
  margin-bottom: 12px;
  letter-spacing: 6px;
  filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.6));
}

.congrat-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.congrat-praise-text {
  font-size: 1.05rem;
  color: var(--accent-blue);
  font-weight: 600;
  margin-bottom: 16px;
}

.congrat-stats {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

/* 庆祝彩屑 Canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10001;
  display: none;
}

/* 问候 Toast 悬浮横幅 */
.greeting-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.greeting-toast.show {
  transform: translateX(-50%) translateY(0);
}
