/* ============================================
   米粒赛事 - 全局样式表
   电竞风格 · 手机优先 · 主色 #ff6b6b
   ============================================ */

/* ---------- 全局重置与基础 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: #ff6b6b;
  text-decoration: none;
}

a:active {
  opacity: 0.7;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

input, button, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* ---------- 响应式容器 ---------- */
.page-container {
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: #f5f5f5;
}

/* ---------- 顶部导航栏 ---------- */
.top-nav {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  height: 48px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.top-nav .back-btn {
  position: absolute;
  left: 12px;
  font-size: 20px;
  color: #333;
  cursor: pointer;
  padding: 4px 8px;
}

.top-nav .nav-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.top-nav .nav-right {
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: #ff6b6b;
  cursor: pointer;
}

/* 为有顶部导航的页面留出空间 */
body.has-top-nav {
  padding-top: 48px;
}

/* ---------- 渐变 Header 背景 ---------- */
.gradient-header {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  color: #fff;
  padding: 24px 20px 32px;
  border-radius: 0 0 24px 24px;
}

.gradient-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.gradient-header p {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ---------- 底部导航栏 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  height: 56px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: #999;
  text-decoration: none;
  transition: color 0.2s, transform 0.15s;
  font-size: 10px;
  gap: 2px;
}

.bottom-nav .nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.bottom-nav .nav-item .nav-text {
  line-height: 1;
}

.bottom-nav .nav-item.active {
  color: #ff6b6b;
  font-weight: 600;
}

/* 为有底部导航的页面留出空间 */
body.has-bottom-nav {
  padding-bottom: 56px;
}

/* ---------- 卡片样式 ---------- */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  padding: 16px;
  margin: 12px 16px;
  transition: box-shadow 0.2s;
  animation: cardIn 0.4s ease-out both;
}

.card:active {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

.card-body {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* ---------- 按钮样式 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn:active {
  transform: scale(0.95);
}

/* 主按钮 - 渐变色 */
.btn-primary {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
}

.btn-primary:active {
  opacity: 0.9;
}

/* 次要按钮 - 白底边框 */
.btn-secondary {
  background: #fff;
  color: #ff6b6b;
  border: 1.5px solid #ff6b6b;
}

.btn-secondary:active {
  background: #fff5f5;
}

/* 危险按钮 */
.btn-danger {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  box-shadow: 0 4px 14px rgba(231, 76, 60, 0.3);
}

/* 块级按钮 */
.btn-block {
  display: flex;
  width: 100%;
}

/* 小按钮 */
.btn-sm {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: 16px;
}

/* 禁用状态 */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 表单输入框 ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  font-size: 14px;
  color: #333;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
  color: #bbb;
}

.form-input:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}

.form-input.error {
  border-color: #e74c3c;
}

.form-input.success {
  border-color: #27ae60;
}

.form-hint {
  font-size: 12px;
  margin-top: 4px;
  color: #999;
}

.form-hint.error {
  color: #e74c3c;
}

.form-hint.success {
  color: #27ae60;
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

/* ---------- 标签样式 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 500;
  background: #f0f0f0;
  color: #666;
}

.tag-primary {
  background: rgba(255, 107, 107, 0.12);
  color: #ff6b6b;
}

.tag-success {
  background: rgba(39, 174, 96, 0.12);
  color: #27ae60;
}

.tag-warning {
  background: rgba(241, 196, 15, 0.15);
  color: #e67e22;
}

.tag-danger {
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
}

/* 游戏logo图标行内样式 */
.game-logo-inline {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ---------- 列表项样式 ---------- */
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:active {
  background: #fafafa;
}

.list-item .item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
  background: #eee;
  overflow: hidden;
}

.list-item .item-content {
  flex: 1;
  min-width: 0;
}

.list-item .item-title {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .item-desc {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .item-extra {
  flex-shrink: 0;
  text-align: right;
  margin-left: 12px;
}

.list-item .item-arrow {
  flex-shrink: 0;
  margin-left: 8px;
  color: #ccc;
  font-size: 14px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #ccc;
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state .empty-text {
  font-size: 14px;
  color: #999;
  margin-bottom: 20px;
}

/* ---------- 加载动画 ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #f0f0f0;
  border-top-color: #ff6b6b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-left: 10px;
  font-size: 13px;
  color: #999;
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  animation: toast-fade 0.3s ease;
  max-width: 70%;
  text-align: center;
}

@keyframes toast-fade {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- 登录/注册页面专用 ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

.auth-header {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  padding: 60px 20px 48px;
  text-align: center;
  color: #fff;
  border-radius: 0 0 32px 32px;
}

.auth-header .logo-icon {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
}

.auth-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  vertical-align: middle;
  margin-right: 6px;
  display: inline-block;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  height: 52px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  gap: 10px;
}

.top-bar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.top-bar-title {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  letter-spacing: 1px;
}

body:not(.auth-page) .page-container {
  padding-top: 52px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
}

.auth-header .slogan {
  font-size: 14px;
  opacity: 0.85;
  margin-top: 6px;
  font-weight: 300;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 32px 24px;
  margin: -24px 20px 20px;
  position: relative;
  z-index: 1;
}

.auth-card .form-group {
  margin-bottom: 20px;
}

.auth-card .btn-primary {
  margin-top: 8px;
}

.auth-footer {
  text-align: center;
  padding: 16px;
  font-size: 14px;
  color: #999;
}

.auth-footer a {
  color: #ff6b6b;
  font-weight: 500;
}

/* ---------- 通用工具类 ---------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: #999; }
.text-primary { color: #ff6b6b; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-8  { padding-top: 8px; padding-bottom: 8px; }
.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-1 { flex: 1; }
.hidden { display: none !important; }

/* ---------- 动画效果 ---------- */

/* 卡片入场动画 */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(6) { animation-delay: 0.22s; }
.card:nth-child(7) { animation-delay: 0.26s; }
.card:nth-child(8) { animation-delay: 0.30s; }
.card:nth-child(n+9) { animation-delay: 0.34s; }

/* Banner渐变流动 */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 统计数字弹跳 */
.stat-num {
  animation: numBounce 0.6s ease-out both;
  animation-delay: 0.3s;
}

@keyframes numBounce {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* 底部导航项动画 */
.bottom-nav .nav-item:active {
  transform: scale(0.85);
}
.bottom-nav .nav-item.active {
  animation: navPop 0.3s ease-out;
}

@keyframes navPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* 页面切换淡入 */
.page-content {
  animation: pageIn 0.3s ease-out;
}

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 安全区域适配（刘海屏） ---------- */
@supports (padding-top: env(safe-area-inset-top)) {
  .top-nav {
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
  }
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + env(safe-area-inset-bottom));
  }
  body.has-bottom-nav {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
  body.has-top-nav {
    padding-top: calc(48px + env(safe-area-inset-top));
  }
}
