/* ============================================================
   幸运抽奖 —— 只补充 main.css 里没有的转盘 / 图例 / 历史样式
   颜色一律走 main.css 里的 CSS 变量，保证与全站视觉一致

   奖项池改造后新增的两类样式：
     .lottery-pool                 等待室/对局中展示「当前奖项池」的一行字
     .lottery-legend-item.empty    已抽完的奖项：置灰 + 「已抽完」小标签
     .lottery-history-row .tag.left 每条记录里「抽完这一次后还剩几个」
   ============================================================ */

.lottery-wheel {
  /* 触屏上不要有长按选中/双击缩放干扰 */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.42));
}

/* ---------------------------- 当前奖项池 ---------------------------- */

.lottery-pool {
  max-width: 460px;
  margin: 0 auto 10px;
  font-size: 0.82rem;
  text-align: center;
  font-family: var(--mono);
}

.lottery-pool[hidden] {
  display: none;
}

/* ---------------------------- 奖项图例 ---------------------------- */

.lottery-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: center;
  max-width: 460px;
  margin: 0 auto;
}

.lottery-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
}

.lottery-legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* 剩余/初始数量：比奖项名稍微亮一点，一眼能看出库存 */
.lottery-legend-item .lcount {
  color: var(--accent-2);
  font-weight: 600;
}

/* 抽完的奖项：圆点变灰、整体压暗，并跟一个「已抽完」标签 */
.lottery-legend-item.empty {
  opacity: 0.55;
}

.lottery-legend-item.empty i {
  background: var(--text-dim) !important;
}

.lottery-legend-item.empty .lcount {
  color: var(--text-dim);
  text-decoration: line-through;
}

/* ---------------------------- 抽奖记录 ---------------------------- */

.lottery-history {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 10px 12px;
}

.lottery-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.lottery-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lottery-history-list > li:first-child {
  margin-top: 8px;
}

.lottery-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.45);
  border: 1px solid var(--border);
}

.lottery-history-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lottery-history-row .pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.lottery-history-row .prize {
  color: var(--accent-2);
  font-weight: 600;
  white-space: nowrap;
}

/* 这一手之后该奖项还剩几个（0 = 刚好被抽完） */
.lottery-history-row .tag.left {
  color: var(--text-dim);
  white-space: nowrap;
}

.lottery-history-empty {
  padding: 10px 4px;
  font-size: 0.84rem;
  text-align: center;
}

/* ---------------------------- 移动端 ---------------------------- */

@media (max-width: 560px) {
  .lottery-legend {
    gap: 4px 10px;
  }
  .lottery-legend-item,
  .lottery-history-row {
    font-size: 0.78rem;
  }
  .lottery-history-list {
    max-height: 180px;
  }
}

/* 超窄屏（比如 320px 的老手机）：优先保住「第几次」和「抽到什么」，让昵称先缩 */
@media (max-width: 380px) {
  .lottery-history-row {
    gap: 5px;
    font-size: 0.74rem;
    padding: 5px 6px;
  }
  .lottery-history-row .pname {
    max-width: 30%;
    font-size: 0.82rem;
  }
  .lottery-history-row .tag {
    padding: 1px 6px;
  }
  /* 窄屏上「剩 N」优先级最低，先让位给奖项名 */
  .lottery-history-row .tag.left {
    display: none;
  }
}
