:root {
  --blue: #2f80ed;
  --blue-deep: #1c5fc0;
  --orange: #ff8a3d;
  --orange-deep: #f5701a;
  --cream: #fff8ef;
  --ink: #2a3140;
  --soft: #8a94a6;
  --gold: #ffb84d;
  --green: #2ecc71;
  --red: #ff5a5f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #d6ecff 0%, #e3f6ff 38%, #fff3e0 100%);
  overflow-x: hidden;
}

/* 飘动背景 */
.hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.hearts span {
  position: absolute;
  bottom: -40px;
  font-size: 22px;
  opacity: .55;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0); opacity: .6; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.screen.active { display: flex; }

.card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, .94);
  border-radius: 26px;
  padding: 28px 24px 30px;
  box-shadow: 0 18px 50px rgba(47, 128, 237, .22);
  backdrop-filter: blur(6px);
  text-align: center;
  animation: pop .35s ease;
}
@keyframes pop {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.logo { font-size: 54px; line-height: 1; margin-bottom: 6px; }
h1 { margin: 6px 0 2px; font-size: 28px; color: var(--blue-deep); letter-spacing: 1px; }
.subtitle { margin: 0 0 18px; color: var(--soft); font-size: 14px; }

.field { display: block; text-align: left; margin: 14px 0; }
.field span { font-size: 13px; color: var(--soft); }
.field input {
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  font-size: 16px;
  border: 2px solid #cfe3ff;
  border-radius: 14px;
  outline: none;
  background: #fff;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--blue); }

.name-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.name-chip {
  flex: 1 1 auto;
  min-width: 70px;
  padding: 10px 8px;
  border: 2px solid #cfe3ff;
  border-radius: 14px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue-deep);
  cursor: pointer;
  transition: all .15s;
}
.name-chip:active { transform: scale(.97); }
.name-chip.sel { border-color: var(--orange); background: #fff3e0; color: var(--orange-deep); }

.btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, opacity .2s;
  margin-top: 10px;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--orange)); color: #fff; box-shadow: 0 8px 20px rgba(47, 128, 237, .4); }
.btn.primary:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--blue-deep); border: 2px solid var(--blue); }
.btn.mini { width: auto; padding: 7px 12px; font-size: 13px; margin-top: 8px; }
.btn.vote { margin-top: 10px; background: #fff3e0; color: var(--orange-deep); border: 2px solid var(--orange); }
.btn.vote:disabled { opacity: .45; }

.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; color: var(--soft); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #cfe3ff; }

.tip { font-size: 12.5px; color: var(--soft); margin-top: 14px; line-height: 1.6; }

/* 大厅 */
.room-code-box { margin: 16px 0; padding: 16px; background: var(--cream); border-radius: 18px; }
.room-code-label { font-size: 12px; color: var(--soft); }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--blue-deep); margin: 4px 0; }
.players { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.player-chip { padding: 12px; border-radius: 14px; background: #fff; border: 2px dashed #bcd6ff; font-size: 15px; }
.player-chip.ok { border-style: solid; border-color: var(--green); color: #1e9e57; }

/* 单元多选 */
.unit-select { margin: 16px 0 4px; text-align: left; }
.unit-select-title { font-size: 13px; color: var(--soft); margin-bottom: 8px; }
.unit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-chip {
  flex: 1 1 auto;
  min-width: 88px;
  padding: 9px 8px;
  border: 2px solid #cfe3ff;
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-deep);
  cursor: pointer;
  transition: all .15s;
}
.unit-chip:active { transform: scale(.97); }
.unit-chip.sel { border-color: var(--orange); background: #fff3e0; color: var(--orange-deep); }
.unit-chip:disabled { cursor: default; }
.unit-chip:disabled:not(.sel) { opacity: .45; }

/* 游戏顶栏 */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(47, 128, 237, .12);
}
.score b { color: var(--blue-deep); font-size: 17px; }
.round-info b { color: var(--orange-deep); }
.role-tag { font-size: 12px; color: var(--soft); }

#screen-game { align-items: flex-start; padding-top: 70px; }
.game-card { margin-bottom: 30px; }
.round-type {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.round-prompt { font-size: 21px; line-height: 1.5; margin: 0 0 18px; color: var(--ink); }

.area { margin-top: 8px; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #cfe3ff;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
}
.choice-btn:active { transform: scale(.98); }
.choice-btn.sel { border-color: var(--blue); background: #eaf3ff; font-weight: 700; }

/* 揭晓 */
.reveal { animation: pop .3s ease; }
.answer-pair { display: flex; align-items: stretch; gap: 8px; margin: 10px 0; }
.answer-block {
  flex: 1;
  background: var(--cream);
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.answer-block.theirs { background: #eaf3ff; }
.who { font-size: 12px; color: var(--soft); margin-bottom: 6px; }
.answer-text { font-size: 16px; font-weight: 700; line-height: 1.5; min-height: 24px; word-break: break-word; }
.vs { align-self: center; font-size: 13px; font-weight: 800; color: var(--orange); }
.round-result { margin-top: 12px; font-size: 16px; font-weight: 800; min-height: 22px; }
.round-result.ok { color: var(--green); }
.round-result.no { color: var(--red); }
.round-explain {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--soft);
  background: #f5f9ff;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}

.next { margin-top: 16px; }

/* 结果 */
.result-card .logo { font-size: 60px; }
#result-title { font-size: 28px; }
.final-scores { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 18px 0; }
.fs { display: flex; flex-direction: column; align-items: center; }
.fs span { font-size: 13px; color: var(--soft); }
.fs b { font-size: 38px; color: var(--blue-deep); line-height: 1; }
.fs.vs { font-size: 16px; color: var(--soft); font-weight: 800; }
.result-desc { font-size: 14px; color: var(--ink); line-height: 1.7; margin: 6px 0 20px; padding: 0 6px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(28, 42, 64, .92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  max-width: 86vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
