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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.page {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.page.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.title {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 8px;
}

.subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 32px;
}

.card {
  background: #16213e;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #aaa;
}

input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #333;
  border-radius: 12px;
  background: #0f3460;
  color: #fff;
  font-size: 1rem;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: #e94560;
}

input::placeholder {
  color: #666;
}

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

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

.btn.primary {
  background: #e94560;
  color: #fff;
}

.btn.primary:hover {
  background: #c73e54;
}

.btn.secondary {
  background: transparent;
  color: #888;
  border: 2px solid #333;
}

.btn.secondary:hover {
  border-color: #555;
  color: #aaa;
}

.btn.big {
  padding: 18px;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.divider {
  text-align: center;
  color: #555;
  margin: 16px 0;
  font-size: 0.9rem;
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 等待页 */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.room-header h1 {
  font-size: 1.5rem;
}

.player-count {
  background: #e94560;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.qrcode-wrap {
  text-align: center;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: inline-block;
  margin-left: 50%;
  transform: translateX(-50%);
}

.player-list {
  list-style: none;
}

.player-list li {
  padding: 12px 0;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.player-list li.me {
  color: #e94560;
  font-weight: 600;
}

.player-list li.offline {
  color: #555;
  opacity: 0.6;
}

.host-badge {
  background: #e94560;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
}

.offline-badge {
  background: #444;
  color: #999;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
}

/* 游戏页 */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.game-header span:first-child {
  font-size: 1.1rem;
  color: #aaa;
}

.countdown {
  font-size: 2rem;
  font-weight: 700;
  color: #e94560;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.countdown.warning {
  color: #ff0000;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.7; transform: scale(1.1); }
}

.bomb {
  font-size: 5rem;
  text-align: center;
  margin: 16px 0;
  transition: transform 0.2s;
}

.bomb.active {
  animation: shake 0.3s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-5deg); }
  75% { transform: translateX(8px) rotate(5deg); }
}

.bomb-text {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.bomb-status {
  text-align: center;
  font-size: 1.2rem;
  color: #e94560;
  margin-bottom: 16px;
  min-height: 1.5em;
}

.pass-area {
  margin-bottom: 24px;
}

.pass-area p {
  text-align: center;
  color: #aaa;
  margin-bottom: 12px;
}

.pass-btn {
  display: block;
  width: 100%;
  padding: 16px;
  margin-bottom: 8px;
  border: 2px solid #e94560;
  border-radius: 12px;
  background: transparent;
  color: #e94560;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.pass-btn:active {
  transform: scale(0.97);
}

.pass-btn:hover {
  background: #e9456020;
}

.pass-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.score-list {
  list-style: none;
}

.score-list li {
  padding: 8px 0;
  border-bottom: 1px solid #222;
  display: flex;
  justify-content: space-between;
}

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

/* 结果页 */
.rank-list {
  list-style: none;
}

.rank-list li {
  padding: 12px 0;
  border-bottom: 1px solid #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.rank-list li.me {
  color: #e94560;
  font-weight: 600;
}

.rank {
  font-weight: 700;
  margin-right: 8px;
}

.score {
  color: #888;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .title {
    font-size: 2rem;
  }

  .container {
    padding: 0 4px;
  }
}
