/* =============== 基础重置 & 变量 =============== */
:root {
  /* 霓虹紫 / 骚粉 / 酸绿 Y2K 赛博配色 */
  --primary: #B026FF;          /* 霓虹紫 */
  --primary-dark: #8E00E0;
  --primary-light: #D77AFF;
  --secondary: #00F0FF;        /* 电光青 */
  --secondary-dark: #00C8D4;
  --neon-pink: #FF2E9A;        /* 骚粉 */
  --neon-green: #00FF9C;       /* 酸绿 */
  --neon-yellow: #F9F871;
  --danger: #FF2E6A;
  --danger-dark: #E81E56;
  --warning: #FFC93C;
  --warning-dark: #E8B12C;
  --success: #00FF9C;
  --bg: #0A0614;               /* 更深的夜色 */
  --bg-card: #15102A;
  --bg-card-hover: #1F1840;
  --text: #FFFFFE;
  --text-secondary: #C5BDE0;
  --text-muted: #7B6E9C;
  --border: #2E1F5C;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(176, 38, 255, 0.25);
}

/* 赛博霓虹背景网格 - 全屏 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(176, 38, 255, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 46, 154, 0.15), transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 240, 255, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(176, 38, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 38, 255, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
  animation: gridScroll 20s linear infinite;
}

@keyframes gridScroll {
  from { background-position: 0 0, 0 0; }
  to { background-position: 40px 40px, 40px 40px; }
}

#app { z-index: 1; }

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

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

#app {
  width: 100%;
  height: 100%;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}

/* =============== 页面切换 =============== */
.page {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============== 按钮 =============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--neon-pink));
  color: white;
  box-shadow: 0 4px 16px rgba(176, 38, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-dark), #E01E7A);
  box-shadow: 0 6px 24px rgba(255, 46, 154, 0.5);
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(100%); }

.btn-secondary {
  background: var(--secondary);
  color: var(--bg);
}
.btn-secondary:hover:not(:disabled) { background: var(--secondary-dark); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); }

.btn-warning {
  background: var(--warning);
  color: var(--bg);
}
.btn-warning:hover:not(:disabled) { background: var(--warning-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { 
  background: var(--bg-card-hover);
  color: var(--text);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-icon {
  font-size: 20px;
}

/* =============== 输入框 =============== */
.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--primary);
}

.input::placeholder {
  color: var(--text-muted);
}

/* =============== 弹窗 =============== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: modalIn 0.3s ease;
}

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 22px;
}

.modal-content .input {
  margin-bottom: 16px;
}

.modal-content .btn {
  width: 100%;
  margin-bottom: 10px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* =============== 首页 =============== */
.home-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 48px;
}

.version-info {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 1px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.2s, transform 0.2s;
  opacity: 0.9;
}

.sound-toggle:hover {
  opacity: 1;
  transform: scale(1.15);
}

.sound-toggle.muted {
  opacity: 0.4;
  filter: grayscale(1);
}

.logo-area {
  text-align: center;
}

.dice-icon {
  font-size: 84px;
  display: inline-block;
  animation: diceWobble 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 16px rgba(176, 38, 255, 0.7));
}

@keyframes diceWobble {
  0%, 100%  { transform: translateY(0) rotate(-8deg); }
  25%       { transform: translateY(-8px) rotate(6deg); }
  50%       { transform: translateY(-14px) rotate(-4deg); }
  75%       { transform: translateY(-6px) rotate(8deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.game-title {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-pink), var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 12px;
  letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(255, 46, 154, 0.4);
  filter: drop-shadow(0 2px 8px rgba(176, 38, 255, 0.5));
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 2px 8px rgba(176, 38, 255, 0.5)); }
  50%      { filter: drop-shadow(0 2px 20px rgba(255, 46, 154, 0.8)); }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 10px;
  letter-spacing: 2px;
  opacity: 0.85;
}

.menu-buttons {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =============== 等待房间 =============== */
.waiting-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 24px;
}

