/* ========================================
   CSS 变量定义
   ======================================== */
:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --subtext: #4d4d4d;
  --border: #e5e5e5;
  --shadow: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-heavy: 0 20px 48px rgba(0,0,0,0.16);
  --overlay: rgba(0, 0, 0, 0.4);
  --accent: #0078d4;
}

/* ========================================
   基础样式
   ======================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 50%, #dfe7f0 100%);
  color: var(--text);
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

#popup-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

/* ========================================
   入场弹窗样式
   ======================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.modal {
  width: min(92vw, 480px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  animation: modalAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal .titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #f3f4f6 100%);
  border-bottom: 1px solid var(--border);
}

.modal .titlebar .icon {
  font-size: 24px;
  animation: bounce 1s infinite;
}

.modal .titlebar .title {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.modal .content {
  padding: 24px 20px;
  color: var(--subtext);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
}

.modal .actions {
  padding: 0 20px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  background: #f7f7f7;
  color: var(--text);
  transition: all 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: #0066b8;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn.primary:hover {
  background: #0066b8;
}

.btn:active {
  transform: translateY(0);
}

/* ========================================
   温馨提示弹窗样式
   ======================================== */
.popup {
  position: absolute;
  width: 240px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15), 0 10px 40px rgba(0,0,0,0.1);
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  transform-origin: center;
}

.popup .header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f3f3f3;
  border-bottom: 1px solid var(--border);
}

.popup .header .icon {
  font-size: 14px;
}

.popup .header .title {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.popup .content {
  padding: 16px 14px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* ========================================
   主题颜色样式
   ======================================== */
.popup.theme-blue .header { background: #e3f2fd; border-bottom-color: #bbdefb; }
.popup.theme-blue .content { background: #f1f8ff; }

.popup.theme-green .header { background: #e8f5e9; border-bottom-color: #c8e6c9; }
.popup.theme-green .content { background: #f1f8f4; }

.popup.theme-orange .header { background: #fff3e0; border-bottom-color: #ffe0b2; }
.popup.theme-orange .content { background: #fffaf3; }

.popup.theme-purple .header { background: #f3e5f5; border-bottom-color: #e1bee7; }
.popup.theme-purple .content { background: #faf5fc; }

.popup.theme-pink .header { background: #fce4ec; border-bottom-color: #f8bbd0; }
.popup.theme-pink .content { background: #fff0f5; }

.popup.theme-yellow .header { background: #fffde7; border-bottom-color: #fff9c4; }
.popup.theme-yellow .content { background: #fffef7; }

.popup.theme-cyan .header { background: #e0f7fa; border-bottom-color: #b2ebf2; }
.popup.theme-cyan .content { background: #f0fcff; }

.popup.theme-red .header { background: #ffebee; border-bottom-color: #ffcdd2; }
.popup.theme-red .content { background: #fff5f5; }

.popup.theme-teal .header { background: #e0f2f1; border-bottom-color: #b2dfdb; }
.popup.theme-teal .content { background: #f0faf9; }

.popup.theme-mint .header { background: #e8f8f5; border-bottom-color: #c8ebe3; }
.popup.theme-mint .content { background: #f5fcfa; }

/* ========================================
   动画效果
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalAppear {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* 弹窗出现动画 - 从上 */
@keyframes popupFromTop {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-80px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateY(0);
  }
  80% {
    transform: scale(0.95) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 弹窗出现动画 - 从下 */
@keyframes popupFromBottom {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(80px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateY(0);
  }
  80% {
    transform: scale(0.95) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 弹窗出现动画 - 从左 */
@keyframes popupFromLeft {
  0% {
    opacity: 0;
    transform: scale(0.3) translateX(-80px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateX(0);
  }
  80% {
    transform: scale(0.95) translateX(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
}

/* 弹窗出现动画 - 从右 */
@keyframes popupFromRight {
  0% {
    opacity: 0;
    transform: scale(0.3) translateX(80px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateX(0);
  }
  80% {
    transform: scale(0.95) translateX(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
}

/* 弹窗出现动画 - 从左上 */
@keyframes popupFromTopLeft {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-60px, -60px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translate(0, 0);
  }
  80% {
    transform: scale(0.95) translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}

/* 弹窗出现动画 - 从右上 */
@keyframes popupFromTopRight {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(60px, -60px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translate(0, 0);
  }
  80% {
    transform: scale(0.95) translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}

/* 弹窗出现动画 - 从左下 */
@keyframes popupFromBottomLeft {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(-60px, 60px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translate(0, 0);
  }
  80% {
    transform: scale(0.95) translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}

/* 弹窗出现动画 - 从右下 */
@keyframes popupFromBottomRight {
  0% {
    opacity: 0;
    transform: scale(0.3) translate(60px, 60px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translate(0, 0);
  }
  80% {
    transform: scale(0.95) translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}

/* 动画应用类 */
.anim-top { animation: popupFromTop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-bottom { animation: popupFromBottom 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-left { animation: popupFromLeft 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-right { animation: popupFromRight 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-topleft { animation: popupFromTopLeft 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-topright { animation: popupFromTopRight 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-bottomleft { animation: popupFromBottomLeft 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-bottomright { animation: popupFromBottomRight 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 640px) {
  .popup {
    width: min(240px, 85vw);
    font-size: 13px;
  }
  
  .popup .content {
    font-size: 16px;
    padding: 14px 12px;
  }
  
  .modal .content {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .modal .titlebar {
    padding: 12px 16px;
  }
  
  .modal .content {
    padding: 20px 16px;
  }
  
  .modal .actions {
    padding: 0 16px 16px;
  }
}

