











#arenaScene {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 400;
  pointer-events: auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(80, 62, 34, 0.55) 0%, rgba(14, 11, 8, 0.96) 62%, #070604 100%),
    linear-gradient(180deg, #191410, #080605);
}


#arenaScene::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 226, 170, 0.05) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 46px);
}


#arenaScene::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 88%, rgba(255, 150, 40, 0.20) 0%, transparent 34%),
    radial-gradient(circle at 92% 88%, rgba(255, 150, 40, 0.20) 0%, transparent 34%);
  animation: arenaTorchPulse 3.2s ease-in-out infinite;
}
@keyframes arenaTorchPulse {
  0%, 100% { opacity: 0.72; }
  50%      { opacity: 1; }
}





.arena-frame {
  position: relative;
  width: 96%;
  max-width: 420px;
  max-height: 96%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}


.arena-topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 32px 6px 8px;
  border: 2px solid #8b6914;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(74, 55, 40, 0.94), rgba(26, 20, 14, 0.96));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 226, 170, 0.12);
}
.arena-boss-avatar {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  border-radius: 50%;
  border: 2px solid #c9a227;
  background: radial-gradient(circle at 34% 28%, #6d5a3c, #2b2114);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.65), 0 0 14px rgba(201, 162, 39, 0.45);
  animation: bossNod 4.2s ease-in-out infinite;
}
@keyframes bossNod {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50%      { transform: rotate(2deg) scale(1.04); }
}
.arena-boss-meta { min-width: 0; flex: 1; }
.arena-boss-name {
  font-size: 11px; letter-spacing: 2px; color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.9);
}
.arena-boss-line {
  margin-top: 2px;
  font-size: 11.5px; line-height: 1.5; color: #e8dcc0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  min-height: 2.4em;
}
.arena-boss-line .caret {
  display: inline-block; width: 6px;
  color: #ffd700; animation: arenaCaret 0.7s steps(1) infinite;
}
@keyframes arenaCaret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.arena-close {
  position: absolute; right: 7px; top: 7px;
  width: 24px; height: 24px; line-height: 22px; text-align: center;
  font-size: 13px; color: #d9c9a0;
  border: 1px solid #6b5a3a; border-radius: 50%;
  background: rgba(30, 24, 16, 0.9);
  cursor: pointer; user-select: none;
  transition: all 0.16s;
}
.arena-close:hover { color: #fff; border-color: #ffd700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.55); }


.arena-stage {
  position: relative;
  width: 100%;
  border: 2px solid #8b6914;
  border-radius: 13px;
  overflow: hidden;
  background: #0a0806;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.7), inset 0 0 26px rgba(0, 0, 0, 0.65);
}
#arenaCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.arena-side-tag {
  position: absolute; top: 7px;
  padding: 2px 9px;
  font-size: 10.5px; letter-spacing: 2px;
  border-radius: 9px;
  border: 1px solid;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.arena-side-tag.left {
  left: 8px; color: #9fd0ff;
  border-color: rgba(90, 150, 230, 0.7);
  background: rgba(20, 44, 82, 0.72);
}
.arena-side-tag.right {
  right: 8px; color: #ffb0b0;
  border-color: rgba(230, 90, 90, 0.7);
  background: rgba(82, 20, 20, 0.72);
}

.arena-vs {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px; font-weight: 900; font-style: italic;
  letter-spacing: 2px;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 180, 40, 0.9), 0 3px 6px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  animation: arenaVsPulse 2.4s ease-in-out infinite;
}
@keyframes arenaVsPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.86; }
  50%      { transform: translate(-50%, -50%) scale(1.09); opacity: 1; }
}


.arena-bet {
  padding: 6px 8px 7px;
  border: 2px solid #8b6914;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(74, 55, 40, 0.92), rgba(26, 20, 14, 0.96));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 226, 170, 0.1);
}
.arena-bet-title {
  text-align: center;
  font-size: 11.5px; letter-spacing: 1.5px; color: #ffd700;
  margin-bottom: 4px;
  text-shadow: 0 0 9px rgba(255, 215, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.9);
}
.arena-bet-row { display: flex; gap: 6px; }
.arena-bet-btn {
  flex: 1;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.18s, filter 0.18s;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  border: 2px solid;
}
.arena-bet-left {
  color: #cfe6ff; border-color: #4a7fc1;
  background: linear-gradient(160deg, #1d3a63, #101f36);
}
.arena-bet-left:hover { box-shadow: 0 0 16px rgba(90, 150, 230, 0.6); transform: translateY(-2px); }
.arena-bet-right {
  color: #ffd8d8; border-color: #b85050;
  background: linear-gradient(160deg, #63201d, #361010);
}
.arena-bet-right:hover { box-shadow: 0 0 16px rgba(230, 90, 90, 0.6); transform: translateY(-2px); }

.arena-bet-draw {
  color: #ffe9a8; border-color: #8a6d2f;
  background: linear-gradient(160deg, #4a3a15, #241a08);
}
.arena-bet-draw:hover { box-shadow: 0 0 16px rgba(255, 215, 0, 0.5); transform: translateY(-2px); }
.arena-bet-btn:active { transform: scale(0.96); }
.arena-bet-btn:disabled { cursor: default; filter: grayscale(0.65) brightness(0.62); transform: none; box-shadow: none; }

.arena-bet-btn.arena-picked {
  border-color: #ffd700;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.65), inset 0 0 12px rgba(255, 215, 0, 0.14);
  animation: arenaPickedPulse 1.9s ease-in-out infinite;
}
@keyframes arenaPickedPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.10); }
  50%      { box-shadow: 0 0 24px rgba(255, 230, 150, 0.95), inset 0 0 16px rgba(255, 215, 0, 0.20); }
}

