/* =====================================================================
   香草喵の小窝 — 二次元猫娘主题设计系统
   作者：香草酱 (香草喵)  |  纯 CSS，零依赖
   各游戏模块的交互样式由对应 JS 自注入，本文件只管全局视觉与布局
   ===================================================================== */

/* ---------- 设计 Token ---------- */
:root {
  /* 樱花粉紫系配色 */
  --pink:        #ff8fc7;
  --pink-soft:   #ffd6e8;
  --pink-deep:   #ff5fa2;
  --purple:      #b794f6;
  --purple-soft: #e9d8ff;
  --mint:        #8ef0d6;
  --cream:       #fff5fb;
  --sky:         #bde0fe;
  --ink:         #4a3a5c;
  --ink-soft:    #7a6a8c;

  /* 语义色（亮色主题） */
  --bg:          #fff0f7;
  --bg-2:        #ffe3f1;
  --surface:     #ffffff;
  --surface-2:   #fff7fc;
  --text:        var(--ink);
  --text-soft:   var(--ink-soft);
  --accent:      var(--pink-deep);
  --border:      #ffd0e6;

  /* 形状与阴影 */
  --radius:      22px;
  --radius-lg:   34px;
  --shadow:      0 10px 30px rgba(255, 95, 162, 0.18);
  --shadow-soft: 0 6px 18px rgba(183, 148, 246, 0.18);
  --shadow-pop:  0 14px 40px rgba(255, 95, 162, 0.32);

  /* 字体 */
  --font: "ZCOOL KuaiLe", "Baloo 2", "M PLUS Rounded 1c", "PingFang SC",
          "Microsoft YaHei", system-ui, sans-serif;
}

/* 暗色（夜晚）主题 */
body.night {
  --bg:        #241934;
  --bg-2:      #2e2042;
  --surface:   #342748;
  --surface-2: #3d2e54;
  --text:      #ffe9f6;
  --text-soft: #c9b4e0;
  --accent:    #ff9ed1;
  --border:    #4a3768;
  --shadow:      0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-pop:  0 14px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, var(--purple-soft), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.7;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
  cursor: default;
}

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

::selection { background: var(--pink); color: #fff; }

/* 自定义滚动条 */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--pink); border-radius: 99px;
  border: 3px solid var(--bg);
}