.waiting-container h2 {
  font-size: 22px;
  color: var(--text-secondary);
  animation: pulse 2s ease infinite;
}

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

.room-code-display {
  text-align: center;
}

.room-code-display .label {
  font-size: 14px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.code-digits {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.code-digit {
  width: 44px;
  height: 52px;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-light);
  font-family: 'Courier New', monospace;
}

.share-buttons {
  display: flex;
  gap: 10px;
}

.player-list {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.player-item.you {
  border-color: var(--primary);
}

.player-status {
  font-size: 20px;
}

.player-name {
  font-size: 16px;
  font-weight: 600;
}

.room-timer {
  font-size: 14px;
  color: var(--text-muted);
}

/* =============== 对局主界面 =============== */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  gap: 8px;
  overflow: hidden;
  position: relative;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  gap: 8px;
  min-width: 0;
}

.player-header .player-name {
  font-size: 15px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* 骰子 */
.dice-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 8px 0;
}

.die {
  width: 52px;
  height: 52px;
  background: #f5f0e8;
  border: 2px solid #c9bfa8;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 6px;
  transition: all 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.4);
  position: relative;
}

.die.hidden {
  background: var(--bg-card-hover);
  border-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.die.revealed {
  animation: dieReveal 0.5s ease;
}

/* 圆点基础样式 */
.die .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2c2c2c;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

/* 1和4的圆点用红色 */
.die[data-value="1"] .dot,
.die[data-value="4"] .dot {
  background: #cc2222;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

/* 圆点位置 - 使用grid定位 */
.dot.top-left     { grid-column: 1; grid-row: 1; align-self: start; justify-self: start; }
.dot.top-right    { grid-column: 3; grid-row: 1; align-self: start; justify-self: end; }
.dot.mid-left     { grid-column: 1; grid-row: 2; align-self: center; justify-self: start; }
.dot.center       { grid-column: 2; grid-row: 2; align-self: center; justify-self: center; }
.dot.mid-right    { grid-column: 3; grid-row: 2; align-self: center; justify-self: end; }
.dot.bottom-left  { grid-column: 1; grid-row: 3; align-self: end; justify-self: start; }
.dot.bottom-right { grid-column: 3; grid-row: 3; align-self: end; justify-self: end; }

@keyframes dieReveal {
  0%   { transform: rotateY(0deg) rotateX(0deg) scale(1); }
  30%  { transform: rotateY(180deg) rotateX(90deg) scale(1.15); }
  60%  { transform: rotateY(360deg) rotateX(180deg) scale(0.95); }
  100% { transform: rotateY(360deg) rotateX(360deg) scale(1); }
}

@keyframes diceShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  10% { transform: translate(-6px, -4px) rotate(-15deg) scale(1.05); }
  20% { transform: translate(6px, 4px) rotate(18deg) scale(0.95); }
  30% { transform: translate(-5px, 6px) rotate(-12deg) scale(1.08); }
  40% { transform: translate(6px, -5px) rotate(20deg) scale(0.93); }
  50% { transform: translate(-4px, 7px) rotate(-8deg) scale(1.1); }
  60% { transform: translate(5px, -7px) rotate(14deg) scale(0.94); }
  70% { transform: translate(-6px, 3px) rotate(-18deg) scale(1.06); }
  80% { transform: translate(6px, -4px) rotate(16deg) scale(0.96); }
  90% { transform: translate(-3px, -6px) rotate(-6deg) scale(1.03); }
}

.die.shaking {
  animation: diceShake 0.3s ease infinite;
}

/* 叫数记录 */
.bid-history {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 14px;
  overflow-y: auto;
  min-height: 80px;
  max-height: 180px;
  border: 1px solid var(--border);
}

.bid-history-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bid-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bid-item {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  animation: slideIn 0.3s ease;
}

.bid-item.mine {
  border-left: 3px solid var(--primary);
}

.bid-item.theirs {
  border-left: 3px solid var(--secondary);
}

.bid-item .bid-player {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bid-item .bid-content {
  font-weight: 700;
  margin-top: 2px;
  word-break: break-word;
}

/* 飞/斋模式标签颜色 */
.mode-tag-fly {
  color: #e74c3c;
  font-weight: 800;
}

.mode-tag-zhai {
  color: #2980b9;
  font-weight: 800;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.turn-indicator {
  font-size: 13px;
  color: var(--primary-light);
  margin-top: 8px;
  font-weight: 600;
}

/* 操作区 */
.action-area {
  padding: 10px 0;
}

.bid-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bid-selectors {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.selector-group {
  flex: 1;
}

.selector-group label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.number-selector {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.sel-btn {
  width: 36px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.sel-btn:active {
  background: var(--primary);
}

.sel-value {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-light);
}

.dice-value-selector {
  display: flex;
  gap: 4px;
}

.dice-val-btn {
  width: 34px;
  height: 40px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.dice-val-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.dice-val-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.mode-toggle {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  height: 40px;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

/* 飞 - 橙红暖色 */
.mode-btn.mode-fly.active {
  background: #e74c3c;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* 斋 - 蓝色冷色 */
.mode-btn.mode-zhai.active {
  background: #2980b9;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mode-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: var(--bg);
  color: var(--text-muted);
}

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

.bid-buttons {
  display: flex;
  gap: 10px;
}

.bid-buttons .btn {
  flex: 1;
}

/* 叫骰:开:劈 = 4:4:2 比例 */
.bid-buttons .btn-bid-action {
  flex: 4;
}

.bid-buttons .btn-open-action {
  flex: 4;
}

.bid-buttons .btn-challenge-action {
  flex: 2;
}

/* 计时条 */
.timer-bar {
  position: relative;
  height: 28px;
  background: var(--bg-card);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 8px;
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
  border-radius: 14px;
  width: 100%;
  transition: width 1s linear;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* 劈骰提示 */
.challenge-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(253,203,110,0.15), rgba(255,107,107,0.15));
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid rgba(253,203,110,0.3);
}

.challenge-icon {
  font-size: 28px;
  animation: flash 0.5s ease infinite alternate;
}

@keyframes flash {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.challenge-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--warning);
}

/* 等待对方 */
.waiting-text {
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  padding: 20px;
  animation: pulse 2s ease infinite;
}

/* =============== 结算页面 =============== */
.settlement-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  gap: 16px;
  overflow-y: auto;
}

.settlement-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.settlement-dice-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settlement-player-dice {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.settlement-player-dice .player-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settlement-player-dice .pattern-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.pattern-tag.single { background: var(--danger); color: white; }
.pattern-tag.leopard { background: var(--warning); color: var(--bg); }
.pattern-tag.pureLeopard { background: var(--success); color: white; }
.pattern-tag.normal { background: var(--border); color: var(--text-secondary); }

.settlement-details {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  border: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-value {
  font-weight: 700;
}

.settlement-result {
  text-align: center;
  padding: 16px;
  width: 100%;
  border-radius: var(--radius);
}

.result-winner {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-score {
  font-size: 15px;
  color: var(--text-secondary);
}

.settlement-stats {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.stats-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-align: center;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.stats-row .stat-name {
  font-weight: 600;
}

.stats-row .stat-detail {
  color: var(--text-secondary);
}

.settlement-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* 再来一局按钮发光效果 */
.btn-glow {
  animation: glowPulse 1s ease infinite;
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.6);
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(108, 92, 231, 0.4); }
  50% { box-shadow: 0 0 25px rgba(108, 92, 231, 0.8), 0 0 40px rgba(108, 92, 231, 0.3); }
}

/* =============== 规则页面 =============== */
.rules-container {
  flex: 1;
  padding: 32px 24px;
  overflow-y: auto;
}

.rules-container h2 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 24px;
}

.rules-content {
  margin-bottom: 24px;
}

.rules-content h3 {
  font-size: 17px;
  color: var(--primary-light);
  margin: 18px 0 8px;
}

.rules-content p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

.rules-content ul {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

/* =============== Toast =============== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  z-index: 3500;          /* v2.6.6：高于 overlay(3000)，断线时也能看到提示 */
  transition: transform 0.3s ease;
  max-width: 90%;
  text-align: center;
  white-space: pre-line;  /* v2.6.6：支持 \n 换行（多行预设说明） */
  line-height: 1.5;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

/* =============== 断线遮罩 =============== */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

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

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.overlay-content p {
  color: var(--text-secondary);
  font-size: 16px;
}

/* =============== 响应式 =============== */
@media (min-width: 481px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}



/* =============== 规则吸边按钮（v2.6.6：移到右下角，不再遮挡对手分数） =============== */
.rules-float-btn {
  position: absolute;
  bottom: 60px;          /* 聊天栏上方 */
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(21, 16, 42, 0.78);
  backdrop-filter: blur(6px);
  font-size: 15px;
  cursor: pointer;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  opacity: 0.72;
  transition: all 0.2s;
}

.rules-float-btn:hover {
  opacity: 1;
  border-color: var(--primary-light);
}

.rules-float-btn:active {
  transform: scale(0.9);
  background: var(--bg-card-hover);
  opacity: 1;
}

/* 规则速查弹窗 */
.rules-quick-modal {
  text-align: left !important;
  max-width: 380px !important;
}

.rules-quick-modal h2 {
  text-align: center;
  font-size: 20px;
}

.rules-quick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.rule-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.rule-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.rule-text strong {
  color: var(--text);
}

.rule-text em {
  color: var(--warning);
  font-style: normal;
  font-weight: 700;
}

/* =============== 数量和点数之间的"个"字 =============== */
.selector-sep {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
}

/* =============== 聊天栏 =============== */
.chat-bar {
  display: flex;
  gap: 6px;
  padding: 6px 0;
  align-items: center;
}

.chat-input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 17px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  flex-shrink: 0;
}

/* =============== 弹幕（v2.6.6：限高一窄条，避免遮挡分数/骰子/操作区） =============== */
.danmaku-container {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 76px;          /* 仅顶部 2 条 lane，避开下方所有信息 */
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

/* v2.7.1: 赛制进度条出现时,弹幕容器整体下移避免被遮挡 */
.game-container.has-match-bar .danmaku-container {
  top: 36px;
  height: 64px;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7), 0 0 8px rgba(0,0,0,0.3);
  animation: danmakuMove 12s linear forwards;
  padding: 3px 10px;
  border-radius: 12px;
  pointer-events: none;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.danmaku-item.mine {
  color: #A29BFE;
  background: rgba(108, 92, 231, 0.15);
}

.danmaku-item.theirs {
  color: #00CEC9;
  background: rgba(0, 206, 201, 0.15);
}

@keyframes danmakuMove {
  from { right: -300px; opacity: 1; }
  85% { opacity: 1; }
  to { right: 110%; opacity: 0; }
}

/* =============== 创建房间 - 人数选择器 =============== */
.player-count-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.count-btn {
  width: 72px;
  height: 48px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.count-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 0 12px rgba(108, 92, 231, 0.4);
}

.count-btn:hover:not(.active) {
  border-color: var(--primary-light);
  color: var(--text);
}

.total-dice-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

/* =============== 创房弹窗 - 玩法预设 & 单骰行为 =============== */
.modal-create-content {
  max-height: 88vh;
  overflow-y: auto;
  width: min(420px, 92vw);
}

.create-section {
  margin-bottom: 18px;
}

.section-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-tip {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  cursor: help;
}

.preset-selector,
.single-behavior-selector {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.preset-btn,
.sb-btn {
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-size: 13px;
  line-height: 1.4;
}

.preset-btn .preset-name,
.sb-btn .sb-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.preset-btn .preset-short,
.sb-btn .sb-short {
  color: var(--text-muted);
  font-size: 12px;
}

.preset-btn.active,
.sb-btn.active {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.15);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.35);
}

.preset-btn:hover:not(.active),
.sb-btn:hover:not(.active) {
  border-color: var(--primary-light);
}

.preset-detail,
.single-behavior-detail {
  background: var(--bg-tertiary, rgba(255,255,255,0.04));
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.preset-detail ul {
  margin: 0;
  padding-left: 18px;
}

.preset-detail li {
  margin: 2px 0;
}

/* 单骰行为的 3 个按钮横向排列 */
.single-behavior-selector {
  grid-template-columns: repeat(3, 1fr);
}

.sb-btn {
  text-align: center;
  padding: 10px 6px;
}

.sb-btn .sb-name {
  font-size: 13px;
}

/* 游戏内规则标签（对局主界面顶部） */
.ruleset-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(108, 92, 231, 0.12);
  border: 1px solid rgba(108, 92, 231, 0.35);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ruleset-badge .badge-icon {
  font-size: 13px;
}

/* 单骰重摇提示（toast 升级版） */
.reroll-banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: linear-gradient(135deg, #ff9f43, #ee5253);
  color: #fff;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: rerollBannerIn 0.3s ease-out;
}

@keyframes rerollBannerIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* =============== 等待房间 - 多人列表 =============== */
.player-item.other {
  border-color: var(--secondary);
}

.player-item.bot {
  border-color: var(--warning);
  background: rgba(253, 203, 110, 0.08);
}

.player-item.empty {
  opacity: 0.5;
  border-style: dashed;
}

/* 添加机器人按钮 */
.btn-add-bot {
  width: 100%;
  max-width: 300px;
  padding: 14px 24px;
  font-size: 16px;
  animation: glowPulseBot 2s ease infinite;
}

@keyframes glowPulseBot {
  0%, 100% { box-shadow: 0 0 8px rgba(253, 203, 110, 0.3); }
  50% { box-shadow: 0 0 20px rgba(253, 203, 110, 0.6); }
}

/* =============== 多人对手区域 =============== */
.opponents-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 多人模式下对手区域更紧凑 */
.opponents-area .opponent-area {
  padding: 2px 0;
}

.opponents-area .player-header {
  padding: 2px 0;
}

.opponents-area .player-header .player-name {
  font-size: 13px;
}

.opponents-area .player-score {
  font-size: 11px;
}

/* 多人模式下骰子更小 */
.opponents-area .dice-row {
  gap: 6px;
  padding: 4px 0;
}

.opponents-area .die {
  width: 40px;
  height: 40px;
  padding: 4px;
}

.opponents-area .die .dot {
  width: 7px;
  height: 7px;
}

/* 3-4人时叫数记录区域更小 */
@media (max-height: 750px) {
  .bid-history {
    max-height: 100px;
    min-height: 60px;
  }
  .opponents-area .die {
    width: 36px;
    height: 36px;
    padding: 3px;
  }
  .opponents-area .die .dot {
    width: 6px;
    height: 6px;
  }
}

/* 非常矮的屏幕，进一步压缩 */
@media (max-height: 640px) {
  .opponents-area .die {
    width: 32px;
    height: 32px;
    padding: 3px;
  }
  .opponents-area .die .dot {
    width: 5px;
    height: 5px;
  }
  .my-dice .die {
    width: 44px;
    height: 44px;
    padding: 5px;
  }
  .my-dice .die .dot {
    width: 8px;
    height: 8px;
  }
}

/* =============== Y2K 交互增强 =============== */

/* 轮到我时，我方区域脉冲霓虹光 */
.my-area.my-turn {
  border-radius: var(--radius);
  animation: myTurnPulse 1.6s ease-in-out infinite;
  position: relative;
}
@keyframes myTurnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(176, 38, 255, 0.6), 0 0 0 0 rgba(255, 46, 154, 0.4); }
  50%      { box-shadow: 0 0 20px 4px rgba(176, 38, 255, 0.8), 0 0 40px 10px rgba(255, 46, 154, 0.25); }
}

/* 轮到我时，操作区按钮呼吸 */
.action-area.my-turn-active .btn-primary,
.action-area.my-turn-active .btn-danger,
.action-area.my-turn-active .btn-warning {
  animation: btnBreath 1.5s ease-in-out infinite;
}
@keyframes btnBreath {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.03); filter: brightness(1.15); }
}

/* 全屏震动（开骰时） */
.shake-screen {
  animation: screenShake 0.5s cubic-bezier(.36,.07,.19,.97);
}
@keyframes screenShake {
  10%, 90% { transform: translate(-2px, 0); }
  20%, 80% { transform: translate(3px, 0); }
  30%, 50%, 70% { transform: translate(-5px, 1px); }
  40%, 60% { transform: translate(5px, -1px); }
}

/* 开骰全屏闪白 */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(255, 46, 154, 0.3));
  z-index: 9999;
  pointer-events: none;
  animation: flashWhite 0.4s ease-out forwards;
}
@keyframes flashWhite {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

/* 倒计时危险状态（剩 ≤5 秒） */
.timer-bar.danger .timer-fill {
  background: linear-gradient(90deg, #FF2E6A, #FF2E9A);
  animation: timerDanger 0.4s ease infinite alternate;
}
.timer-bar.danger .timer-text {
  color: #FF2E6A;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 46, 106, 0.8);
  animation: timerTextBlink 0.4s ease infinite alternate;
}
@keyframes timerDanger {
  from { box-shadow: inset 0 0 4px rgba(255,46,106,0.5); }
  to   { box-shadow: inset 0 0 16px rgba(255,46,106,0.9), 0 0 12px rgba(255,46,106,0.6); }
}
@keyframes timerTextBlink {
  from { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.12); }
}

/* 结算标题霓虹发光 */
.settlement-title {
  background: linear-gradient(135deg, var(--neon-pink), var(--primary-light), var(--secondary)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  filter: drop-shadow(0 0 14px rgba(255, 46, 154, 0.6));
  font-size: 32px !important;
}

/* 骰子悬浮光效（我方） */
.my-dice .die {
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.4), 0 0 8px rgba(176, 38, 255, 0.25);
}

/* 对手叫数时，他们的卡片闪一下 */
.opponent-area.speaking {
  animation: opponentFlash 0.8s ease;
}
@keyframes opponentFlash {
  0%, 100% { background: transparent; }
  30%      { background: rgba(0, 240, 255, 0.12); border-radius: var(--radius-sm); }
}

/* 弹幕更潮：加霓虹描边 */
.danmaku-item {
  box-shadow: 0 2px 12px rgba(176, 38, 255, 0.3);
  backdrop-filter: blur(4px);
}
.danmaku-item.mine {
  color: var(--primary-light);
  background: rgba(176, 38, 255, 0.2);
  border: 1px solid rgba(215, 122, 255, 0.4);
}
.danmaku-item.theirs {
  color: var(--secondary);
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.4);
}
.danmaku-item.trash {
  color: var(--neon-pink);
  background: rgba(255, 46, 154, 0.15);
  border: 1px solid rgba(255, 46, 154, 0.4);
  font-weight: 700;
}

/* 房间码显示 - 霓虹感 */
.code-digit {
  background: var(--bg-card);
  border: 2px solid var(--neon-pink);
  color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 46, 154, 0.3), inset 0 0 8px rgba(255, 46, 154, 0.15);
  text-shadow: 0 0 8px rgba(255, 46, 154, 0.6);
}

