:root {
  --bg-gradient: radial-gradient(circle at center, #151d2a 0%, #080c14 100%);
  --panel-bg: rgba(22, 32, 48, 0.85);
  --card-bg: rgba(30, 41, 59, 0.7);
  --p1-color: #ff4757;
  --p1-glow: rgba(255, 71, 87, 0.5);
  --p2-color: #2ed573;
  --p2-glow: rgba(46, 213, 115, 0.5);
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --neon-cyan: #38bdf8;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 10px 12px 24px;
}

.container {
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: max-width 0.3s ease;
}

.container.in-game {
  max-width: 680px;
}

/* 顶部通用导航栏 */
.app-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.brand-title .badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-weight: 600;
  -webkit-text-fill-color: #93c5fd;
}

.header-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-icon {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #334155;
  border-color: #64748b;
}

/* Toast 悬浮提示 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  color: #f8fafc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 12px rgba(56, 189, 248, 0.3);
  display: none;
  pointer-events: none;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 规则与结算全局模态弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.modal.show {
  display: flex;
}
.modal-content {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.8);
  animation: modal-zoom 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-zoom {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #38bdf8;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 8px;
}
.modal-body {
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
}
.modal-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.modal-btn:hover {
  background: #3b82f6;
}
