/**
 * 大屏端布局与皮肤（紫金风）
 * 通用令牌 / 按钮 / 头像 / 涂鸦底 都在 theme.css 里，这里只管大屏自己的布局。
 */

:root {
  --board-w: 340px;
  --wall-h: 30vh;        /* 头像墙高度，JS 会按视口重算并回写 */
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  display: block;
  transition: opacity 0.4s;
}

/* 报名阶段让位给大厅：赛道淡出，排行榜收起。
   注意是 CSS 隐藏而不是停掉绘制 —— 画布位图仍然有内容，
   自动化测试要从 getImageData 采样确认渲染没坏。 */
body.phase-idle #stage { opacity: 0; }
body.phase-idle #board { display: none; }

/* ================= 顶部状态条 ================= */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  z-index: 20;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  font-size: 28px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--sh-1);
}
.titles h1 {
  font-size: 30px;
  letter-spacing: 5px;
  font-weight: 900;
  color: #fff;
  line-height: 1.16;
  text-shadow: 0 3px 0 rgba(43, 27, 107, 0.3);
}
.titles p {
  font-size: 14px;
  color: var(--dim);
  letter-spacing: 3px;
  margin-top: 2px;
}

.hud { display: flex; gap: 14px; }
.hud-item {
  min-width: 128px;
  padding: 8px 20px;
  text-align: center;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.hud-num {
  display: block;
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  line-height: 1.15;
  text-shadow: 0 2px 0 rgba(43, 27, 107, 0.35);
}
.hud-label { font-size: 12px; color: var(--dim); letter-spacing: 2px; }

/* 报名和结算阶段顶部只留标题和齿轮，把舞台让给大厅 / 领奖台 */
body.phase-idle .hud,
body.phase-finished .hud { display: none; }

#gear {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: 0.2s;
}
#gear:hover { background: var(--gold); color: var(--ink); transform: rotate(45deg); }

/* ================= 排行榜 ================= */
#board {
  position: fixed;
  top: calc(var(--top-h) + 10px);
  right: 20px;
  width: var(--board-w);
  max-height: calc(100vh - var(--top-h) - var(--footer-h) - 30px);
  padding: 16px 16px 12px;
  border-radius: var(--radius);
  background: var(--panel-deep);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  box-shadow: var(--sh-2);
  z-index: 15;
  display: flex;
  flex-direction: column;
}
#board h2 {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--dim);
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
#board h2 .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }

#boardList { list-style: none; overflow: hidden; flex: 1; }

#boardList li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  margin-bottom: 5px;
  border-left: 4px solid transparent;
}
#boardList li .rk {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 13px; font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
#boardList li:nth-child(1) .rk { background: var(--gold); color: var(--ink); box-shadow: 0 0 14px rgba(255, 201, 60, 0.6); }
#boardList li:nth-child(2) .rk { background: #dfe4ee; color: #36284f; }
#boardList li:nth-child(3) .rk { background: #e59a5c; color: #3a1d00; }

#boardList li .av { font-size: 20px; flex: 0 0 auto; }
/* 榜行里的 .av 是给 emoji 排版用的，没有圆形裁切 ——
   微信头像（.av-img）得自带尺寸和圆角，否则会按原图撑破整行 */
#boardList li .av .av-img {
  display: block;
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(43, 27, 107, 0.4);
}
#boardList li .nm {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#boardList li .sc {
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
#boardList li .sc b { color: var(--gold); font-size: 15px; }
#boardList li.done .sc b { color: #7dff9b; }
#boardList li .fin { font-size: 11px; color: var(--gold); }

.board-empty {
  flex: 1;
  display: grid; place-content: center;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
  line-height: 2;
  padding: 30px 0;
}
.board-empty small { font-size: 12px; opacity: 0.75; }

/* ================= 报名大厅 ================= */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: calc(var(--top-h) + 8px) 28px calc(var(--footer-h) + 12px);
  transition: opacity 0.45s;
  /* 大厅是展示层，不能吃掉点击 —— 否则盖住右上角齿轮，
     主持人报名阶段就打不开控制台了 */
  pointer-events: none;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

/* 比赛中 / 倒计时 / 结算时大厅自动退场 */
body.phase-racing #overlay,
body.phase-countdown #overlay,
body.phase-finished #overlay { opacity: 0; pointer-events: none; }

.lobby {
  width: min(1560px, 96vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2vh;
}

/* ---- 上半：艺术字 + 插画 + 二维码 ---- */
.lobby-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: min(6vw, 92px);
  width: 100%;
}

