/* ========================================
   李三两Owl的Steam销量估算器 - 主样式
   ======================================== */

/* CSS 变量定义 */
:root {
  /* 暗黑模式（默认） */
  --bg-primary: #0f1419;
  --bg-secondary: #1a2332;
  --bg-card: #212b3d;
  --text-primary: #ffffff;
  --text-secondary: #8b9bb4;
  --accent-blue: #66c0f4;
  --accent-green: #00d084;
  --accent-red: #ff6b6b;
  --accent-gold: #ffd700;
  --accent-orange: #ff8a65;
  --border-color: #3d4b5f;
  --border-glow: rgba(102, 192, 244, 0.3);
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --border-glow: rgba(0, 0, 0, 0.1);
}

/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ========================================
   好评等级卡片样式
   ======================================== */

.rating-card {
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.rating-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, var(--card-glow-color, transparent) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rating-card:hover::before {
  opacity: 0.15;
}

.rating-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
  box-shadow: 0 10px 30px var(--border-glow);
}

.rating-card.active {
  transform: scale(1.05);
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 215, 0, 0.1) 100%);
}

.rating-card.active::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent-gold);
  color: #000;
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.rating-card .icon {
  font-size: 24px;
  margin-bottom: 4px;
  display: block;
}

.rating-card .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  white-space: nowrap;
}

.rating-card .multiplier {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-blue);
}

/* 各卡片的主题色 */
.rating-card[data-rating="mixed"] { --card-glow-color: #b39ddb; }
.rating-card[data-rating="mostly"] { --card-glow-color: #81c784; }
.rating-card[data-rating="very"] { --card-glow-color: #4fc3f7; }
.rating-card[data-rating="overwhelming"] { --card-glow-color: #ffd54f; }
.rating-card[data-rating="viral"] { --card-glow-color: #ff8a65; }

/* 涟漪动画效果 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ========================================
   滑块样式
   ======================================== */

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(102, 192, 244, 0.4);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ========================================
   输入框样式
   ======================================== */

input[type="number"],
select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(102, 192, 244, 0.2);
}

/* 移除数字输入框的箭头 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ========================================
   按钮通用样式
   ======================================== */

button {
  cursor: pointer;
  font-family: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ========================================
   动画效果
   ======================================== */

/* 心跳动画 */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(1); }
  75% { transform: scale(1.15); }
}

.heartbeat {
  animation: heartbeat 0.5s ease-in-out;
}

/* 数字跳动动画 */
@keyframes number-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); color: var(--accent-green); }
  100% { transform: scale(1); }
}

.number-update {
  animation: number-pulse 0.3s ease-out;
}

/* 渐入动画 */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fade-in 0.4s ease-out;
}

/* ========================================
   Toast 提示
   ======================================== */

#toast {
  font-weight: 500;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================
   语言切换按钮
   ======================================== */

#langToggle {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  cursor: pointer !important;
  position: relative;
  z-index: 100;
  min-width: 36px;
  text-align: center;
  pointer-events: auto;
}

#langToggle:hover {
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
}

/* ========================================
   响应式适配
   ======================================== */

/* 平板端 */
@media (max-width: 1024px) {
  .rating-card {
    padding: 10px 4px;
  }
  
  .rating-card .icon {
    font-size: 20px;
  }
  
  .rating-card .label {
    font-size: 11px;
  }
  
  .rating-card .multiplier {
    font-size: 16px;
  }
}

/* 移动端 */
@media (max-width: 640px) {
  .rating-card {
    padding: 8px 2px;
  }
  
  .rating-card .icon {
    font-size: 18px;
  }
  
  .rating-card .label {
    font-size: 10px;
  }
  
  .rating-card .multiplier {
    font-size: 14px;
  }
  
  /* 移动端卡片横向滚动 */
  #ratingCards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  
  #ratingCards .rating-card {
    flex: 0 0 auto;
    min-width: 70px;
    scroll-snap-align: start;
  }
  
  #ratingCards::-webkit-scrollbar {
    height: 4px;
  }
  
  /* 结果卡片堆叠 */
  .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* 小屏手机 */
@media (max-width: 380px) {
  .rating-card .label {
    font-size: 9px;
  }
  
  #ratingCards .rating-card {
    min-width: 60px;
  }
}

/* ========================================
   ECharts 图表容器
   ======================================== */

#waterfallChart {
  border-radius: 8px;
}

/* ========================================
   爱心雨 Canvas
   ======================================== */

#heartCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ========================================
   高级选项动画
   ======================================== */

#advancedPanel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 0;
}

#advancedPanel.open {
  max-height: 500px;
  opacity: 1;
}

#advancedArrow {
  transition: transform 0.3s ease;
}

#advancedArrow.open {
  transform: rotate(180deg);
}

/* ========================================
   赞赏弹窗动画
   ======================================== */

#donateModal.show {
  display: flex;
}

#donateContent.show {
  transform: scale(1);
  opacity: 1;
}

/* 赞赏金额按钮 */
.donate-amount {
  transition: all 0.2s ease;
}

.donate-amount.active {
  border-color: var(--accent-blue);
  background: rgba(102, 192, 244, 0.2);
  color: var(--accent-blue);
}

/* ========================================
   结果卡片数值样式
   ======================================== */

#resultSales,
#resultGross,
#resultNet {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ========================================
   链接样式
   ======================================== */

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* ========================================
   加载状态
   ======================================== */

.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
