:root {
  --bg: #0b132b;
  --panel: rgba(12, 20, 37, 0.8);
  --card: rgba(18, 29, 50, 0.9);
  --accent: #f25f5c;
  --accent-2: #247ba0;
  --accent-3: #70c1b3;
  --text: #f7f7ff;
  --muted: #9fa8c9;
  --success: #4cc9f0;
  --danger: #ef476f;
  --shadow: 0 20px 35px rgba(3, 8, 20, 0.45);
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #1b2a49, #040b18 60%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  border: none;
  cursor: pointer;
  font: inherit;
  -webkit-appearance: none;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow);
}

.primary-btn:hover,
.primary-btn:active {
  transform: translateY(-2px);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.ghost-btn:hover,
.ghost-btn:active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.app-header {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle at 30% 30%, var(--accent-3), var(--accent-2));
  border-radius: 12px;
  font-size: 22px;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.layout {
  padding: 0;
  width: 100%;
}

.player-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 320px;
  height: 100vh;
  background: var(--panel);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(30px);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.player-panel:not(.hidden) {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.player-list {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-content: start;
}

.panel-actions {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-actions button {
  width: 100%;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  gap: 8px;
  border: 2px solid transparent;
  transition: background 0.2s ease;
  cursor: grab;
}

.player-card.dragging {
  opacity: 0.4;
}

.player-card:active {
  background: rgba(255, 255, 255, 0.1);
}

.player-card.active-winner {
  border-color: var(--accent-3);
  background: rgba(112, 193, 179, 0.22);
}

.player-card .avatar {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.player-card .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-card .avatar .emotion {
  position: absolute;
  bottom: -4px;
  right: -6px;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 4px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.player-card .name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  max-width: 100%;
}
.player-card .score {
  display: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
}

.edit-btn {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.edit-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.2);
}

.content {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  min-height: calc(100vh - 72px);
}

.mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.icon-btn-float {
  position: fixed;
  right: 12px;
  top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(112, 193, 179, 0.9);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid rgba(112, 193, 179, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.icon-btn-float:hover {
  background: rgba(112, 193, 179, 1);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.mode-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.95rem;
}

.mode-tab.active {
  color: #fff;
  background: rgba(112, 193, 179, 0.25);
  font-weight: 600;
}

.mode-view {
  display: none;
}

.mode-view.active {
  display: block;
}

.controls-card,
.history-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  max-width: 100%;
  margin: 0 auto;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
  margin-top: 20px;
}

.control span {
  font-weight: 600;
}

.slider-control,
.step-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.step-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
}

.slider-value,
.step-value {
  min-width: 60px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
}

input[type='range'] {
  accent-color: var(--accent-3);
  flex: 1;
}

.drop-zone {
  margin-top: 28px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}

.drop-zone.dragover {
  border-color: var(--accent-3);
  color: #fff;
}

.winner-slot {
  min-height: 72px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  color: var(--muted);
  position: relative;
}

.winner-slot.filled {
  background: rgba(112, 193, 179, 0.26);
  color: #fff;
}

.winner-slot .player-card {
  width: 100%;
  cursor: grab;
}

.control-footer {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.control-footer button {
  flex: 1;
  min-width: 120px;
}

.big-two-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.big-two-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.big-two-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.big-two-card:active {
  transform: scale(0.98);
}

.big-two-card.winner-selected {
  border-color: rgba(112, 193, 179, 0.6);
  background: rgba(112, 193, 179, 0.1);
}

.big-two-card.winner-selected::after {
  content: '✓ 赢家';
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(112, 193, 179, 0.9);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.big-two-card .player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.big-two-card .player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.big-two-card .info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.big-two-card .name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-instruction {
  color: var(--muted);
  text-align: center;
  margin: 12px 0 20px;
  font-size: 0.95rem;
}

#doudizhu-base-selector,
#big-two-base-selector {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  margin: 16px auto !important;
  padding: 16px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border-radius: 10px !important;
  max-width: 300px !important;
}

#doudizhu-base-selector label,
#big-two-base-selector label {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  white-space: nowrap !important;
  margin: 0 !important;
}

#doudizhu-base-selector input[type="number"],
#big-two-base-selector input[type="number"] {
  width: 80px !important;
  padding: 8px 12px !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  text-align: center !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  color: var(--text) !important;
}

.base-score-selector {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  max-width: 300px;
}

.base-score-selector label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.base-score-selector input[type="number"] {
  width: 80px;
  padding: 8px 12px;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text);
}

.player-selector {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
}

.selector-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}

.selected-count {
  font-weight: 600;
  transition: color 0.3s ease;
}

.player-avatars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.player-avatar-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.player-avatar-item:active {
  transform: scale(0.95);
}

