:root {
  --bg: #0e0f14;
  --card: #161821;
  --text: #e9ecf1;
  --muted: #a9b0bd;
  --primary: #4fc3f7;
  --accent: #ffb74d;
  --success: #9ccc65;
  --danger: #ef5350;
  --radius: 14px;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  --run-speed: 10s; /* 动画速度，JS可调 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, #0c0d12, var(--bg));
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(180%) blur(8px);
  background: rgba(12, 13, 18, 0.55);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-content { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.logo { font-weight: 700; letter-spacing: 1px; font-size: 18px; }
.nav a { color: var(--muted); text-decoration: none; margin-left: 16px; }
.nav a:hover { color: var(--text); }

.hero { padding: 48px 0; }
.hero h1 { font-size: clamp(24px, 3vw, 40px); margin: 0 0 8px 0; }
.hero .subtitle { color: var(--muted); margin-bottom: 18px; }

.carousel { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--card); }
.slides { display: flex; transition: transform 600ms ease; }
.slide { min-width: 100%; position: relative; }
.hero-photo { display: block; width: 100%; height: 460px; object-fit: cover; animation: breathe 8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.ctrl { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.35); border: none; color: #fff; padding: 10px 12px; cursor: pointer; border-radius: 999px; }
.ctrl:hover { background: rgba(0,0,0,0.55); }
.ctrl.prev { left: 12px; }
.ctrl.next { right: 12px; }
.dots { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.35); cursor: pointer; }
.dot.active { background: var(--primary); }

.gallery { padding: 44px 0 24px; }
h2 { font-size: clamp(20px, 3vw, 28px); margin: 0 0 8px; }
.section-desc { color: var(--muted); margin: 0 0 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .photo-grid { grid-template-columns: 1fr; } }
.photo-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.photo-card figcaption { padding: 10px 12px; color: var(--muted); }
.photo { width: 100%; height: 220px; object-fit: cover; display: block; transition: transform 320ms ease; }
.photo-card:hover .photo { transform: scale(1.04) translateY(-2px); }
.floating { animation: floatY 6s ease-in-out infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.encyclopedia { padding: 44px 0; }
.tools { display: flex; gap: 12px; margin-bottom: 12px; }
#breedSearch { flex: 1; padding: 12px 14px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.08); background: #12141b; color: var(--text); }
.breed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) { .breed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .breed-grid { grid-template-columns: 1fr; } }
.breed-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; cursor: pointer; display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; transition: transform 200ms ease, box-shadow 200ms ease; }
.breed-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,0.45); }
.breed-icon { font-size: 28px; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 12px; background: linear-gradient(135deg, rgba(79,195,247,.15), rgba(255,183,77,.15)); animation: wag 1.4s ease-in-out infinite; }
.breed-title { font-weight: 600; }
.breed-sub { color: var(--muted); font-size: 13px; }
@keyframes wag { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(6deg); } }

.dynamic { padding: 44px 0 66px; }
.controls { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.btn { padding: 8px 12px; border: 1px solid rgba(255,255,255,0.12); background: #12141b; color: var(--text); border-radius: 9px; cursor: pointer; }
.btn:hover { background: #0f1117; }
.runway { position: relative; height: 240px; background:
  radial-gradient(1200px 300px at 50% 110%, rgba(79,195,247,0.08), transparent),
  linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.runner { position: absolute; left: -15%; top: 0; font-size: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.runner .sprite { display: inline-flex; align-items: center; gap: 8px; animation: runX var(--run-speed) linear infinite; }
.runner.paused .sprite { animation-play-state: paused; }
.runner .dog { display: inline-block; }
@keyframes runX { from { transform: translateX(0); } to { transform: translateX(130vw); } }

.site-footer { padding: 24px 0; border-top: 1px solid rgba(255,255,255,0.06); color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.6); z-index: 40; }
.modal.show { display: flex; }
.modal-content { width: min(680px, 92vw); background: var(--card); border-radius: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.modal-close { position: absolute; right: 12px; top: 12px; border: none; background: rgba(255,255,255,0.08); color: var(--text); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.modal-body { padding: 18px 18px 22px; }
.modal-hero { font-size: 46px; animation: bounce 2.2s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Accessibility focus */
:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- 深景轮播（景深拉进）效果增强 --- */
.carousel { perspective: 1000px; transform-style: preserve-3d; }
.hero .hero-photo { animation: none; }
.slide .hero-photo { transform-origin: 50% 50%; will-change: transform, filter; }
.depth-enter { animation: depthIn 900ms ease both; }
.depth-exit { animation: depthOut 900ms ease both; }
@keyframes depthIn {
  0% { transform: translateZ(-80px) scale(1.06); filter: blur(2px) brightness(0.95); }
  100% { transform: translateZ(0) scale(1); filter: blur(0) brightness(1); }
}
@keyframes depthOut {
  0% { transform: translateZ(0) scale(1); filter: blur(0) brightness(1); }
  100% { transform: translateZ(-120px) scale(1.08); filter: blur(2.5px) brightness(0.9); }
}

/* --- 每犬种独立动态渲染：多样化动画轨迹 --- */
.runner .label {
  position: absolute;
  top: -24px;
  left: 0;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 999px;
}

/* 新增多样化动画轨迹 */
@keyframes zigzagX {
  0% { transform: translate(0, 0); }
  20% { transform: translate(26vw, -7px); }
  40% { transform: translate(52vw, 7px); }
  60% { transform: translate(78vw, -5px); }
  80% { transform: translate(104vw, 5px); }
  100% { transform: translate(130vw, 0); }
}
@keyframes bounceRun {
  0% { transform: translate(0, 0); }
  25% { transform: translate(32vw, -12px); }
  50% { transform: translate(64vw, 0); }
  75% { transform: translate(96vw, -10px); }
  100% { transform: translate(130vw, 0); }
}
@keyframes waveRun {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(32vw, 4px) rotate(4deg); }
  50% { transform: translate(64vw, -4px) rotate(-4deg); }
  75% { transform: translate(96vw, 3px) rotate(3deg); }
  100% { transform: translate(130vw, 0) rotate(0deg); }
}
@keyframes driftRun {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(65vw, 2px) scale(1.04); }
  100% { transform: translate(130vw, 0) scale(1); }
}

/* --- 对话气泡 --- */
.runner .label {
  position: absolute;
  top: -24px;
  left: 0;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 999px;
}
.bubble {
  position: absolute;
  left: 40px;
  top: -74px;
  max-width: min(360px, 68vw);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: #1d2230;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.bubble.show { opacity: 1; transform: translateY(0); }
.bubble::after {
  content: '';
  position: absolute;
  left: -8px;
  bottom: 12px;
  width: 0; height: 0;
  border-right: 8px solid #1d2230;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}