/* 基本樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px;
}

/* 頭部樣式 */
.header {
  background: white;
  border-radius: 15px;
  padding: 15px 20px;
  margin-bottom: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header h1 {
  color: #333;
  font-size: 1.8rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* 按鈕樣式 */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a6fd8;
  transform: translateY(-2px);
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-outline {
  background: transparent;
  border: 2px solid #667eea;
  color: #667eea;
}

.btn-outline:hover {
  background: #667eea;
  color: white;
}

.btn-admin {
  background: #dc3545;
  color: white;
}

.btn-large {
  padding: 15px 30px;
  font-size: 1.1rem;
}

/* Flash 訊息 */
.flash-messages {
  margin-bottom: 15px;
}

.flash {
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: opacity 0.3s ease;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 隊伍資訊卡片 */
.team-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.info-card {
  background: white;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-icon {
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  flex-shrink: 0;
}

.info-content h3 {
  margin-bottom: 5px;
  color: #333;
  font-size: 1rem;
}

.info-content p {
  color: #666;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.bingo-bonus {
  color: #28a745;
  font-weight: bold;
}

.bingo-card {
  border: 2px solid #ffd700;
  background: linear-gradient(135deg, #fff9c4, #fff);
}

.bingo-card .info-icon {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
}

.bingo-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.bingo-line {
  background: #ffd700;
  color: #333;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
}

.info-card.admin-card {
  border: 2px solid #dc3545;
}

/* 進度條 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  transition: width 0.3s ease;
}

/* 遊戲網格 */
.game-section {
  background: white;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

.game-header h2 {
  color: #333;
  font-size: 1.5rem;
  margin: 0;
}

.game-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.layout-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layout-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-locked {
  color: #dc3545;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-waiting {
  color: #ffc107;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.game-description {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* 賓果網格 - 響應式設計 */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 100%;
  margin: 0 auto;
}

.bingo-cell {
  aspect-ratio: 1;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}

.bingo-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.bingo-cell.completed {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border-color: #28a745;
}

/* 編輯模式樣式 */
.bingo-grid.edit-mode .bingo-cell {
  cursor: grab;
  border-color: #ffc107;
  background: #fff3cd;
}

.bingo-grid.edit-mode .bingo-cell:hover {
  border-color: #ff6b6b;
  background: #ffe6e6;
}

.bingo-grid.edit-mode .bingo-cell.completed {
  background: linear-gradient(135deg, #28a745, #20c997);
  opacity: 0.8;
}

/* 編輯模式樣式改進 */
.bingo-grid.edit-mode .bingo-cell {
  cursor: grab !important;
  border: 2px dashed #ffc107 !important;
  background: #fff8e1 !important;
  transition: all 0.2s ease;
  position: relative;
}

.bingo-grid.edit-mode .bingo-cell:hover {
  border-color: #ff9800 !important;
  background: #ffecb3 !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 152, 0, 0.3);
}

.bingo-grid.edit-mode .bingo-cell.completed {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.8), rgba(32, 201, 151, 0.8)) !important;
  border-color: #28a745 !important;
}

.bingo-grid.edit-mode .bingo-cell.completed:hover {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.9), rgba(32, 201, 151, 0.9)) !important;
}

.bingo-cell.sortable-drag {
  cursor: grabbing !important;
  transform: rotate(5deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.cell-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.cell-coord {
  font-size: 0.7rem;
  opacity: 0.7;
}

.completed-icon {
  color: white;
  font-size: 1rem;
}

.drag-handle {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ffc107;
  color: #333;
  padding: 4px;
  border-radius: 4px;
  cursor: grab;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.drag-handle:hover {
  background: #ffcd39;
}

.drag-handle:active {
  cursor: grabbing;
}

.cell-content h4 {
  font-size: 0.75rem;
  margin-bottom: 4px;
  line-height: 1.1;
  text-align: center;
}

.difficulty {
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
  text-align: center;
}

.difficulty-簡單,
.difficulty-simple {
  background: #d4edda;
  color: #155724;
}

.difficulty-中等,
.difficulty-medium {
  background: #fff3cd;
  color: #856404;
}

.difficulty-困難,
.difficulty-hard {
  background: #f8d7da;
  color: #721c24;
}

.points {
  font-size: 0.6rem;
  color: #666;
  margin-top: 3px;
  text-align: center;
}

/* 側邊欄 */
.sidebar {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-section {
  background: white;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
}

.sidebar-section h3 {
  margin-bottom: 12px;
  color: #333;
  font-size: 1rem;
}

.sidebar-section ul {
  list-style: none;
}

.sidebar-section li {
  padding: 4px 0;
  color: #666;
  font-size: 0.85rem;
}

.team-members {
  max-height: 150px;
  overflow-y: auto;
}

.member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.admin-badge {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 3px;
}

.admin-badge i {
  font-size: 0.7rem;
}

/* 模態框 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 25px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.close {
  position: absolute;
  right: 15px;
  top: 10px;
  color: #aaa;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

/* 響應式設計 */
@media (max-width: 1024px) {
  .sidebar {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 20px;
  }

  .container {
    padding: 8px;
  }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 1.4rem;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .team-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .info-card {
    padding: 12px;
  }

  .info-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .bingo-grid {
    gap: 6px;
  }

  .bingo-cell {
    padding: 4px;
    min-height: 70px;
  }

  .cell-content h4 {
    font-size: 0.7rem;
  }

  .game-section {
    padding: 15px;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout-controls {
    width: 100%;
    justify-content: center;
  }
}

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

  .bingo-grid {
    gap: 4px;
  }

  .bingo-cell {
    padding: 3px;
    min-height: 60px;
  }

  .cell-content h4 {
    font-size: 0.65rem;
  }

  .cell-coord {
    font-size: 0.6rem;
  }

  .difficulty {
    font-size: 0.55rem;
    padding: 1px 3px;
  }

  .points {
    font-size: 0.55rem;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .layout-controls {
    flex-direction: column;
  }

  .layout-controls .btn {
    width: 100%;
    justify-content: center;
  }
}

/* 超小螢幕優化 */
@media (max-width: 360px) {
  .bingo-cell {
    min-height: 50px;
    padding: 2px;
  }

  .cell-content h4 {
    font-size: 0.6rem;
  }

  .header {
    padding: 10px 15px;
  }

  .game-section {
    padding: 10px;
  }
}

/* 動畫效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bingo-cell,
.info-card {
  animation: fadeIn 0.5s ease-out;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a6fd8;
}

/* 確保網格在所有螢幕上都能正確顯示 */
.bingo-grid {
  width: 100%;
  max-width: 600px;
}

/* 賓果連線高亮效果 */
.bingo-cell.completed {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

/* 拖拽相關的額外樣式 */
.sortable-ghost {
  opacity: 0.4;
  background: #c8ebfb !important;
}

.sortable-chosen {
  cursor: grabbing !important;
}

/* 拖拽狀態樣式 */
.sortable-ghost {
  opacity: 0.3 !important;
  background: #e3f2fd !important;
  border: 2px dashed #2196f3 !important;
  transform: scale(0.95);
}

.sortable-chosen {
  cursor: grabbing !important;
  transform: rotate(3deg) scale(1.05);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

.sortable-drag {
  cursor: grabbing !important;
  opacity: 0.8;
  transform: rotate(5deg);
}

/* 編輯模式提示 */
.edit-mode-hint {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 0.9rem;
}

/* 拖拽提示圖標 */
.drag-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 193, 7, 0.9);
  color: #333;
  padding: 8px;
  border-radius: 50%;
  font-size: 1.2rem;
  pointer-events: none;
  z-index: 10;
  animation: dragPulse 2s infinite;
}

@keyframes dragPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
}

/* 編輯模式提示框 */
.edit-mode-hint {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border: 2px solid #ffc107;
  color: #856404;
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: slideDown 0.3s ease-out;
}

.edit-mode-hint i {
  font-size: 1.2rem;
  color: #ff9800;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 管理員面板樣式 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-content h3 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 5px;
}

.stat-content p {
  color: #666;
  font-size: 0.9rem;
}

/* 標籤頁樣式 */
.tabs {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.tab-buttons {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  flex-wrap: wrap;
}

.tab-button {
  flex: 1;
  padding: 15px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
  min-width: 120px;
}

.tab-button.active {
  background: white;
  color: #667eea;
  border-bottom: 3px solid #667eea;
}

.tab-button:hover {
  background: #e9ecef;
}

.tab-content {
  display: none;
  padding: 30px;
}

.tab-content.active {
  display: block;
}

.tab-content h2 {
  margin-bottom: 20px;
  color: #333;
}

/* 隊伍卡片樣式 */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.team-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  transition: transform 0.3s ease;
}

.team-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.team-header h3 {
  color: #333;
  margin: 0;
}

.team-stats {
  display: flex;
  gap: 15px;
}

.team-stats .stat {
  font-size: 0.9rem;
  color: #666;
}

.team-stats .points {
  color: #667eea;
  font-weight: bold;
}

.team-members {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dee2e6;
}

.team-members p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.team-bingo {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dee2e6;
}

.team-bingo p {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 0.9rem;
}

/* 用戶表格樣式 */
.users-table {
  overflow-x: auto;
  background: white;
  border-radius: 8px;
}

.users-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.users-table th,
.users-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.users-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.users-table select {
  padding: 5px 10px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: white;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* 關卡網格樣式 */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.challenge-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  transition: transform 0.3s ease;
}

.challenge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.challenge-header h4 {
  margin: 0;
  color: #333;
}

.challenge-location {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.challenge-points {
  color: #667eea;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 15px;
}

/* 活動日誌樣式 */
.activities-list {
  max-height: 500px;
  overflow-y: auto;
  background: white;
  border-radius: 8px;
}

.activity-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid #eee;
}

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

.activity-time {
  color: #666;
  font-size: 0.8rem;
  white-space: nowrap;
  min-width: 80px;
}

.activity-content {
  flex: 1;
}

.activity-content strong {
  color: #333;
  margin-right: 8px;
}

.activity-content span {
  color: #666;
}

/* 響應式設計 - 管理員面板 */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .stat-content h3 {
    font-size: 1.5rem;
  }

  .tab-buttons {
    flex-direction: column;
  }

  .tab-button {
    flex: none;
  }

  .tab-content {
    padding: 20px;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }

  .challenges-grid {
    grid-template-columns: 1fr;
  }

  .users-table {
    font-size: 0.9rem;
  }
}

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

  .team-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .team-stats {
    align-self: stretch;
    justify-content: space-between;
  }
}

/* 關卡詳情頁面樣式 */
.challenge-container {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.challenge-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 30px;
}

.challenge-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-top: 15px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
}

.meta-item i {
  font-size: 1rem;
}

.challenge-content {
  padding: 30px;
}

.challenge-section {
  margin-bottom: 30px;
}

.challenge-section h2 {
  color: #333;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
}

.challenge-section h2 i {
  color: #667eea;
}

.challenge-description {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.challenge-description p {
  margin: 0;
  color: #333;
  line-height: 1.6;
}

.challenge-image {
  margin: 15px 0;
  text-align: center;
}

.challenge-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.task-list {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task-item:last-child {
  margin-bottom: 0;
}

.task-bullet {
  color: #667eea;
  margin-top: 2px;
  font-size: 0.8rem;
}

.task-item span {
  color: #333;
  line-height: 1.5;
}

.hint-section {
  background: #fff3cd;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #ffeaa7;
}

.hint-content {
  color: #856404;
}

.hint-content p {
  margin: 0;
  line-height: 1.6;
}

.info-content {
  background: #e3f2fd;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #bbdefb;
}

.info-content ul {
  margin: 0;
  padding-left: 20px;
  color: #1565c0;
}

.info-content li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.challenge-actions {
  padding: 30px;
  background: #f8f9fa;
  text-align: center;
  border-top: 1px solid #dee2e6;
}

.completion-section {
  max-width: 500px;
  margin: 0 auto;
}

.admin-notice {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
}

.admin-notice i {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}

.admin-notice p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.warning-box {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.warning-box i {
  color: #f0ad4e;
  font-size: 1.2rem;
  margin-top: 2px;
}

.warning-box p {
  margin: 0;
  line-height: 1.5;
}

.completed-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #28a745;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 20px;
  background: #d4edda;
  border-radius: 10px;
  border: 1px solid #c3e6cb;
}

.completed-status i {
  font-size: 1.5rem;
}

.non-admin-notice {
  text-align: center;
}

.info-box {
  background: #e3f2fd;
  border: 1px solid #bbdefb;
  color: #1565c0;
  padding: 25px;
  border-radius: 10px;
}

.info-box h3 {
  color: #1565c0;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.info-box p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.team-admin-info {
  margin-top: 15px;
}

.admin-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 10px 15px;
  border-radius: 8px;
  border: 2px solid #ffd700;
  color: #333;
  font-weight: bold;
}

.admin-card i {
  color: #ffd700;
}

.text-muted {
  color: #6c757d;
  font-style: italic;
}

/* 關卡詳情頁面響應式設計 */
@media (max-width: 768px) {
  .challenge-header {
    padding: 20px;
  }

  .challenge-content {
    padding: 20px;
  }

  .challenge-actions {
    padding: 20px;
  }

  .challenge-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .challenge-section h2 {
    font-size: 1.1rem;
  }

  .admin-notice {
    padding: 15px;
  }

  .admin-notice i {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .challenge-header {
    padding: 15px;
  }

  .challenge-content {
    padding: 15px;
  }

  .challenge-actions {
    padding: 15px;
  }

  .challenge-description,
  .task-list,
  .hint-section,
  .info-content {
    padding: 15px;
  }

  .task-item {
    padding: 8px;
  }

  .warning-box,
  .admin-notice,
  .info-box {
    padding: 15px;
  }
}

/* 排行榜樣式 */
.leaderboard {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 20px;
}

.leaderboard-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 30px;
  text-align: center;
}

.leaderboard-header h2 {
  margin-bottom: 10px;
  font-size: 2rem;
}

.leaderboard-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 1.1rem;
}

.leaderboard-list {
  padding: 20px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin-bottom: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.leaderboard-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.leaderboard-item:last-child {
  margin-bottom: 0;
}

.leaderboard-item.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border-color: #ffd700;
  color: #333;
}

.leaderboard-item.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  border-color: #c0c0c0;
  color: #333;
}

.leaderboard-item.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #daa520);
  border-color: #cd7f32;
  color: #333;
}

.rank-number {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #667eea;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.rank-1 .rank-number {
  background: #ffd700;
  color: #333;
}

.rank-2 .rank-number {
  background: #c0c0c0;
  color: #333;
}

.rank-3 .rank-number {
  background: #cd7f32;
  color: white;
}

.gold {
  color: #ffd700;
  font-size: 1.5rem;
}

.silver {
  color: #c0c0c0;
  font-size: 1.5rem;
}

.bronze {
  color: #cd7f32;
  font-size: 1.5rem;
}

.team-info {
  flex: 1;
}

.team-info h3 {
  margin-bottom: 10px;
  color: #333;
  font-size: 1.3rem;
}

.team-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.team-stats .stat {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #666;
  font-size: 0.9rem;
}

.team-stats .stat i {
  color: #667eea;
}

.progress-section {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 150px;
  flex-shrink: 0;
}

.progress-text {
  font-weight: bold;
  color: #667eea;
  font-size: 1rem;
}

/* 排行榜響應式設計 */
@media (max-width: 768px) {
  .leaderboard-header {
    padding: 20px;
  }

  .leaderboard-header h2 {
    font-size: 1.5rem;
  }

  .leaderboard-item {
    flex-direction: column;
    text-align: center;
    gap: 15px;
    padding: 15px;
  }

  .team-info h3 {
    font-size: 1.1rem;
  }

  .team-stats {
    justify-content: center;
    gap: 15px;
  }

  .progress-section {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .leaderboard-list {
    padding: 15px;
  }

  .leaderboard-item {
    padding: 12px;
  }

  .rank-number {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .team-stats {
    flex-direction: column;
    gap: 8px;
  }
}

/* 關卡編輯表單樣式 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #666;
  font-size: 0.8rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
}

.task-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.task-input-group input {
  flex: 1;
  margin-bottom: 0;
}

.challenge-preview-image {
  margin: 10px 0;
  text-align: center;
}

.challenge-preview-image img {
  max-width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.challenge-desc {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 15px;
  line-height: 1.4;
}

.challenge-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.challenge-actions .btn {
  flex: 1;
  justify-content: center;
}

/* 模態框改進 */
.modal-content h2 {
  color: #333;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f8f9fa;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .task-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .challenge-actions {
    flex-direction: column;
  }
}

/* 改進按鈕樣式 */
.layout-controls .btn {
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.layout-controls .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.layout-controls .btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.layout-controls .btn-success {
  background: linear-gradient(135deg, #28a745, #20c997);
  animation: saveButtonPulse 2s infinite;
}

@keyframes saveButtonPulse {
  0%,
  100% {
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.5);
  }
}

/* 手機端拖拽優化 */
@media (max-width: 768px) {
  .bingo-grid.edit-mode .bingo-cell {
    min-height: 90px;
    border-width: 3px;
  }

  .drag-hint {
    padding: 12px;
    font-size: 1.4rem;
  }

  .edit-mode-hint {
    padding: 12px 15px;
    font-size: 0.9rem;
    flex-direction: column;
    gap: 8px;
  }

  .layout-controls {
    width: 100%;
  }

  .layout-controls .btn {
    flex: 1;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .bingo-grid.edit-mode .bingo-cell {
    min-height: 80px;
  }

  .drag-hint {
    padding: 10px;
    font-size: 1.2rem;
  }

  .edit-mode-hint {
    padding: 10px;
    font-size: 0.85rem;
  }
}

/* 觸控設備拖拽優化 */
@media (pointer: coarse) {
  .bingo-grid.edit-mode .bingo-cell {
    min-height: 100px;
    border-width: 3px;
  }

  .drag-hint {
    padding: 15px;
    font-size: 1.5rem;
  }
}
