/* ===== 小鱼儿的学习游戏 - 全局样式 ===== */

:root {
  --sky-blue: #5bc0de;
  --sky-light: #b3e5fc;
  --grass-green: #66bb6a;
  --grass-light: #a5d6a7;
  --sunny: #ffd54f;
  --coral: #ff7043;
  --purple: #ab47bc;
  --pink: #ec407a;
  --teal: #26a69a;
  --indigo: #5c6bc0;
  --orange: #ffa726;
  --bg-cream: #fff8e1;
  --card-shadow: 0 4px 15px rgba(0,0,0,0.12);
  --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.2);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: "Comic Sans MS", "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #e0f7fa 0%, #fff3e0 50%, #f3e5f5 100%);
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

/* ===== 顶部导航栏 ===== */
.top-bar {
  background: linear-gradient(90deg, var(--sky-blue), var(--indigo));
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar .logo {
  font-size: 1.6rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar .fish-icon { font-size: 2rem; }

.top-bar nav { display: flex; gap: 12px; }

.top-bar nav a {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.2);
  transition: all 0.3s;
  font-weight: bold;
}

.top-bar nav a:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.05);
}

/* ===== 进度面板 ===== */
.progress-panel {
  display: flex;
  gap: 16px;
  background: #fff;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  margin: 16px auto;
  max-width: 900px;
  justify-content: center;
  flex-wrap: wrap;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
}

.progress-item.keys { background: #fff9c4; color: #f57f17; }
.progress-item.points { background: #c8e6c9; color: #2e7d32; }
.progress-item.rounds { background: #e1bee7; color: #6a1b9a; }

.progress-item .icon { font-size: 1.5rem; }

/* ===== 游戏类别卡片 ===== */
.category-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.category-section h2 {
  text-align: center;
  font-size: 1.8rem;
  color: var(--indigo);
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.category-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.3s;
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-5px) scale(1.02);
  border-color: var(--sunny);
}

.category-card .cat-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: block;
}

.category-card .cat-name {
  font-size: 1.3rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.category-card .cat-desc {
  font-size: 0.9rem;
  color: #666;
}

.category-card.bg-blue { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.category-card.bg-green { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.category-card.bg-orange { background: linear-gradient(135deg, #fff3e0, #ffe0b2); }
.category-card.bg-purple { background: linear-gradient(135deg, #f3e5f5, #e1bee7); }
.category-card.bg-pink { background: linear-gradient(135deg, #fce4ec, #f8bbd0); }

/* ===== 学科/年级选择 ===== */
.filter-section {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 20px;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group label {
  display: block;
  font-size: 1rem;
  font-weight: bold;
  color: #555;
  margin-bottom: 8px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 8px 20px;
  border-radius: 30px;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
}

.filter-chip:hover { border-color: var(--sky-blue); }

.filter-chip.active {
  background: var(--sky-blue);
  color: #fff;
  border-color: var(--sky-blue);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  text-align: center;
  font-family: inherit;
}

.btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--sky-blue); color: #fff; }
.btn-success { background: var(--grass-green); color: #fff; }
.btn-warning { background: var(--sunny); color: #5d4037; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-large { padding: 16px 48px; font-size: 1.3rem; border-radius: var(--radius-md); }

/* ===== 游戏通用容器 ===== */
.game-container {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.game-header {
  text-align: center;
  margin-bottom: 20px;
  width: 100%;
  max-width: 800px;
}

.game-header h1 {
  font-size: 2rem;
  color: var(--indigo);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.game-header .game-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.95rem;
  color: #666;
}

.game-header .game-info span {
  background: rgba(255,255,255,0.7);
  padding: 4px 16px;
  border-radius: 20px;
}

/* ===== 题目展示 ===== */
.question-banner {
  background: #fff;
  padding: 20px 32px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  margin: 16px auto;
  max-width: 700px;
  width: 100%;
  color: #333;
  border: 3px solid var(--sky-light);
}

.question-counter {
  display: inline-block;
  background: var(--sunny);
  color: #5d4037;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 1rem;
  margin-bottom: 8px;
}

/* ===== 反馈动画 ===== */
.feedback-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
}

.feedback-overlay.show { display: flex; }

.feedback-content {
  font-size: 5rem;
  animation: bounce-in 0.5s ease;
  text-align: center;
}

.feedback-text {
  font-size: 2rem;
  font-weight: bold;
  margin-top: 16px;
}

.feedback-correct .feedback-content { color: var(--grass-green); }
.feedback-wrong .feedback-content { color: var(--coral); }

@keyframes bounce-in {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes float-up {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-200px); opacity: 0; }
}

@keyframes fall-down {
  0% { transform: translateY(-100px); }
  100% { transform: translateY(100vh); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes star-burst {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  100% { transform: scale(2) rotate(180deg); opacity: 0; }
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: bounce-in 0.3s ease;
}

.modal-box h2 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: var(--indigo);
}

.modal-box p {
  font-size: 1.1rem;
  margin-bottom: 24px;
  color: #555;
}

.modal-box .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== 管理后台 ===== */
.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.admin-section {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.admin-section h3 {
  font-size: 1.3rem;
  color: var(--indigo);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--sky-light);
  padding-bottom: 8px;
}

.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  color: #555;
}

.admin-form-group select,
.admin-form-group input[type="text"],
.admin-form-group input[type="password"],
.admin-form-group input[type="file"] {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
}

.admin-form-group select:focus,
.admin-form-group input:focus {
  border-color: var(--sky-blue);
  outline: none;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.admin-table th,
.admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-table th {
  background: var(--bg-cream);
  font-weight: bold;
  color: #555;
}

.admin-table tr:hover { background: #f5f5f5; }

/* ===== 输入框 ===== */
.text-input {
  padding: 12px 20px;
  border: 3px solid var(--sky-light);
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
}

.text-input:focus { border-color: var(--sky-blue); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .top-bar .logo { font-size: 1.2rem; }
  .top-bar .fish-icon { font-size: 1.5rem; }
  .top-bar nav a { padding: 6px 10px; font-size: 0.85rem; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .category-card { padding: 16px; }
  .category-card .cat-icon { font-size: 2.5rem; }
  .category-card .cat-name { font-size: 1rem; }
  .question-banner { font-size: 1.2rem; padding: 16px; }
  .game-header h1 { font-size: 1.5rem; }
  .progress-panel { padding: 12px; gap: 8px; }
  .progress-item { font-size: 1rem; padding: 6px 12px; }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* ===== 装饰元素 ===== */
.bubble {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: float-up 3s ease-out forwards;
}

.star-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.5rem;
  animation: star-burst 0.8s ease-out forwards;
}

/* ===== 加载动画 ===== */
.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #888;
}

.loading .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--sky-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state .text { font-size: 1.1rem; }

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: bold;
  z-index: 3000;
  animation: slide-down 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.success { background: var(--grass-green); color: #fff; }
.toast.error { background: var(--coral); color: #fff; }
.toast.info { background: var(--sky-blue); color: #fff; }

@keyframes slide-down {
  0% { transform: translate(-50%, -100px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}