.player-avatar-item.selected {
  background: rgba(112, 193, 179, 0.25);
  border-color: #70c1b3;
  box-shadow: 0 0 0 1px rgba(112, 193, 179, 0.3);
  transform: scale(1.02);
}

.player-avatar-item.selected::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: #70c1b3;
  color: #1a1f2e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.player-avatar-item.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.player-avatar-item .avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
}

.player-avatar-item .avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selector-actions {
  margin-top: 12px;
  text-align: center;
}

.selector-actions button {
  min-width: 140px;
}

.selector-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-area {
  margin-top: 16px;
}

.game-area.hidden {
  display: none;
}

.doudizhu-player-grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 24px;
  padding: 0 4px;
}

.doudizhu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  min-width: 95px;
  flex: 1;
  max-width: 120px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.doudizhu-card:hover {
  transform: translateY(-4px);
  background: rgba(112, 193, 179, 0.12);
}

.doudizhu-card.landlord {
  border-color: rgba(112, 193, 179, 0.6);
  background: rgba(112, 193, 179, 0.18);
  box-shadow: 0 0 12px rgba(112, 193, 179, 0.25);
}

.doudizhu-card .player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
}

.doudizhu-card .player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doudizhu-card .player-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.doudizhu-role {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.doudizhu-card.landlord .doudizhu-role {
  color: var(--text);
  background: rgba(112, 193, 179, 0.35);
}

.doudizhu-card button {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.doudizhu-card button:hover {
  background: rgba(112, 193, 179, 0.25);
  border-color: rgba(112, 193, 179, 0.6);
}

.doudizhu-card button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.doudizhu-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.doudizhu-controls label,
.doudizhu-controls span {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.doudizhu-result {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.doudizhu-result span {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
}

.doudizhu-result-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.doudizhu-result-btn:hover {
  background: rgba(112, 193, 179, 0.15);
  border-color: rgba(112, 193, 179, 0.4);
}

.doudizhu-result-btn.active {
  background: rgba(112, 193, 179, 0.25);
  border-color: rgba(112, 193, 179, 0.8);
  box-shadow: 0 0 12px rgba(112, 193, 179, 0.3);
}

.doudizhu-bombs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doudizhu-bombs label {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
}

.bomb-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bomb-btn {
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bomb-btn:hover {
  background: rgba(255, 165, 0, 0.15);
  border-color: rgba(255, 165, 0, 0.4);
}

.bomb-btn.active {
  background: rgba(255, 165, 0, 0.25);
  border-color: rgba(255, 165, 0, 0.8);
  box-shadow: 0 0 12px rgba(255, 165, 0, 0.3);
  color: #ffa500;
}

.doudizhu-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-label {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.preview-item .player-name {
  font-size: 0.85rem;
  color: var(--muted);
}

.preview-item .player-delta {
  font-size: 1.1rem;
  font-weight: 700;
}

.preview-item .player-delta.positive {
  color: var(--success);
}

.preview-item .player-delta.negative {
  color: var(--danger);
}

.settlement-table .role-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 4px;
}

.game-warning {
  background: rgba(249, 112, 104, 0.15);
  border: 2px solid rgba(249, 112, 104, 0.4);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  margin: 20px auto;
  max-width: 400px;
}

.game-warning p {
  margin: 8px 0;
  font-size: 1rem;
}

.game-warning p:first-child {
  font-size: 1.2rem;
  font-weight: 600;
  color: #f97068;
}

.counter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cards-selector {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  flex: 1;
  max-width: none;
}

.card-count-btn {
  width: 100%;
  height: 32px;
  min-width: 0;
  padding: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-count-btn:active {
  transform: scale(0.95);
}

.card-count-btn.active {
  background: rgba(112, 193, 179, 0.3);
  border-color: rgba(112, 193, 179, 0.6);
  color: #70c1b3;
}

.winner-badge-large {
  padding: 8px 16px;
  background: rgba(112, 193, 179, 0.2);
  border-radius: 8px;
  color: #70c1b3;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.counter button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.2rem;
}

.counter-value {
  min-width: 44px;
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.counter-value.winner-badge {
  color: #70c1b3;
  font-size: 0.95rem;
  font-weight: 700;
}

.settlement-records {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
}

.settlement-records h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--muted);
}

.settlement-list {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
}

.settlement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.settlement-table th {
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 6px;
  text-align: center;
  font-weight: 600;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  font-size: 0.8rem;
}

.settlement-table td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  white-space: nowrap;
}

.settlement-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.settlement-table .winner-cell {
  color: #70c1b3;
  font-weight: 600;
}

.settlement-table .positive {
  color: #70c1b3;
}

.settlement-table .negative {
  color: #f97068;
}

.settlement-table .total-row {
  background: rgba(255, 255, 255, 0.05);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

.settlement-table .settlement-row {
  background: rgba(112, 193, 179, 0.1);
  border-top: 2px solid rgba(112, 193, 179, 0.3);
}

.delete-record-btn {
  padding: 3px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
  background: rgba(249, 112, 104, 0.15);
  color: #f97068;
  border: 1px solid rgba(249, 112, 104, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.delete-record-btn:hover {
  background: rgba(249, 112, 104, 0.25);
}

.delete-record-btn:active {
  transform: scale(0.95);
}

.settlement-total {
  margin-top: 20px;
  padding: 20px;
  background: rgba(112, 193, 179, 0.1);
  border: 2px solid rgba(112, 193, 179, 0.3);
  border-radius: 12px;
}

.settlement-total h4 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.settlement-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.settlement-total-player {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.settlement-total-player.positive {
  color: #70c1b3;
}

.settlement-total-player.negative {
  color: #f97068;
}

.history-card {
  min-height: 400px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  margin-top: 24px;
  display: grid;
  gap: 16px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 12px;
}

.history-meta {
  margin-top: 16px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 10px;
  border: 1px solid transparent;
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.history-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.history-title {
  font-weight: 600;
}

.history-time {
  font-size: 0.85rem;
  color: var(--muted);
}

.history-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.filter-btn.active {
  background: rgba(112, 193, 179, 0.3);
  color: #fff;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 11, 24, 0.92);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.overlay-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.overlay-mask.hidden {
  opacity: 0;
  pointer-events: none;
}

.gate-card {
  width: min(430px, 90vw);
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 38px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
}

.password-display {
  margin: 18px auto;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  letter-spacing: 8px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 12px;
}

.password-display[data-filled='true'] {
  color: #fff;
}

.virtual-keyboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.virtual-keyboard button {
  padding: 12px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
}

.gate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}

.gate-hint {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.error {
  color: var(--danger);
  margin-top: 12px;
  min-height: 24px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 11, 24, 0.75);
  display: grid;
  place-items: center;
  z-index: 1500;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(480px, 92vw);
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

input[type='text'],
input[type='file'] {
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

input[type='text']::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.drop-upload {
  border: 2px dashed rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 18px;
  align-items: center;
}

.drop-upload.dragover {
  border-color: var(--accent-3);
}

#avatar-preview {
  min-height: 120px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  overflow: hidden;
}

#avatar-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

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

  .player-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .layout {
    padding: 18px;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    flex: 1;
  }

  .player-card {
    grid-template-columns: 56px 1fr;
  }

  .edit-btn {
    display: none;
  }
}

/* 会话管理样式 */
.sessions-header {
  text-align: center;
  padding: 24px 0;
}

.sessions-header h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sessions-header p {
  margin: 0;
  color: var(--muted);
}

.active-sessions {
  margin-bottom: 32px;
}

.active-sessions h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: var(--text);
}

.session-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.session-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  background: rgba(18, 29, 50, 1);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-type {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.session-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.new-game-section {
  margin-top: 32px;
}

.new-game-section h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: var(--text);
}

.new-game-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.new-game-btn {
  flex: 1;
  min-width: 160px;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.new-game-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(242, 95, 92, 0.4);
}

.new-game-btn:active {
  transform: translateY(-2px);
}

.session-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.danger-btn {
  padding: 12px 24px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(239, 71, 111, 0.3);
}

.danger-btn:hover {
  background: #d63359;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 71, 111, 0.4);
}

.danger-btn:active {
  transform: translateY(0);
}

.empty-message {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 1.1rem;
}

/* 历史记录表格样式 */
.history-table-container {
  overflow: auto;
  margin-top: 24px;
  max-height: calc(100vh - 250px);
  position: relative;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-table thead {
  background: rgba(242, 95, 92, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.history-table .header-row {
  background: rgba(242, 95, 92, 0.15);
}

.history-table .total-row {
  background: rgba(76, 201, 240, 0.15);
  position: sticky;
  top: 45px; /* 表头高度 */
  z-index: 9;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.history-table .total-label {
  font-weight: bold;
  color: var(--text);
  text-align: center;
}

.history-table .zero-total {
  color: var(--muted);
}

.history-table th {
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  white-space: nowrap;
}

.history-table td {
  padding: 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.history-table .not-participated {
  color: rgba(255, 255, 255, 0.2);
  font-weight: normal;
}

.history-table .positive {
  color: var(--success);
  font-weight: 600;
}

.history-table .negative {
  color: var(--danger);
  font-weight: 600;
}

/* 玩家头像样式（用于历史记录表格） */
.player-avatar-header {
  text-align: center !important;
}

.player-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

.player-emoji {
  font-size: 1.8em;
  display: inline-block;
  vertical-align: middle;
}

.player-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: bold;
  font-size: 0.9em;
}

.delete-btn {
  padding: 6px 12px;
  background: var(--danger);
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.delete-btn:hover {
  background: #d63359;
  transform: translateY(-1px);
}

/* 会话详情样式 */
.session-detail {
  padding: 20px;
}

.session-detail h3 {
  margin: 0 0 16px;
  font-size: 1.6rem;
  color: var(--text);
}

.session-detail h4 {
  margin: 24px 0 12px;
  font-size: 1.2rem;
  color: var(--text);
}

.session-summary {
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.session-summary p {
  margin: 8px 0;
  color: var(--muted);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-table th {
  background: rgba(242, 95, 92, 0.1);
  font-weight: 600;
  color: var(--text);
}

.detail-table td {
  color: var(--muted);
}

.detail-table tbody tr:last-child td {
  border-bottom: none;
}

.detail-table .positive {
  color: var(--success);
  font-weight: 600;
}

.detail-table .negative {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 720px) {
  .new-game-buttons {
    flex-direction: column;
  }
  
  .new-game-btn {
    min-width: 100%;
  }
  
  .history-table-container {
    overflow-x: scroll;
  }
  
  .history-table {
    min-width: 600px;
  }
}

/* 广告位样式 */
.ad-container {
  margin-top: 24px;
  width: 100%;
}

.ad-placeholder {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1rem;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-placeholder p {
  margin: 0;
  font-weight: 500;
}

/* 密码页面广告位样式 */
.gate-ad-container {
  margin-top: 24px;
  width: 100%;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gate-ad-placeholder {
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-ad-placeholder p {
  margin: 0;
  font-weight: 500;
}

/* 德州扑克样式 */
.texas-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
  padding: 0 8px;
}

.texas-player-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.texas-player-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(112, 193, 179, 0.3);
}

.texas-player-card .player-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
}

.texas-player-card .player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.texas-player-card .player-name-label {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

.texas-score-input {
  width: 100%;
  max-width: 180px;
  padding: 10px 12px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  transition: all 0.2s ease;
}

.texas-score-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(112, 193, 179, 0.6);
  box-shadow: 0 0 0 3px rgba(112, 193, 179, 0.1);
}

.texas-score-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.input-hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.texas-sum-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.texas-sum-indicator.sum-zero {
  background: rgba(112, 193, 179, 0.15);
  border-color: rgba(112, 193, 179, 0.6);
  box-shadow: 0 0 20px rgba(112, 193, 179, 0.2);
}

.texas-sum-indicator.sum-non-zero {
  background: rgba(243, 129, 129, 0.15);
  border-color: rgba(243, 129, 129, 0.6);
}

.sum-label {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

.sum-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  min-width: 80px;
  text-align: center;
  transition: all 0.3s ease;
}

.texas-sum-indicator.sum-zero .sum-value {
  color: #70c1b3;
}

.texas-sum-indicator.sum-non-zero .sum-value {
  color: #f38181;
}

.sum-status {
  font-size: 1.2rem;
  font-weight: 600;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.texas-sum-indicator.sum-zero .sum-status {
  opacity: 1;
  transform: scale(1);
  color: #70c1b3;
}

.texas-sum-indicator.sum-zero .sum-status::before {
  content: '✓ 可以结算';
}

.texas-sum-indicator.sum-non-zero .sum-status {
  opacity: 1;
  transform: scale(1);
  color: #f38181;
}

.texas-sum-indicator.sum-non-zero .sum-status::before {
  content: '⚠ 总和需为0';
}

@media (max-width: 768px) {
  .texas-player-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }
  
  .texas-player-card {
    padding: 12px 8px;
  }
  
  .texas-player-card .player-avatar {
    width: 50px;
    height: 50px;
  }
  
  .texas-score-input {
    font-size: 1rem;
    padding: 8px 10px;
  }
}

/* ==================== Google AdSense 广告样式 ==================== */

.ad-container {
  width: 100%;
  margin: 16px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.ad-top {
  margin-top: 0;
  margin-bottom: 20px;
}

.ad-history {
  margin: 20px 0;
}

/* 广告位占位符（测试用） */
.ad-placeholder {
  width: 100%;
  min-height: 90px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* 响应式广告调整 */
@media (max-width: 768px) {
  .ad-container {
    margin: 12px 0;
    padding: 8px;
    min-height: 80px;
  }
  
  .ad-top {
    margin-bottom: 16px;
  }
}

