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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #000;
  color: #fff;
  overflow-x: hidden;
}

/* 页面容器 */
.page {
  display: none;
  min-height: 100vh;
  padding: 20px 0;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.page.active {
  display: block;
}

/* 游戏页面特殊处理 - 隐藏头部和底部导航 */
#game-play {
  padding: 20px;
  min-height: 100vh;
}

#game-play .page-header {
  display: none;
}

/* 页面标题 */
.page-header {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.header-left, .header-right {
  width: 80px;
}

.header-title {
  text-align: center;
  flex: 1;
}

.library-button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.library-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.library-icon {
  font-size: 16px;
}

.library-text {
  font-size: 14px;
  font-weight: 500;
}

.back-button {
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.back-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

.header-title h1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.header-title p {
  font-size: 10px;
  opacity: 0.7;
  letter-spacing: 1.5px;
}

/* 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.9);
  padding: 10px 20px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-content {
  display: flex;
  justify-content: space-around;
  max-width: 600px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 8px 15px;
  border-radius: 10px;
  flex: 1;
  margin: 0 8px;
}

.nav-item.active {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 3px;
}

.nav-text {
  font-size: 12px;
  font-weight: 500;
}

/* 主页面样式 */
#game-config {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

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

.config-section h2 {
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

.player-cards {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.player-card {
  flex: 1;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-card:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-5px);
}

.player-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 500;
}

.player-card p {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 15px;
}

.theme-preview {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  font-size: 14px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.start-game-btn {
  width: 100%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
  border: none;
  padding: 15px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.start-game-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

/* 题库页面样式 */
#library {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

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

.library-section h2 {
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.theme-card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-card:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-5px);
}

.theme-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 500;
}

.theme-card p {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 15px;
  line-height: 1.4;
}

.theme-card .task-count {
  font-size: 12px;
  opacity: 0.5;
}

/* 主题详情页面 */
#theme-detail {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.theme-detail-header {
  text-align: center;
  margin-bottom: 30px;
}

.theme-detail-header h2 {
  font-size: 20px;
  margin-bottom: 10px;
  font-weight: 600;
}

.theme-detail-header p {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 15px;
}

.task-list {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 30px;
  max-height: 500px;
  overflow-y: auto;
}

.task-item {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.task-item h4 {
  font-size: 14px;
  margin-bottom: 5px;
  font-weight: 500;
}

.task-item p {
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.4;
}

.back-btn {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  padding: 15px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.back-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
}

/* 游戏页面样式 */
#game-play {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.game-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  gap: 15px;
  flex-wrap: nowrap;
  width: 100%;
  white-space: nowrap;
  overflow: visible;
  min-width: 300px;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.player-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.player-number {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
}

.vs {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  padding: 0 8px;
  white-space: nowrap;
}

.turn-indicator {
  text-align: center;
  padding: 15px 30px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-weight: 600;
  animation: pulse 2s infinite;
  margin-bottom: 30px;
  font-size: 18px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.game-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 10px;
  margin: 30px 0;
  position: relative;
}

.board-cell {
  aspect-ratio: 1;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  position: relative;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.board-cell.start {
  background-color: rgba(255, 107, 107, 0.2);
  border: 2px solid #ff6b6b;
}

.board-cell.star {
  background-color: rgba(255, 215, 0, 0.2);
  border: 2px solid #ffd700;
}

.board-cell.bomb {
  background-color: rgba(255, 107, 107, 0.2);
  border: 2px solid #ff6b6b;
}

.board-cell.occupied {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.player-piece {
  position: absolute;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  transition: all 0.5s ease;
  z-index: 10;
}

.player1-piece {
  background-color: #4ecdc4;
  box-shadow: 0 0 10px #4ecdc4;
}

.player2-piece {
  background-color: #ff6b6b;
  box-shadow: 0 0 10px #ff6b6b;
}

.board-center {
  grid-column: 5; /* 第5列 */
  grid-row: 5; /* 第5行 */
  background-color: rgba(255, 215, 0, 0.3);
  border: 3px solid #ffd700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  border-radius: 50%;
  z-index: 5;
}

.dice-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 30px 0;
}

.dice {
  width: 120px;
  height: 120px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: bold;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.dice.rolling {
  animation: roll 2s ease-in-out;
}

@keyframes roll {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.1);
  }
  50% {
    transform: rotate(180deg) scale(0.9);
  }
  75% {
    transform: rotate(270deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.roll-btn {
  background: linear-gradient(135deg, #4ecdc4, #45b7aa);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.roll-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(78, 205, 196, 0.3);
}

.roll-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 任务卡片样式 */
.task-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  max-width: 320px;
  aspect-ratio: 3/4;
  perspective: 1000px;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  display: block;
}

/* 确保在移动设备上也能正确居中 */
@media (max-width: 480px) {
  .task-card {
    width: 75%;
    max-width: 280px;
  }
}

.task-card.active {
  opacity: 1;
  visibility: visible;
}

.task-card-front,
.task-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background-color: rgba(0, 0, 0, 0.95);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  transition: transform 0.6s;
  cursor: pointer;
}

.task-card-front {
  transform: rotateY(0deg);
}

.task-card-back {
  transform: rotateY(180deg);
}

.task-card.flipped .task-card-front {
  transform: rotateY(180deg);
}

.task-card.flipped .task-card-back {
  transform: rotateY(0deg);
}

.task-card .task-title {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: 600;
  text-align: center;
}

.task-card-front p {
  font-size: 16px;
  opacity: 0.7;
  text-align: center;
}

.task-card .task-type {
  text-align: center;
  font-size: 16px;
  opacity: 0.8;
  margin-bottom: 15px;
}

.task-card .task-theme {
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 15px;
}

.task-card .task-executor {
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 20px;
}

.task-card .task-content {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-card-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
}

.task-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.accept-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
}

.accept-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.reject-btn {
  background: linear-gradient(135deg, #f44336, #da190b);
  color: white;
}

.reject-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
}

.reject-note {
  font-size: 12px;
  opacity: 0.7;
  font-weight: normal;
}

/* 主题选择弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: rgba(0, 0, 0, 0.95);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-theme-item {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-theme-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(10px);
}

.modal-theme-item h3 {
  font-size: 16px;
  margin-bottom: 5px;
  font-weight: 500;
}

.modal-theme-item p {
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.4;
}

/* 角色反转弹窗 */
.role-reversal-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.95);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  z-index: 2000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  min-width: 300px;
}

.role-reversal-modal.active {
  opacity: 1;
  visibility: visible;
}

.role-reversal-modal h3 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  animation: bounce 1s ease-in-out;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* 游戏结束弹窗 */
.game-over-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.95);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  z-index: 2000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  min-width: 300px;
}

.game-over-modal.active {
  opacity: 1;
  visibility: visible;
}

.game-over-modal h3 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
}

.game-over-modal p {
  font-size: 16px;
  margin-bottom: 30px;
  opacity: 0.8;
}

/* 返回按钮 */
.back-arrow {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 100;
}

.back-arrow:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .player-cards {
    flex-direction: column;
  }
  
  .theme-cards {
    grid-template-columns: 1fr;
  }
  
  .game-board {
    gap: 5px;
  }
  
  .board-cell {
    font-size: 16px;
  }
  
  .dice {
    width: 80px;
    height: 80px;
    font-size: 36px;
  }
  
  .task-card {
    padding: 20px;
  }
  
  .modal-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .header-title h1 {
    font-size: 20px;
  }
  
  .nav-icon {
    font-size: 20px;
  }
  
  .nav-text {
    font-size: 12px;
  }
  
  .game-header {
    flex-direction: column;
    gap: 15px;
  }
  
  .board-cell {
    font-size: 12px;
  }
  
  .dice {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  
  .roll-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}