/* Cliff Push game UI — deploy: 2026-07-05-celebrate-v1 */
.lobby-screen, .waiting-screen {
  background: #ffffff;
  padding: 1.25rem;
  color: #1a1a1a;
}

.screen-header { text-align: center; margin-bottom: 1.25rem; position: relative; }
.screen-back {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #444;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}
.screen-back:hover { background: #eee; }
.screen-header--game .screen-back {
  top: 0.35rem;
  transform: none;
}
.screen-header h2 {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--warm-amber);
  margin-top: 0.5rem;
}

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #111;
  font-size: 1rem;
}

#room-code-input {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
  text-align: center;
}

.role-toggle { display: flex; gap: 0.5rem; }
.role-btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: 10px;
  border: 2px solid #ddd;
  background: #f5f5f5;
  color: #666;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.role-btn.selected {
  border-color: var(--cool-blue);
  color: #111;
  background: rgba(169,201,226,0.15);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.char-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 0.65rem;
  color: #555;
}
.char-pick svg { width: 48px; height: 58px; }
.char-pick.selected { border-color: var(--warm-amber); background: rgba(212,167,106,0.12); }

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-top: 0.5rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cool-blue), var(--warm-amber));
  color: #111;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  border: 1px solid #ccc;
  color: #444;
}

