* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: "Georgia", serif;
  background: #1a1a2e;
  color: #333;
  overflow: hidden;
}

/* Screen System */
.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background-size: cover;
  background-position: center;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Georgia", serif;
}

.loading-content {
  text-align: center;
  color: #f5e6d3;
}

.loading-content h1 {
  font-size: 48px;
  margin-bottom: 40px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.loading-bar {
  width: 500px;
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 3px solid #8b6f47;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, #d4a574, #c29966);
  width: 0%;
  transition: width 0.3s ease;
}

#loadingText {
  font-size: 16px;
  color: #d4a574;
}

/* Transition Overlay */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Shared Layouts */
.center-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.parchment-panel {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 8px solid #8b6f47;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
}

.parchment-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(139, 111, 71, 0.05) 2px,
    rgba(139, 111, 71, 0.05) 4px
  );
  border-radius: 4px;
  pointer-events: none;
}

.parchment-panel h2 {
  color: #8b6f47;
  font-size: 28px;
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
}

.parchment-panel h3 {
  color: #8b6f47;
  font-size: 20px;
  margin-bottom: 15px;
}

/* Title Screen */
[data-screen="title"] {
  display: flex;
  background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('assets/village_bg.webp');
  background-size: cover;
}

.title-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 15px;
  padding: 60px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.title-content h1 {
  font-size: 64px;
  color: #f5e6d3;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.title-content p {
  font-size: 24px;
  color: #f0e6d2;
  margin-bottom: 40px;
}

.name-input {
  width: 300px;
  padding: 12px 20px;
  font-size: 18px;
  border: 3px solid #8b6f47;
  border-radius: 6px;
  background: rgba(255,255,255,0.9);
  color: #333;
  margin-bottom: 20px;
  font-family: "Georgia", serif;
  text-align: center;
}

.name-input::placeholder {
  color: #aaa;
}

/* Buttons */
.btn-brown, .btn-red, .btn-blue, .btn-grey {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border: 3px solid #8b6f47;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Georgia", serif;
}

.btn-brown {
  background: linear-gradient(135deg, #d4a574 0%, #c29966 100%);
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  border-color: #8b6f47;
}

.btn-brown:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-red {
  background: linear-gradient(135deg, #d97e70 0%, #c96858 100%);
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  border-color: #8b4a42;
}

.btn-red:hover {
  transform: scale(1.05);
}

.btn-blue {
  background: linear-gradient(135deg, #5a9fd4 0%, #4285c2 100%);
  color: #fff;
  border-color: #2c5aa0;
}

.btn-blue:hover {
  transform: scale(1.05);
}

.btn-grey {
  background: linear-gradient(135deg, #999 0%, #777 100%);
  color: #fff;
  border-color: #555;
}

.btn-grey:hover {
  transform: scale(1.05);
}

.btn-large {
  padding: 16px 40px;
  font-size: 20px;
  min-width: 200px;
}

/* Pet Selection */
.pet-selection-panel {
  max-width: 900px;
  text-align: center;
}

.pet-selection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin: 30px 0;
}

.pet-card {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.pet-card:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.pet-card img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin-bottom: 15px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.pet-card h3 {
  color: #8b6f47;
  font-size: 24px;
  margin-bottom: 10px;
}

.pet-card p {
  color: #555;
  font-size: 14px;
  margin: 8px 0;
}

.pet-card button {
  margin-top: 15px;
  width: 100%;
}

/* Intro Panel */
.intro-panel {
  max-width: 700px;
  text-align: center;
}

#introText {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 30px;
  color: #333;
}

#introBtn {
  margin-bottom: 10px;
}

/* Village Layout */
.village-layout {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 20px;
}

.pet-info-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  width: 300px;
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}

.rank-info-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 280px;
}

.profile-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 16px;
}

/* My Profile overlay */
.profile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-overlay.show {
  display: flex;
}

.profile-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 8px solid #8b6f47;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  font-family: "Georgia", serif;
  color: #5a4a33;
}

.profile-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: #8b6f47;
  cursor: pointer;
  line-height: 1;
}

