/* Immersive stage + slim dark-glass chat */

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000 url("/assets/bg-modern.jpg") center/cover no-repeat fixed;
  color: #f3eef2;
  font-family: system-ui, -apple-system, "Roboto", "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

body {
  touch-action: manipulation;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  background: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Robot stage */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 48% at 50% 46%, rgba(255, 70, 170, 0.16), transparent 62%),
    radial-gradient(ellipse 30% 20% at 50% 82%, rgba(255, 80, 180, 0.08), transparent 70%);
}

.floor {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 48%;
  height: 9%;
  transform: translateX(-50%);
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(255, 90, 180, 0.28), rgba(255, 40, 140, 0.08) 42%, transparent 72%);
  filter: blur(10px);
}

.robot {
  position: relative;
  left: 0;
  top: 0;
  width: min(86vmin, 92vw, 520px);
  aspect-ratio: 1.12 / 1;
  z-index: 2;
  will-change: transform;
  transform-origin: 50% 55%;
}

/* Single smooth capsule/teardrop arms — no separate balls or bumps */
.arm {
  position: absolute;
  top: 48%;
  width: 12.5%;
  height: 46%;
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  background:
    linear-gradient(165deg, #fff5fb 0%, #ffd0e8 22%, #ff9ac8 64%, #e85aa0 100%);
  box-shadow:
    inset 0 8px 12px rgba(255, 255, 255, 0.72),
    inset 0 -10px 14px rgba(140, 20, 80, 0.16),
    0 0 18px rgba(255, 80, 180, 0.22),
    0 10px 18px rgba(0, 0, 0, 0.4);
}

.arm-l {
  left: 3.2%;
  transform-origin: 86% 10%;
  border-radius: 70% 80% 46% 50% / 26% 22% 74% 78%;
}

.arm-r {
  right: 3.2%;
  transform-origin: 14% 10%;
  border-radius: 80% 70% 50% 46% / 22% 26% 78% 74%;
}

/* Soft gloss highlight only — not a separate sphere */
.arm::after {
  content: "";
  position: absolute;
  top: 10%;
  width: 46%;
  height: 28%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
  filter: blur(1.4px);
  pointer-events: none;
}

.arm-l::after { left: 22%; }
.arm-r::after { right: 22%; left: auto; }

.arm.is-pulse {
  box-shadow:
    inset 0 8px 12px rgba(255, 255, 255, 0.72),
    0 0 26px rgba(255, 140, 220, 0.7),
    0 0 44px rgba(255, 80, 180, 0.4);
}

/* Smooth glossy dome head — no crest/button */
.head {
  position: absolute;
  left: 20%;
  right: 20%;
  top: 2%;
  height: 76%;
  z-index: 4;
  transform-origin: 50% 60%;
  will-change: transform;
}

.shell {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 48% 48% 44% 44% / 54% 54% 44% 44%;
  background:
    linear-gradient(155deg, #fff7fb 0%, #ffd4e8 22%, #ff9ecb 58%, #e24b96 100%);
  box-shadow:
    inset 0 14px 22px rgba(255, 255, 255, 0.72),
    inset 0 -18px 28px rgba(120, 10, 70, 0.22),
    0 0 40px rgba(255, 70, 170, 0.28),
    0 18px 40px rgba(0, 0, 0, 0.55);
}

.shell-shine {
  position: absolute;
  left: 12%;
  top: 6%;
  width: 42%;
  height: 24%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent);
  filter: blur(2px);
  pointer-events: none;
  z-index: 3;
}

.shell-rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 200, 230, 0.28),
    inset 0 -8px 18px rgba(180, 20, 90, 0.12);
  z-index: 3;
}

.visor {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 16%;
  bottom: 14%;
  border-radius: 50% 50% 42% 42% / 58% 58% 40% 40%;
  background: #000000;
  overflow: hidden;
  z-index: 2;
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 1),
    inset 0 3px 10px rgba(255, 180, 220, 0.08),
    0 0 0 3px rgba(40, 8, 24, 0.55),
    0 0 28px rgba(255, 60, 180, 0.35),
    0 0 56px rgba(255, 40, 160, 0.18);
}