.art-wrap {
  position: relative;
  padding: 34px 42px;
  flex: none;
}
.art-ring {
  position: absolute;
  inset: -6% -3%;
  border: 4px dashed rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: rotate(-11deg);
  pointer-events: none;
}
/* 每个字都是一个独立旋转的「贴纸」—— 参考图里三个字并不共线，
   各自歪一点才有手绘感，所以旋转下放到 .ch 上而不是整行。 */
.art-title {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.1vw, 22px);
  transform: rotate(-5deg);
  font-size: clamp(64px, 8.4vw, 132px);
  font-weight: 900;
  line-height: 1;
}
/* 白色「贴纸边」的做法：本体是白描边字，::before 用渐变填在上面盖住字形。
   ⚠ 不能写成「本体渐变 + ::before 白描边垫在后面（z-index:-1）」——
   一旦 .ch 带了 transform 就成了层叠上下文，z-index:-1 再也逃不出去，
   反而会盖到渐变填充上，整块糊成白饼。所以描边在下、填充在上。 */
.art-title .ch {
  position: relative;
  display: inline-block;
  color: #fff;
  -webkit-text-stroke: 0.26em #fff;
  text-shadow: 0 0.045em 0 rgba(43, 27, 107, 0.35);
}
.art-title .ch::before {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  z-index: 1;                    /* 定位元素天然压在行内文字之上 */
  color: transparent;
  -webkit-text-stroke: 0;
  background-clip: text;
  -webkit-background-clip: text;
}
.art-title .c1 { transform: rotate(-8deg); }
.art-title .c1::before { background-image: linear-gradient(175deg, #ff8ae0 0%, #b93ce8 100%); }
.art-title .c2 { transform: rotate(4deg) translateY(0.06em); }
.art-title .c2::before { background-image: linear-gradient(175deg, #ff7a66 0%, #e8342a 100%); }
.art-title .c3 { transform: rotate(9deg); }
.art-title .c3::before { background-image: linear-gradient(175deg, #ffe07a 0%, #ff9518 100%); }

.art-tag {
  position: absolute;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  white-space: nowrap;
}
.art-tag { z-index: 2; }
.art-tag.t1 { top: 2%; left: -2%; transform: rotate(-9deg); }
.art-tag.t2 { bottom: 6%; right: -7%; transform: rotate(7deg); }

.hero-phone { flex: none; width: clamp(170px, 17vw, 270px); }
.hero-phone svg { width: 100%; height: auto; display: block; }

/* ---- 二维码 ---- */
.qr-card { flex: none; text-align: center; }
.qr-frame {
  display: inline-block;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(28, 16, 76, 0.4);
}
.qr-card img {
  display: block;
  width: clamp(150px, 14vw, 230px);
  height: clamp(150px, 14vw, 230px);
}
.qr-url {
  margin-top: 10px;
  font-size: 14px;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(43, 27, 107, 0.3);
}
.qr-hint {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(43, 27, 107, 0.35);
}

/* ---- 中部：人数 + 开始按钮 ---- */
.lobby-bar {
  display: flex;
  align-items: center;
  gap: min(7vw, 120px);
}
.lobby-count {
  font-size: clamp(24px, 2.6vw, 40px);
  font-weight: 800;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 3px 0 rgba(43, 27, 107, 0.3);
}
.lobby-count b {
  font-size: 1.34em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}
/* 大厅里唯一可点的东西 */
#ctaStart { pointer-events: auto; }

/* ---- 下半：全员头像网格 ----
   用 grid 而不是 flex-wrap：flex 只按剩余宽度换行，第二行不满时会居中，
   于是两行头像左右对不齐。固定 12 列才是个「网格」。 */
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  justify-items: center;
  align-content: flex-start;
  gap: clamp(10px, 1.4vh, 20px) clamp(6px, 0.8vw, 16px);
  width: min(100%, 1340px);
  margin: 0 auto;
  max-height: 34vh;
  overflow: hidden;
}
.lobby-slot { text-align: center; width: clamp(52px, 4.6vw, 78px); }
.lobby-slot .avatar-circle { width: 100%; font-size: clamp(22px, 2.2vw, 34px); }
.lobby-slot .nm {
  margin-top: 5px;
  font-size: clamp(10px, 0.85vw, 13px);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(43, 27, 107, 0.35);
}
.lobby-more {
  display: grid;
  place-items: center;
  width: clamp(52px, 4.6vw, 78px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 4px solid rgba(255, 255, 255, 0.4);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

/* ================= 头像墙（赛中） ================= */
#wall {
  position: fixed;
  left: 0;
  right: var(--board-w);
  bottom: var(--footer-h);
  height: var(--wall-h);
  z-index: 12;
  padding: 0 24px 10px;
  display: none;
}
/* 只有赛中看头像墙；结算页让位给领奖台（见「领奖台」一节的隐藏规则） */
body.phase-racing #wall { display: block; }

.wall-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--dim);
  padding: 4px 0 8px;
}
.wall-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  animation: pulse 1.6s infinite;
}
.wall-rail { position: relative; height: calc(100% - 28px); }

.wall-chip {
  position: absolute;
  top: 0; left: 0;
  width: 96px;                 /* JS 会按名次算出的实际宽度覆盖掉 */
  text-align: center;
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.22, 0.9, 0.3, 1.06);
}
.wall-chip .avatar-circle { width: 100%; font-size: clamp(28px, 3.6vw, 68px); }
.wall-chip .nm {
  margin-top: 6px;
  font-size: clamp(11px, 0.95vw, 15px);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(43, 27, 107, 0.4);
}
.wall-chip .rk {
  position: absolute;
  top: -4px; left: -4px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(43, 27, 107, 0.85);
  border: 2px solid #fff;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  z-index: 2;
}
.wall-chip.top1 .rk { background: var(--gold); color: var(--ink); }
.wall-chip.top2 .rk { background: #dfe4ee; color: #36284f; }
.wall-chip.top3 .rk { background: #e59a5c; color: #3a1d00; }
.wall-chip.top1 .avatar-circle {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.55), 0 0 26px rgba(255, 201, 60, 0.6);
  animation: chomp 0.5s ease-in-out infinite alternate;
}
@keyframes chomp { to { transform: translateX(4px) rotate(2deg); } }

/* ================= 倒计时 ================= */
#countdown {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  font-size: 220px;
  font-weight: 900;
  color: var(--gold);
  text-shadow:
    0 0 0 #fff,
    -6px -6px 0 #fff, 6px -6px 0 #fff, -6px 6px 0 #fff, 6px 6px 0 #fff,
    0 18px 50px rgba(28, 16, 76, 0.6);
  pointer-events: none;
}
#countdown.show { display: grid; }
#countdown.tick { animation: cd 0.9s ease-out; }
@keyframes cd {
  0% { transform: scale(2.1); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0; }
}

/* 冲线白闪 */
#flash {
  position: fixed; inset: 0;
  z-index: 35;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
#flash.on { animation: flash 0.42s ease-out; }
@keyframes flash { 0% { opacity: 0.72; } 100% { opacity: 0; } }

/* 提示条 */
#notice {
  position: fixed;
  top: calc(var(--top-h) + 12px);
  left: 50%;
  transform: translate(-50%, -18px);
  z-index: 45;
  padding: 12px 30px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: rgba(43, 27, 107, 0.9);
  border: 2px solid var(--line);
  opacity: 0;
  transition: 0.35s;
  pointer-events: none;
}
#notice.show { opacity: 1; transform: translate(-50%, 0); }
#notice.warn { border-color: var(--gold); color: var(--gold); }

/* ================= 领奖台 ================= */
/* 结算页必须盖死赛道：用和大厅同一个紫渐变 + 同一层涂鸦（.doodle-layer），
   所以整页看起来像换了一屏，而不是「赛道上面浮了个框」。 */
#result {
  position: fixed;
  inset: 0;
  /* 必须压在赛道(1)和头像墙(12)之上，但要在顶栏(20)之下 ——
     结算页盖住齿轮的话，主持人就再也打不开控制台了。
     排行榜和头像墙在这一段已经被 CSS 收掉，不用担心被盖。 */
  z-index: 18;
  display: none;
  overflow: hidden;
  background: linear-gradient(160deg, #7a6cf2 0%, var(--p2) 55%, #5b4ad8 100%);
  pointer-events: none;   /* 结算页也要能点到齿轮 */
}
#result.show { display: block; animation: fadeIn 0.4s; }
@keyframes fadeIn { from { opacity: 0; } }

/* 结果页不再需要排行榜和头像墙 —— 名次就是领奖台本身 */
body.phase-finished #board,
body.phase-finished #wall { display: none; }

.result-inner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1240px, 78vw);
}

