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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Avenir Next', 'Segoe UI', sans-serif;
}

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
}

#game-container {
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ========== Screens ========== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.screen.active {
  display: flex;
}

/* ========== Start Screen ========== */
.title-area {
  text-align: center;
  margin-bottom: 30px;
}

.title-emoji {
  font-size: 80px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

h1 {
  font-size: 42px;
  margin: 10px 0;
  text-shadow: 0 4px 20px rgba(255, 100, 50, 0.5);
  background: linear-gradient(135deg, #ff6b35, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #aaa;
  font-size: 16px;
  letter-spacing: 2px;
}

.start-info {
  margin-bottom: 30px;
}

.info-item {
  padding: 10px 0;
  font-size: 18px;
  color: #ddd;
  text-align: center;
}

.big-btn {
  padding: 18px 50px;
  font-size: 22px;
  font-weight: bold;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff6b35, #e63946);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
  transition: transform 0.1s;
}

.big-btn:active {
  transform: scale(0.95);
}

/* ========== Game Screen ========== */
#game-screen {
  justify-content: flex-start;
  padding: 10px;
}

/* Top Bar */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  gap: 8px;
}

.player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-name {
  font-size: 13px;
  font-weight: bold;
}

.hp-bar {
  width: 100%;
  height: 16px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.hp-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s ease;
}

.player-hp-fill {
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  width: 100%;
}

.enemy-hp-fill {
  background: linear-gradient(90deg, #ff5722, #ff9800);
  width: 100%;
}

.hp-text {
  font-size: 12px;
  color: #aaa;
  text-align: right;
}

#round-timer {
  font-size: 28px;
  font-weight: bold;
  min-width: 50px;
  text-align: center;
  color: #ffd700;
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

#score-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0;
  font-size: 14px;
  color: #aaa;
}

#score-bar strong {
  color: #ffd700;
}

/* ========== Ring ========== */
#ring {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 30%),
    linear-gradient(180deg, #2d1810 0%, #5a3825 20%, #7a4f35 50%, #5a3825 80%, #2d1810 100%);
  border: 3px solid rgba(255, 200, 100, 0.3);
  margin: 8px 0;
  min-height: 200px;
}

/* Ring ropes */
#ring::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 5%;
  right: 5%;
  bottom: 25%;
  border: 2px solid rgba(255, 50, 50, 0.3);
  border-radius: 10px;
  pointer-events: none;
}

#ring::after {
  content: '';
  position: absolute;
  top: 22%;
  left: 8%;
  right: 8%;
  bottom: 30%;
  border: 2px solid rgba(255, 50, 50, 0.2);
  border-radius: 10px;
  pointer-events: none;
}

/* ========== Fighters ========== */
.fighter {
  position: absolute;
  bottom: 15%;
  transition: transform 0.15s ease;
}

.player-side {
  left: 15%;
}

.enemy-side {
  right: 15%;
}

.fighter-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.fighter-head {
  font-size: 48px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.fighter-gloves {
  display: flex;
  gap: 8px;
  margin-top: -8px;
  position: relative;
  z-index: 1;
}

.glove {
  font-size: 28px;
  transition: transform 0.1s ease;
}

/* Punch animations */
.fighter.punching-left .left-glove {
  transform: translateX(-20px) scale(1.3);
}

.fighter.punching-right .right-glove {
  transform: translateX(20px) scale(1.3);
}

.fighter.punching-crit .glove {
  transform: scale(1.5);
  filter: drop-shadow(0 0 10px #ffd700);
}

.fighter.defending {
  transform: translateY(5px);
}

.fighter.defending .fighter-gloves {
  gap: 2px;
}

.fighter.defending .glove {
  transform: translateY(-20px) scale(1.1);
}

.fighter.hit {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.fighter.crit-hit {
  animation: critShake 0.4s ease;
}

@keyframes critShake {
  0%, 100% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-15px) scale(1.05); }
  75% { transform: translateX(15px) scale(1.05); }
}

/* ========== Effects Layer ========== */
#effects-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.effect {
  position: absolute;
  animation: effectPop 0.6s ease forwards;
  pointer-events: none;
  font-size: 30px;
  z-index: 11;
}

.effect-damage {
  color: #ff4444;
  font-weight: bold;
  font-size: 24px;
  text-shadow: 0 2px 8px rgba(255, 0, 0, 0.5);
  animation: damagePop 0.8s ease forwards;
}

