/* 游戏专用样式：照 style.css（可爱风）的颜色变量来做 */
.app { padding: 18px 14px 28px; }
h1 { font-size: 1.55rem; line-height: 1.3; }
.lead { margin-bottom: 14px; font-size: .95rem; }

.label { display: block; font-size: .78rem; color: var(--muted); font-weight: 700; }

/* ---------- 战绩板 ---------- */
.board { margin-top: 0; padding: 12px 14px; }
.board-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-stat {
  text-align: center; padding: 6px 4px; border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
}
.big-stat b { font-size: 1.9rem; line-height: 1.15; color: var(--accent); }
.big-stat b::after { content: " 连"; font-size: .85rem; color: var(--muted); }
.board-row { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 8px; text-align: center; }
.board-row b { font-size: 1.2rem; }
.board-row > div + div { border-left: 2px dotted var(--border); }
.bump { animation: numBump .5s ease; display: inline-block; }
@keyframes numBump { 40% { transform: scale(1.45); } }

/* ---------- 对战区 ---------- */
.arena {
  position: relative; margin-top: 12px; padding: 12px 6px 10px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  overflow: hidden; transition: background-color .3s;
}
.arena.flash-win { background: color-mix(in srgb, #ffe27a 30%, var(--card)); }
.arena.flash-lose { background: color-mix(in srgb, #7aa8ff 22%, var(--card)); }
.side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.name { font-size: .8rem; font-weight: 800; color: var(--muted); }
.vs { align-self: center; font-weight: 900; font-size: 1.1rem; color: var(--accent-2); padding: 0 2px; margin-top: -30px; }

.hand {
  position: relative; z-index: 4;
  width: 72px; height: 72px; display: grid; place-items: center;
  font-size: 42px; line-height: 1;
  background: var(--bg); border: 3px solid var(--border); border-radius: 50%;
}
.side-cpu .hand { border-color: var(--accent-2); }
.hand.thinking { animation: fistShake .3s ease-in-out infinite; }
.hand.pop { animation: pop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes fistShake { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(-10deg); } }
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.side-me .hand.clash { animation: clashR .7s ease; }
.side-cpu .hand.clash { animation: clashL .7s ease; }
@keyframes clashR { 40% { transform: translateX(34px) rotate(15deg); } 55% { transform: translateX(22px); } }
@keyframes clashL { 40% { transform: translateX(-34px) rotate(-15deg); } 55% { transform: translateX(-22px); } }

.fighter { position: relative; z-index: 5; width: 110px; height: 118px; display: grid; place-items: end center; }

/* ---------- 小猫咪 ---------- */
.cat { --fur: #ffb468; --fur-d: #f0963f; --ink: #3a2230; position: relative; width: 100px; height: 110px; }
.cat > div, .cat .head > div { position: absolute; }
.cat .head {
  left: 10px; top: 0; width: 80px; height: 64px; z-index: 3;
  background: var(--fur); border-radius: 50% 50% 46% 46%;
}
.cat .head::before { /* 额头花纹 */
  content: ""; position: absolute; left: 31px; top: 4px; width: 18px; height: 12px;
  background: repeating-linear-gradient(90deg, var(--fur-d) 0 3px, transparent 3px 7px); border-radius: 0 0 8px 8px;
}
.cat .ear { top: -7px; width: 26px; height: 26px; background: var(--fur); border-radius: 4px; transform: rotate(45deg); z-index: -1; }
.cat .ear::after { content: ""; position: absolute; inset: 6px; background: #ff9fbf; border-radius: 3px; }
.cat .el { left: 5px; } .cat .er { right: 5px; }
.cat .eye { top: 26px; width: 9px; height: 12px; background: var(--ink); border-radius: 50%; }
.cat .eye::before { content: ""; position: absolute; left: 2px; top: 2px; width: 3px; height: 3px; background: #fff; border-radius: 50%; }
.cat .eyl { left: 22px; } .cat .eyr { right: 22px; }
.cat .blush { top: 40px; width: 13px; height: 7px; background: #ff8fb1; border-radius: 50%; opacity: .75; }
.cat .bl { left: 8px; } .cat .br { right: 8px; }
.cat .mouth { left: 0; right: 0; top: 33px; text-align: center; font-size: 17px; line-height: 1; color: var(--ink); font-weight: 900; }
.cat .body {
  left: 18px; top: 50px; width: 64px; height: 46px; z-index: 1;
  background: var(--fur); border-radius: 30px 30px 22px 22px;
}
.cat .body::after { content: ""; position: absolute; left: 17px; top: 12px; width: 30px; height: 28px; background: #ffe6c9; border-radius: 50%; }
.cat .leg { top: 86px; width: 14px; height: 20px; background: var(--fur); border-radius: 0 0 8px 8px; border-bottom: 5px solid #fff3e3; transform-origin: top center; }
.cat .l1 { left: 20px; } .cat .l2 { left: 35px; } .cat .l3 { left: 51px; } .cat .l4 { left: 66px; }
.cat .tail { left: 72px; top: 44px; width: 13px; height: 48px; background: var(--fur-d); border-radius: 10px; transform: rotate(35deg); transform-origin: bottom center; }

/* 表情 */
.cat.happy .eye { height: 9px; width: 13px; background: transparent; border: 4px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; top: 27px; }
.cat.happy .eye::before { display: none; }
.cat.happy .eyl { left: 20px; } .cat.happy .eyr { right: 20px; }
.cat.sad .eye { background: transparent; width: 14px; height: 14px; }
.cat.sad .eye::before { content: ">"; position: static; display: block; width: auto; height: auto; background: none; color: var(--ink); font: 900 18px/14px system-ui, sans-serif; text-align: center; }
.cat.sad .eyr::before { content: "<"; }
.cat.sad .mouth { transform: rotate(180deg); top: 36px; }
.cat.nervous .mouth { font-size: 15px; }

/* 赢：跳起来 */
.cat.win { animation: catJump .62s ease-out 3; }
.cat.win .leg { animation: legFlail .16s ease-in-out infinite alternate; }
.cat.win .tail { animation: tailWag .2s ease-in-out infinite alternate; }
@keyframes catJump {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  15% { transform: translateY(0) scale(1.12, .88); }
  50% { transform: translateY(-34px) rotate(-8deg) scale(.95, 1.06); }
  85% { transform: translateY(0) scale(1.1, .9); }
}
@keyframes legFlail { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@keyframes tailWag { from { transform: rotate(10deg); } to { transform: rotate(55deg); } }

/* 输：摔个四脚朝天 */
.cat.lose { animation: catFlop .9s cubic-bezier(.4,.1,.5,1.3) forwards; }
.cat.lose .leg { animation: legKick .22s ease-in-out .8s infinite alternate; }
.cat.lose .tail { animation: tailWag .3s ease-in-out .8s infinite alternate; }
@keyframes catFlop {
  0% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-34px) rotate(-25deg); }
  70% { transform: translateY(8px) rotate(195deg); }
  85% { transform: translateY(-14px) rotate(172deg); }
  100% { transform: translateY(-10px) rotate(180deg); }
}
@keyframes legKick { from { transform: rotate(-30deg); } to { transform: rotate(30deg); } }

/* 平：冒汗滴 */
.sweat { position: absolute; top: 4px; right: 4px; font-size: 22px; opacity: 0; pointer-events: none; z-index: 5; }
.side.sweaty .sweat { animation: sweatDrip 1.2s ease-in .3s infinite; }
@keyframes sweatDrip { 0% { opacity: 0; transform: translateY(-6px) scale(.6); } 20% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(26px) scale(.9); } }
.cat.nervous { animation: tremble .12s linear 6; }
@keyframes tremble { 50% { transform: translateX(2px); } }

/* 电脑 */
.robot { font-size: 74px; line-height: 1; padding-bottom: 6px; }
.robot.gloat { animation: robotLaugh .35s ease-in-out infinite alternate; }
.robot.dizzy { animation: robotDizzy 1s ease-in-out 2; }
@keyframes robotLaugh { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-14px) rotate(8deg); } }
@keyframes robotDizzy { 25% { transform: rotate(-18deg) translateX(-6px); } 75% { transform: rotate(18deg) translateX(6px); } }

/* 星星、眼泪 */
.fx-local { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.star { position: absolute; left: 50%; top: 40%; font-size: 22px; animation: starBurst 1.1s ease-out var(--d, 0s) forwards; opacity: 0; }
@keyframes starBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(180deg); }
}
.tear { position: absolute; top: 78px; left: 50%; font-size: 18px; opacity: 0; animation: tearFly .9s ease-out var(--d, 0s) infinite; }
@keyframes tearFly {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.5); }
  15% { opacity: 1; }
  50% { transform: translate(calc(-50% + var(--dx)), -26px) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx) * 1.6), 20px) scale(.9); }
}