.result-again {
  position: absolute;
  right: 112px;          /* 让开右上角那颗齿轮 */
  top: 24px;
  pointer-events: auto;
  z-index: 2;
}

.result-qr {
  position: absolute;
  right: 3.4vw;
  top: 50%;
  transform: translateY(-46%);
}
.result-qr .qr-card img { width: clamp(130px, 11vw, 190px); height: clamp(130px, 11vw, 190px); }

/* ---- 三级台阶 ---- */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(10px, 1.4vw, 26px);
}

.win {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(140px, 14vw, 220px);
  animation: rise 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}
@keyframes rise { from { transform: translateY(60px); opacity: 0; } }
.win:nth-child(1) { animation-delay: 0.3s; }
.win:nth-child(2) { animation-delay: 0.1s; }
.win:nth-child(3) { animation-delay: 0.46s; }

.wcol {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* 头像外圈按名次走金/银/铜，不跟随选手身份色 ——
   领奖台上一圈绿头像实在不像名次。身份色改由名字胶囊上的字色承担。 */
.win .wav { position: relative; width: 60%; }
.win .wav .avatar-circle {
  width: 100%;
  font-size: clamp(32px, 3.2vw, 54px);
  border-width: 6px;
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 4px rgba(255, 201, 60, 0.45), 0 0 40px rgba(255, 201, 60, 0.5) !important;
}
.win.p2 .wav .avatar-circle {
  border-color: #eef1f6 !important;
  box-shadow: 0 0 0 4px rgba(240, 244, 250, 0.4), var(--sh-1) !important;
}
.win.p3 .wav .avatar-circle {
  border-color: #f0a868 !important;
  box-shadow: 0 0 0 4px rgba(240, 168, 104, 0.4), var(--sh-1) !important;
}
/* 冠军头像背后的金色光晕，代替参考图里的桂冠 */
.win.p1 .wav::after {
  content: "";
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 201, 60, 0.42), transparent 68%);
  z-index: -1;
}
.win .crown {
  position: absolute;
  left: 50%;
  top: -38px;
  transform: translateX(-50%);
  font-size: clamp(34px, 3.2vw, 54px);
  z-index: 3;
  filter: drop-shadow(0 4px 8px rgba(28, 16, 76, 0.5));
}