.visor canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Bottom chat — always on top, never fades behind the robot */
.chat {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 10px;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
  background: linear-gradient(to top, #050308 0%, rgba(5, 3, 8, 0.96) 72%, rgba(5, 3, 8, 0.88) 100%);
}

.chat-log {
  z-index: 20;
  max-height: min(24vh, 200px);
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 180, 220, 0.35) transparent;
  background: rgba(10, 6, 12, 0.82);
  border: 1px solid rgba(255, 150, 210, 0.22);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.msg {
  max-width: 86%;
  flex-shrink: 0;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-weight: 450;
}

.msg-bot {
  align-self: flex-start;
  color: #fff8fb;
  background: rgba(18, 10, 16, 0.92);
  border: 1px solid rgba(255, 150, 210, 0.45);
  border-bottom-left-radius: 6px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.msg-user {
  align-self: flex-end;
  color: #fff5fa;
  background: rgba(255, 90, 160, 0.32);
  border: 1px solid rgba(255, 170, 210, 0.4);
  border-bottom-right-radius: 6px;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 6px;
  border-radius: 999px;
  background: rgba(18, 12, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.chat-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: none;
  background: transparent;
  color: #f6eef3;
  font: inherit;
  font-size: 0.95rem;
}

.chat-input::placeholder { color: rgba(243, 230, 236, 0.42); }

.icon-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: #f0d6e4;
  cursor: pointer;
}

.icon-btn.send {
  background: linear-gradient(180deg, #ffb0d4, #ff5aa3);
  color: #2a1020;
}

.icon-btn.is-on {
  color: #ff8ec8;
  box-shadow: 0 0 0 2px rgba(255, 120, 190, 0.35);
}

@media (orientation: landscape) {
  .robot { width: min(70vmin, 58vw, 480px); }
  .chat-log { max-height: min(28vh, 160px); }
  .floor { bottom: 3%; }
}

@media (max-height: 640px) {
  .chat-log { max-height: min(22vh, 150px); }
}

@media (prefers-reduced-motion: reduce) {
  .robot, .head, .arm { will-change: auto; }
}


/* Top-left 3-line menu */
.menu-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 12px));
  left: 12px;
  z-index: 40;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(12, 8, 12, 0.55);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.menu-btn span {
  display: block;
  width: 16px;
  height: 1.6px;
  border-radius: 2px;
  background: #f0d6e4;
}
.menu-pop {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top, 12px)) + 42px);
  left: 12px;
  z-index: 41;
  min-width: 132px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(12, 8, 14, 0.92);
  border: 1px solid rgba(255, 160, 210, 0.22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #fff4f8;
  font: inherit;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus { background: rgba(255, 90, 160, 0.18); }
.menu-item.sub { padding-left: 18px; color: #ffd0e6; font-size: 0.78rem; }
.menu-sub { padding-top: 2px; }

/* Game mode: robot stays visible on top, board below */
.app.is-game .stage {
  flex: 0 0 30%;
  max-height: 32%;
  min-height: 28%;
}
.app.is-game .chat { display: none !important; }
.app.is-game .robot {
  width: min(52vmin, 68vw, 240px);
}
.app.is-game .floor { height: 7%; bottom: 1%; opacity: 0.45; }

.game-panel {
  position: relative;
  z-index: 16;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 2px 10px 12px;
  background: linear-gradient(to top, rgba(5, 3, 8, 0.72), rgba(5, 3, 8, 0.45));
}
.game-panel[hidden] { display: none !important; }

.game-speech {
  position: relative;
  z-index: 35;
  width: min(94vw, 400px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  min-height: 0;
  flex-shrink: 0;
  margin-top: 0;
}
.game-speech[hidden] { display: none !important; }
.game-speech-bubble {
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(18, 10, 16, 0.95);
  border: 1px solid rgba(255, 150, 210, 0.5);
  color: #fff8fb;
  font-size: 0.84rem;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 80, 180, 0.16);
  text-align: center;
}
.game-speech.is-pop .game-speech-bubble {
  animation: speechPop 0.32s ease;
}
@keyframes speechPop {
  0% { opacity: 0; transform: translateY(8px) scale(0.92); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.game-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(94vw, 400px);
  flex-shrink: 0;
  z-index: 20;
}
.game-status {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: #ffe8f3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-btn {
  flex-shrink: 0;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 160, 210, 0.3);
  background: rgba(20, 12, 16, 0.85);
  color: #ffe8f3;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.game-btn:active { background: rgba(255, 90, 160, 0.25); }

.game-mount {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}
.game-mount[hidden] { display: none !important; }

/* ---- 3D wooden Shashka board ---- */
.board-stage {
  width: min(94vw, 400px);
  max-height: 100%;
  perspective: 850px;
  perspective-origin: 50% 82%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board-frame {
  width: 100%;
  transform: rotateX(18deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 236, 200, 0.14) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(0deg, rgba(80, 40, 10, 0.12) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #d2a36a 0%, #b07a40 48%, #8a5528 100%);
  border-radius: 8px;
  padding: 10px 8px 8px 8px;
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 230, 180, 0.45),
    inset 0 -4px 8px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-columns: 16px 1fr;
  grid-template-rows: 1fr 14px;
  gap: 2px 3px;
}
.board-cord {
  display: grid;
  pointer-events: none;
  color: #f3e0c0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.board-cord-ranks {
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
}
.board-cord-files {
  grid-template-columns: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
}
.board-cord-spacer { width: 16px; }
.board-grid-wrap {
  min-width: 0;
  min-height: 0;
}
.board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(60, 30, 10, 0.45), 0 2px 0 rgba(255, 230, 180, 0.2);
  touch-action: manipulation;
  background: #3a2414;
}
.sq {
  position: relative;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.sq-light {
  background:
    repeating-linear-gradient(82deg, rgba(255, 255, 255, 0.10) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(98deg, rgba(140, 90, 30, 0.07) 0 2px, transparent 2px 15px),
    linear-gradient(180deg, #f2d39c, #e8c282);
}
.sq-dark {
  background:
    repeating-linear-gradient(82deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(98deg, rgba(255, 200, 120, 0.06) 0 2px, transparent 2px 16px),
    linear-gradient(180deg, #5e3820, #4a2a16);
}
.sq.is-sel {
  background: linear-gradient(180deg, #3d9b2f, #2f7d24) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.sq.is-hint::after,
.sq.is-hit::after {
  content: "";
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e02424;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}

.piece {
  position: relative;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
}
.piece-p {
  background:
    radial-gradient(circle at 32% 26%, #ffffff 0 12%, transparent 22%),
    radial-gradient(circle at 50% 54%, #f7f7f7 0 46%, #e4e4e4 72%, #d8d8d8 100%);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.85),
    inset 0 -3px 5px rgba(0, 0, 0, 0.22),
    0 3px 7px rgba(0, 0, 0, 0.45);
}
.piece-r {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.38) 0 9%, transparent 20%),
    radial-gradient(circle at 50% 54%, #2d2d30 0 46%, #1a1a1d 72%, #111114 100%);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.18),
    inset 0 -3px 5px rgba(0, 0, 0, 0.55),
    0 3px 7px rgba(0, 0, 0, 0.55);
}
.piece-p::before,
.piece-r::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.16);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.18),
    0 0 0 3px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}
.piece-r::before {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(0, 0, 0, 0.25);
}
.piece.is-king::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72em;
  color: #f4d06a;
  text-shadow: 0 0 6px rgba(255, 200, 60, 0.9), 0 1px 1px rgba(0, 0, 0, 0.6);
}
.piece.is-eaten {
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s, transform 0.2s;
}

.fly-piece {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 37;
  pointer-events: none;
  margin: 0;
  will-change: transform;
}
.fly-piece.is-held {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
.arm.is-reaching { visibility: hidden !important; }
.reach-arm {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 36 !important;
  pointer-events: none !important;
  margin: 0 !important;
  max-width: none !important;
  max-height: none !important;
  will-change: transform;
  transform-origin: 50% 8%;
}
.reach-arm.is-pulse {
  filter: drop-shadow(0 0 10px rgba(255, 140, 220, 0.55));
}

/* ---- X-O ---- */
.xo-wrap {
  width: min(86vw, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.xo-score { color: #ffd6ea; font-size: 0.8rem; }
.xo-grid {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, #1a0e16, #0c070b);
  border: 1px solid rgba(255, 120, 200, 0.35);
  box-shadow: 0 0 24px rgba(255, 70, 160, 0.18), inset 0 0 18px rgba(255, 80, 180, 0.08);
}
.xo-cell {
  border: 0;
  border-radius: 12px;
  background: rgba(30, 16, 24, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 120, 200, 0.25);
  color: #fff;
  font-size: clamp(2rem, 12vw, 3.2rem);
  font-weight: 800;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.xo-cell.mark-x { color: #d9fbff; text-shadow: 0 0 10px #7ef0ff, 0 0 22px #3ad4ff; }
.xo-cell.mark-o { color: #ffb3d9; text-shadow: 0 0 10px #ff5ab0, 0 0 22px #ff2f90; }
.xo-cell.is-win { background: rgba(255, 90, 160, 0.22); }
.xo-cell:disabled { cursor: default; }

/* ---- RPS ---- */
.rps-wrap {
  width: min(92vw, 360px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rps-score { color: #ffd6ea; font-size: 0.8rem; }
.rps-stage {
  width: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}
.rps-side {
  flex: 1;
  text-align: center;
  color: #ffe8f3;
}
.rps-emoji {
  font-size: 3.1rem;
  line-height: 1.1;
  filter: drop-shadow(0 0 10px rgba(255, 100, 180, 0.35));
}
.rps-side.is-shake .rps-emoji { animation: rpsShake 0.16s linear infinite; }
@keyframes rpsShake {
  0%, 100% { transform: rotate(-14deg) translateY(0); }
  50% { transform: rotate(14deg) translateY(-6px); }
}
.rps-label { font-size: 0.75rem; opacity: 0.8; margin-top: 4px; }
.rps-vs { color: #ff9ec8; font-weight: 700; }
.rps-count {
  color: #fff4f8;
  font-size: 1.05rem;
  min-height: 1.4em;
  text-align: center;
}
.rps-btns {
  display: flex;
  gap: 8px;
  width: 100%;
}
.rps-btn {
  flex: 1;
  border: 1px solid rgba(255, 160, 210, 0.35);
  background: rgba(24, 12, 18, 0.92);
  color: #fff8fb;
  border-radius: 14px;
  padding: 10px 4px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  touch-action: manipulation;
}
.rps-btn:active { background: rgba(255, 90, 160, 0.25); }
.rps-btn:disabled { opacity: 0.55; }

/* ---- Tennis ---- */
.tennis-canvas {
  width: min(92vw, 360px);
  height: min(52vh, 420px);
  max-height: 100%;
  background: #0b1a12;
  border-radius: 14px;
  border: 1px solid rgba(180, 255, 200, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(80, 255, 160, 0.1);
  touch-action: none;
  display: block;
}

@media (orientation: landscape) {
  .app.is-game { flex-direction: row; }
  .app.is-game .stage {
    flex: 0 0 36%;
    max-height: none;
    min-height: 100%;
  }
  .app.is-game .robot { width: min(54vmin, 28vw, 240px); }
  .board-stage { width: min(58vh, 54vw, 400px); }
  .tennis-canvas { width: min(58vh, 54vw, 400px); height: min(78vh, 520px); }
}

@media (max-height: 640px) {
  .app.is-game .stage { flex-basis: 26%; max-height: 28%; }
}

/* ===== Custom game art (RPS images + Shashka piece images) ===== */
.rps-emoji { min-height: 92px; display: grid; place-items: center; }
.rps-img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(255, 100, 180, 0.45)); user-select: none; -webkit-user-drag: none; }
.rps-q { font-size: 2.6rem; opacity: 0.7; }
.rps-emoji.is-reveal .rps-img { animation: rpsPop 0.7s cubic-bezier(.2,1.6,.4,1); }
@keyframes rpsPop { 0% { transform: scale(0.3) rotate(-20deg); } 60% { transform: scale(1.18) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
.rps-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rps-btn-img { width: 54px; height: 54px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 120, 190, 0.35)); }

.piece-p, .piece-r { box-shadow: none !important; background-color: transparent; }
.piece-p { background: url(../assets/checker-white.png) center / contain no-repeat; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45)); }
.piece-r { background: url(../assets/checker-black.png) center / contain no-repeat; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55)); }
.piece-p::before, .piece-r::before { display: none; }
.piece.is-king::after {
  content: "👑";
  inset: auto;
  top: -18%;
  left: 50%;
  width: 62%;
  height: 52%;
  transform: translateX(-50%);
  border-radius: 40%;
  font-size: 0.62em;
  line-height: 1;
  background: radial-gradient(circle at 50% 40%, #ffe48a, #e0a722 70%, #a86d0a);
  box-shadow: 0 0 8px rgba(255, 200, 60, 0.9), 0 1px 2px rgba(0, 0, 0, 0.6);
  border: 1px solid #fff2b0;
  text-shadow: none;
}
