:root {
  --bg-0: #080b18;
  --bg-1: #0f1530;
  --bg-2: #16204a;
  --ink: #eaf0ff;
  --sub: #9aa6cf;
  --sub-2: #6f7aa6;
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .16);
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .09);
  --brand: linear-gradient(135deg, #8b5cff 0%, #ff6fae 100%);
  --brand-2: linear-gradient(135deg, #36e0c6 0%, #4f8cff 100%);
  --gold: #ffd479;
  --red: #ff5d73;
  --green: #34d399;
  --blue: #5b8cff;
  --yellow: #ffd166;
  --shadow: 0 22px 55px rgba(0, 0, 0, .5);
  --shadow-sm: 0 10px 26px rgba(0, 0, 0, .38);
  --radius: 22px;
  --radius-sm: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(139, 92, 255, .28), transparent 60%),
    radial-gradient(820px 480px at 96% 4%, rgba(255, 111, 174, .22), transparent 55%),
    radial-gradient(900px 620px at 50% 115%, rgba(54, 224, 198, .16), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0) 70%);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 22px 18px 64px; }

/* 顶部品牌栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 50px; height: 50px; border-radius: 16px;
  background: var(--brand); display: grid; place-items: center;
  font-size: 25px; box-shadow: 0 12px 30px rgba(139, 92, 255, .45);
  position: relative;
}
.logo::after { content: ""; position: absolute; inset: 0; border-radius: 16px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.brand h1 { font-size: 23px; letter-spacing: .6px; font-weight: 800; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .tag { font-size: 12.5px; color: var(--sub); letter-spacing: .3px; }
.namebox { display: flex; align-items: center; gap: 10px; }
.namebox input {
  border: 1px solid var(--line-2); border-radius: 13px; padding: 11px 14px; font-size: 14px; width: 160px; outline: none;
  background: var(--glass); color: var(--ink); backdrop-filter: blur(8px); transition: border-color .15s, background .15s;
}
.namebox input::placeholder { color: var(--sub-2); }
.namebox input:focus { border-color: #8b5cff; background: var(--glass-2); }

/* 英雄区 */
.hero { text-align: center; padding: 18px 0 30px; }
.hero h2 { font-size: 38px; font-weight: 900; letter-spacing: .5px; line-height: 1.1;
  background: linear-gradient(100deg, #ffffff, #c9d4ff 55%, #ffc9e6);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--sub); margin-top: 12px; font-size: 15.5px; letter-spacing: .3px; }

/* 大厅游戏卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.gcard {
  background: linear-gradient(165deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  cursor: pointer; box-shadow: var(--shadow-sm); backdrop-filter: blur(10px);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.gcard::before { content: ""; position: absolute; inset: 0; background: var(--g-grad, var(--brand)); opacity: 0; transition: opacity .25s; }
.gcard:hover { transform: translateY(-7px); box-shadow: 0 26px 60px rgba(0, 0, 0, .55); border-color: var(--line-2); }
.gcard .ic {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 33px; color: #fff; margin-bottom: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35); position: relative; z-index: 1;
  background: var(--g-grad, var(--brand));
}
.gcard h3 { font-size: 20px; font-weight: 800; position: relative; z-index: 1; }
.gcard .meta { color: var(--sub); font-size: 13px; margin-top: 7px; position: relative; z-index: 1; }
.gcard .play {
  margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; position: relative; z-index: 1;
  color: #fff; font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 12px;
  background: var(--glass-2); border: 1px solid var(--line-2); transition: background .2s;
}
.gcard:hover .play { background: var(--brand); border-color: transparent; }

/* 加入行 & 通用按钮 */
.joinrow { display: flex; gap: 10px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }
.joinrow input {
  border: 1px solid var(--line-2); border-radius: 13px; padding: 12px 16px; font-size: 16px; width: 190px;
  text-transform: uppercase; letter-spacing: 3px; outline: none; background: var(--glass); color: var(--ink);
  text-align: center; font-weight: 700; transition: border-color .15s;
}
.joinrow input::placeholder { color: var(--sub-2); letter-spacing: 3px; }
.joinrow input:focus { border-color: #ff6fae; }
.btn {
  border: none; cursor: pointer; border-radius: 13px; padding: 12px 20px; font-size: 15px; font-weight: 800; color: #fff;
  background: var(--brand); box-shadow: 0 12px 28px rgba(139, 92, 255, .35); transition: transform .14s, filter .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--glass-2); color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; backdrop-filter: blur(8px); }
.btn.ghost:hover { background: var(--glass); }
.btn.sm { padding: 9px 16px; font-size: 13.5px; border-radius: 11px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: none; }

/* 房间布局 */
.room { display: none; grid-template-columns: 312px 1fr; gap: 20px; margin-top: 6px; align-items: start; }
.room.show { display: grid; }
.panel {
  background: linear-gradient(165deg, var(--glass-2), var(--glass));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; backdrop-filter: blur(12px); position: relative;
}
.panel::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); pointer-events: none; }
.code {
  font-size: 34px; font-weight: 900; letter-spacing: 6px; text-align: center;
  background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.codehint { text-align: center; color: var(--sub); font-size: 12px; margin: 5px 0 16px; }

/* 玩家列表（头像） */
.plist { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.plist li { display: flex; align-items: center; gap: 11px; padding: 9px 12px; background: var(--glass); border: 1px solid var(--line); border-radius: 13px; font-size: 14.5px; transition: background .15s; }
.plist li:hover { background: var(--glass-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; flex: 0 0 auto; background: var(--brand-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.host-tag { margin-left: auto; font-size: 11px; color: var(--gold); font-weight: 800; letter-spacing: .5px; }

.stage { min-height: 440px; display: flex; flex-direction: column; padding: 20px 22px; }
.stage .wait { margin: auto; text-align: center; color: var(--sub); }
.stage .wait .big { font-size: 60px; margin-bottom: 12px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .4)); }

/* 游戏通用头部 */
.ghead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.gtitle { font-size: 21px; font-weight: 900; letter-spacing: .5px; display: flex; align-items: center; gap: 9px; }
.gtitle .gt-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--accent, var(--brand)); box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.ghead .gsub { color: var(--sub); font-size: 13.5px; font-weight: 600; }
.toast { position: fixed; left: 50%; top: 22px; transform: translateX(-50%) translateY(-12px); background: rgba(20, 26, 50, .92); color: #fff; padding: 11px 20px; border-radius: 13px; font-size: 14px; font-weight: 600; z-index: 99; opacity: 0; transition: opacity .22s, transform .22s; pointer-events: none; box-shadow: var(--shadow); border: 1px solid var(--line-2); backdrop-filter: blur(10px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(190, 40, 60, .95); border-color: rgba(255, 120, 140, .4); }

/* ===== 谁是卧底 ===== */
.uc-reveal {
  position: relative; text-align: center; padding: 26px 20px; border-radius: 18px; margin: 6px 0 14px; overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 111, 174, .18), rgba(139, 92, 255, .18));
  border: 1px solid var(--line-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: pop .35s cubic-bezier(.2, .9, .2, 1.2);
}
.uc-reveal .word { font-size: 46px; font-weight: 900; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.uc-reveal .tagline { display: block; font-size: 14px; margin-top: 8px; font-weight: 700; }
.uc-reveal .tagline.spy { color: var(--red); }
.uc-reveal .tagline.civ { color: var(--green); }
.roundline { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 14px; font-weight: 600; transition: transform .15s, border-color .15s;
}
.chip .av { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-2); display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 800; }
.chip.me { border-color: var(--gold); background: rgba(255, 212, 121, .12); }
.chip.dead { opacity: .4; text-decoration: line-through; }
.chip.turn { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(91, 140, 255, .5); transform: translateY(-2px); }
.chip .skull { font-size: 13px; }
.log { max-height: 124px; overflow: auto; font-size: 13px; color: var(--sub); background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; margin-top: 12px; line-height: 1.7; }
.log::-webkit-scrollbar { width: 6px; } .log::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.votegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 11px; margin-top: 12px; }

/* ===== 你画我猜 ===== */
.dg-wrap { display: grid; grid-template-columns: 1fr 234px; gap: 16px; }
.dg-stage { position: relative; border-radius: 16px; padding: 8px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); }
.dg-canvas { background: #fff; border-radius: 12px; width: 100%; display: block; touch-action: none; cursor: crosshair; box-shadow: 0 14px 34px rgba(0, 0, 0, .35); }
.dg-side { display: flex; flex-direction: column; gap: 11px; }
.dg-word {
  font-size: 23px; font-weight: 900; text-align: center; padding: 14px 10px; border-radius: 14px;
  background: linear-gradient(145deg, rgba(54, 224, 198, .22), rgba(79, 140, 255, .22));
  border: 1px solid var(--line-2); color: #aef3e6; letter-spacing: 1px;
}
.dg-word.drawer { color: var(--gold); background: linear-gradient(145deg, rgba(255, 212, 121, .2), rgba(255, 111, 174, .2)); }
.palette { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 28px; height: 28px; border-radius: 9px; cursor: pointer; border: 2px solid rgba(255, 255, 255, .25); box-shadow: 0 4px 10px rgba(0, 0, 0, .3); transition: transform .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { outline: 3px solid #fff; outline-offset: 1px; }
.chatter { flex: 1; overflow: auto; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 13px; padding: 11px; font-size: 13.5px; min-height: 130px; line-height: 1.7; }
.chatter div { margin: 5px 0; color: var(--sub); }
.chatter .sys { color: var(--blue); font-weight: 700; }
.chatter .me { color: var(--ink); }
.dg-side input[type="range"] { accent-color: #8b5cff; }
.dg-field { display: flex; gap: 7px; }
.dg-field input { flex: 1; border: 1px solid var(--line-2); border-radius: 11px; padding: 9px 11px; background: var(--glass); color: var(--ink); font-size: 13.5px; outline: none; }
.dg-field input::placeholder { color: var(--sub-2); }

/* ===== 扑克 / UNO 卡 ===== */
.scoreboard { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.sb {
  display: inline-flex; align-items: center; gap: 7px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 13px; font-size: 13.5px; font-weight: 600; transition: border-color .15s, transform .15s;
}
.sb .av { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-2); display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 800; }
.sb.you { border-color: var(--gold); background: rgba(255, 212, 121, .12); }
.sb.turn { border-color: var(--green); box-shadow: 0 0 0 2px rgba(52, 211, 153, .5); transform: translateY(-2px); }
.sb .role { color: var(--gold); font-weight: 800; font-size: 12px; }

.table-cards { display: flex; gap: 7px; justify-content: center; min-height: 92px; align-items: center; margin: 6px 0; }
.turn-flag { text-align: center; color: var(--green); font-weight: 800; font-size: 13.5px; margin: 4px 0 2px; letter-spacing: .5px; }

/* 扑克卡 */
.pcard {
  position: relative; width: 56px; height: 80px; border-radius: 11px; background: #fbfcff; flex: 0 0 auto;
  display: flex; flex-direction: column; justify-content: space-between; padding: 6px 7px; cursor: pointer; user-select: none;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35); border: 1px solid rgba(0, 0, 0, .06); transition: transform .15s, box-shadow .15s;
}
.pcard .rk { font-size: 17px; font-weight: 900; line-height: 1; }
.pcard .rk.b { text-align: right; transform: rotate(180deg); }
.pcard .mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; opacity: .92; }
.pcard.sel { transform: translateY(-16px); box-shadow: 0 16px 30px rgba(139, 92, 255, .5); outline: 2px solid #8b5cff; }
.pcard.r { color: var(--red); } .pcard.b { color: var(--blue); } .pcard.g { color: var(--green); } .pcard.y { color: var(--yellow); }
.pcard.w { background: linear-gradient(160deg, #1c1c2e, #34344f); color: #fff; }
.pcard .jok { font-size: 22px; }

.hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; padding: 4px; }

/* UNO 卡 */
.uno-card {
  position: relative; width: 60px; height: 88px; border-radius: 13px; flex: 0 0 auto; cursor: pointer; user-select: none;
  box-shadow: 0 7px 16px rgba(0, 0, 0, .42); border: 3px solid #fff; transition: transform .15s, box-shadow .15s; overflow: hidden;
  display: grid; place-items: center;
}
.uno-card .oval { width: 40px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .92); display: grid; place-items: center; font-size: 21px; font-weight: 900; }
.uno-card .corner { position: absolute; top: 4px; left: 7px; font-size: 13px; font-weight: 900; color: #fff; opacity: .9; }
.uno-card.r { background: linear-gradient(160deg, #ff5d73, #d6304a); } .uno-card.g { background: linear-gradient(160deg, #34d399, #119e6f); }
.uno-card.b { background: linear-gradient(160deg, #5b8cff, #2f5fd0); } .uno-card.y { background: linear-gradient(160deg, #ffd166, #e0a000); }
.uno-card.w { background: linear-gradient(160deg, #2b2b40, #15151f); }
.uno-card.w .oval { background: conic-gradient(#ff5d73 0 25%, #ffd166 0 50%, #34d399 0 75%, #5b8cff 0); color: #fff; }
.uno-card.sel { transform: translateY(-16px) scale(1.04); box-shadow: 0 18px 34px rgba(255, 209, 102, .5); outline: 2px solid #ffd479; }

/* ===== 狼人杀 ===== */
.ww-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.ww-p {
  position: relative; border-radius: 16px; padding: 14px 14px 13px; font-size: 14px; overflow: hidden;
  background: linear-gradient(160deg, var(--glass-2), var(--glass)); border: 1px solid var(--line);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.ww-p .ww-av { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--brand-2); color: #fff; margin-bottom: 9px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.ww-p .nm { font-weight: 800; font-size: 15px; }
.ww-p .role { color: var(--sub); font-size: 12.5px; margin-top: 3px; font-weight: 600; }
.ww-p.you { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255, 212, 121, .4); }
.ww-p.dead { opacity: .45; filter: grayscale(.5); }
.ww-p.dead::after { content: "💀"; position: absolute; top: 10px; right: 12px; font-size: 20px; }
.ww-p.known-wolf { border-color: var(--red); box-shadow: 0 0 0 1px rgba(255, 93, 115, .5); }
.ww-role-banner { text-align: center; font-weight: 900; font-size: 18px; padding: 12px; border-radius: 14px; margin-bottom: 12px; letter-spacing: .5px; background: linear-gradient(145deg, rgba(139, 92, 255, .22), rgba(255, 111, 174, .2)); border: 1px solid var(--line-2); }
.btnrow { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.ww-field { display: flex; gap: 8px; width: 100%; margin-top: 12px; }
.ww-field input { flex: 1; border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 13px; background: var(--glass); color: var(--ink); font-size: 14px; outline: none; }
.ww-field input::placeholder { color: var(--sub-2); }

/* 结果横幅 */
.result-banner {
  text-align: center; font-size: 28px; font-weight: 900; padding: 18px; border-radius: 16px; margin: 6px 0 12px;
  animation: pop .4s cubic-bezier(.2, .9, .2, 1.2);
}
.result-banner.win { background: linear-gradient(145deg, rgba(52, 211, 153, .25), rgba(91, 140, 255, .22)); border: 1px solid var(--line-2); color: #b6f5da; }
.result-banner.lose { background: linear-gradient(145deg, rgba(255, 93, 115, .25), rgba(255, 111, 174, .2)); border: 1px solid var(--line-2); color: #ffc2cc; }
.result-sub { text-align: center; color: var(--sub); font-size: 14px; margin-bottom: 6px; }

@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 780px) {
  .room { grid-template-columns: 1fr; }
  .dg-wrap { grid-template-columns: 1fr; }
  .hero h2 { font-size: 28px; }
  .code { font-size: 30px; }
}