/* ---------- 浮动背景装饰 ---------- */
.bg-decor {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-decor .floaty {
  position: absolute; bottom: -40px; font-size: 26px; opacity: 0.5;
  animation: floatUp linear infinite;
  will-change: transform;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

/* ---------- 鼠标拖尾 ---------- */
.cursor-trail-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9998; }
.cursor-trail-layer .trail {
  position: fixed; transform: translate(-50%, -50%);
  font-size: 18px; pointer-events: none;
  animation: trailFade 0.8s ease-out forwards;
}
@keyframes trailFade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.3) rotate(40deg); }
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 99px; border: none;
  font-family: var(--font); font-size: 1.05rem; cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
  user-select: none;
}
.btn:hover  { transform: translateY(-3px) scale(1.04); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn--primary {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; box-shadow: var(--shadow-pop);
}
.btn--ghost {
  background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow-soft); border: 2px solid var(--border);
}

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border-bottom: 2px solid var(--border);
}
.nav__logo { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; }
.nav__paw { font-size: 1.6rem; animation: wiggle 2.5s ease-in-out infinite; }
.nav__title {
  background: linear-gradient(135deg, var(--pink-deep), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav__menu { display: flex; align-items: center; gap: clamp(8px, 2vw, 22px); }
.nav__link {
  position: relative; padding: 6px 4px; font-size: 1.05rem; color: var(--text-soft);
  transition: color 0.2s;
}
.nav__link::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 0; height: 3px;
  background: var(--pink); border-radius: 99px; transition: width 0.25s;
}
.nav__link:hover { color: var(--accent); }
.nav__link:hover::after { width: 100%; }
.nav__btn {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--surface); font-size: 1.2rem; cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.nav__btn:hover { transform: rotate(-20deg) scale(1.1); }

@keyframes wiggle {
  0%,100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); }
}

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; padding: clamp(30px, 6vw, 70px) clamp(16px, 5vw, 60px) 60px; }
.hero__inner {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(24px, 5vw, 60px);
  align-items: center;
}
.hero__hi { color: var(--accent); font-size: 1.2rem; }
.hero__title { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.12; margin: 6px 0 14px; }
.hero__title-accent {
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--pink-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { color: var(--text-soft); font-size: 1.15rem; margin-bottom: 26px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 30px; }
.hero__stats { display: flex; gap: 26px; }
.hero__stat { display: flex; flex-direction: column; }
.hero__stat b {
  font-size: 1.9rem; color: var(--accent);
  background: linear-gradient(135deg, var(--pink-deep), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__stat span { color: var(--text-soft); font-size: 0.95rem; }

/* Hero 底部波浪 */
.hero__wave {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 70px;
  background:
    radial-gradient(40px 36px at 40px 70px, var(--surface) 99%, transparent) repeat-x;
  background-size: 80px 70px; opacity: 0.7;
}

/* ============ 纯 CSS 手绘猫娘 ============ */
.hero__cat { position: relative; display: flex; flex-direction: column; align-items: center; }
.catgirl {
  position: relative; width: 240px; height: 300px; cursor: pointer;
  animation: idleBob 3.5s ease-in-out infinite; outline: none;
  --skin: #fff4ef; --hair-c: #f7c8df; --hair-d: #ec9fc6;
}
body.night .catgirl { --hair-c: #d7a6ef; --hair-d: #b97fdc; }
@keyframes idleBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* 猫耳 */
.catgirl__ears { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 200px; z-index: 3; }
.ear {
  position: absolute; width: 0; height: 0;
  border-left: 34px solid transparent; border-right: 34px solid transparent;
  border-bottom: 56px solid var(--hair-d);
}
.ear--left  { left: 14px;  transform: rotate(-18deg); transform-origin: bottom center; animation: earTwitchL 4s ease-in-out infinite; }
.ear--right { right: 14px; transform: rotate(18deg);  transform-origin: bottom center; animation: earTwitchR 4s ease-in-out infinite; }
.ear__inner {
  position: absolute; left: -16px; bottom: 6px; width: 0; height: 0;
  border-left: 16px solid transparent; border-right: 16px solid transparent;
  border-bottom: 28px solid var(--pink-soft);
}
@keyframes earTwitchL { 0%,90%,100% { transform: rotate(-18deg);} 95% { transform: rotate(-30deg);} }
@keyframes earTwitchR { 0%,92%,100% { transform: rotate(18deg);} 97% { transform: rotate(30deg);} }

/* 头 */
.catgirl__head {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  width: 180px; height: 170px; z-index: 2;
}
.hair {
  position: absolute; inset: 0; background: var(--hair-c);
  border-radius: 46% 46% 44% 44% / 52% 52% 48% 48%;
  box-shadow: inset -10px -14px 0 rgba(0,0,0,0.04);
}
.hair::before, .hair::after {
  content: ""; position: absolute; bottom: -6px; width: 30px; height: 60px;
  background: var(--hair-c); border-radius: 0 0 60% 60%;
}
.hair::before { left: 6px; transform: rotate(8deg); }
.hair::after  { right: 6px; transform: rotate(-8deg); }
.face {
  position: absolute; left: 50%; top: 58px; transform: translateX(-50%);
  width: 140px; height: 100px; background: var(--skin);
  border-radius: 50% 50% 48% 48%; z-index: 1;
}
.eye {
  position: absolute; top: 30px; width: 26px; height: 32px;
  background: #3a2b48; border-radius: 50%;
  animation: blink 4.2s infinite;
}
body.night .eye { background: #2a1d38; }
.eye--left  { left: 26px; }
.eye--right { right: 26px; }
.pupil {
  position: absolute; top: 6px; left: 6px; width: 11px; height: 11px;
  background: #fff; border-radius: 50%; opacity: 0.9;
}
@keyframes blink { 0%,94%,100% { transform: scaleY(1);} 97% { transform: scaleY(0.1);} }
.blush {
  position: absolute; top: 52px; width: 24px; height: 13px;
  background: var(--pink); border-radius: 50%; opacity: 0.55; filter: blur(1px);
}
.blush--left  { left: 12px; }
.blush--right { right: 12px; }
.mouth {
  position: absolute; left: 50%; top: 66px; transform: translateX(-50%);
  width: 18px; height: 9px;
  border: 3px solid #c46; border-top: none;
  border-radius: 0 0 18px 18px; transition: all 0.25s;
}
/* 开心表情（被摸时 main.js 加 .happy） */
.catgirl.happy .mouth { width: 26px; height: 14px; border-color: var(--pink-deep); }
.catgirl.happy .eye { height: 8px; border-radius: 12px 12px 0 0; top: 42px; animation: none; }
.catgirl.happy .blush { opacity: 0.85; width: 30px; }

/* 身体 */
.catgirl__body {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 150px; height: 120px;
  background: linear-gradient(160deg, var(--purple-soft), var(--pink-soft));
  border-radius: 60px 60px 40px 40px; z-index: 1;
  box-shadow: var(--shadow-soft);
}
/* 尾巴 */
.catgirl__tail {
  position: absolute; bottom: 10px; right: 2px; width: 22px; height: 110px;
  background: var(--hair-d); border-radius: 99px;
  transform-origin: bottom center; animation: tailWag 2.2s ease-in-out infinite;
  z-index: 0;
}
.catgirl__tail::after {
  content: ""; position: absolute; top: -6px; left: -4px; width: 30px; height: 30px;
  background: var(--pink-soft); border-radius: 50%;
}
@keyframes tailWag {
  0%,100% { transform: rotate(14deg); } 50% { transform: rotate(-22deg); }
}

/* 摸摸特效容器 */
.pet-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pet-fx .heart {
  position: absolute; font-size: 22px; animation: heartPop 1s ease-out forwards;
}
@keyframes heartPop {
  0%   { transform: translateY(0) scale(0.4); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(-90px) scale(1.2) rotate(20deg); opacity: 0; }
}

/* 说话气泡 */
.speech-bubble {
  position: relative; margin-bottom: 14px; align-self: center;
  background: var(--surface); color: var(--text);
  padding: 12px 20px; border-radius: 20px; box-shadow: var(--shadow-soft);
  border: 2px solid var(--border); font-size: 1.05rem; max-width: 280px; text-align: center;
  animation: bubbleIn 0.4s cubic-bezier(.34,1.56,.64,1);
}
.speech-bubble::after {
  content: ""; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: var(--surface);
}
@keyframes bubbleIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.hero__hint { margin-top: 18px; color: var(--text-soft); font-size: 0.95rem; text-align: center; }

/* ---------- 区块标题 ---------- */
.section-head { text-align: center; margin: 20px auto 36px; }
.section-head__title { font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--accent); }
.section-head__sub { color: var(--text-soft); font-size: 1.1rem; }

/* ---------- 游戏区 ---------- */
.games { position: relative; z-index: 1; background: var(--surface); padding: 60px clamp(16px, 5vw, 60px); }
.games__grid {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px;
}
.game-card {
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px;
  box-shadow: var(--shadow-soft); transition: transform 0.25s, box-shadow 0.25s;
  display: flex; flex-direction: column;
}
.game-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-pop); }
.game-card--wide { grid-column: 1 / -1; }
.game-card__head { text-align: center; margin-bottom: 16px; }
.game-card__icon {
  display: inline-block; font-size: 2.6rem; margin-bottom: 6px;
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-8px);} }
.game-card__name { font-size: 1.5rem; color: var(--accent); }
.game-card__desc { color: var(--text-soft); font-size: 0.98rem; }
.game-mount { flex: 1; }