.arena-hint {
  margin-top: 4px;
  text-align: center;
  font-size: 10.5px; line-height: 1.5; color: #b9ac8e;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  min-height: 0;   
}
.arena-again {
  display: none;
  width: 100%;
  margin-top: 5px;
  padding: 6px;
  font-family: inherit;
  font-size: 12px; letter-spacing: 2px;
  color: #ffe9a8;
  border: 2px solid #c9a227; border-radius: 10px;
  background: linear-gradient(135deg, #5a4620, #2a2011);
  cursor: pointer;
  transition: all 0.16s;
}
.arena-again:hover { border-color: #ffd700; box-shadow: 0 0 16px rgba(255, 215, 0, 0.55); color: #fff; }


.arena-coins {
  flex: 0 0 auto;
  margin-right: 24px;
  padding: 3px 9px;
  font-size: 11.5px; letter-spacing: 1px; white-space: nowrap;
  color: #ffe9a8;
  border: 1px solid #c9a227; border-radius: 11px;
  background: linear-gradient(160deg, rgba(90, 70, 32, 0.9), rgba(38, 28, 14, 0.94));
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.35), inset 0 1px 0 rgba(255, 230, 170, 0.18);
}
.arena-coin-num { color: #ffd700; font-weight: bold; }


.arena-coin-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-right: 3px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 1px solid rgba(120, 84, 10, 0.95);
  background: radial-gradient(circle at 32% 26%, #fff6c0 0%, #ffd94a 42%, #c8911a 78%, #8a6410 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), inset 0 0 2px rgba(255, 255, 255, 0.85);
  font-style: normal; font-weight: 700; font-size: 9px; line-height: 1;
  color: #6b4a00; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.arena-coin-ico::before { content: '兽'; }


.arena-hud {
  position: absolute; left: 50%; bottom: 6px;
  transform: translateX(-50%);
  padding: 2px 10px;
  font-size: 10.5px; letter-spacing: 1px; white-space: nowrap;
  color: #e8dcc0;
  border: 1px solid rgba(201, 162, 39, 0.42); border-radius: 9px;
  background: rgba(10, 8, 6, 0.62);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}


.arena-result {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%) scale(0.92);
  display: none; text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
}
.arena-result-show { display: block; opacity: 1; transform: translateY(-50%) scale(1); }
.arena-result-title {
  font-size: 27px; font-weight: 900; letter-spacing: 4px; color: #ffd700;
  text-shadow: 0 0 18px rgba(255, 180, 40, 0.95), 0 3px 8px rgba(0, 0, 0, 0.95);
}
.arena-result-win .arena-result-title {
  color: #8dffb0;
  text-shadow: 0 0 20px rgba(120, 255, 160, 0.95), 0 3px 8px rgba(0, 0, 0, 0.95);
}
.arena-result-sub {
  margin-top: 5px; font-size: 12.5px; letter-spacing: 1px; color: #fff3d0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}


.arena-stake-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.arena-stake-label { font-size: 11px; letter-spacing: 2px; color: #c9b896; }
.arena-stake-btn {
  flex: 0 0 auto;
  padding: 5px 11px;
  font-family: inherit; font-size: 11.5px; font-weight: bold; letter-spacing: 1px;
  color: #ffe9a8;
  border: 2px solid #c9a227; border-radius: 9px;
  background: linear-gradient(160deg, #5a4620, #2a2011);
  cursor: pointer; transition: all 0.16s;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
.arena-stake-btn:hover {
  border-color: #ffd700; color: #fff;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.55); transform: translateY(-2px);
}
.arena-stake-btn:active { transform: scale(0.96); }
.arena-stake-btn:disabled { cursor: default; filter: grayscale(0.6) brightness(0.6); transform: none; box-shadow: none; }
.arena-stake-note { margin-left: auto; font-size: 10px; color: #8c8069; }


.arena-act-row { display: flex; gap: 6px; margin-top: 5px; }
.arena-act-row .arena-again { margin-top: 0; }
.arena-shop-open {
  display: block;
  border-color: #8a6fbf; color: #d8c8ff;
  background: linear-gradient(135deg, #3a2d55, #20182f);
}
.arena-shop-open:hover { border-color: #b9a4ff; color: #fff; box-shadow: 0 0 16px rgba(150, 120, 240, 0.6); }


.arena-shop {
  position: absolute; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(6, 5, 4, 0.82);
}
.arena-shop-box {
  width: 88%; max-width: 340px; padding: 14px;
  border: 2px solid #8b6914; border-radius: 15px;
  background: linear-gradient(150deg, #2b2418, #16120c);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 226, 170, 0.12);
}
.arena-shop-title {
  text-align: center; font-size: 15px; letter-spacing: 5px; color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}
.arena-shop-sub { margin: 6px 0 11px; text-align: center; font-size: 10.5px; line-height: 1.6; color: #9c9078; }



.arena-shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.arena-shop-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  box-sizing: border-box; height: 92px; padding: 6px;
  border: 2px solid #6b5a3a; border-radius: 11px;
  background: linear-gradient(160deg, rgba(74, 55, 40, 0.9), rgba(26, 20, 14, 0.94));
  cursor: pointer; transition: all 0.16s;
}
.arena-shop-slot:hover { border-color: #ffd700; box-shadow: 0 0 16px rgba(255, 215, 0, 0.45); transform: translateY(-2px); }
.arena-shop-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}
.arena-shop-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.arena-shop-name { font-size: 11.5px; letter-spacing: 1px; color: #e8dcc0; white-space: nowrap; }
.arena-shop-price { font-size: 11px; color: #ffd700; display: inline-flex; align-items: center; }
.arena-shop-owned { cursor: default; filter: grayscale(0.5) brightness(0.75); }
.arena-shop-owned:hover { border-color: #6b5a3a; box-shadow: none; transform: none; }
.arena-shop-owned .arena-shop-price { color: #7ee787; }
.arena-shop-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid #3a3020;
}
.arena-shop-wallet { font-size: 11.5px; color: #ffe9a8; }
.arena-shop-close {
  padding: 7px 13px; font-family: inherit; font-size: 11.5px;
  color: #e8dcc0; border: 1px solid #6b5a3a; border-radius: 8px;
  background: rgba(40, 32, 20, 0.9); cursor: pointer; transition: all 0.16s;
}
.arena-shop-close:hover { border-color: #ffd700; color: #fff; }


.arena-toast {
  position: absolute; left: 50%; bottom: 78px;
  transform: translateX(-50%);
  z-index: 60; max-width: 84%;
  padding: 8px 14px;
  font-size: 12px; line-height: 1.5; text-align: center; color: #fff3d0;
  border: 1px solid #c9a227; border-radius: 10px;
  background: rgba(24, 18, 10, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}








.arena-battle {
  position: absolute; inset: 0; z-index: 45;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  
  gap: 6px; padding: 6px;
  background: radial-gradient(ellipse at 50% 38%, rgba(70, 54, 30, 0.55) 0%, rgba(10, 8, 6, 0.97) 64%, #060504 100%);
}

#arenaScene.arena-in-battle .arena-frame { display: none; }



.arena-battle-bar {
  width: min(96vw, 700px);
  display: none; align-items: center; justify-content: space-between; gap: 8px;
}

.arena-battle-bar .arena-side-tag { position: static; }
.arena-battle-hud {
  flex: 1; text-align: center;
  padding: 3px 12px;
  font-size: 12px; letter-spacing: 1.5px; white-space: nowrap;
  color: #ffe9a8;
  border: 1px solid rgba(201, 162, 39, 0.5); border-radius: 10px;
  background: rgba(10, 8, 6, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.arena-battle-bar .arena-coins { margin-right: 0; }

.arena-battle-stage {
  position: relative;
  
  width: min(98vw, 820px);
  border: 2px solid #8b6914; border-radius: 16px;
  overflow: hidden;
  background: #0a0806;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.6);
}
#arenaBattleCv { display: block; width: 100%; height: auto; }
.arena-battle-stage .arena-result { z-index: 3; }
.arena-battle-stage .arena-result-title { font-size: 34px; }

.arena-battle-foot {
  width: min(98vw, 820px);
  display: flex; align-items: center; gap: 10px;
}
.arena-battle-bet {
  flex: 1; min-width: 0;
  font-size: 11.5px; line-height: 1.6; color: #c9b896;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.arena-battle-bet b { color: #ffd700; }
.arena-battle-foot .arena-again {
  display: none;
  width: auto; min-width: 138px; margin-top: 0; padding: 9px 16px;
  flex: 0 0 auto;
}


@media (orientation: landscape) and (max-height: 520px) {
  .arena-battle { justify-content: flex-start; overflow-y: auto; }
}


@media (orientation: landscape) and (max-height: 520px) {
  #arenaScene { justify-content: flex-start; overflow-y: auto; }
  .arena-frame { max-width: 320px; padding: 6px 0; }
}