.profile-arch {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.prof-arch-emoji {
  font-size: 56px;
  line-height: 1;
  flex-shrink: 0;
}

.prof-arch-name {
  font-size: 26px;
  font-weight: bold;
  color: #8b6f47;
  margin-bottom: 4px;
}

.prof-arch-summary {
  font-size: 15px;
  line-height: 1.4;
  color: #6b5a42;
}

.prof-dim-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 14px;
}

.prof-dim {
  display: grid;
  grid-template-columns: 150px 1fr 34px;
  align-items: center;
  gap: 10px;
}

.prof-dim-name {
  font-size: 13px;
  font-weight: bold;
  color: #6b5a42;
}

.prof-bar {
  height: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

.prof-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4a574, #b5824a);
  border-radius: 8px;
  transition: width 0.5s ease;
}

.prof-dim-val {
  font-size: 13px;
  font-weight: bold;
  color: #8b6f47;
  text-align: right;
}

.prof-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prof-section h4 {
  font-size: 16px;
  color: #8b6f47;
  margin-bottom: 6px;
}

.prof-section p {
  font-size: 14px;
  line-height: 1.45;
  margin: 3px 0;
  color: #5a4a33;
}

.prof-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px solid rgba(139, 111, 71, 0.3);
}

.prof-stats-row span {
  background: rgba(139, 111, 71, 0.15);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: bold;
  color: #6b5a42;
}

#petInfoBox {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

#rankInfoBox {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.pet-display {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}

.pet-sprite-village {
  width: 70px;
  height: 70px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.pet-details {
  flex: 1;
  text-align: left;
}

.pet-details h3 {
  color: #8b6f47;
  margin-bottom: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pet-name-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #8b6f47;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pet-name-edit-btn:hover {
  opacity: 0.7;
}

.stat-row {
  margin-bottom: 7px;
}

.stat-bar {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 2px solid #8b6f47;
  border-radius: 6px;
  padding: 4px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: relative;
}

.stat-label {
  font-size: 10px;
  color: #8b6f47;
  font-weight: bold;
  margin-bottom: 3px;
}

.stat-bar-bg {
  width: 100%;
  height: 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid #8b6f47;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8ed5a4, #6bc584);
  width: 100%;
  transition: width 0.3s ease;
}

.stat-bar-fill-xp {
  height: 100%;
  background: linear-gradient(90deg, #5a9fd4, #4285c2);
  width: 100%;
  transition: width 0.3s ease;
}

.stat-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}

#petInfoBox img, #rankInfoBox img {
  max-width: 120px;
  margin: 10px auto;
  display: block;
}

.shops-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
}

.shop-button {
  position: absolute;
  background: linear-gradient(135deg, #d4a574 0%, #c29966 100%);
  border: 5px solid #8b6f47;
  border-radius: 10px;
  padding: 24px 34px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.shop-button:hover {
  transform: scale(1.05);
}

#weaponShopBtn {
  left: 6%;
  top: 42%;
  transform: translateY(-50%);
}

#magicShopBtn {
  left: 27%;
  top: 52%;
  transform: translateY(-50%);
}

#armoryBtn {
  right: 9%;
  top: 42%;
  transform: translateY(-50%);
}

.shop-label {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  text-align: center;
  line-height: 1.4;
}

.center-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
}

.btn-arena {
  background: linear-gradient(135deg, #d97e70 0%, #c96858 100%);
  color: #fff;
  border: 4px solid #8b4a42;
  padding: 18px 34px;
  font-size: 17px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Georgia", serif;
  min-width: 160px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn-arena:hover {
  transform: scale(1.05);
}

/* Shop Screen */
.shop-panel {
  max-width: 700px;
}

#shopQuote {
  color: #8b6f47;
}

.shop-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.shop-item {
  display: grid;
  grid-template-columns: 1fr 140px;
  align-items: center;
  background: #f9f5f0;
  border: 3px solid #8b6f47;
  border-radius: 6px;
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shop-item:hover:not(.locked):not(.owned) {
  background: #f0e8de;
  transform: translateX(5px);
}

.shop-item.locked,
.shop-item.owned {
  opacity: 0.6;
  cursor: not-allowed;
}

.shop-item-info h4 {
  color: #8b6f47;
  font-size: 16px;
  margin-bottom: 3px;
}

.shop-item-info p {
  color: #666;
  font-size: 13px;
}

.shop-item-price {
  text-align: right;
  font-weight: bold;
  color: #8b6f47;
  font-size: 16px;
}

.shop-item.owned .shop-item-price {
  color: #8ed5a4;
}

.shop-item.locked .shop-item-price {
  color: #999;
}

/* Arena Screen */
.arena-layout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  padding: 20px;
}

.rank-ladder-panel {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  height: fit-content;
  overflow-y: auto;
  max-height: 90vh;
}

#rankLadder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  background: #e8dcc8;
  border: 2px solid #8b6f47;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  text-align: center;
  color: #333;
}

