/* 黑猩猩和电炖锅打架 —— 厨房 × 丛林,暖灯泡底 + 不锈钢高光 */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 50% 12%, #3a2a1c 0%, #171210 68%),
    #141110;
  color: #f3e7d6;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }

button {
  font: inherit; border: none; border-radius: 10px;
  padding: 8px 14px; background: #4a3a2a; color: #f3e7d6; cursor: pointer;
  transition: filter .12s, transform .06s;
}
button:hover:not(:disabled) { filter: brightness(1.2); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.linkish { background: none; color: #d8b98a; text-decoration: underline; padding: 4px; }
input {
  font: inherit; padding: 9px 12px; border-radius: 9px;
  border: 1px solid #7a6448; background: #fff; color: #241a12; width: 100%;
}
.err { color: #ff9d8a; min-height: 1.2em; margin: 0; }
.hint { color: #b49b78; font-size: 13.5px; line-height: 1.7; margin: 0; }
.hint a { color: #e8b84b; }
.row { display: flex; gap: 10px; align-items: center; }

/* 首页 / 大厅 */
.screen { min-height: 100dvh; }
#home, #lobby { display: grid; place-items: center; padding: 18px; }
.card {
  background: #f6ecdb; color: #2b2018;
  border-radius: 16px; padding: 24px; width: min(470px, 94vw);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.card h1 { margin: 0; font-size: 27px; line-height: 1.25; letter-spacing: -.5px; }
.card h2 { margin: 0; }
.card .hint { color: #75604a; }
.card .hint a { color: #a8541c; }
.vs { color: #b8763a; font-weight: 400; margin: 0 5px; }
.tagline { margin: 0; color: #7b6349; font-size: 14.5px; }
.room-code { font-family: ui-monospace, monospace; letter-spacing: 4px; color: #a8541c; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode {
  background: #2f2519; color: #f6ecdb; text-align: left;
  padding: 12px 13px; display: flex; flex-direction: column; gap: 3px;
}
.mode b { font-size: 15.5px; }
.mode span { font-size: 11.5px; color: #bda88a; line-height: 1.4; }

.pickrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pickrow .lbl { font-size: 13px; color: #75604a; width: 34px; flex: none; }
.pick, .lvl { background: #e0d0b4; color: #4a3a28; padding: 6px 12px; font-size: 13.5px; }
.pick.on, .lvl.on { background: #c9812f; color: #fff6e6; font-weight: 700; }

#lobby-players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
#lobby-players li { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.tag { font-size: 11px; background: #d8c6a6; color: #4a3a28; border-radius: 5px; padding: 1px 7px; }

/* 打架现场 */
#fight { display: grid; place-items: center; padding: 10px; gap: 10px; align-content: center; }
#stage-wrap { position: relative; width: min(100%, 1100px); }
#stage {
  display: block; width: 100%; height: auto;
  border-radius: 12px; background: #1b1512;
  box-shadow: 0 16px 44px rgba(0,0,0,.62);
  image-rendering: auto;
}
#btn-quit {
  position: absolute; top: 9px; right: 9px; z-index: 3;
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  background: rgba(20,16,12,.62); color: #f3e7d6; font-size: 15px; line-height: 1;
}
/* 大字喊话:KO! / 第二局 / 平手 */
#shout {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; z-index: 2;
  font-size: clamp(30px, 7vw, 62px); font-weight: 900; letter-spacing: 3px;
  color: #ffe9a8; text-shadow: 0 4px 0 #a03a1e, 0 0 26px rgba(255,180,60,.6);
  animation: shoutin .34s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes shoutin {
  from { opacity: 0; transform: scale(.55) rotate(-7deg); }
  to   { opacity: 1; transform: none; }
}

/* 手机虚拟按键 */
#pad {
  width: min(100%, 1100px);
  display: flex; justify-content: space-between; gap: 14px;
  padding: 0 4px 6px;
  touch-action: none;
}
.pad-side { display: flex; gap: 9px; align-items: center; }
.pb {
  width: 60px; height: 60px; border-radius: 50%; padding: 0;
  font-size: 15px; font-weight: 700;
  background: #3c2e20; color: #f3e7d6;
  box-shadow: 0 3px 0 #241a12;
  user-select: none; -webkit-user-select: none;
}
.pb:active { transform: translateY(3px); box-shadow: none; }
.pb.hit { background: #9c4a24; }
.pb.sp  { background: #c9812f; color: #2b2018; }

#modal-layer {
  position: fixed; inset: 0; background: rgba(0,0,0,.66);
  display: grid; place-items: center; z-index: 40; padding: 16px;
}
#modal { gap: 12px; text-align: center; }
#modal h2 { font-size: 24px; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #2b2018; color: #f3e7d6; padding: 10px 16px; border-radius: 9px; z-index: 60;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
}

@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .card h1 { font-size: 23px; }
  .pb { width: 52px; height: 52px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #shout { animation: none; }
}