/* ---------- 关于 ---------- */
.about { position: relative; z-index: 1; padding: 70px clamp(16px, 5vw, 60px); }
.about__card {
  max-width: 880px; margin: 0 auto; display: flex; gap: 28px; align-items: flex-start;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow);
}
.about__avatar {
  font-size: 4rem; flex-shrink: 0;
  animation: idleBob 3s ease-in-out infinite;
}
.about__title { color: var(--accent); margin-bottom: 10px; font-size: 1.6rem; }
.about__body p { color: var(--text-soft); margin-bottom: 10px; }
.about__body code, kbd {
  background: var(--bg-2); padding: 2px 8px; border-radius: 8px;
  font-family: ui-monospace, monospace; color: var(--accent); font-size: 0.9em;
}
.about__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.about__tags span {
  background: var(--pink-soft); color: var(--pink-deep);
  padding: 5px 14px; border-radius: 99px; font-size: 0.9rem;
}
body.night .about__tags span { background: var(--bg-2); color: var(--accent); }

/* ---------- 页脚 ---------- */
.footer {
  text-align: center; padding: 40px 20px; color: var(--text-soft);
  border-top: 2px solid var(--border); background: var(--surface);
}
.footer__tip { font-size: 0.9rem; margin-top: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__text { order: 2; }
  .hero__cat { order: 1; }
  .hero__cta, .hero__stats { justify-content: center; }
  .games__grid { grid-template-columns: 1fr; }
  .about__card { flex-direction: column; align-items: center; text-align: center; }
  .nav__title { display: none; }
}

/* 尊重减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