.lobby-error { color: var(--danger); font-size: 0.8rem; min-height: 1.2rem; margin-bottom: 0.5rem; }
.room-hint { font-size: 0.75rem; color: #888; text-align: center; margin-bottom: 0.75rem; }

.waiting-screen .room-code {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  color: #111;
  margin: 0.5rem 0 1rem;
}

.player-slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}
.player-slot.ready { border: 1px solid var(--success); }
.player-slot.empty { opacity: 0.5; }
.player-slot.connecting { opacity: 0.85; border-style: dashed; }
.player-slot.spectator {
  border: 1px dashed var(--cool-blue);
  background: rgba(169, 201, 226, 0.12);
}
.player-slot .char-thumb {
  flex-shrink: 0;
  width: 40px;
  height: 48px;
}
.player-slot .char-thumb svg { width: 40px; height: 48px; display: block; }
.player-slot .info { min-width: 0; flex: 1; }
.player-slot .info strong { display: block; font-size: 0.85rem; color: #1a1a1a; }
.player-slot .info span { font-size: 0.7rem; color: #666; }

.share-link {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 0.75rem 0;
  color: #666;
}

/* ===== GAME ===== */
.game-screen, .spectator-screen, .win-screen { background: #ffffff; }

.screen-header--game {
  padding: 0.5rem;
  background: #ffffff;
}

.cliff-arena {
  height: 250px;
  position: relative;
  overflow: hidden;
  background: #56BCEB;
}

.cliff-scene-mount {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.cliff-scene-mount svg { width: 100%; height: 100%; display: block; }

.battle-stage {
  position: absolute;
  bottom: 102px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 0;
  z-index: 10;
  transition: transform 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.fighter { display: flex; flex-direction: column; align-items: center; position: relative; }
.fighter-left { margin-right: -4px; }
.fighter-right { margin-left: -4px; }
.char-anim { transform-origin: bottom center; }
.char-anim svg,
.fighter svg {
  width: 72px;
  height: 88px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
  display: block;
}

.fighter.pushing .char-anim { animation: char-push 0.28s ease-in-out infinite alternate; }
.fighter-left.pushing .char-anim { animation-name: char-push-left; }
.fighter-right.pushing .char-anim { animation-name: char-push-right; }
.fighter.losing .char-anim { animation: char-fall-left 0.55s ease-in-out infinite alternate; }
.fighter-right.losing .char-anim { animation-name: char-fall-right; }

.fighter.losing .fall-arm-left { animation: arm-wave-left 0.32s ease-in-out infinite alternate; transform-origin: 14px 8px; }
.fighter.losing .fall-arm-right { animation: arm-wave-right 0.32s ease-in-out infinite alternate; transform-origin: 50px 8px; }
.fighter-right.losing .fall-arm-left { animation-name: arm-wave-right; transform-origin: 50px 8px; }
.fighter-right.losing .fall-arm-right { animation-name: arm-wave-left; transform-origin: 14px 8px; }

@keyframes char-push-left {
  0% { transform: translateX(0) scaleX(1); }
  100% { transform: translateX(3px) scaleX(1.01); }
}
@keyframes char-push-right {
  0% { transform: translateX(0); }
  100% { transform: translateX(-3px); }
}
@keyframes char-fall-left {
  0% { transform: translate(0, 0) rotate(-6deg); }
  100% { transform: translate(10px, 14px) rotate(18deg); }
}
@keyframes char-fall-right {
  0% { transform: translate(0, 0) rotate(6deg); }
  100% { transform: translate(-10px, 14px) rotate(-18deg); }
}
@keyframes arm-wave-left {
  0% { transform: rotate(-8deg); }
  100% { transform: rotate(18deg); }
}
@keyframes arm-wave-right {
  0% { transform: rotate(8deg); }
  100% { transform: rotate(-18deg); }
}

.fighter.edge-fall { z-index: 25; pointer-events: none; }
.fighter.edge-fall .char-anim { animation: none !important; }
.fighter-left.edge-fall { animation: fighter-edge-fall-left 0.55s ease-out forwards; }
.fighter-right.edge-fall { animation: fighter-edge-fall-right 0.55s ease-out forwards; }
@keyframes fighter-edge-fall-left {
  0% { transform: translate(0, 0) rotate(-6deg); }
  100% { transform: translate(-22px, 36px) rotate(-32deg); }
}
@keyframes fighter-edge-fall-right {
  0% { transform: translate(0, 0) rotate(6deg); }
  100% { transform: translate(22px, 36px) rotate(32deg); }
}

.fighter-right .char-anim svg { transform: scaleX(-1); }

.strain-line {
  position: absolute;
  font-size: 0.55rem;
  font-weight: 800;
  color: #ffcc66;
  opacity: 0;
  pointer-events: none;
  animation: strain-pop 0.4s ease-in-out infinite;
}
.fighter.pushing .strain-line { opacity: 1; }
.fighter-left .strain-line { top: -8px; right: -4px; }
.fighter-right .strain-line { top: -8px; left: -4px; }

@keyframes strain-pop {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.fighter-name {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--chrome);
  margin-top: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.fighter.word-win-callout {
  animation: word-win-glow 1.3s ease-out;
}
.fighter.word-win-callout .fighter-name {
  color: var(--warm-amber);
  text-shadow: 0 0 8px rgba(212, 167, 106, 0.85), 0 1px 4px rgba(0, 0, 0, 0.9);
}
@keyframes word-win-glow {
  0%, 100% { filter: none; }
  12%, 50% { filter: drop-shadow(0 0 10px rgba(212, 167, 106, 0.95)); }
}
.word-win-label {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--warm-amber);
  white-space: nowrap;
  pointer-events: none;
  z-index: 42;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  animation: word-win-label 1.3s ease-out forwards;
}
@keyframes word-win-label {
  0% { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.85); }
  18%, 55% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.95); }
}
.thumbs-fly-up {
  position: absolute;
  left: 50%;
  bottom: 58%;
  transform: translateX(-50%);
  font-size: 1.45rem;
  line-height: 1;
  pointer-events: none;
  z-index: 41;
  animation: thumbs-fly-up 1.3s ease-out forwards;
}
@keyframes thumbs-fly-up {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.5); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.95); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-42px) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-68px) scale(1); }
}

.wall-block {
  width: 38px;
  height: 82px;
  padding: 3px;
  background: #8a8078;
  border-radius: 2px;
  margin: 0 -8px;
  position: relative;
  z-index: 8;
  border: 2px solid #5a4030;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25), 2px 0 6px rgba(0,0,0,0.2);
  overflow: hidden;
}