/* 玩家头像名字悬浮描边 */
.player-item.you {
  border-color: var(--neon-pink);
  box-shadow: 0 0 16px rgba(255, 46, 154, 0.3);
}

/* =============== 创房 - 技能模式选择器 =============== */
.skill-mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.sm-btn {
  padding: 10px 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-size: 13px;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sm-btn .sm-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.sm-btn .sm-short {
  color: var(--text-muted);
  font-size: 11px;
}

.sm-btn.active {
  border-color: var(--primary);
  background: rgba(176, 38, 255, 0.18);
  box-shadow: 0 0 10px rgba(176, 38, 255, 0.4);
}

.sm-btn.active .sm-short {
  color: var(--primary-light);
}

.skill-mode-detail {
  background: var(--bg-tertiary, rgba(255,255,255,0.04));
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* =============== 等待房间 - 技能标签 =============== */
.player-skill-tag {
  margin-left: auto;
  padding: 2px 8px;
  background: rgba(176, 38, 255, 0.2);
  border: 1px solid rgba(176, 38, 255, 0.4);
  border-radius: 10px;
  font-size: 11px;
  color: var(--primary-light);
  white-space: nowrap;
}

.player-skill-tag.empty {
  background: rgba(255,255,255,0.05);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.skill-mode-badge {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  background: rgba(176, 38, 255, 0.15);
  border: 1px solid rgba(176, 38, 255, 0.4);
  border-radius: 12px;
  color: var(--primary-light);
  font-size: 12px;
  text-align: center;
}

/* v2.7.1: 等待页赛制模式徽章 */
.match-mode-badge {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  background: rgba(255, 165, 0, 0.15);
  border: 1px solid rgba(255, 165, 0, 0.45);
  border-radius: 12px;
  color: #ffa500;
  font-size: 12px;
  text-align: center;
  font-weight: 600;
}

/* =============== v2.7.0 赛制模式选择器 =============== */
.match-mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.mm-btn {
  padding: 10px 6px;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.2s;
}

.mm-btn .mm-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.mm-btn .mm-short {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.mm-btn.active {
  background: rgba(255, 165, 0, 0.18);
  border-color: #ffa500;
  color: #ffa500;
}

.mm-btn.active .mm-short {
  color: #ffa500cc;
}

.match-mode-target {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.target-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.target-row label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 40px;
}

.match-target-selector {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--border);
}

.match-target-selector .sel-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}

.match-target-selector .sel-btn:active {
  background: var(--bg-card-hover);
}

.match-target-selector .sel-value {
  min-width: 40px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffa500;
}

.target-unit {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 32px;
}

.match-mode-detail {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 4px;
  line-height: 1.5;
}

/* =============== v2.7.0 游戏页顶部赛制进度条 =============== */
.match-progress-bar {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 165, 0, 0.18);
  border: 1px solid rgba(255, 165, 0, 0.5);
  color: #ffa500;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-progress-bar.urgent {
  background: rgba(255, 60, 60, 0.2);
  border-color: rgba(255, 60, 60, 0.6);
  color: #ff5555;
  animation: matchPulse 1.2s infinite;
}

@keyframes matchPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}

