/**
 * SKKF 公共样式库
 * 包含：CSS 变量、基础样式、背景效果、常用组件
 */

/* ========== CSS 变量 ========== */
:root {
  /* 主题色 */
  --night: #0d1220;
  --sky: #14203b;
  --pink: #ff7ab6;
  --mint: #7ee6e6;
  --sun: #ffd77a;
  
  /* 功能色 */
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  
  /* 文字色 */
  --ink: #f6f7fb;
  --muted: #c7d0e4;
  
  /* 玻璃效果 */
  --glass: rgba(255,255,255,0.12);
  --glass-border: rgba(255,255,255,0.2);
  --glass-hover: rgba(255,255,255,0.35);
}

/* ========== 基础重置 ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "ZCOOL KuaiLe", "LXGW WenKai", "Noto Serif CJK SC", system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 可访问性与交互细节 ========== */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

button, input, textarea, select {
  font-family: inherit;
}

button, a, .btn {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: rgba(126,230,230,0.25);
}

/* WebKit 自动填充在暗色背景下的可读性 */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0px 1000px rgba(0,0,0,0.22) inset;
}

/* 滚动条（不影响非 WebKit 浏览器） */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0);
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.28);
    background-clip: padding-box;
  }
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== 背景效果 ========== */
.bg-gradient {
  background:
    radial-gradient(900px 500px at 10% -5%, rgba(255,122,182,0.35), transparent 60%),
    radial-gradient(800px 400px at 90% 10%, rgba(126,230,230,0.25), transparent 65%),
    radial-gradient(1200px 800px at 50% 120%, rgba(255,215,122,0.18), transparent 60%),
    linear-gradient(180deg, #0b1020, #121a33 50%, #0d1220);
  background-attachment: fixed;
}

/* 星星动画背景 */
.stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(255,255,255,0.7) 50%, transparent 52%),
    radial-gradient(2px 2px at 20% 70%, rgba(255,255,255,0.6) 50%, transparent 52%),
    radial-gradient(2px 2px at 45% 30%, rgba(255,255,255,0.8) 50%, transparent 52%),
    radial-gradient(2px 2px at 70% 25%, rgba(255,255,255,0.6) 50%, transparent 52%),
    radial-gradient(2px 2px at 82% 60%, rgba(255,255,255,0.7) 50%, transparent 52%);
  opacity: 0.6;
  animation: twinkle 7s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.75; }
}

/* 渐变丝带效果 */
.ribbons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255,122,182,0.12), transparent 50%),
    linear-gradient(-140deg, rgba(126,230,230,0.12), transparent 50%);
  mix-blend-mode: screen;
  z-index: -1;
}

/* ========== 容器 ========== */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--glass-hover);
  background: rgba(255,255,255,0.12);
}

.btn-primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #000;
}

.btn-primary:hover {
  background: #ff8ec4;
  border-color: #ff8ec4;
}

.btn-mint {
  background: rgba(126,230,230,0.2);
  border-color: rgba(126,230,230,0.4);
  color: var(--mint);
}

.btn-mint:hover {
  background: rgba(126,230,230,0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
}

/* ========== 卡片 ========== */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
}

.card-hover {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--glass-hover);
  box-shadow: 0 26px 60px rgba(0,0,0,0.45);
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.tag-pink {
  background: rgba(255,122,182,0.2);
  border: 1px solid rgba(255,122,182,0.3);
  color: #ffd2e4;
}

.tag-mint {
  background: rgba(126,230,230,0.14);
  border: 1px solid rgba(126,230,230,0.18);
  color: #d7ffff;
}

.tag-sun {
  background: rgba(255,215,122,0.2);
  border: 1px solid rgba(255,215,122,0.3);
  color: #fff3d9;
}

.tag-success {
  background: rgba(74,222,128,0.2);
  border: 1px solid rgba(74,222,128,0.3);
  color: #7fff9b;
}

.tag-danger {
  background: rgba(248,113,113,0.2);
  border: 1px solid rgba(248,113,113,0.3);
  color: #ffc4c4;
}

/* ========== 表单元素 ========== */
.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--mint);
}

.input::placeholder {
  color: var(--muted);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* ========== Toast 提示 ========== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  padding: 12px 20px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  z-index: 9999;
}

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

.toast.success {
  border-color: rgba(74,222,128,0.5);
}

.toast.error {
  border-color: rgba(248,113,113,0.5);
}

/* ========== 加载动画 ========== */
.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-pink { color: var(--pink); }
.text-mint { color: var(--mint); }
.text-sun { color: var(--sun); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }

/* ========== 动画 ========== */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.float-up {
  animation: floatUp 0.6s ease forwards;
}

@keyframes floatUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 响应式断点 ========== */
@media (max-width: 768px) {
  .wrap, .wrap-narrow, .wrap-wide {
    padding: 0 12px;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }
  
  .card {
    padding: 16px;
    border-radius: 14px;
  }
  
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

body.prismatic {
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --bloom-glow: 0 0 20px rgba(126, 230, 230, 0.1);
  
  letter-spacing: 0.02em;
}

body.prismatic .bg-gradient {
  animation: prismatic-breathe 24s ease-in-out infinite alternate;
}

@keyframes prismatic-breathe {
  0% { filter: hue-rotate(0deg) saturate(100%) brightness(100%); }
  50% { filter: hue-rotate(8deg) saturate(115%) brightness(105%); }
  100% { filter: hue-rotate(-5deg) saturate(105%) brightness(100%); }
}

body.prismatic::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: overlay;
  opacity: 0.6;
}

body.prismatic .card,
body.prismatic .hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: var(--glass-shadow), inset 0 1px 0 0 rgba(255,255,255,0.1);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(110%);
}

body.prismatic .card:hover,
body.prismatic .link-card:hover {
  border-color: var(--glass-highlight);
  box-shadow: 0 24px 50px rgba(0,0,0,0.5), inset 0 0 0 1px var(--glass-highlight), var(--bloom-glow);
  transform: translateY(-4px);
}

/* 排除非卡片链接的 hover 效果 */
body.prismatic a.card:hover,
body.prismatic a.link-card:hover {
  transform: translateY(-4px) scale(1.005);
}

body.prismatic h1,
body.prismatic h2,
body.prismatic h3 {
  text-shadow: 0 4px 12px rgba(0,0,0,0.3);
  letter-spacing: 0.04em;
}

body.prismatic p {
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* 修复 SVG 图标过大问题：限制 header 返回链接中的 SVG 尺寸 */
body.prismatic header svg,
body.prismatic .back-link svg {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
}

body.prismatic .btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  backdrop-filter: blur(8px);
}

body.prismatic .btn:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.1));
  box-shadow: 0 6px 20px rgba(0,0,0,0.25), 0 0 15px rgba(255,255,255,0.15);
  border-color: var(--glass-highlight);
  transform: translateY(-1px);
}


