/* 乒乓球2 · 双人对战 —— 卡通游戏界面 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E96A18;
  --orange-ink: #7A3208;
  --blue: #2E7CF6;
  --blue-deep: #1554C8;
  --red: #F0443C;
  --red-deep: #C42720;
  --cream: #FFF7EC;
  --ink: #2A1B12;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #23150e;
  font-family: var(--font);
  color: var(--ink);
}

body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.game {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background: #e9824c;
}

.field {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------------- HUD ---------------- */
.hud {
  position: absolute;
  z-index: 20;
  top: calc(var(--safe-top) + 10px);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scoreboard {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(72, 47, 31, 0.58), rgba(43, 25, 15, 0.62));
  border: 1.5px solid rgba(255, 246, 231, 0.5);
  box-shadow:
    0 9px 22px rgba(60, 25, 0, 0.3),
    0 2px 0 rgba(255, 255, 255, 0.16) inset,
    0 -2px 0 rgba(0, 0, 0, 0.2) inset;
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 78px;
  height: 54px;
  border-radius: 13px;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 3px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.16s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.score-card.blue {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(122, 183, 255, 0.62), rgba(122, 183, 255, 0) 62%),
    linear-gradient(170deg, #4a98ff 0%, #2473ee 48%, #1550c4 100%);
}

.score-card.red {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 156, 142, 0.62), rgba(255, 156, 142, 0) 62%),
    linear-gradient(170deg, #ff7064 0%, #ef443c 48%, #c42620 100%);
}

.score-tag {
  font-size: 9.5px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.14em;
  opacity: 0.88;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.score-num {
  font-size: 29px;
  line-height: 0.94;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.24);
  transition: transform 0.15s ease;
}

.score-num.bump {
  animation: score-bump 0.42s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes score-bump {
  0% { transform: scale(1); }
  38% { transform: scale(1.48) rotate(-5deg); }
  100% { transform: scale(1); }
}

.score-vs {
  padding: 0 4px;
  font-size: 23px;
  line-height: 1;
  font-weight: 900;
  color: #fff4df;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.round-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 248, 235, 0.5);
  background: rgba(44, 26, 16, 0.46);
  color: #fffaf0;
  box-shadow: 0 6px 16px rgba(40, 16, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.round-btn .mp-icon {
  width: 24px;
  height: 24px;
}

.round-btn:active {
  transform: translateY(-50%) scale(0.9);
  background: rgba(44, 26, 16, 0.66);
}

.match-meta {
  position: absolute;
  z-index: 19;
  top: calc(var(--safe-top) + 82px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border-radius: 999px;
  background: rgba(47, 27, 15, 0.3);
  border: 1px solid rgba(255, 243, 224, 0.2);
  color: rgba(255, 249, 237, 0.9);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
  white-space: nowrap;
}

.meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd15c;
  box-shadow: 0 0 6px rgba(255, 209, 92, 0.9);
}

/* ---------------- 操控提示 ---------------- */
.zone-glow {
  position: absolute;
  left: 0;
  right: 0;
  height: 27%;
  z-index: 4;
  pointer-events: none;
}

.zone-red {
  top: 0;
  background: radial-gradient(120% 100% at 50% 0%, rgba(255, 84, 70, 0.22), rgba(255, 84, 70, 0) 72%);
}

.zone-blue {
  bottom: 0;
  background: radial-gradient(120% 100% at 50% 100%, rgba(52, 128, 255, 0.26), rgba(52, 128, 255, 0) 72%);
}

.hint {
  position: absolute;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fff9ee;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(45, 27, 16, 0.42);
  border: 1px solid rgba(255, 247, 234, 0.24);
  box-shadow: 0 6px 16px rgba(40, 16, 0, 0.16);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.hint.hide {
  opacity: 0;
  transform: translateY(6px);
}

.hint-red {
  top: calc(var(--safe-top) + 112px);
  left: 14px;
}

.hint-blue {
  bottom: calc(var(--safe-bottom) + 18px);
  left: 14px;
}

.hint-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.hint-red .hint-dot {
  background: #ff6c60;
  color: #ff6c60;
}

.hint-blue .hint-dot {
  background: #5b9dff;
  color: #5b9dff;
}

/* ---------------- 居中提示 ---------------- */
.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%) scale(0.82);
  opacity: 0;
  padding: 13px 26px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(43, 25, 14, 0.9), rgba(26, 14, 8, 0.92));
  border: 1.5px solid rgba(255, 240, 214, 0.34);
  color: #fff8e9;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 18px 40px rgba(20, 8, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 1.4, 0.4, 1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast.blue {
  color: #bcdcff;
  border-color: rgba(110, 172, 255, 0.55);
}

.toast.red {
  color: #ffc8c3;
  border-color: rgba(255, 125, 113, 0.5);
}

.toast.gold {
  color: #ffe3a1;
  border-color: rgba(255, 209, 92, 0.6);
}

/* ---------------- 底部按钮通用 ---------------- */
.primary-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 330px;
  height: 58px;
  margin: 0 auto;
  border: none;
  border-radius: 19px;
  overflow: hidden;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #ffb45f 0%, #ff8a3d 42%, #f37218 100%);
  box-shadow: 0 7px 0 #bf4f0b, 0 16px 26px rgba(65, 24, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.primary-btn::after {
  content: "";
  position: absolute;
  inset: 2px 2px 52% 2px;
  border-radius: 17px 17px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.primary-btn .mp-icon {
  width: 25px;
  height: 25px;
}

.primary-btn:active {
  transform: translateY(4px) scale(0.99);
  box-shadow: 0 3px 0 #bf4f0b, 0 8px 16px rgba(65, 24, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.42);
}

.primary-btn.compact {
  height: 54px;
  font-size: 17px;
  margin-top: 18px;
}

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 46px;
  margin: 9px auto 0;
  border-radius: 15px;
  border: 1.5px solid rgba(116, 72, 38, 0.2);
  background: rgba(255, 255, 255, 0.52);
  color: #7a4a27;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.ghost-btn .mp-icon {
  width: 20px;
  height: 20px;
}

