* { box-sizing: border-box; }
:root {
  --text: #f2f4ff; --dim: #9aa3c7; --line: rgba(255,255,255,.12); --glass: rgba(22,26,62,.82);
  --cyan: #2fe0ff; --yellow: #ffd93d; --purple: #b75cff; --green: #45e07a; --red: #ff4d6d; --blue: #3f7dff;
  --orange: #ff9a3c; --pink: #ff5fc8; --accent: #6c7cff;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1028; color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
/* 舞台固定 16:9，等比缩放铺满窗口 */
#stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: 0 0; }
#game { position: absolute; inset: 0; width: 1920px; height: 1080px; outline: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 18px; }
.small-inline { font-size: 16px; font-weight: normal; margin-left: 10px; }
.pink { color: var(--pink); } .green { color: var(--green); } .red { color: var(--red); } .orange { color: var(--orange); }
.purple { color: #c77dff; } .cyan { color: var(--cyan); } .yellow { color: var(--yellow); }

/* ---------- 大厅（背景由 canvas 绘制） ---------- */
#lobby { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card { position: relative; z-index: 1; width: 820px; padding: 48px 56px 44px; border-radius: 28px; text-align: center;
  background: var(--glass); border: 2px solid var(--line); backdrop-filter: blur(10px);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); }
.logo { font-size: 84px; font-weight: 900; margin: 0 0 12px; letter-spacing: 6px; }
.logo.sm { font-size: 44px; margin: 0; letter-spacing: 3px; }
.logo span { display: inline-block; text-shadow: 0 0 24px currentColor; }
.c1 { color: var(--cyan); } .c2 { color: var(--yellow); } .c3 { color: var(--red); } .c4 { color: var(--purple); } .c5 { color: var(--green); }
h1 { font-size: 56px; margin: 0 0 18px; }
h2 { font-size: 40px; margin: 0 0 22px; }
h3 { font-size: 24px; margin: 26px 0 10px; color: var(--text); text-align: left; }
.accent { color: var(--yellow); font-size: 28px; font-weight: bold; }
.row { display: flex; gap: 12px; margin: 14px 0; align-items: center; }
.col { display: flex; flex-direction: column; gap: 14px; }
input { flex: 1; min-width: 0; font: inherit; font-size: 24px; padding: 14px 20px; border-radius: 14px;
  border: 2px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); outline: none; transition: border-color .15s; }
