/* ============================================
   网页游戏大厅 - 全局样式
   Pastel theme with light, soft colors
   ============================================ */

:root {
  /* Pastel color palette */
  --bg-primary: #f5f0e8;
  --bg-secondary: #e8e0d5;
  --bg-card: #fffdf7;
  --bg-nav: #fff9f0;
  --text-primary: #4a3728;
  --text-secondary: #6b5d4e;
  --text-light: #8c7b6e;
  --accent: #c4956a;
  --accent-hover: #b07d50;
  --accent-light: #f0dcc8;
  --success: #8fbc8f;
  --danger: #d49595;
  --warning: #d4c895;
  --info: #95b8d4;
  --border: #d4c8b8;
  --border-light: #e8ddd0;
  --shadow: 0 2px 12px rgba(74, 55, 40, 0.08);
  --shadow-lg: 0 8px 32px rgba(74, 55, 40, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== Navbar ========== */
.navbar {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 8px rgba(74, 55, 40, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  letter-spacing: 1px;
}

.navbar-brand .icon {
  font-size: 28px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.navbar-nav a, .navbar-nav button {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.navbar-nav a:hover, .navbar-nav button:hover,
.navbar-nav a.active {
  color: var(--accent);
  background: var(--accent-light);
}

.navbar-nav .btn-login {
  background: var(--accent);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 500;
}

.navbar-nav .btn-login:hover {
  background: var(--accent-hover);
  color: white;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.navbar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent);
}

/* ========== Container ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-enter-active,
.page-leave-active {
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.page-enter-from {
  opacity: 0;
  transform: translateY(12px);
}
.page-leave-to {
  opacity: 0;
  transform: translateY(-12px);
}

/* ========== Carousel ========== */
.carousel-section {
  margin-bottom: 40px;
}

.carousel {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 2.5 / 1;
  max-height: 420px;
  background: var(--bg-card);
}

.carousel-slides {
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.carousel-slide-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 120px;
  opacity: 0.15;
}

.carousel-slide-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px;
}

.carousel-slide-content h2 {
  font-size: 32px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 700;
}

.carousel-slide-content p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.8);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  z-index: 2;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.carousel-btn:hover {
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }

.carousel-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 2px solid rgba(0,0,0,0.15);
  cursor: pointer;
  transition: var(--transition);
}

.carousel-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  width: 28px;
  border-radius: 5px;
}

/* ========== Section Header ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header h2 .icon {
  font-size: 26px;
}

/* ========== Game Grid ========== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-light);
}

.game-card .game-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.game-card .game-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.game-card .game-desc {
  font-size: 12px;
  color: var(--text-light);
}

.game-card .game-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  margin-top: 8px;
  font-weight: 500;
}

.badge-hot {
  background: #fde8e8;
  color: #c45555;
}

.badge-new {
  background: #e0f0e8;
  color: #5a9a6f;
}

.badge-pvp {
  background: #e8e4f8;
  color: #6a5aaa;
}

/* ========== Category Tabs ========== */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}

.category-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ========== Game Page ========== */
.game-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.game-header .back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-primary);
}

.game-header .back-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.game-header h2 {
  font-size: 24px;
  font-weight: 700;
}

.game-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.game-canvas-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #1a1a2e;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  min-height: 400px;
}

.game-canvas-wrapper.light-bg {
  background: #faf8f3;
}

.game-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-secondary);
}

.game-info-bar .score {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.game-controls {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== Buttons ========== */
.btn {
  padding: 10px 24px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

/* ========== Forms (Login/Register) ========== */
.auth-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border-light);
}

.auth-card h2 {
  font-size: 26px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 32px;
}

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.15);
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
}

.auth-card .btn {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 16px;
  margin-top: 8px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-light);
}

.auth-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* ========== Grid Game Styles ========== */
.grid-game {
  display: grid;
  gap: 2px;
  justify-content: center;
  padding: 16px;
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  font-size: 18px;
  user-select: none;
}

/* ========== Card Styles ========== */
.playing-card {
  width: 60px;
  height: 85px;
  border-radius: 6px;
  background: white;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  position: relative;
  user-select: none;
}

.playing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.playing-card.selected {
  transform: translateY(-12px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(196, 149, 106, 0.3);
}

.playing-card.red { color: #d44; }
.playing-card.black { color: #333; }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  min-width: 300px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.modal-content .btn {
  margin: 6px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 300;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  .game-card {
    padding: 16px;
  }
  .game-card .game-icon {
    font-size: 36px;
  }
  .carousel {
    max-height: 240px;
  }
  .carousel-slide-content h2 {
    font-size: 22px;
  }
  .auth-card {
    padding: 24px;
  }
  .container {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .game-card {
    padding: 12px 8px;
  }
  .game-card .game-icon {
    font-size: 28px;
    margin-bottom: 6px;
  }
  .game-card .game-name {
    font-size: 12px;
  }
  .navbar {
    padding: 0 12px;
  }
  .navbar-brand {
    font-size: 18px;
  }
}