/* =============== v2.7.0 最终排名页 =============== */
.final-ranking-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
}

.final-trophy {
  font-size: 72px;
  animation: trophyBounce 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.final-title {
  font-size: 26px;
  margin: 12px 0 6px;
  background: linear-gradient(135deg, #ffd700, #ffa500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.final-reason {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.final-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.final-ranking-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s;
}

.rank-row.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 165, 0, 0.08));
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 4px 14px rgba(255, 215, 0, 0.15);
}

.rank-row.rank-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.16), rgba(150, 150, 150, 0.06));
  border-color: rgba(192, 192, 192, 0.5);
}

.rank-row.rank-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.16), rgba(165, 100, 40, 0.06));
  border-color: rgba(205, 127, 50, 0.5);
}

.rank-row.rank-last {
  background: rgba(255, 60, 60, 0.08);
  border-color: rgba(255, 60, 60, 0.3);
}

.rank-row.is-me {
  outline: 2px solid var(--primary-light);
  outline-offset: -2px;
}

.rank-medal {
  font-size: 28px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rank-score {
  font-size: 22px;
  font-weight: 800;
  color: #ffa500;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.rank-score .rank-score-unit {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

.rank-row.rank-1 .rank-score {
  color: #ffd700;
}

.rank-row.rank-last .rank-score {
  color: #ff5555;
}

.final-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =============== 等待房间 - 技能自选面板 =============== */
.skill-choose-panel {
  width: 100%;
  max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
}

.skill-choose-title {
  font-size: 13px;
  color: var(--primary-light);
  margin-bottom: 10px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.skill-choose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.skill-choose-card {
  text-align: left;
  padding: 8px 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.skill-choose-card.active {
  border-color: var(--primary);
  background: rgba(176, 38, 255, 0.18);
  box-shadow: 0 0 10px rgba(176, 38, 255, 0.4);
}

.skill-choose-card:hover:not(.active) {
  border-color: var(--primary-light);
}

.skill-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.skill-card-icon { font-size: 18px; }

.skill-card-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.skill-card-type {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.skill-card-type.active {
  background: rgba(255, 46, 154, 0.22);
  color: var(--neon-pink);
}

.skill-card-type.passive {
  background: rgba(0, 240, 255, 0.18);
  color: var(--secondary);
}

.skill-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 自选进度区 */
.skill-choose-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.skill-choose-progress-title {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.skill-choose-progress-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skill-progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
}

.skill-progress-item.done {
  color: var(--text);
  border: 1px solid rgba(176, 38, 255, 0.35);
}

.skill-progress-item.pending {
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.skill-progress-status {
  font-size: 13px;
}

.skill-progress-name {
  flex: 0 0 auto;
  font-weight: 600;
}

.skill-progress-skill {
  margin-left: auto;
  font-size: 11px;
  color: var(--primary-light);
}

.skill-progress-item.pending .skill-progress-skill {
  color: var(--text-muted);
}

.skill-choose-progress-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.skill-choose-progress-hint.ready {
  color: var(--neon-pink);
  font-weight: 700;
  font-style: normal;
}

/* =============== 对局 - 技能栏 =============== */
.skill-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 6px;
  background: linear-gradient(135deg, rgba(176, 38, 255, 0.12), rgba(255, 46, 154, 0.08));
  border: 1px solid rgba(176, 38, 255, 0.3);
  border-radius: var(--radius);
}

.skill-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.skill-bar .skill-icon {
  font-size: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(215, 122, 255, 0.7));
}

.skill-text {
  flex: 1;
  min-width: 0;
}

.skill-name-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-desc-line {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-state {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.skill-state.ready {
  background: rgba(0, 255, 156, 0.2);
  color: var(--success);
}

.skill-state.used {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.skill-state.passive {
  background: rgba(0, 240, 255, 0.18);
  color: var(--secondary);
}

.btn-skill-use {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 13px;
  min-width: 70px;
}

/* 封口提示 */
.silencer-hint {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(255, 46, 106, 0.15);
  border: 1px solid rgba(255, 46, 106, 0.5);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  animation: pulse 1.2s ease infinite;
}

/* 透视高亮的对手骰子 */
.opponent-dice .die.peeked {
  background: #fff7d1;
  border-color: var(--warning);
  box-shadow: 0 0 8px rgba(255, 201, 60, 0.8), inset 0 0 4px rgba(255, 201, 60, 0.3);
}

/* =============== 技能 - 目标/骰子选择弹窗 =============== */
.skill-target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.skill-target-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.skill-target-btn:hover {
  border-color: var(--primary);
  background: rgba(176, 38, 255, 0.12);
}

.skill-target-btn .target-arrow {
  color: var(--primary-light);
  font-size: 18px;
}

.skill-dice-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.skill-dice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.skill-dice-btn:hover {
  border-color: var(--primary);
  background: rgba(176, 38, 255, 0.12);
  transform: translateY(-2px);
}

.skill-dice-btn .die {
  width: 42px;
  height: 42px;
  padding: 5px;
}

.skill-dice-btn .die .dot {
  width: 8px;
  height: 8px;
}

.skill-dice-btn .dice-idx {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