.win .wnm {
  margin-top: 12px;
  max-width: 100%;
  padding: 5px 18px;
  border-radius: 999px;
  background: rgba(43, 27, 107, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.4);
  font-size: clamp(15px, 1.4vw, 21px);
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win.p1 .wnm {
  background: linear-gradient(180deg, var(--gold-l), var(--gold-d));
  border-color: #fff;
  color: var(--ink) !important;
}
.win .wsc {
  margin-top: 7px;
  font-size: clamp(12px, 1vw, 15px);
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}
.win .wsc b { color: var(--gold); font-size: 1.35em; font-variant-numeric: tabular-nums; }
.win.p1 .wsc b { color: #fff5cf; }
.wtime.miss { color: rgba(255, 255, 255, 0.6); }

/* 坐垫：头像是「坐」在台阶上的，不加这层会像悬空 */
.cushion {
  width: 82%;
  height: clamp(16px, 1.6vw, 24px);
  margin-top: 10px;
  margin-bottom: -7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe9a8, #f2b73c);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.7), 0 8px 16px rgba(28, 16, 76, 0.3);
}
.win.p2 .cushion { background: linear-gradient(180deg, #b6d1f8, #6f95dd); }
.win.p3 .cushion { background: linear-gradient(180deg, #ffc79b, #e8804a); }

/* 台阶本体 */
.pedestal {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 12px 12px 5px 5px;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, var(--gold-l) 0%, var(--gold) 46%, var(--gold-d) 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.6),
    inset -7px 0 0 rgba(160, 100, 10, 0.14),
    0 12px 28px rgba(28, 16, 76, 0.34);
}
/* 视觉顺序固定「亚军 - 冠军 - 季军」，DOM 仍是名次序，好让入场动画错开 */
.win.p1 { order: 2; }
.win.p2 { order: 1; }
.win.p3 { order: 3; }

/* 台阶高度要留得住号码牌：牌子(含白边)比块高还大的话会从上下两头冒出去 */
.win.p1 .pedestal { height: clamp(150px, 21vh, 240px); }
.win.p2 .pedestal { height: clamp(116px, 15vh, 172px); }
.win.p3 .pedestal { height: clamp(96px, 12.5vh, 144px); }
/* 三级台阶都是金的（参考图里没有银台铜台），只靠明度区分层次 */
.win.p2 .pedestal { background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, #fdf6df 0%, #ecd9a4 100%); }
.win.p3 .pedestal { background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, #ffd98a 0%, #e3a334 100%); }

.medal {
  display: grid;
  place-items: center;
  width: clamp(64px, 6.2vw, 104px);
  height: clamp(64px, 6.2vw, 104px);
  border-radius: 50%;
  font-size: clamp(34px, 3.2vw, 54px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #a9741a;
  background: radial-gradient(circle at 38% 28%, #fff8dd, var(--gold) 58%, var(--gold-d) 100%);
  border: 6px solid #fff;
  box-shadow: 0 8px 18px rgba(28, 16, 76, 0.3), inset 0 -7px 12px rgba(170, 110, 15, 0.3);
}
.win.p2 .medal { color: #9a7d33; background: radial-gradient(circle at 38% 28%, #fffdf4, #f5e5b4 58%, #dcc27f 100%); }
.win.p3 .medal { color: #a9741a; background: radial-gradient(circle at 38% 28%, #fff2cf, #f7c75a 58%, #e09b22 100%); }

/* 台阶底座 */
.podium-base {
  height: clamp(18px, 1.8vw, 28px);
  width: min(720px, 80%);
  margin: -2px auto 0;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--gold-l), var(--gold-d));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.65), 0 12px 28px rgba(28, 16, 76, 0.36);
}

/* 4 名之后的小圆头像 */
.podium-rest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 1.1vw, 20px);
  margin-top: clamp(12px, 1.6vh, 26px);
}
.podium-rest .chip {
  width: clamp(58px, 5.4vw, 84px);
  text-align: center;
}
.podium-rest .chip .rk {
  display: block;
  margin-bottom: 3px;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(28, 16, 76, 0.4);
}
.podium-rest .chip .avatar-circle { width: 100%; font-size: clamp(22px, 2vw, 32px); }
.podium-rest .chip .nm {
  margin-top: 4px;
  font-size: clamp(10px, 0.85vw, 13px);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-empty {
  text-align: center;
  color: var(--dim);
  font-size: 20px;
  padding: 60px 0;
}

/* ================= 控制台 ================= */
#console {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.3, 1, 0.4, 1);
}
#console.open { transform: translateY(0); }

.console-inner {
  max-width: 1180px;
  margin: 0 auto 0;
  padding: 16px 26px 20px;
  border-radius: 20px 20px 0 0;
  background: rgba(38, 24, 96, 0.98);
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: 0 -18px 50px rgba(28, 16, 76, 0.55);
  backdrop-filter: blur(14px);
}
.console-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 3px;
  color: var(--dim);
}
#consoleClose {
  background: none; border: none; color: var(--dim);
  cursor: pointer; font-size: 13px; font-family: inherit;
}
#consoleClose:hover { color: var(--gold); }

.console-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
}
/* 三列固定给输入框，按钮单独一行 —— 否则按钮列会把输入框挤没 */
.console-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 20px;
}
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; letter-spacing: 1px; }
.field input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.2); }
.field input::placeholder { color: var(--faint); }