.rank-item.current {
  background: linear-gradient(135deg, #d4a574 0%, #c29966 100%);
  color: #fff;
  font-weight: bold;
  border-color: #6b5a3f;
}

.rank-item.locked {
  opacity: 0.5;
  color: #999;
}

.arena-info-panel {
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.arena-info-panel h2 {
  margin-bottom: 20px;
}

#arenaInfoBox {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 30px;
  color: #333;
}

.arena-info-panel button {
  margin-bottom: 12px;
}

/* Battle Screens */
.battle-arena {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 20px;
  background: rgba(20, 15, 35, 0.32);
}

.info-box {
  position: absolute;
  background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
  border: 6px solid #8b6f47;
  border-radius: 10px;
  padding: 15px 20px;
  min-width: 220px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.info-box.player-info {
  top: 50%;
  left: 13%;
}

.info-box.enemy-info {
  top: 19%;
  right: 13%;
}

.info-sub {
  margin-top: 6px;
  font-size: 12px;
  font-weight: bold;
  color: #c96858;
  text-align: center;
}

/* Screen flash on hits */
.battle-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 30;
}

.battle-flash.flash-hit {
  animation: flashHit 0.35s ease-out;
}

.battle-flash.flash-crit {
  animation: flashCrit 0.45s ease-out;
}

.battle-flash.flash-enemy {
  animation: flashEnemy 0.35s ease-out;
}

@keyframes flashHit {
  0% { opacity: 0.55; background: radial-gradient(circle, rgba(255,200,120,0.7), transparent 70%); }
  100% { opacity: 0; }
}

@keyframes flashCrit {
  0% { opacity: 0.75; background: radial-gradient(circle, rgba(255,180,40,0.85), transparent 70%); }
  100% { opacity: 0; }
}

@keyframes flashEnemy {
  0% { opacity: 0.55; background: radial-gradient(circle, rgba(220,60,50,0.7), transparent 70%); }
  100% { opacity: 0; }
}

/* Floating damage / heal numbers */
.dmg-popup {
  position: absolute;
  font-size: 40px;
  font-weight: bold;
  font-family: "Georgia", serif;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 35;
  animation: dmgFloat 1.1s ease-out forwards;
}

.dmg-popup.dmg-crit { color: #ffca3a; font-size: 52px; }
.dmg-popup.dmg-enemy { color: #ff6b5e; }
.dmg-popup.dmg-heal { color: #8ed5a4; }

@keyframes dmgFloat {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -20px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -90px) scale(1); opacity: 0; }
}

.info-name {
  font-size: 14px;
  font-weight: bold;
  color: #8b6f47;
  text-align: center;
  margin-bottom: 8px;
}

.hp-bar-bg {
  width: 100%;
  height: 22px;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid #8b6f47;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8ed5a4, #6bc584);
  width: 100%;
  transition: width 0.3s ease;
}

.hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}

.pet-sprite {
  position: absolute;
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  image-rendering: pixelated;
}

.pet-sprite.player-pet {
  bottom: 26%;
  left: 26%;
  width: 168px;
  height: 168px;
}

.pet-sprite.player-pet.evolved-pet {
  width: 200px;
  height: 200px;
}

.pet-sprite.enemy-pet {
  top: 28%;
  right: 27%;
}

.battle-banner {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 12px 30px;
  border-radius: 6px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  max-width: 80%;
  z-index: 10;
}

.timer-bar-container {
  position: absolute;
  top: 47%;
  left: 50%;
  transform: translateX(-50%);
  width: 42%;
  max-width: 480px;
  z-index: 20;
}

.timer-bar-bg {
  width: 100%;
  height: 32px;
  background: rgba(0, 0, 0, 0.4);
  border: 3px solid #d4a574;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4a574, #c29966);
  width: 100%;
  transition: width 0.1s linear;
}

/* Lucky Charm: timer glows green while the crit window (first 4s) is live */
.timer-bar-fill.timer-crit-glow {
  background: linear-gradient(90deg, #6bdd8f, #3fbf6a);
  box-shadow: 0 0 14px 3px rgba(80, 220, 130, 0.9);
}

.timer-text {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}

.problem-area {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 25;
}

.problem-text {
  font-size: 44px;
  font-weight: bold;
  color: #f3c879;
  padding: 18px 40px;
  background: rgba(20, 15, 35, 0.45);
  border: 3px solid #f3c879;
  border-radius: 10px;
  line-height: 1.2;
  display: inline-block;
  margin: 0;
}

.battle-actions {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 240px 240px;
  justify-content: center;
  gap: 12px;
  z-index: 15;
}

.btn-action {
  padding: 15px 12px;
  font-size: 16px;
  font-weight: bold;
  border: 4px solid;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Georgia", serif;
  text-align: center;
}

.use-potion {
  background: linear-gradient(135deg, #7bc47f 0%, #5aa85f 100%);
  border-color: #3f7a44;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.use-potion:hover:not(:disabled) {
  transform: scale(1.05);
}

.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quick-strike {
  background: linear-gradient(135deg, #d4a574 0%, #c29966 100%);
  border-color: #8b6f47;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.quick-strike:hover {
  transform: scale(1.05);
}

.power-blast {
  background: linear-gradient(135deg, #d97e70 0%, #c96858 100%);
  border-color: #8b4a42;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.power-blast:hover {
  transform: scale(1.05);
}

.run-away {
  background: linear-gradient(135deg, #7f9fc0 0%, #6b8ba8 100%);
  border-color: #556b8f;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.run-away:hover {
  transform: scale(1.05);
}

.math-choices {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  max-width: 450px;
  width: 100%;
  z-index: 20;
}

.math-choice {
  padding: 28px 25px;
  font-size: 32px;
  font-weight: bold;
  background: linear-gradient(135deg, #ff9f5a 0%, #f28145 100%);
  border: 4px solid #cc7a35;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Georgia", serif;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}

.math-choice:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.math-controls {
  position: absolute;
  top: 47%;
  right: 30px;
  transform: translateY(-10%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  width: 150px;
}

.math-controls button,
.math-controls .btn-attack-label {
  padding: 14px 30px;
  font-size: 16px;
  font-weight: bold;
  border: 3px solid;
  border-radius: 6px;
  text-align: center;
  font-family: "Georgia", serif;
}

.math-controls button {
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-attack-label {
  background: linear-gradient(135deg, #d4a574 0%, #c29966 100%);
  border-color: #8b6f47;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  opacity: 0.55;
  cursor: default;
}

.btn-blue {
  background: linear-gradient(135deg, #5a9fd4 0%, #4285c2 100%);
  border-color: #2c5aa0;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn-blue:hover {
  transform: scale(1.05);
}

.btn-grey {
  background: linear-gradient(135deg, #999 0%, #777 100%);
  border-color: #555;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn-grey:hover {
  transform: scale(1.05);
}

/* Result Screen */
.result-panel {
  max-width: 600px;
  text-align: center;
}

#resultContent {
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 30px;
  color: #333;
}

#resultContent h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #8b6f47;
}

.promoted {
  color: #5a9fd4;
  font-size: 20px;
  font-weight: bold;
  margin-top: 15px;
}

/* Responsive */
@media (max-width: 1200px) {
  .village-layout {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .pet-info-panel, .rank-info-panel {
    margin: 0 auto;
    max-width: 300px;
  }

  .village-center {
    margin: 20px 0;
  }

  .arena-layout {
    grid-template-columns: 1fr;
  }

  .rank-ladder-panel {
    max-height: auto;
  }
}

@media (max-width: 800px) {
  .pet-selection-grid {
    grid-template-columns: 1fr;
  }

  .battle-pets {
    gap: 20px;
  }

  .battle-pet {
    width: 140px;
    height: 140px;
  }

  .battle-actions {
    grid-template-columns: 1fr;
  }

  .math-choices {
    grid-template-columns: 1fr;
  }
}
