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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #8B0000;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: url('images/s-bj.jpg') no-repeat center center;
  background-size: cover;
  color: #fff;
  overflow-y: auto;
}

.page.hidden {
  display: none;
}

/* 顶部标题栏 */
.header-bar {
  width: 100%;
  text-align: center;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #d4a84b;
  border-radius: 8px;
}

.title {
  font-size: 20px;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
}

/* 主题标题图（统一各页面风格） */
.title-img {
  width: 64%;
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto 18px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}

/* 选队页 */
.team-page {
  justify-content: flex-start;
  padding-top: 8vh;
}

.team-header {
  text-align: center;
  margin-bottom: 4vh;
}

.team-sub-title {
  font-size: 16px;
  color: #ffe082;
  margin-top: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  width: 100%;
  margin-bottom: 3vh;
  padding: 0 4vw;
}

.team-card {
  position: relative;
  width: 38vw;
  max-width: 170px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.team-card.disabled {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.team-card-bg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.team-card-content {
  position: absolute;
  bottom: 9%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.team-count-box {
  display: flex;
  align-items: baseline;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.team-count-num {
  font-size: 28px;
  line-height: 1;
}

.team-count-unit {
  font-size: 14px;
  margin-left: 2px;
}

.vs-icon {
  width: 16vw;
  max-width: 70px;
  flex-shrink: 0;
  z-index: 2;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.vs-icon img {
  width: 100%;
  height: auto;
  display: block;
}

/* 按钮 */
.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.btn-join {
  width: 76%;
  padding: 8px 0;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(180deg, #9e9e9e, #616161);
  border-radius: 6px;
  box-shadow: 0 3px 0 #424242;
}

.btn-join-a,
.btn-join-b {
  background: linear-gradient(180deg, #9e9e9e, #616161);
}

.btn-join:disabled {
  background: linear-gradient(180deg, #bdbdbd, #757575);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.8;
}

.btn-random-join {
  border: none;
  background: transparent;
  padding: 0;
  width: 64vw;
  max-width: 280px;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-random-join:active {
  transform: scale(0.96);
}

.btn-random-join img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.btn-random-join:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-random {
  background: #00c853;
  color: #fff;
  width: 200px;
}

.error-text {
  color: #ff9999;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 等待页 */
.waiting-page {
  justify-content: flex-start;
  padding-top: 30px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ffd700;
}

.user-nickname {
  font-size: 14px;
  color: #ffd700;
}

.team-info {
  font-size: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.highlight {
  color: #ffd700;
  font-weight: bold;
  font-size: 18px;
}

.teams-status {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #d4a84b;
  border-radius: 8px;
}

.status-name {
  font-size: 15px;
}

.status-count {
  font-size: 15px;
  color: #ffd700;
  font-weight: bold;
}

.waiting-tip {
  font-size: 18px;
  color: #ffcc80;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 游戏中页 */
.playing-page {
  justify-content: flex-start;
  padding-top: 30px;
}

.countdown {
  font-size: 64px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
  margin: 20px 0;
  font-family: 'Courier New', monospace;
}

.shake-hint {
  font-size: 32px;
  font-weight: bold;
  color: #ffcc80;
  margin: 32px 0;
  animation: shakeText 0.5s infinite;
}

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

.personal-shakes {
  font-size: 18px;
  margin-top: 16px;
  color: #fff;
}

.sound-controls {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.control-btn {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #d4a84b;
  border-radius: 6px;
  color: #ffd700;
  font-size: 13px;
  cursor: pointer;
}

/* 结算页 */
.result-page {
  justify-content: flex-start;
  padding-top: 30px;
}

.result-title {
  font-size: 28px;
  font-weight: bold;
  color: #ffd700;
  margin: 16px 0;
  text-align: center;
}

.result-score {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #d4a84b;
  border-radius: 8px;
  font-size: 16px;
}

.top3-section {
  width: 100%;
  max-width: 320px;
  margin-bottom: 24px;
}

.top3-section h3 {
  text-align: center;
  color: #ffd700;
  margin-bottom: 12px;
}

.top3-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top3-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.top3-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffd700;
  color: #8B0000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.top3-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ffd700;
}

.top3-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top3-name {
  font-size: 14px;
  color: #fff;
}

.top3-shakes {
  font-size: 12px;
  color: #ffcc80;
}

/* 禁止加入页 */
.late-join-page {
  justify-content: center;
}

.late-content {
  text-align: center;
}

.late-content h2 {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 12px;
}

.late-content p {
  font-size: 16px;
  color: #ffcc80;
  margin-bottom: 24px;
}