.field-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.shout-row { display: flex; gap: 10px; }
.shout-row input { flex: 1; }

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.16s;
}
.btn:hover { background: rgba(255, 255, 255, 0.2); border-color: var(--gold); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-l), var(--gold-d));
  border-color: transparent;
  color: var(--ink);
  font-weight: 900;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger:hover { border-color: #ff8090; color: #ffb3bd; background: rgba(232, 52, 42, 0.24); }
.btn kbd { opacity: 0.6; background: rgba(0, 0, 0, 0.22); }

.console-hint { font-size: 12px; color: var(--dim); opacity: 0.8; }

/* ================= 口令弹窗 ================= */
#pinModal {
  position: fixed; inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(28, 16, 76, 0.82);
}
#pinModal.show { display: grid; }
.pin-box {
  width: 340px;
  padding: 28px;
  border-radius: 20px;
  background: #3a2a86;
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  text-align: center;
}
.pin-box h3 { font-size: 17px; letter-spacing: 2px; margin-bottom: 20px; font-weight: 700; }
.pin-box input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 20px;
  text-align: center;
  letter-spacing: 8px;
  outline: none;
  font-family: inherit;
}
.pin-box input:focus { border-color: var(--gold); }
.pin-err { height: 18px; font-size: 12px; color: #ffb3bd; margin-top: 8px; }
.pin-btns { display: flex; gap: 12px; margin-top: 10px; }
.pin-btns .btn { flex: 1; }

/* toast */
#toast {
  position: fixed;
  bottom: calc(var(--footer-h) + 20px);
  left: 50%;
  transform: translate(-50%, 24px);
  z-index: 90;
  padding: 12px 26px;
  border-radius: 12px;
  background: rgba(43, 27, 107, 0.96);
  border: 1px solid var(--line);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.9em;
}

/* 竖屏 / 小屏兜底 */
@media (max-width: 1100px) {
  :root { --board-w: 260px; }
  .titles h1 { font-size: 24px; }
  .lobby-hero { gap: 28px; }
}
