* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1400px 900px at 50% 12%, #17293c 0%, #0e1822 55%, #0a111a 100%) fixed;
  color: #e8eef4; -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: #8aa0b4; font-size: 13px; }

.screen { max-width: 860px; margin: 0 auto; padding: 24px 16px; }
.back-hub { display: inline-block; color: #6fc2ff; text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.screen h1 { text-align: center; margin-bottom: 20px; font-size: 26px; }
.screen h2 { font-size: 16px; margin-bottom: 10px; color: #cfe0ee; }

.panel { background: #18242f; border: 1px solid #263845; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.panel.rules .muted { line-height: 1.8; }
.home-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .home-cols { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: #8aa0b4; margin: 8px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #34495c; background: #0f1923; color: #e8eef4; font-size: 15px; outline: none;
}
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 10px;
  border: 1px solid #3c5268; background: #24364a; color: #e8eef4; font-size: 15px; cursor: pointer; margin-top: 10px;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(#35ad6c, #1e7a4b); border: none; }
.btn.danger { background: linear-gradient(#d95463, #a92f3e); border: none; }
.btn.warn { background: linear-gradient(#c9964a, #9c6d25); border: none; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.small { padding: 5px 10px; font-size: 13px; margin-top: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.row select { flex: 1; }

.room-list { max-height: 200px; overflow-y: auto; }
.room-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #263845; gap: 8px; }
.room-item .btn { margin-top: 0; padding: 6px 14px; }
.join-code { display: flex; gap: 8px; margin-top: 12px; }
.join-code .btn { margin-top: 0; }
.footer { text-align: center; margin-top: 10px; }
.share { font-size: 15px; word-break: break-all; margin-bottom: 6px; }
.share b { color: #6fc2ff; }

.player-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #263845; font-size: 15px; }
.player-row:last-child { border-bottom: none; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #2c3f53; color: #9fc1dd; margin-left: 6px; }
.tag.host { background: #6b5424; color: #ffd97a; }
.tag.easy { background: #1f4d33; color: #8fe6b4; }
.tag.medium { background: #54481f; color: #f0d77c; }
.tag.hard { background: #5c2730; color: #ff9aa8; }

/* ===== 对局界面 ===== */
.screen-game {
  max-width: 700px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; padding: 8px 12px 12px;
}
#g-topbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; color: #8aa0b4; font-size: 13px; }

#players-row { display: flex; gap: 10px; justify-content: center; padding: 8px 0; }
.pcard {
  background: linear-gradient(180deg, rgba(24,37,52,.96), rgba(12,20,30,.94));
  border: 1.5px solid #3d5266; border-radius: 12px;
  padding: 8px 12px; width: 168px; position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  display: flex; align-items: center; gap: 9px;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(255,211,77,.3), 0 0 10px rgba(255,211,77,.4); }
  50%     { box-shadow: 0 0 0 2px rgba(255,211,77,.55), 0 0 20px rgba(255,211,77,.8); }
}
.pcard.turn { border-color: #ffd34d; animation: pulse 1.6s ease-in-out infinite; }
.pcard.me { border-color: #5aa7e0; }
/* 阵营图标:圆形小棋子,红「帅」黑「将」 */
.pcard .piece-ico {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
  background: radial-gradient(circle at 34% 30%, #fdf3dd, #e6c795 62%, #c9a065);
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.pcard .piece-ico.red { color: #b8221a; border: 2px solid #b8221a; }
.pcard .piece-ico.black { color: #222; border: 2px solid #333; }
.pcard .pinfo { min-width: 0; }
.pcard .pname { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pchips { font-size: 12px; color: #ffd97a; }
.pcard .timer-badge {
  position: absolute; top: -10px; right: -8px;
  display: inline-flex; width: 32px; height: 32px; border-radius: 50%;
  align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 50% 40%, #ffcf5a, #e8961f); border: 2px solid #fff;
}
#vs-mark { align-self: center; font-size: 15px; font-weight: 800; color: #5f7488; }

/* 棋盘:温暖木纹面板,和深色页面形成对比 */
#board-wrap {
  margin: 6px auto; padding: 10px;
  background: linear-gradient(150deg, #6b4a28, #4a3118);
  border-radius: 16px;
  box-shadow: 0 10px 34px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,224,170,.25);
}
#board { display: block; border-radius: 8px; touch-action: manipulation; }

#turn-hint { text-align: center; min-height: 22px; padding-top: 6px; font-size: 14px; }
#turn-hint b { color: #ffd34d; }
#turn-hint .check-warn { color: #ff6b5e; font-weight: 800; }

#log-panel {
  margin-top: 10px; background: rgba(15,25,36,.8); border: 1px solid #2a3d50;
  border-radius: 12px; padding: 8px 12px; height: 96px; overflow: hidden;
}
#log-lines { height: 100%; overflow-y: auto; font-size: 12px; line-height: 1.7; color: #b8cadb; }

#reveal-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(4,8,12,.72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#reveal-box {
  background: rgba(10,17,26,.97); border: 1px solid #ffd34d; border-radius: 16px;
  padding: 20px 24px; max-width: 440px; width: 100%;
  box-shadow: 0 0 0 4px rgba(255,211,77,.1), 0 12px 44px rgba(0,0,0,.7);
  text-align: center;
}
#reveal-box h3 { font-size: 20px; margin-bottom: 8px; }
#reveal-box .verdict { font-size: 14px; color: #ffd97a; line-height: 1.8; }

#toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #6b2530; border: 1px solid #8d3441; color: #fff; padding: 9px 18px; border-radius: 9px;
  font-size: 14px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .25s;
}
#toast.show { opacity: 1; }
#disconnected { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; display: flex; align-items: center; justify-content: center; }

@media (max-width: 560px) {
  .pcard { width: 146px; padding: 7px 9px; }
  .pcard .piece-ico { width: 24px; height: 24px; font-size: 14px; }
}