input::placeholder { color: #69719a; }
input:focus { border-color: var(--accent); }

button { font: inherit; font-size: 24px; font-weight: bold; padding: 14px 26px; border-radius: 14px; border: none;
  cursor: pointer; color: #fff; background: linear-gradient(180deg, #7d8bff, #5a63f0); box-shadow: 0 5px 0 #3b3fb0;
  transition: transform .08s, box-shadow .08s, filter .15s; white-space: nowrap; }
button:hover { filter: brightness(1.12); transform: translateY(-2px); box-shadow: 0 7px 0 #3b3fb0; }
button:active { transform: translateY(4px); box-shadow: 0 1px 0 #3b3fb0; }
button.ghost { background: rgba(255,255,255,.06); color: var(--text); border: 2px solid var(--line); box-shadow: 0 5px 0 rgba(0,0,0,.35); }
button.ghost.danger { color: var(--red); border-color: rgba(255,77,109,.4); }
button.sm { font-size: 20px; padding: 10px 18px; }
button.big { font-size: 32px; padding: 22px 20px; width: 100%; margin-top: 10px; border-radius: 18px; }
#btn-room-start { background: linear-gradient(180deg, #5df08f, #2fbf63); box-shadow: 0 6px 0 #1f8a45; color: #08240f; }
#btn-help-login { margin-top: 26px; }

/* 主菜单 */
.card.menu { width: 1240px; padding: 36px 48px 34px; text-align: left; }
.menu-head { display: flex; align-items: center; gap: 28px; padding-bottom: 22px; border-bottom: 2px solid var(--line); }
.menu-head .me { flex: 1; display: flex; flex-direction: column; font-size: 26px; }
.menu-head .me .dim { font-size: 19px; margin-top: 2px; }
.head-btns { display: flex; gap: 12px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 28px 0 8px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; height: 250px; padding: 28px 30px;
  border-radius: 22px; text-align: left; white-space: normal; position: relative; overflow: hidden; }
.mode i { font-style: normal; font-size: 56px; line-height: 1; margin-bottom: 8px; }
.mode b { font-size: 38px; }
.mode small { font-size: 19px; font-weight: normal; line-height: 1.5; opacity: .92; }
.mode::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 140px; height: 140px; border-radius: 26px;
  background: rgba(255,255,255,.14); transform: rotate(18deg); }
.m-single { background: linear-gradient(150deg, #45e07a, #17a3a3); box-shadow: 0 7px 0 #0d6e6e; }
.m-solo { background: linear-gradient(150deg, #2fe0ff, #3f5dff); box-shadow: 0 7px 0 #2735a8; }
.m-br { background: linear-gradient(150deg, #ffb23d, #ff4d6d); box-shadow: 0 7px 0 #a8263f; }
.m-single:hover { box-shadow: 0 9px 0 #0d6e6e; } .m-solo:hover { box-shadow: 0 9px 0 #2735a8; } .m-br:hover { box-shadow: 0 9px 0 #a8263f; }
.friends { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.friends .box { padding: 4px 22px 8px; border-radius: 18px; background: rgba(255,255,255,.04); border: 2px solid var(--line); }
.friends h3 { margin: 16px 0 6px; font-size: 22px; }
.friends button { font-size: 21px; padding: 12px 18px; }
.friends input { font-size: 21px; padding: 12px 16px; }
.gift-strip { display: flex; gap: 28px; justify-content: center; margin-top: 22px; padding: 14px; border-radius: 14px;
  background: rgba(255,95,200,.08); border: 2px dashed rgba(255,95,200,.35); font-size: 21px; }

ul, ol { list-style: none; padding: 0; margin: 18px 0; font-size: 26px; text-align: left; }
#room-members li, #result-list li { padding: 12px 22px; border-radius: 14px; background: rgba(255,255,255,.05); border: 2px solid var(--line);
  margin: 8px 0; display: flex; gap: 14px; align-items: center; }
#result-list li span { color: var(--dim); min-width: 120px; }
#result-list li b { margin-left: auto; }
li.me { background: rgba(255,217,61,.12) !important; border-color: rgba(255,217,61,.6) !important; color: var(--yellow); font-weight: bold; }
li .dim { font-size: 20px; }
#scr-result .row .big { flex: 1; }

/* 匹配中的跳跳方块 */
.loader { display: flex; justify-content: center; gap: 14px; margin: 30px 0; }
.loader i { width: 34px; height: 34px; border-radius: 6px; animation: hop 1s ease-in-out infinite; }
.loader i:nth-child(1) { background: var(--cyan); }
.loader i:nth-child(2) { background: var(--yellow); animation-delay: .15s; }
.loader i:nth-child(3) { background: var(--purple); animation-delay: .3s; }
.loader i:nth-child(4) { background: var(--green); animation-delay: .45s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-26px) rotate(90deg); } }
#scr-login > p, #scr-queue > p { font-size: 22px; }
.login-wrap #login-status { font-size: 24px; margin-top: 24px; }

kbd { display: inline-block; min-width: 34px; padding: 3px 10px; border-radius: 8px; background: rgba(255,255,255,.1);
  border: 2px solid var(--line); border-bottom-width: 4px; font-family: inherit; font-weight: bold; color: var(--text); text-align: center; }

/* ---------- 浮层：暂停 / 设置 / 说明 ---------- */
.overlay { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center;
  background: rgba(5,7,20,.66); backdrop-filter: blur(4px); }
.panel { position: relative; width: 1500px; max-height: 960px; padding: 36px 48px; border-radius: 26px; background: #171b40;
  border: 2px solid var(--line); box-shadow: 0 30px 90px rgba(0,0,0,.6); display: flex; flex-direction: column; }
.panel.narrow { width: 560px; text-align: center; }
.panel h2 { margin-bottom: 16px; }
.panel .x { position: absolute; right: 22px; top: 18px; width: 56px; height: 56px; padding: 0; border-radius: 50%;
  background: rgba(255,255,255,.08); box-shadow: none; font-size: 40px; line-height: 1; color: var(--dim); }
.panel .x:hover { transform: none; color: var(--text); }
.panel .foot { margin-top: 18px; display: flex; justify-content: center; }
.panel .foot .big { width: 320px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; font-size: 22px; }
.settings-grid h3 { margin-top: 12px; }
.slider { display: grid; grid-template-columns: 230px 1fr 160px; align-items: center; gap: 16px; margin: 14px 0; }
.slider span { display: flex; flex-direction: column; }
.slider small { font-size: 15px; color: var(--dim); margin-top: 2px; }
.slider em { font-style: normal; color: var(--yellow); font-weight: bold; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 10px; padding: 0; border-radius: 5px; border: none; background: rgba(255,255,255,.15); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--cyan); cursor: pointer; }
.keytable { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.keytable th { text-align: left; color: var(--dim); font-weight: normal; font-size: 18px; padding: 4px 6px; }
.keytable td { padding: 5px 6px; }
.keybtn { width: 100%; font-size: 20px; padding: 9px 10px; background: rgba(255,255,255,.07); border: 2px solid var(--line); box-shadow: none; }
.keybtn:hover { transform: none; box-shadow: none; border-color: var(--accent); }
.keybtn.capturing { border-color: var(--yellow); color: var(--yellow); animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: .5; } }

.tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.tabs button { font-size: 22px; padding: 12px 24px; background: rgba(255,255,255,.06); border: 2px solid var(--line); box-shadow: none; color: var(--dim); }
.tabs button:hover { transform: none; box-shadow: none; }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.help-body { overflow-y: auto; padding-right: 10px; font-size: 22px; line-height: 1.6; max-height: 740px; }
.help-body::-webkit-scrollbar { width: 10px; } .help-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 5px; }
.rules { font-size: 22px; margin: 0; }
.rules li { padding: 12px 18px; margin: 8px 0; border-radius: 12px; background: rgba(255,255,255,.04); border-left: 4px solid var(--accent); }
.help-table { width: 100%; border-collapse: collapse; font-size: 22px; }
.help-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.help-table td:first-child { width: 280px; }
.help-table td .dim { font-size: 18px; }
.help-table.grid th { text-align: left; color: var(--dim); font-weight: normal; padding: 8px 14px; border-bottom: 2px solid var(--line); }
.help-table.grid { font-size: 20px; }
.help-table.grid td { padding: 8px 12px; }
.help-table.grid td:first-child { width: 46%; }
.help-table.grid td:not(:first-child) { font-weight: bold; white-space: nowrap; }
.hl-c td:first-child { color: var(--cyan); } .hl-p td:first-child { color: #c77dff; } .hl-y td:first-child { color: var(--yellow); }
.hl-o td:first-child { color: var(--orange); }
.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 36px; }
.two-col h3 { margin-top: 0; }

.points { font-size: 19px; color: var(--yellow); }
.points b { font-size: 22px; }
.rank-me { font-size: 22px; padding: 12px 18px; border-radius: 12px; background: rgba(255,217,61,.1); border: 2px solid rgba(255,217,61,.4); }
.rank-me:empty { display: none; }
.rank-me b { color: var(--yellow); }
.help-table.rank td:first-child, .help-table.rank th:first-child { width: 90px; text-align: center; }
.help-table.rank tr.me td { color: var(--yellow); background: rgba(255,217,61,.08); }
#result-list .pts { color: var(--yellow); }

/* ---------- 提示气泡 ---------- */
#toasts { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); width: 900px; z-index: 12;
  display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none; align-items: center; }
/* 对局中：移到左下角，不挡棋盘 */
#toasts.ingame { left: 20px; bottom: 20px; transform: none; width: 380px; align-items: flex-start; gap: 8px; }
#toasts.ingame .toast { font-size: 19px; padding: 9px 16px; border-radius: 12px; }
.toast { padding: 12px 26px; border-radius: 16px; font-size: 24px; background: rgba(20,24,58,.92); color: var(--text);
  border: 2px solid var(--line); box-shadow: 0 8px 22px rgba(0,0,0,.4); animation: pop .3s cubic-bezier(.3,1.6,.6,1);
  transition: opacity .4s; }
.toast b { color: var(--yellow); }
.toast.error { border-color: rgba(255,77,109,.7); } .toast.gift { border-color: var(--pink); }
.toast.ko { border-color: var(--yellow); } .toast.out { opacity: 0; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

#invites { position: absolute; top: 26px; right: 26px; display: flex; flex-direction: column; gap: 14px; z-index: 16; }
.invite { width: 480px; padding: 24px; border-radius: 20px; background: #1d2250; border: 2px solid var(--yellow);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 24px; animation: pop .3s cubic-bezier(.3,1.6,.6,1); }
.invite .row button { flex: 1; }
.invite .ok { background: linear-gradient(180deg, #5df08f, #2fbf63); box-shadow: 0 5px 0 #1f8a45; color: #08240f; }

#devpanel { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 13;
  padding: 12px; border-radius: 16px; background: rgba(20,24,58,.9); border: 2px dashed var(--pink); font-size: 17px; width: 170px; }
#devpanel button { font-size: 16px; padding: 8px 10px; box-shadow: 0 3px 0 #3b3fb0; }

/* ---------- 官方身份码界面（开放平台设计规范） ---------- */
#code-modal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); }
.bili-auth { position: relative; width: 1080px; height: 676px; background: #fff; border-radius: 8px; overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.bili-auth-tv { position: absolute; left: -10px; bottom: -70px; width: 330px; color: #ff6699; opacity: .08; }
.bili-auth-close { position: absolute; right: 26px; top: 18px; width: 56px; height: 56px; padding: 0; border-radius: 50%;
  background: transparent; box-shadow: none; color: #9499a0; font-size: 56px; font-weight: 300; line-height: 50px; }
.bili-auth-close:hover, .bili-auth-close:active { transform: none; box-shadow: none; color: #61666d; }
.bili-auth-title { margin-top: 56px; text-align: center; font-size: 48px; color: #ff6699; letter-spacing: 1px; }
.bili-auth-field { display: flex; align-items: center; width: 830px; height: 88px; margin: 74px auto 0;
  border: 2px solid #e3e5e7; border-radius: 8px; overflow: hidden; }
.bili-auth-field:focus-within { border-color: #ff6699; }
.bili-auth-label { flex: none; width: 176px; height: 100%; display: flex; align-items: center; justify-content: center;
  background: #f6f7f8; border-right: 2px solid #e3e5e7; color: #18191c; font-size: 38px; }
.bili-auth-field input { flex: 1; height: 100%; border: none; border-radius: 0; background: #fff; padding: 0 26px;
  font-size: 38px; color: #18191c; }
.bili-auth-field input::placeholder { color: #c9ccd0; }
.bili-auth-clear { flex: none; width: 70px; height: 100%; padding: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: #9499a0; font-size: 48px; font-weight: 300; }
.bili-auth-clear:hover, .bili-auth-clear:active { transform: none; box-shadow: none; color: #61666d; }
.bili-auth-tip { display: flex; justify-content: space-between; align-items: center; width: 830px; margin: 14px auto 0;
  font-size: 32px; color: #c9ccd0; }
.bili-auth-q { display: inline-flex; width: 34px; height: 34px; margin-right: 16px; border: 2px solid #c9ccd0; border-radius: 50%;
  align-items: center; justify-content: center; font-style: normal; font-size: 24px; vertical-align: middle; }
.bili-auth-tip a { color: #ff6699; text-decoration: none; }
.bili-auth-error { height: 40px; margin-top: 18px; text-align: center; color: #f85a54; font-size: 28px; }
.bili-auth-btn { display: block; width: 320px; height: 84px; margin: 18px auto 0; padding: 0; border-radius: 8px;
  background: #ff6699; box-shadow: none; color: #fff; font-size: 38px; font-weight: normal; }
.bili-auth-btn:hover { background: #ff85ad; transform: none; box-shadow: none; filter: none; }
.bili-auth-btn:active { transform: none; box-shadow: none; }
.bili-auth-btn:disabled { background: #ffb3cc; cursor: default; }
.bili-auth-remember { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px;
  font-size: 34px; color: #18191c; cursor: pointer; user-select: none; }
.bili-auth-remember input { display: none; }
.bili-auth-remember i { width: 38px; height: 38px; border: 2px solid #9499a0; border-radius: 50%; position: relative; }
.bili-auth-remember input:checked + i { background: #5fbf6f; border-color: #5fbf6f; }
.bili-auth-remember input:checked + i::after { content: ''; position: absolute; left: 12px; top: 5px; width: 9px; height: 18px;
  border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.login-wrap #login-status { font-size: 24px; margin-top: 24px; }
