* { box-sizing: border-box; }

:root {
  --ink: #16241b;
  --ink-2: #0a1a10;
  --pond-0: #061a12;
  --pond-1: #0d3323;
  --pond-2: #14482f;
  --lime: #bff45a;
  --lime-deep: #8ad635;
  --cream: #fff6dd;
  --cream-2: #f4e7c2;
  --skin: #ffd8a3;
  --skin-edge: #eeb273;
  --red: #ff5c5c;
  --yellow: #ffd84a;
  --muted: #9fc0ab;
  --panel: rgba(9, 34, 23, 0.9);
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--cream);
  background:
    radial-gradient(120% 85% at 50% -10%, #1f5e3f 0%, #0d3624 42%, #061a12 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, input { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ==================== 池塘背景 ==================== */
.pond-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.pond-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.5;
}
.pond-glow.g1 { width: 380px; height: 380px; left: -120px; top: -80px; background: #2f8a55; }
.pond-glow.g2 { width: 320px; height: 320px; right: -100px; top: 24%; background: #6aa53a; opacity: 0.28; }
.pond-glow.g3 { width: 420px; height: 300px; left: 40%; bottom: -160px; background: #1f7a58; opacity: 0.4; }

.bubble {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(191, 244, 90, 0.28);
  box-shadow: inset 0 0 18px rgba(191, 244, 90, 0.12);
  animation: bubbleFloat 14s ease-in-out infinite;
}
.bubble.b1 { width: 26px; height: 26px; left: 9%; bottom: 16%; animation-delay: 0s; }
.bubble.b2 { width: 14px; height: 14px; left: 26%; bottom: 8%; animation-delay: 2.4s; }
.bubble.b3 { width: 34px; height: 34px; right: 12%; bottom: 24%; animation-delay: 1.2s; }
.bubble.b4 { width: 18px; height: 18px; right: 30%; bottom: 9%; animation-delay: 4s; }

.lily {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3f8f4f, #1c5833 70%);
  opacity: 0.35;
  clip-path: polygon(50% 50%, 100% 0, 100% 100%, 0 100%, 0 0);
}
.lily.l1 { width: 150px; height: 90px; left: -40px; bottom: 18%; }
.lily.l2 { width: 110px; height: 70px; right: -26px; top: 12%; transform: rotate(150deg); }

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
  50% { transform: translateY(-26px) scale(1.06); opacity: 0.9; }
}

#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  width: 100%;
}
.screen.is-active { display: flex; }

/* ==================== 通用组件 ==================== */
.panel {
  background: linear-gradient(165deg, rgba(20, 58, 39, 0.94), rgba(8, 30, 20, 0.94));
  border: 2px solid rgba(191, 244, 90, 0.22);
  border-radius: 20px;
  padding: 12px 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink);
  background: var(--cream-2);
  box-shadow: 0 5px 0 #061a11, 0 9px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #061a11, 0 4px 10px rgba(0, 0, 0, 0.3); }
.btn:disabled { filter: saturate(0.35) brightness(0.78); transform: none; cursor: not-allowed; }

.btn-primary { background: linear-gradient(180deg, #dcff85, #96e63e); color: #12240f; }
.btn-lime { background: linear-gradient(180deg, #dcff85, #96e63e); }
.btn-ghost {
  background: rgba(12, 42, 27, 0.92);
  color: var(--cream);
  border-color: rgba(191, 244, 90, 0.45);
  box-shadow: 0 4px 0 rgba(3, 16, 10, 0.9);
}
.btn-danger { background: linear-gradient(180deg, #ff9c8b, #ef4b44); color: #2a0b08; }
.btn-text {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0.5px;
}
.btn-text:active { transform: none; box-shadow: none; }

.btn-xl {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 13px 12px;
  border-radius: 20px;
  font-size: 23px;
}
.btn-xl .btn-sub { font-size: 14px; font-weight: 600; letter-spacing: 0.5px; opacity: 0.78; }
.btn-xl:disabled .btn-sub { opacity: 0.7; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 2px solid rgba(191, 244, 90, 0.3);
  background: rgba(5, 24, 15, 0.78);
  color: var(--cream);
  font-size: 16px;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
}
.icon-btn.danger { border-color: rgba(255, 110, 100, 0.5); color: #ff9d92; }
.icon-btn:active { transform: translateY(1px); }

.mini-btn {
  font-size: 14px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(191, 244, 90, 0.12);
  border: 1px solid rgba(191, 244, 90, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.mini-btn:active { background: rgba(191, 244, 90, 0.24); }

/* ==================== 大厅 ==================== */
#screen-lobby { overflow: hidden; }
.lobby-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lobby-scroll > * { flex: 0 0 auto; }

.brand { text-align: center; padding-top: 4px; }
.brand-tag {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 2px;
  color: #cfe9b6;
  border: 1px solid rgba(191, 244, 90, 0.35);
  border-radius: 999px;
  padding: 3px 12px;
  background: rgba(10, 40, 25, 0.6);
}
.brand-title {
  margin: 8px 0 3px;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(38px, 10vw, 54px);
  line-height: 1.04;
  letter-spacing: 2px;
  color: var(--lime);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 5px 0 rgba(0, 0, 0, 0.45);
}
.brand-title span { color: #fff3c4; }
.brand-sub { margin: 0; font-size: 15px; color: #b6d6c0; letter-spacing: 0.5px; }

.hero {
  position: relative;
  height: clamp(166px, 26vh, 216px);
  border-radius: 24px;
  border: 2px dashed rgba(191, 244, 90, 0.22);
  background:
    radial-gradient(80% 100% at 28% 100%, rgba(191, 244, 90, 0.2), transparent 62%),
    linear-gradient(160deg, rgba(31, 92, 60, 0.55), rgba(7, 28, 18, 0.25));
  overflow: hidden;
}
.hero-frog {
  position: absolute;
  left: 3%;
  bottom: -2%;
  width: 47%;
  max-width: 200px;
  animation: heroBob 4s ease-in-out infinite;
}
.hero-frog svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45)); }
.hero-burst {
  position: absolute;
  right: 5%;
  top: 15%;
  display: flex;
  flex-direction: column;
  transform: rotate(-5deg);
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(26px, 7.4vw, 38px);
  line-height: 1.06;
  color: var(--yellow);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.hero-burst span:last-child { color: #fff3c4; }

@keyframes heroBob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

.name-panel { display: flex; flex-direction: column; gap: 7px; }
.name-panel label { font-size: 14px; color: #a9cbb3; letter-spacing: 1px; }
.name-row { display: flex; align-items: center; gap: 10px; }
#name-input {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(3, 18, 11, 0.66);
  border: 2px solid rgba(191, 244, 90, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
#name-input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(191, 244, 90, 0.16); }
#name-input::placeholder { color: #6f927b; font-weight: 500; }

.conn-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.conn-dot i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd54a;
  box-shadow: 0 0 8px currentColor;
}
.conn-dot.is-online i { background: #7ee06a; }
.conn-dot.is-offline i { background: #ff6b6b; }

.lobby-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.join-box {
  display: flex;
  gap: 8px;
  animation: popIn 0.24s ease-out;
}
#join-code {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--yellow);
  background: rgba(3, 18, 11, 0.66);
  border: 2px solid rgba(191, 244, 90, 0.3);
  border-radius: 12px;
  padding: 9px 12px;
  outline: none;
}
#join-code::placeholder { color: #6f927b; letter-spacing: 1px; font-weight: 500; }
.join-box .btn { padding: 8px 14px; font-size: 16px; }

.lobby-list-panel { padding: 12px 12px 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: 1px; }
.panel-head-right { display: flex; align-items: center; gap: 8px; }
.online-num { font-size: 14px; color: var(--muted); }

.room-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 196px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.room-empty {
  font-size: 14px;
  color: #88a895;
  padding: 13px;
  text-align: center;
  border: 1px dashed rgba(191, 244, 90, 0.2);
  border-radius: 12px;
}
.room-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(4, 20, 12, 0.55);
  border: 1px solid rgba(191, 244, 90, 0.14);
}
.room-row .r-code { font-size: 17px; font-weight: 900; color: var(--yellow); letter-spacing: 2px; }
.room-row .r-host {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: #d7ecd9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-row .r-state { font-size: 14px; color: var(--muted); white-space: nowrap; }
.room-row .btn { padding: 5px 13px; font-size: 15px; border-radius: 10px; box-shadow: 0 3px 0 #05140c; }

.rule-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.rule-steps li { display: flex; gap: 8px; font-size: 14px; line-height: 1.5; color: #cfe3d4; }
.rule-steps b {
  flex: 0 0 auto;
  height: fit-content;
  color: var(--lime);
  background: rgba(191, 244, 90, 0.12);
  border-radius: 8px;
  padding: 0 6px;
  font-size: 14px;
  white-space: nowrap;
}
.lobby-foot { margin: 0; text-align: center; font-size: 14px; color: #7f9f8b; letter-spacing: 0.5px; }

/* ==================== 等待房间 ==================== */
#screen-room {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 2px 8px;
}
.topbar-title { font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.room-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 6px;
}
.room-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding: 4px 0;
}
.code-card {
  text-align: center;
  background: linear-gradient(165deg, rgba(22, 64, 42, 0.92), rgba(8, 30, 20, 0.94));
  border: 2px solid rgba(191, 244, 90, 0.25);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}
.code-label { font-size: 14px; letter-spacing: 3px; color: var(--muted); }
.code-line { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 2px; }
.code-line strong {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  font-family: "Arial Black", "PingFang SC", sans-serif;
}
.code-tip { margin: 2px 0 0; font-size: 14px; color: #a9cbb3; }

.seat-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.seat-card {
  background: linear-gradient(170deg, rgba(20, 58, 39, 0.94), rgba(7, 28, 18, 0.94));
  border: 2px solid rgba(191, 244, 90, 0.28);
  border-radius: 18px;
  padding: 14px 8px 12px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
}
.seat-card.empty { border-style: dashed; border-color: rgba(191, 244, 90, 0.18); opacity: 0.85; }
.seat-avatar { font-size: 38px; line-height: 1.1; }
.seat-card.empty .seat-avatar { color: #6f927b; font-weight: 900; }
.seat-name {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-state { font-size: 14px; color: var(--muted); margin-top: 2px; }
.seat-state.is-ready { color: var(--lime); font-weight: 800; }
.seat-divider {
  font-size: 16px;
  font-weight: 900;
  color: var(--yellow);
  background: var(--ink);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(191, 244, 90, 0.5);
}
.ready-note {
  text-align: center;
  font-size: 14px;
  color: #b6d6c0;
  padding: 2px;
}
.ready-note.is-starting { color: var(--lime); font-weight: 800; }

.flow-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 14px;
  background: rgba(4, 20, 12, 0.55);
  border: 1px solid rgba(191, 244, 90, 0.2);
  text-align: center;
}
.flow-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lime);
  color: #12240f;
  font-size: 14px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.flow-step b { font-size: 15px; color: #e7f7e1; line-height: 1.25; }
.flow-step small { font-size: 14px; color: var(--muted); line-height: 1.3; }
.room-rules {
  font-size: 14px;
  line-height: 1.55;
  color: #a9cbb3;
  background: rgba(4, 20, 12, 0.5);
  border: 1px dashed rgba(191, 244, 90, 0.2);
  border-radius: 14px;
  padding: 9px 12px;
}
.room-rules p { margin: 0; }
.room-rules b { color: var(--yellow); }

/* ==================== 对局 ==================== */
#screen-game {
  position: relative;
  padding: 0 10px calc(6px + env(safe-area-inset-bottom));
  gap: 4px;
  overflow: hidden;
  max-width: 660px;
  margin: 0 auto;
  width: 100%;
}

.gbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 2px 0;
}
.gbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mini { font-size: 15px; font-weight: 900; color: var(--lime); white-space: nowrap; }
.room-chip {
  font-size: 14px;
  color: #a9cbb3;
  background: rgba(4, 20, 12, 0.6);
  border: 1px solid rgba(191, 244, 90, 0.25);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.room-chip b { color: var(--yellow); letter-spacing: 1px; }
.gbar-right { display: flex; gap: 6px; }

.opp-block, .me-block { flex: 0 0 auto; display: flex; flex-direction: column; }

.seat-line {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
  font-size: 15px;
  min-width: 0;
  height: 24px;
}
.role-badge {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 0 8px;
  line-height: 20px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: #241c04;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.role-badge.is-respond { background: #ffb46b; }
.seat-line .seat-name {
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 44%;
}
.pick-state {
  margin-left: auto;
  font-size: 14px;
  color: #a9cbb3;
  background: rgba(4, 20, 12, 0.62);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}
.pick-state.is-picked { color: #12240f; background: var(--lime); font-weight: 800; }
.pick-state.is-waiting { color: #ffd54a; }

.hand-wrap {
  position: relative;
  height: clamp(96px, 15.2vh, 138px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
#opp-hand-wrap { height: clamp(84px, 13.4vh, 120px); }
.hand {
  height: 100%;
  width: auto;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 9px 12px rgba(0, 0, 0, 0.4));
  transition: filter 0.2s ease;
}
#opp-hand { transform: scaleX(-1) scale(0.96); }
.hand-wrap.is-loser { animation: handShake 0.5s ease-in-out; }

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 110px;
  border-radius: 22px;
  border: 2px solid rgba(191, 244, 90, 0.2);
  background:
    radial-gradient(92% 72% at 50% 104%, rgba(63, 150, 86, 0.55), transparent 70%),
    radial-gradient(70% 60% at 18% 16%, rgba(191, 244, 90, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(9, 36, 24, 0.86), rgba(4, 20, 13, 0.92));
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.stage-topline {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 7;
}
.round-chip {
  font-size: 14px;
  font-weight: 800;
  color: #0f2115;
  background: #cbe9a8;
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}
.phase-tip {
  font-size: 14px;
  color: #bfe0c5;
  background: rgba(4, 20, 12, 0.66);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.phase-tip.is-urgent { color: #2a0b08; background: #ff8a72; font-weight: 800; }

.frog-zone {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  height: 82%;
  display: flex;
  align-items: flex-end;
  z-index: 2;
}
.frog {
  height: 100%;
  display: flex;
  align-items: flex-end;
  animation: frogIdle 3.6s ease-in-out infinite;
}
.frog svg { height: 100%; width: auto; display: block; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.42)); }
.stage-ground {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 76%;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.55), transparent 72%);
  z-index: 1;
}

.frog.is-hop { animation: frogHop 0.5s cubic-bezier(0.3, 0.9, 0.4, 1); }
.frog.is-happy { animation: frogHappy 0.65s ease-in-out 2; }
.frog.is-sad { animation: frogSad 0.8s ease-in-out; }
.stage.is-shake { animation: shake 0.45s ease-in-out; }

.chant-bubble {
  position: absolute;
  right: 8px;
  top: 34px;
  display: none;
  flex-direction: column;
  background: var(--cream);
  color: #1b2a16;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 5px 10px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  transform: rotate(-4deg);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
  z-index: 6;
  white-space: nowrap;
}
.chant-bubble::after {
  content: '';
  position: absolute;
  left: 16px;
  bottom: -11px;
  border: 7px solid transparent;
  border-top-color: var(--ink);
}
.chant-bubble.is-on { display: flex; animation: popIn 0.3s ease-out; }
.chant-bubble.is-shout { background: var(--yellow); transform: rotate(2deg) scale(1.06); }

.fx-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}
.count-wrap { position: relative; display: grid; place-items: center; animation: countPop 0.46s ease-out; }
.count-burst {
  position: absolute;
  width: clamp(148px, 36vw, 186px);
  height: clamp(148px, 36vw, 186px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2e7042, #0b2a1b 74%);
  border: 3px dashed rgba(191, 244, 90, 0.6);
  box-shadow: 0 0 0 7px rgba(191, 244, 90, 0.12), inset 0 0 28px rgba(0, 0, 0, 0.55);
  animation: spinSlow 9s linear infinite;
}
.count-num {
  position: relative;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(62px, 16.5vh, 100px);
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  text-shadow: 6px 7px 0 rgba(0, 0, 0, 0.45);
}
.count-num.is-go {
  font-size: clamp(26px, 8vw, 42px);
  color: #fff3c4;
  text-align: center;
  letter-spacing: 2px;
  line-height: 1.1;
}

.splash { display: flex; flex-direction: column; align-items: center; gap: 2px; animation: popIn 0.36s cubic-bezier(0.2, 1.8, 0.4, 1); }
.splash-main {
  font-size: clamp(32px, 9.6vw, 48px);
  font-weight: 900;
  color: var(--yellow);
  letter-spacing: 2px;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 5px 0 rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.splash-sub {
  font-size: 15px;
  color: #e6f5e2;
  background: rgba(4, 20, 12, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.splash.is-bad .splash-main { color: #ff7d6d; }
.splash.is-pass .splash-main { color: #a9e8ff; }

.log-strip {
  flex: 0 0 auto;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 0 1px;
}
.log-strip::-webkit-scrollbar { display: none; }
.log-empty { font-size: 14px; color: #7f9f8b; white-space: nowrap; }
.log-chip {
  flex: 0 0 auto;
  font-size: 14px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(4, 20, 12, 0.7);
  border: 1px solid rgba(191, 244, 90, 0.2);
  color: #cfe3d4;
  white-space: nowrap;
}
.log-chip.is-match { border-color: rgba(255, 110, 100, 0.6); color: #ffb0a4; }

.choose-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.finger-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: clamp(66px, 9.4vh, 84px);
  border-radius: 16px;
  border: 3px solid rgba(191, 244, 90, 0.35);
  background: linear-gradient(180deg, rgba(22, 62, 41, 0.96), rgba(8, 30, 19, 0.96));
  color: var(--cream);
  box-shadow: 0 5px 0 rgba(2, 12, 7, 0.9);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  padding: 4px;
}
.finger-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(2, 12, 7, 0.9); }
.finger-btn .finger-icon { height: 38px; display: flex; align-items: center; justify-content: center; }
.finger-btn .finger-icon svg { height: 100%; width: auto; display: block; }
.finger-icon .target { filter: drop-shadow(0 0 4px rgba(191, 244, 90, 0.85)); }
.finger-btn.is-picked .finger-icon .target { fill: #173a10; filter: none; }
.finger-name { font-size: 16px; font-weight: 900; letter-spacing: 1px; line-height: 1.2; }
.finger-btn kbd {
  position: absolute;
  top: 3px;
  right: 6px;
  font-family: inherit;
  font-size: 14px;
  color: #8fb59a;
  opacity: 0.85;
}
.finger-btn:disabled { opacity: 0.42; }
.finger-btn.is-picked {
  border-color: var(--lime);
  background: linear-gradient(180deg, #dcff85, #96e63e);
  color: #12240f;
  box-shadow: 0 5px 0 #3c5c1a, 0 0 20px rgba(191, 244, 90, 0.5);
}
.finger-btn.is-picked kbd { color: #33511d; }
.finger-btn.is-picked::after {
  content: '✓';
  position: absolute;
  top: -9px;
  left: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #12240f;
  color: var(--lime);
  font-size: 14px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 2px solid var(--lime);
}
.finger-btn.is-urgent { animation: btnPulse 0.7s infinite; border-color: #ffb46b; }
.btn.is-queueing { background: linear-gradient(180deg, #ffe08a, #ffbf4d); color: #2a1c04; }

.timer-line {
  flex: 0 0 auto;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  visibility: hidden;
}
.timer-line.is-on { visibility: visible; }
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8ee63c, #ffd84a);
}
.timer-fill.is-danger { background: #ff6b5e; }

.foot-tip {
  flex: 0 0 auto;
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: #9fc0ab;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

/* ==================== 结算 ==================== */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 14, 9, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.result-card {
  position: relative;
  width: min(420px, 92vw);
  max-height: 86dvh;
  overflow-y: auto;
  background: linear-gradient(170deg, #fff8e3, #f2e3bd);
  color: #1b2a16;
  border: 4px solid var(--ink);
  border-radius: 26px;
  padding: 16px 18px 14px;
  box-shadow: 0 0 0 6px rgba(191, 244, 90, 0.22), 0 22px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: resultIn 0.4s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.result-kicker { font-size: 14px; font-weight: 800; letter-spacing: 2px; color: #5c7a4d; }
.result-emoji { font-size: 54px; line-height: 1.06; margin: 2px 0; animation: emojiBounce 0.8s ease-in-out infinite alternate; }
.result-title {
  margin: 0;
  font-size: clamp(34px, 9.6vw, 46px);
  letter-spacing: 2px;
  color: #2b7c2b;
  -webkit-text-stroke: 2px #16261b;
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 rgba(0, 0, 0, 0.14);
}
.result-title.is-lose { color: #e0483f; }
.result-desc { margin: 7px 0 0; font-size: 16px; line-height: 1.5; font-weight: 600; }
.result-detail {
  margin: 8px 0 0;
  font-size: 14px;
  color: #5c7a4d;
  background: rgba(22, 60, 32, 0.08);
  border-radius: 10px;
  padding: 6px 8px;
}
.result-actions { display: flex; gap: 10px; margin-top: 13px; }
.result-actions .btn { flex: 1; padding: 10px 8px; font-size: 17px; }
.result-hint { min-height: 20px; margin: 7px 0 0; font-size: 14px; color: #8a6a2c; font-weight: 600; }
.result-overlay .confetti {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  pointer-events: none;
}

/* ==================== 弹窗 ==================== */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 7, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(460px, 94vw);
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, #fff8e3, #f3e5c3);
  color: #1b2a16;
  border: 4px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55);
  animation: resultIn 0.3s ease-out;
}
.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 2px dashed rgba(27, 42, 22, 0.2);
}
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: 1px; }
.modal-head .icon-btn { background: #fff; color: #1b2a16; border-color: #1b2a16; }
.modal-body { padding: 12px 16px 16px; overflow-y: auto; }
.modal-rules-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.55; }
.modal-rules-list li::marker { color: #2b7c2b; font-weight: 900; }
.modal-tip {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  background: rgba(191, 244, 90, 0.28);
  border-left: 4px solid #2b7c2b;
  padding: 8px 10px;
  border-radius: 8px;
}
.modal-foot { margin: 10px 0 0; font-size: 14px; color: #6d8a5d; text-align: center; }

.confirm-card { width: min(360px, 92vw); }
.confirm-text { font-size: 16px; line-height: 1.55; margin: 0 0 14px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
.confirm-actions .btn-ghost {
  background: #e7d7ae;
  color: #1b2a16;
  border-color: #1b2a16;
  box-shadow: 0 4px 0 #b9a679;
}

/* ==================== 提示 ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 100;
  max-width: 86vw;
  background: rgba(6, 24, 15, 0.96);
  color: #e9f7e6;
  border: 2px solid rgba(191, 244, 90, 0.5);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==================== 动画 ==================== */
@keyframes frogIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.01); }
}
@keyframes frogHop {
  0% { transform: translateY(0) scale(1, 1); }
  28% { transform: translateY(-28px) scale(1.05, 0.94); }
  58% { transform: translateY(0) scale(1.1, 0.9); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes frogHappy {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-5deg) scale(1.04); }
  75% { transform: rotate(5deg) scale(1.04); }
}
@keyframes frogSad {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(7px) rotate(-3deg); }
  65% { transform: translateY(3px) rotate(2deg); }
}
@keyframes handShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  45% { transform: translateX(5px) rotate(1deg); }
  70% { transform: translateX(-3px); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes popIn {
  0% { transform: scale(0.55) rotate(-6deg); opacity: 0; }
  70% { transform: scale(1.06) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes countPop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.16); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 5px 0 rgba(2, 12, 7, 0.9); }
  50% { box-shadow: 0 5px 0 rgba(2, 12, 7, 0.9), 0 0 0 4px rgba(255, 180, 107, 0.35); }
}
@keyframes resultIn {
  0% { transform: scale(0.82) translateY(18px); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes emojiBounce {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-8px) rotate(4deg); }
}
@keyframes confettiFall {
  to { transform: translateY(440px) rotate(560deg); opacity: 0; }
}
.finger .finger-line { stroke: rgba(80, 44, 18, 0.4); stroke-width: 3; fill: none; stroke-linecap: round; }
.hand .palm-shape { fill: var(--skin); }
.hand .wrist-shape { fill: #efbb80; }
.hand .fold-shape { fill: var(--skin-edge); }
.hand .band-shape { fill: var(--lime-deep); }
.hand .hand-line { stroke: rgba(80, 44, 18, 0.35); stroke-width: 3; fill: none; stroke-linecap: round; }

/* 手部 */
.finger { transition: transform 0.42s cubic-bezier(0.2, 1.8, 0.35, 1), filter 0.2s ease, opacity 0.24s ease; }
.finger.is-up { transform: translateY(-38px); }
.hand.is-reveal .finger:not(.is-up) { opacity: 0.24; }
.hand.is-reveal .finger.is-up { filter: drop-shadow(0 0 10px rgba(191, 244, 90, 0.95)); }
.finger.is-match { filter: drop-shadow(0 0 9px #ff6b5e); }
.finger.is-match .finger-shape { fill: #ffb1a3; }
.finger .finger-shape { fill: var(--skin); }
.finger .nail { fill: #fff1d8; opacity: 0.9; }

/* ==================== 适配 ==================== */
@media (max-height: 720px) {
  .hand-wrap { height: clamp(84px, 13.6vh, 112px); }
  #opp-hand-wrap { height: clamp(76px, 12vh, 98px); }
  .choose-bar { gap: 7px; }
  .finger-btn { height: clamp(62px, 9vh, 76px); }
  .finger-btn .finger-icon { height: 34px; }
  .foot-tip { font-size: 14px; }
  .stage { min-height: 100px; }
  .seat-line { height: 22px; }
}

@media (max-height: 620px) and (orientation: portrait) {
  .hand-wrap { height: 76px; }
  #opp-hand-wrap { height: 66px; }
  .frog-zone { height: 76%; }
  .finger-btn { height: 58px; }
  .finger-btn .finger-icon { height: 32px; }
  .finger-name { font-size: 15px; }
  .stage { min-height: 92px; }
  .foot-tip { display: none; }
  .log-strip { height: 26px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  #screen-game { overflow-y: auto; max-width: 900px; }
  .hand-wrap { height: 78px; }
  #opp-hand-wrap { height: 68px; }
  .stage { flex: 0 0 128px; min-height: 128px; }
  .finger-btn { height: 56px; }
  .finger-btn .finger-icon { height: 30px; }
  .finger-name { font-size: 15px; }
  .foot-tip { display: none; }
  .choose-bar { max-width: 520px; width: 100%; margin: 0 auto; }
  .timer-line { max-width: 520px; width: 100%; margin: 0 auto; }
}

@media (min-width: 720px) {
  #screen-game { max-width: 700px; }
  .hero { height: 224px; }
  .hero-frog { max-width: 226px; }
}

@media (min-width: 900px) {
  .lobby-scroll { max-width: 720px; }
  #screen-game { max-width: 720px; }
  #screen-room { max-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