.effect-crit {
  color: #ffd700;
  font-weight: bold;
  font-size: 32px;
  text-shadow: 0 2px 15px rgba(255, 215, 0, 0.8);
  animation: critPop 1s ease forwards;
}

.effect-defend {
  font-size: 28px;
  animation: defendPop 0.5s ease forwards;
}

@keyframes effectPop {
  0% { transform: scale(0) translateY(0); opacity: 1; }
  50% { transform: scale(1.2) translateY(-20px); opacity: 1; }
  100% { transform: scale(0.8) translateY(-40px); opacity: 0; }
}

@keyframes damagePop {
  0% { transform: scale(0.5) translateY(0); opacity: 1; }
  30% { transform: scale(1.5) translateY(-10px); opacity: 1; }
  100% { transform: scale(1) translateY(-50px); opacity: 0; }
}

@keyframes critPop {
  0% { transform: scale(0.3) translateY(0); opacity: 1; }
  30% { transform: scale(2) translateY(-15px); opacity: 1; }
  60% { transform: scale(1.5) translateY(-30px); opacity: 1; }
  100% { transform: scale(1) translateY(-60px); opacity: 0; }
}

@keyframes defendPop {
  0% { transform: scale(0.5); opacity: 1; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* Stars burst effect */
.star-burst {
  position: absolute;
  pointer-events: none;
  z-index: 12;
}

.star-particle {
  position: absolute;
  font-size: 18px;
  animation: starFly 0.6s ease-out forwards;
}

@keyframes starFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { opacity: 0; }
}

/* ========== Controls ========== */
#controls {
  width: 100%;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.fight-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.08s, box-shadow 0.08s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fight-btn:active {
  transform: scale(0.92);
}

.punch-btn {
  flex: 1;
  min-height: 70px;
  background: linear-gradient(135deg, #2979ff, #1565c0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(21, 101, 192, 0.4);
}

.punch-btn:active {
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.4);
}

.defend-btn {
  flex: 1;
  min-height: 70px;
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: #fff;
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

.defend-btn:active {
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.4);
}

.defend-btn.defending-active {
  background: linear-gradient(135deg, #66bb6a, #43a047);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

.crit-btn {
  width: 100%;
  min-height: 60px;
  background: linear-gradient(135deg, #ff6f00, #e65100);
  color: #fff;
  box-shadow: 0 4px 15px rgba(230, 81, 0, 0.4);
  font-size: 18px;
}

.crit-btn:active {
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.4);
}

.crit-btn.on-cooldown {
  background: linear-gradient(135deg, #555, #333);
  box-shadow: none;
  pointer-events: none;
}

.btn-icon {
  font-size: 26px;
}

.btn-label {
  font-size: 13px;
  font-weight: bold;
  margin-top: 2px;
}

/* Crit cooldown bar */
.cooldown-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.3);
}

.cooldown-fill {
  height: 100%;
  width: 100%;
  background: #ffd700;
  transition: width 0.1s linear;
}

/* ========== End Screen ========== */
#end-screen {
  gap: 15px;
}

#result-emoji {
  font-size: 80px;
}

#result-title {
  font-size: 36px;
}

#result-score {
  font-size: 24px;
  color: #ffd700;
}

#result-stats {
  text-align: center;
  color: #aaa;
  line-height: 2;
  font-size: 16px;
}

/* ========== Screen flash ========== */
.screen-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  animation: flash 0.15s ease forwards;
}

.screen-flash.hit-flash {
  background: rgba(255, 0, 0, 0.2);
}

.screen-flash.crit-flash {
  background: rgba(255, 215, 0, 0.3);
}

@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== Responsive ========== */
@media (max-height: 600px) {
  .title-emoji { font-size: 50px; }
  h1 { font-size: 28px; }
  .fighter-head { font-size: 36px; }
  .glove { font-size: 22px; }
  .fight-btn { min-height: 55px; }
  .crit-btn { min-height: 45px; }
  .btn-icon { font-size: 20px; }
  #round-timer { font-size: 22px; }
}

@media (min-height: 800px) {
  .fighter-head { font-size: 56px; }
  .glove { font-size: 32px; }
  .fight-btn { min-height: 80px; }
  .crit-btn { min-height: 70px; }
}