.ghost-btn:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.8);
}

/* ---------------- 全屏层 ---------------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen[hidden] {
  display: none !important;
}

/* ---------------- 首页 ---------------- */
.start-screen {
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 18px);
  overflow: hidden;
  background: #ec7a30;
}

.start-bg {
  position: absolute;
  inset: -10%;
  background-image: url("images/gen/gptimg_1795247478_look.png");
  background-size: cover;
  background-position: 50% 54%;
  filter: blur(30px) saturate(1.4) brightness(0.94);
  transform: scale(1.1);
  opacity: 0.86;
}

.start-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(95% 64% at 50% 34%, rgba(255, 198, 128, 0.2), rgba(138, 52, 8, 0.56) 100%),
    linear-gradient(180deg, rgba(173, 73, 18, 0.5) 0%, rgba(160, 66, 16, 0.24) 38%, rgba(112, 43, 7, 0.76) 100%);
}

.start-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.poster-wrap {
  position: relative;
  width: 100%;
  max-width: 382px;
  padding: 7px;
  border-radius: 27px;
  background: linear-gradient(145deg, #fffdf8 0%, #ffe9cb 52%, #f7d3a5 100%);
  box-shadow:
    0 26px 46px rgba(35, 12, 0, 0.46),
    0 8px 14px rgba(35, 12, 0, 0.24),
    inset 0 1px 0 #fff;
  transform: rotate(-1.2deg);
}

.poster {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 21px;
  background: #2c7fe8;
  box-shadow: inset 0 0 0 1px rgba(83, 40, 12, 0.16);
}

.poster-pin {
  position: absolute;
  z-index: 3;
  top: -8px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0c9, #ffc44c 45%, #d9820d 100%);
  box-shadow: 0 4px 8px rgba(60, 22, 0, 0.35);
}

.pin-left { left: 26px; }
.pin-right { right: 26px; }

.poster-tag {
  position: absolute;
  z-index: 3;
  left: 17px;
  bottom: 17px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  color: #fff9ec;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(28, 19, 12, 0.54);
  border: 1px solid rgba(255, 247, 232, 0.32);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.poster-tag .mp-icon {
  width: 14px;
  height: 14px;
  color: #ffd15c;
}





.game-title {
  margin: 17px 0 0;
  font-size: clamp(40px, 12vw, 54px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fffdf7;
  text-shadow:
    0 3px 0 #b34a0d,
    0 6px 0 #8d3706,
    0 12px 26px rgba(40, 12, 0, 0.44);
}

.game-title span {
  display: inline-block;
  margin-left: 3px;
  color: #ffd54f;
  text-shadow:
    0 3px 0 #c06a00,
    0 6px 0 #8f4b00,
    0 12px 24px rgba(40, 12, 0, 0.4);
  transform: translateY(-6px) rotate(7deg);
}

.game-sub {
  margin: 11px 0 18px;
  color: #ffe9cf;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 6px rgba(30, 10, 0, 0.4);
}

.how-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 17px;
}

.how {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(255, 249, 238, 0.95);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(43, 24, 12, 0.42);
  border: 1px solid rgba(255, 244, 226, 0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.how-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.how-blue .how-dot {
  background: #66a5ff;
  color: #66a5ff;
}

.how-red .how-dot {
  background: #ff766a;
  color: #ff766a;
}

.start-foot {
  margin: 13px 0 0;
  color: rgba(255, 238, 216, 0.6);
  font-size: 10.5px;
  letter-spacing: 0.14em;
}

/* ---------------- 暂停 / 结算 ---------------- */
.modal-screen {
  background: rgba(26, 13, 6, 0.34);
}

.modal-art {
  position: absolute;
  inset: -10%;
  background-image: url("images/gen/gptimg_1795247478_look.png");
  background-size: cover;
  background-position: 50% 54%;
  filter: blur(20px) saturate(1.15) brightness(0.8);
  transform: scale(1.08);
  opacity: 0.6;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 60% at 50% 42%, rgba(255, 150, 70, 0.1), rgba(20, 9, 3, 0.58) 100%),
    linear-gradient(180deg, rgba(32, 14, 4, 0.4), rgba(20, 9, 3, 0.7));
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(100%, 348px);
  margin: 0 20px;
  padding: 26px 22px 22px;
  border-radius: 28px;
  text-align: center;
  background:
    radial-gradient(120% 70% at 50% 0%, #fffdf8 0%, #fff5e5 52%, #ffe6c9 100%);
  border: 2px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    0 30px 60px rgba(20, 7, 0, 0.5),
    0 2px 0 rgba(255, 255, 255, 0.8) inset;
  animation: card-in 0.36s cubic-bezier(0.2, 1.25, 0.4, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-kicker {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  color: #b4611c;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: rgba(255, 138, 61, 0.14);
  border: 1px solid rgba(255, 138, 61, 0.22);
}

.modal-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-top: 13px;
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

.ms-blue { color: #2574ef; }
.ms-red { color: #e8433b; }
.ms-sep { color: #b89a7c; font-size: 32px; }

.modal-title {
  margin: 9px 0 0;
  color: #462615;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.modal-sub {
  margin: 7px 0 0;
  color: #a07a58;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.result-card {
  padding-top: 20px;
}

.winner-badge {
  width: 74px;
  height: 74px;
  margin: -4px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, #ffd76a 0%, #ffb02e 48%, #f08a11 100%);
  box-shadow:
    0 10px 22px rgba(180, 96, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 0 -4px 0 rgba(170, 90, 0, 0.18);
}

.winner-badge .mp-icon {
  width: 40px;
  height: 40px;
}

.result-score {
  margin-top: 12px;
  color: #5a3218;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 窄屏 HUD ---------------- */
@media (max-width: 355px) {
  .scoreboard { padding: 4px; gap: 2px; border-radius: 17px; }
  .score-card { width: 68px; height: 50px; border-radius: 11px; }
  .score-num { font-size: 26px; }
  .score-tag { font-size: 9px; }
  .score-vs { font-size: 20px; padding: 0 2px; }
  .round-btn { width: 42px; height: 42px; right: 0; }
  .round-btn .mp-icon { width: 22px; height: 22px; }
  .hint { font-size: 10.5px; padding: 6px 10px; }
  .match-meta { font-size: 9.5px; }
}

/* ---------------- 小屏适配 ---------------- */
@media (max-height: 730px) {
  .poster-wrap { max-width: 312px; padding: 6px; border-radius: 23px; }
  .poster { border-radius: 18px; }
  .game-title { margin-top: 12px; font-size: clamp(35px, 10.5vw, 46px); }
  .game-sub { margin: 8px 0 13px; font-size: 12px; }
  .primary-btn { height: 52px; font-size: 17px; border-radius: 17px; }
  .how-row { margin-top: 12px; }
  .start-foot { margin-top: 9px; }
  .modal-card { padding: 20px 18px 17px; }
  .winner-badge { width: 62px; height: 62px; margin-bottom: 9px; }
  .modal-score { font-size: 38px; }
}

@media (max-height: 640px) {
  .poster-wrap { max-width: 270px; }
  .start-foot { display: none; }
  .game-sub { margin-bottom: 10px; }
}

@media (min-width: 520px) {
  .game { max-width: 560px; margin: 0 auto; box-shadow: 0 0 80px rgba(0, 0, 0, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-card { animation: none; }
  .score-num.bump { animation: none; }
}