.brick-wall { display: flex; flex-direction: column; gap: 2px; height: 100%; width: 100%; }
.brick-row { display: flex; gap: 2px; flex: 1; min-height: 0; }
.brick-row.offset { margin-left: -8px; padding-left: 6px; }
.brick-row span {
  flex: 1;
  min-width: 0;
  border-radius: 1px;
  background: linear-gradient(180deg, #d47858 0%, #b85a42 45%, #903828 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -1px 0 rgba(0,0,0,0.2);
}
.brick-row:nth-child(even) span { background: linear-gradient(180deg, #c86848 0%, #a04832 45%, #802818 100%); }

.wall-block.shove-left { animation: wall-shove-left 0.28s ease-in-out infinite alternate; }
.wall-block.shove-right { animation: wall-shove-right 0.28s ease-in-out infinite alternate; }
@keyframes wall-shove-left { 0% { transform: translateX(0); } 100% { transform: translateX(3px); } }
@keyframes wall-shove-right { 0% { transform: translateX(0); } 100% { transform: translateX(-3px); } }

.wall-crack {
  position: absolute;
  width: 2px;
  height: 24px;
  background: #3a2010;
  top: 28px;
  left: 50%;
  transform: translateX(-50%) rotate(12deg);
  opacity: 0.7;
  z-index: 2;
}

.spec-cliff { height: 210px; }
.spec-cliff .battle-stage { bottom: 86px; }

.game-hud {
  padding: 1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.round-badge {
  text-align: center;
  font-size: 0.65rem;
  color: var(--warm-amber);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.word-display {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0.5rem 0 1rem;
  line-height: 1.4;
  word-break: break-word;
  cursor: text;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.word-display .done { color: var(--cool-blue); }
.word-display .current { color: var(--warm-amber); text-decoration: underline; text-underline-offset: 4px; }
.word-display .todo { color: #444; }
.word-display .error { color: var(--danger); }

.type-input {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  font-size: 16px;
  text-align: center;
  border-radius: 12px;
  border: 2px solid var(--cool-blue);
  background: #f5f5f5;
  color: #111;
  margin-bottom: 1rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: text;
  -webkit-user-select: text;
  -webkit-appearance: none;
  appearance: none;
}
.type-input:focus {
  outline: 2px solid var(--warm-amber);
  outline-offset: 2px;
  border-color: var(--warm-amber);
}
.type-input.input-locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.type-input.flash-error { border-color: var(--danger); animation: flash 0.2s; }
@keyframes flash { 50% { background: rgba(232,93,93,0.15); } }

.vs-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat-card { background: #f5f5f5; border-radius: 10px; padding: 0.65rem 0.75rem; border: 1px solid #eee; }
.stat-card.you { border: 1px solid rgba(169,201,226,0.5); }
.stat-card .label { font-size: 0.65rem; color: #888; }
.stat-card .wpm { font-size: 1.1rem; font-weight: 700; color: #5a8ab0; }
.stat-bar { height: 5px; background: #ddd; border-radius: 3px; margin-top: 0.35rem; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--cool-blue), var(--warm-amber)); transition: width 0.3s; }

/* Spectator */
.spec-banner {
  background: rgba(212,167,106,0.15);
  border-bottom: 1px solid rgba(212,167,106,0.3);
  padding: 0.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--warm-amber);
}
.spec-typing { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; background: #ffffff; }
.spec-player { background: #f5f5f5; border-radius: 12px; padding: 0.85rem; border: 1px solid #eee; }
.spec-player-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.spec-player-header svg { width: 32px; height: 38px; }
.spec-player-header .wpm { margin-left: auto; font-size: 0.75rem; color: #5a8ab0; }
.spec-player-header strong { color: #111; }
.spec-typed { font-family: ui-monospace, monospace; font-size: 0.85rem; color: #888; }
.spec-typed .match { color: var(--cool-blue); }

/* Win */
.win-screen {
  background: #ffffff;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  color: #111;
}
.win-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--warm-amber), #666);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
#win-subtitle { color: #666; }
.win-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
  margin-top: 1rem;
}
.win-char-stage {
  position: relative;
  width: min(72vw, 200px);
  height: clamp(140px, 38vw, 190px);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
}
.win-char {
  position: relative;
  z-index: 2;
  transform-origin: center bottom;
  animation: win-star-jump 1.15s cubic-bezier(0.34, 1.35, 0.64, 1) infinite;
}
.win-char svg {
  width: clamp(96px, 28vw, 132px);
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(212, 167, 106, 0.22));
}
.char-celebrate-svg .celebrate-limbs {
  opacity: 1;
}
.char-celebrate-svg .celebrate-arm-l {
  transform-origin: 14px 44px;
  animation: celebrate-arm-l 1.15s ease-in-out infinite;
}
.char-celebrate-svg .celebrate-arm-r {
  transform-origin: 50px 44px;
  animation: celebrate-arm-r 1.15s ease-in-out infinite;
}
.char-celebrate-svg .celebrate-leg-l {
  transform-origin: 22px 68px;
  animation: celebrate-leg-l 1.15s ease-in-out infinite;
}
.char-celebrate-svg .celebrate-leg-r {
  transform-origin: 42px 68px;
  animation: celebrate-leg-r 1.15s ease-in-out infinite;
}
@keyframes win-star-jump {
  0%, 100% { transform: translateY(0) scale(1, 1) rotate(0deg); }
  10% { transform: translateY(5px) scale(1.06, 0.94) rotate(0deg); }
  26%, 44% { transform: translateY(-34px) scale(1.14, 0.84) rotate(-2deg); }
  58% { transform: translateY(-12px) scale(1.06, 0.94) rotate(1deg); }
  72% { transform: translateY(0) scale(1.03, 0.97) rotate(0deg); }
}
@keyframes celebrate-arm-l {
  0%, 18%, 56%, 100% { transform: rotate(18deg); }
  28%, 44% { transform: rotate(-28deg); }
}
@keyframes celebrate-arm-r {
  0%, 18%, 56%, 100% { transform: rotate(-18deg); }
  28%, 44% { transform: rotate(28deg); }
}
@keyframes celebrate-leg-l {
  0%, 18%, 56%, 100% { transform: rotate(0deg); }
  28%, 44% { transform: rotate(-14deg); }
}
@keyframes celebrate-leg-r {
  0%, 18%, 56%, 100% { transform: rotate(0deg); }
  28%, 44% { transform: rotate(14deg); }
}
.win-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.win-star {
  position: absolute;
  left: 50%;
  bottom: 28%;
  width: 14px;
  height: 14px;
  opacity: 0;
  animation: win-star-fly 2.4s ease-out infinite;
}
.win-star::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--warm-amber, #d4a76a);
  clip-path: polygon(
    50% 0%, 61% 35%, 98% 35%, 68% 57%,
    79% 91%, 50% 70%, 21% 91%, 32% 57%,
    2% 35%, 39% 35%
  );
  filter: drop-shadow(0 0 4px rgba(212, 167, 106, 0.65));
}
.win-star:nth-child(1)  { --star-x: -58px; --star-drift: -8px;  animation-delay: 0s;    width: 12px; height: 12px; }
.win-star:nth-child(2)  { --star-x: -36px; --star-drift: 4px;   animation-delay: 0.35s; width: 10px; height: 10px; }
.win-star:nth-child(3)  { --star-x: -14px; --star-drift: -5px;  animation-delay: 0.7s;  width: 16px; height: 16px; }
.win-star:nth-child(4)  { --star-x: 8px;   --star-drift: 6px;   animation-delay: 1.05s; width: 11px; height: 11px; }
.win-star:nth-child(5)  { --star-x: 30px;  --star-drift: -4px;  animation-delay: 1.4s;  width: 14px; height: 14px; }
.win-star:nth-child(6)  { --star-x: 52px;  --star-drift: 9px;   animation-delay: 1.75s; width: 10px; height: 10px; }
.win-star:nth-child(7)  { --star-x: -48px; --star-drift: 12px;  animation-delay: 0.55s; width: 9px;  height: 9px;  }
.win-star:nth-child(8)  { --star-x: -8px;  --star-drift: -10px; animation-delay: 0.9s;  width: 13px; height: 13px; }
.win-star:nth-child(9)  { --star-x: 22px;  --star-drift: 7px;   animation-delay: 1.25s; width: 12px; height: 12px; }
.win-star:nth-child(10) { --star-x: 44px;  --star-drift: -6px;  animation-delay: 1.6s;  width: 15px; height: 15px; }
@keyframes win-star-fly {
  0% {
    opacity: 0;
    transform: translate(calc(-50% + var(--star-x, 0)), 24px) scale(0.35) rotate(0deg);
  }
  12% { opacity: 1; }
  55% { opacity: 0.85; }
  100% {
    opacity: 0;
    transform: translate(
      calc(-50% + var(--star-x, 0) + var(--star-drift, 0)),
      -100px
    ) scale(1.05) rotate(160deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .win-char,
  .win-star,
  .char-celebrate-svg .celebrate-arm-l,
  .char-celebrate-svg .celebrate-arm-r,
  .char-celebrate-svg .celebrate-leg-l,
  .char-celebrate-svg .celebrate-leg-r {
    animation: none !important;
  }
  .win-char { transform: translateY(-8px); }
  .char-celebrate-svg .celebrate-arm-l { transform: rotate(-28deg); }
  .char-celebrate-svg .celebrate-arm-r { transform: rotate(28deg); }
  .char-celebrate-svg .celebrate-leg-l { transform: rotate(-14deg); }
  .char-celebrate-svg .celebrate-leg-r { transform: rotate(14deg); }
}
#fallen-char { display: none; }

.fighter.fall-off-cliff {
  z-index: 30;
  animation: fighter-plunge-off 2.5s ease-in forwards;
  pointer-events: none;
}
.fighter.fall-off-cliff .char-anim {
  animation: none !important;
}
.fighter-left.fall-off-cliff { --fall-x: 36px; }
.fighter-right.fall-off-cliff { --fall-x: -36px; }
.fighter.fall-off-cliff .fall-arm-left {
  animation: arm-wave-left 0.28s ease-in-out infinite alternate;
  transform-origin: 14px 8px;
}
.fighter.fall-off-cliff .fall-arm-right {
  animation: arm-wave-right 0.28s ease-in-out infinite alternate;
  transform-origin: 50px 8px;
}
@keyframes fighter-plunge-off {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  30% { transform: translate(calc(var(--fall-x, 24px) * 0.5), 24px) rotate(-10deg); opacity: 1; }
  65% { transform: translate(var(--fall-x, 24px), 80px) rotate(22deg); opacity: 0.75; }
  100% { transform: translate(calc(var(--fall-x, 24px) * 1.4), 220px) rotate(48deg); opacity: 0; }
}

.fallen-char {
  position: absolute;
  right: 10%;
  bottom: 25%;
  opacity: 1;
  animation: fall-off-plunge 2.4s ease-in forwards;
}
.fallen-char svg { width: 64px; height: 78px; }
.fallen-char .fall-arm-left { animation: arm-wave-left 0.28s ease-in-out infinite alternate; transform-origin: 14px 8px; }
.fallen-char .fall-arm-right { animation: arm-wave-right 0.28s ease-in-out infinite alternate; transform-origin: 50px 8px; }
@keyframes fall-off-plunge {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  35% { transform: translate(24px, 40px) rotate(-12deg); opacity: 0.95; }
  70% { transform: translate(48px, 100px) rotate(28deg); opacity: 0.6; }
  100% { transform: translate(72px, 180px) rotate(52deg); opacity: 0; }
}

.play-again-choice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 280px);
  margin-top: 1.5rem;
}
.play-again-prompt {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 380px) {
  .word-display { font-size: 1.1rem; }
  .cliff-arena { height: 220px; }
  .battle-stage { bottom: 88px; }
  .fighter svg { width: 60px; height: 74px; }
}

/* Mobile soft keyboard — keep word visible above keyboard (iOS Safari) */
@media (max-width: 768px), (pointer: coarse) {
  .game-screen.keyboard-open {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;
    height: var(--game-vv-height, 100dvh);
    max-height: var(--game-vv-height, 100dvh);
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
  }

  .game-screen.keyboard-open .cliff-arena {
    height: 150px;
    min-height: 150px;
    flex-shrink: 0;
  }

  .game-screen.keyboard-open .battle-stage {
    bottom: 58px;
  }

  .game-screen.keyboard-open .char-anim svg,
  .game-screen.keyboard-open .fighter svg {
    width: 56px;
    height: 68px;
  }

  .game-screen.keyboard-open .screen-header--game {
    margin-bottom: 0;
    padding: 0.35rem 0.5rem;
  }

  .game-screen.keyboard-open .game-hud {
    flex: 0 0 auto;
    padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }

  .game-screen.keyboard-open .round-badge {
    margin-bottom: 0.25rem;
  }

  .game-screen.keyboard-open .word-display {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.25rem;
  }

  .game-screen.keyboard-open .type-input {
    margin-bottom: 0.5rem;
  }

  .game-screen.keyboard-open .vs-stats {
    gap: 0.45rem;
  }

  .game-screen.keyboard-open .stat-card {
    padding: 0.45rem 0.55rem;
  }

  .game-screen.keyboard-open .stat-bar {
    display: none;
  }
}
