@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}

/* 自定义动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 老虎机动画 */
@keyframes slotMachine {
  0% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-10px);
  }
  50% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes slotSpin {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 165, 0, 0.6);
  }
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* 慢速旋转动画 */
@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin-slow {
  animation: spin-slow 3s linear infinite;
}

.animate-slot-machine {
  animation: slotMachine 0.3s ease-in-out;
}

.animate-slot-spin {
  animation: slotSpin 0.5s ease-in-out;
}

.animate-glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

.animate-sparkle {
  animation: sparkle 1.5s ease-in-out infinite;
}

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

@keyframes textFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(1.05);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(251, 146, 60, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(251, 146, 60, 0.6);
  }
}

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

.animate-fadeInUp {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-slideIn {
  animation: slideIn 0.3s ease-out forwards;
}

.animate-textFadeIn {
  animation: textFadeIn 0.5s ease-out forwards;
}

.animate-textFadeOut {
  animation: textFadeOut 0.3s ease-out forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* 文字切换容器 */
.text-transition {
  position: relative;
  overflow: hidden;
}

.text-transition .text-item {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-transition .text-item.entering {
  animation: textFadeIn 0.5s ease-out forwards;
}

.text-transition .text-item.leaving {
  animation: textFadeOut 0.3s ease-out forwards;
}

/* 按钮悬停效果 */
.btn-magic {
  position: relative;
  overflow: hidden;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 滚动提示动画 */
@keyframes scrollHint {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

.scroll-hint {
  animation: scrollHint 2s ease-in-out infinite;
}

/* 屏幕切换动画 */
.screen-transition {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  height: 200vh; /* 包含两个屏幕的高度 */
  position: relative;
}

.screen-main {
  transform: translateY(0);
}

.screen-ranking {
  transform: translateY(-100vh);
}

.screen-transitioning {
  pointer-events: none;
}

/* 确保每个屏幕内容不会互相干扰 */
.screen-transition > div {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* 当显示排行榜时，隐藏主屏幕内容 */
.screen-ranking > div:first-child {
  visibility: hidden;
  pointer-events: none;
}

/* 当显示主屏幕时，隐藏排行榜内容 */
.screen-main > div:last-child {
  visibility: hidden;
  pointer-events: none;
}

/* 防止滚动条 */
body {
  overflow: hidden;
}

/* 隐藏滚动条但保持滚动功能 */
.hide-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

/* 浮动按钮样式 */
.floating-button {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 增强动效 */
.hover\:shadow-3xl:hover {
  box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.25);
}

/* 下雨动画 - 柔和的美食雨滴 */
@keyframes rain-drop {
  0% {
    transform: translateY(-200px);
    opacity: 0;
  }
  5% {
    opacity: 0.6;
  }
  95% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(calc(100vh + 200px));
    opacity: 0;
  }
}

/* 不同的雨滴轨迹 - 从屏幕外开始 */
.animate-meteor-1 {
  animation: rain-drop 8s linear infinite;
  animation-delay: 0s;
  left: 5%;
  top: -300px;
}

.animate-meteor-2 {
  animation: rain-drop 10s linear infinite;
  animation-delay: 1.2s;
  left: 15%;
  top: -250px;
}

.animate-meteor-3 {
  animation: rain-drop 7s linear infinite;
  animation-delay: 2.8s;
  left: 25%;
  top: -350px;
}

.animate-meteor-4 {
  animation: rain-drop 9s linear infinite;
  animation-delay: 4.1s;
  left: 35%;
  top: -200px;
}

.animate-meteor-5 {
  animation: rain-drop 11s linear infinite;
  animation-delay: 5.5s;
  left: 45%;
  top: -280px;
}

.animate-meteor-6 {
  animation: rain-drop 6s linear infinite;
  animation-delay: 0.7s;
  left: 55%;
  top: -320px;
}

.animate-meteor-7 {
  animation: rain-drop 8.5s linear infinite;
  animation-delay: 2.3s;
  left: 65%;
  top: -240px;
}

.animate-meteor-8 {
  animation: rain-drop 9.5s linear infinite;
  animation-delay: 3.9s;
  left: 75%;
  top: -290px;
}

.animate-meteor-9 {
  animation: rain-drop 7.5s linear infinite;
  animation-delay: 1.6s;
  left: 85%;
  top: -260px;
}

.animate-meteor-10 {
  animation: rain-drop 10.5s linear infinite;
  animation-delay: 4.7s;
  left: 95%;
  top: -310px;
}

.animate-meteor-11 {
  animation: rain-drop 6.5s linear infinite;
  animation-delay: 0.3s;
  left: 10%;
  top: -270px;
}

.animate-meteor-12 {
  animation: rain-drop 8.8s linear infinite;
  animation-delay: 3.2s;
  left: 20%;
  top: -230px;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .floating-button {
    bottom: 1rem !important;
    right: 1rem !important;
  }

  /* 移动端隐藏悬浮提示，使用触摸友好的设计 */
  .floating-button .group:hover .absolute {
    display: none;
  }
}

.btn-magic::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-magic:hover::before {
  left: 100%;
}

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* 渐变文字动画 */
.gradient-text {
  background: linear-gradient(-45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* 文本截断工具类 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
