* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: radial-gradient(ellipse at center, #2b3a2f 0%, #16201a 70%);
  color: #e8e2d0;
}
button {
  cursor: pointer; border: 1px solid #8a7b52; background: #3a3225; color: #f0e6c8;
  padding: 6px 14px; border-radius: 6px; font-size: 14px;
}
button:hover { background: #4a4030; }
button.primary { background: #7a2e21; border-color: #b8563f; }
button.primary:hover { background: #93392a; }
button:disabled { opacity: .4; cursor: not-allowed; }
input {
  padding: 8px 10px; border-radius: 6px; border: 1px solid #6b6046;
  background: #201c14; color: #f0e6c8; font-size: 15px; outline: none;
}

#toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #7a2e21; color: #fff; padding: 8px 18px; border-radius: 6px;
  display: none; z-index: 99; box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* ---------- 首页 ---------- */
.screen { height: 100%; }
.home-box {
  max-width: 340px; margin: 12vh auto; text-align: center;
  display: flex; flex-direction: column; gap: 14px; padding: 30px;
  background: rgba(0,0,0,.35); border: 1px solid #5a4f38; border-radius: 12px;
}
.home-box h1 { font-size: 42px; color: #d8b56a; letter-spacing: 8px; }
.home-box .sub { color: #9a917c; font-size: 13px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; width: 0; text-transform: uppercase; }

/* ---------- 大厅 ---------- */
.lobby { max-width: 460px; margin: 8vh auto; padding: 26px; background: rgba(0,0,0,.35); border: 1px solid #5a4f38; border-radius: 12px; }
.lobby h2 { color: #d8b56a; margin-bottom: 4px; }
.lobby .code { font-size: 34px; letter-spacing: 6px; color: #fff; margin-bottom: 14px; }
.lobby ul { list-style: none; margin-bottom: 16px; }
.lobby li { padding: 7px 10px; border-bottom: 1px dashed #4a4433; display: flex; justify-content: space-between; }
.lobby .btns { display: flex; gap: 10px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 4px; background: #4a4030; }

/* ---------- 游戏桌面 ---------- */
.game { display: flex; flex-direction: column; height: 100vh; padding: 8px; gap: 6px; }
.topbar { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #b7ae97; padding: 2px 8px; }
.topbar .roomcode { color: #d8b56a; }
.winner-banner {
  text-align: center; font-size: 20px; color: #ffd873; padding: 10px;
  background: rgba(122,46,33,.55); border: 1px solid #b8563f; border-radius: 8px;
}

.seats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.seat {
  width: 148px; border: 2px solid #5a4f38; border-radius: 10px; padding: 6px 8px;
  background: rgba(0,0,0,.4); position: relative; font-size: 12px;
}
.seat.turn { border-color: #ffd873; box-shadow: 0 0 10px rgba(255,216,115,.45); }
.seat.dead { opacity: .45; filter: grayscale(1); }
.seat.targetable { cursor: pointer; border-color: #7fb069; }
.seat.targeted { border-color: #e2574c; box-shadow: 0 0 10px rgba(226,87,76,.6); }
.seat .nm { font-size: 13px; color: #fff; display: flex; justify-content: space-between; }
.seat .gen { color: #d8b56a; }
.seat .hp { letter-spacing: 1px; }
.hp .on { color: #6fd06f; } .hp .off { color: #555; }
.hp.low .on { color: #e2574c; }
.seat .row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; min-height: 16px; }
.chip { font-size: 11px; background: #33402e; border: 1px solid #55684d; padding: 0 5px; border-radius: 3px; color: #cfe3c0; }
.chip.judge { background: #4a2f3a; border-color: #7a4f5f; color: #f0c9d8; }
.identity { font-size: 11px; padding: 0 6px; border-radius: 3px; }
.id-主公 { background: #8a6d1d; color: #fff; }
.id-忠臣 { background: #7a4f21; color: #fff; }
.id-反贼 { background: #274a27; color: #cfe3c0; }
.id-内奸 { background: #333355; color: #ccd; }
.id-unknown { background: #333; color: #999; }

.center { flex: 1; display: flex; gap: 8px; min-height: 120px; }
.logpane {
  flex: 1; background: rgba(0,0,0,.45); border: 1px solid #4a4433; border-radius: 8px;
  overflow-y: auto; padding: 8px 10px; font-size: 12px; line-height: 1.7; color: #c8bfa6;
}
.side { width: 130px; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; font-size: 12px; color: #9a917c; }

.prompt {
  min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 12px;
  background: rgba(0,0,0,.5); border: 1px solid #6b6046; border-radius: 8px; flex-wrap: wrap;
}
.prompt .msg { color: #ffd873; font-size: 14px; }

.mybar { display: flex; gap: 8px; align-items: flex-end; }
.myinfo { width: 150px; font-size: 12px; }
.hand { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-height: 96px; align-items: flex-end; }
.card {
  width: 64px; height: 92px; background: #f5eedd; border-radius: 6px; border: 2px solid #b7ae97;
  color: #222; display: flex; flex-direction: column; padding: 4px 5px; cursor: pointer;
  font-size: 12px; user-select: none; transition: transform .08s;
}
.card:hover { transform: translateY(-8px); }
.card.sel { transform: translateY(-12px); border-color: #e2574c; box-shadow: 0 0 8px rgba(226,87,76,.7); }
.card.dim { opacity: .45; cursor: default; }
.card.dim:hover { transform: none; }
.card .cr { font-weight: bold; font-size: 13px; }
.card .cr.red { color: #c0392b; }
.card .cn { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: bold; text-align: center; }
.card .ct { font-size: 10px; color: #777; text-align: right; }