/* 画面抖一抖 */
.app.shake { animation: screenShake .55s cubic-bezier(.36,.07,.19,.97); }
@keyframes screenShake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(6px) rotate(.6deg); }
  30%, 50%, 70% { transform: translateX(-10px) rotate(-1deg); }
  40%, 60% { transform: translateX(10px) rotate(1deg); }
}

/* 倒数 */
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 8;
  font-size: 84px; font-weight: 900; color: var(--accent);
  text-shadow: 0 4px 0 var(--card), 0 0 18px var(--card);
}
.countdown span { animation: tick .45s ease-out forwards; }
@keyframes tick { 0% { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1); opacity: .9; } }

/* 结果文字 */
.result { margin: 12px 0; min-height: 2.2em; text-align: center; font-size: 1.15rem; font-weight: 900; }
.result.win { color: #e8890c; } .result.lose { color: #5b7fd6; } .result.draw { color: var(--muted); }
.result.show { animation: pop .45s cubic-bezier(.3,1.6,.5,1); }

/* 出拳按钮 */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice {
  min-height: 96px; padding: 6px 4px; border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 1.05rem; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.choice .emo { font-size: 38px; line-height: 1.1; }
.choice:disabled { opacity: .5; cursor: default; transform: none; }

.footer { margin-top: 18px; text-align: center; }
button.ghost {
  background: transparent; color: var(--muted); border: 2px solid var(--border);
  box-shadow: none; min-height: 44px; padding: 0 20px; font-size: .9rem;
}
button.ghost:active { transform: translateY(1px); box-shadow: none; }

/* 彩带 */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.conf { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: confFall var(--dur) linear var(--d) forwards; }
@keyframes confFall { to { transform: translate(var(--drift), 112vh) rotate(var(--rot)); } }

/* 确认框 */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(40, 20, 30, .45); }
.modal[hidden] { display: none; }
.modal-box { margin: 0; max-width: 320px; width: 100%; text-align: center; border-style: solid; animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
.modal-title { margin: 0 0 6px; font-weight: 900; font-size: 1.15rem; }
.modal-text { margin: 0 0 16px; color: var(--muted); font-size: .92rem; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions button { flex: 1; padding: 0 10px; }
.modal-actions .ghost { min-height: 48px; }

@media (prefers-reduced-motion: reduce) {
  .app.shake, .cat.nervous { animation: none; }
}
