/* ===== boss-fight.css — мини-игра боя с боссом (Minecraft RPG) =====
 * Победа → переход к следующей локации + редкая награда.
 * Поражение → колесо фортуны: шанс на «⚡ СУПЕРУДАР» (ученику всегда везёт).
 */

#screen-boss {
  display: none;
  padding: 76px 12px 40px;
  background-image:
    linear-gradient(180deg, rgba(20,10,10,.92) 0%, rgba(26,29,41,.95) 100%),
    url('../img/minecraft/loc5-stronghold.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}
#screen-boss.active { display: block; }

.boss-fight-wrap {
  max-width: 700px;
  margin: 0 auto;
}

.boss-fight-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.boss-fight-title {
  font-size: 24px; font-weight: 900; color: var(--rb-red);
  text-shadow: 2px 2px 0 #000;
  animation: pulse 1s infinite;
}

.boss-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  background: rgba(0,0,0,.4);
  border: 3px solid var(--rb-dark-3);
  border-radius: var(--rb-radius-l);
  padding: 20px;
}

.boss-side, .player-side {
  text-align: center;
}

.boss-img-wrap, .player-img-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
}
.boss-img {
  width: 140px; height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(226,35,26,.4));
  transition: transform .2s;
}
.boss-img-active {
  animation: bossShake .5s infinite;
}
@keyframes bossShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.boss-emoji {
  position: absolute;
  top: -8px; right: -8px;
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.8));
}
.player-img {
  width: 120px; height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,166,81,.4));
  transition: transform .2s;
}
.player-img-active {
  animation: playerBob 1s infinite;
}
@keyframes playerBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.boss-name, .player-name {
  font-size: 18px; font-weight: 800; margin-bottom: 6px;
}
.boss-name { color: var(--rb-red); }
.player-name { color: var(--rb-green); }

.boss-hp-bar, .player-hp-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--rb-dark);
  border: 2px solid var(--rb-dark-3);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 6px;
}
.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rb-red), #FF6B6B);
  transition: width .4s;
}
.player-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rb-green), #7EE3A8);
  transition: width .4s;
}
.boss-hp-text, .player-hp-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

.boss-hearts, .player-hearts {
  font-size: 14px;
  letter-spacing: 1px;
  min-height: 20px;
}
.boss-heart.empty, .player-heart.empty {
  opacity: .3;
}

.player-gear {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  margin-top: 8px;
}
.gear-chip {
  background: var(--rb-dark-3);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.vs-divider {
  font-size: 32px;
  animation: pulse 1s infinite;
  color: var(--rb-yellow);
}

.boss-log {
  background: rgba(0,0,0,.5);
  border: 2px solid var(--rb-dark-3);
  border-radius: var(--rb-radius);
  padding: 10px 14px;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 16px;
  font-size: 13px;
}
.log-entry {
  padding: 2px 0;
  line-height: 1.4;
}
.log-entry.player { color: #7EE3A8; }
.log-entry.boss { color: #FF9B96; }
.log-entry.dodge { color: var(--rb-cyan); }
.log-entry.win { color: var(--rb-yellow); font-weight: 800; }
.log-entry.lose { color: var(--rb-red); font-weight: 800; }

.boss-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.boss-turn-wait {
  font-size: 18px;
  color: var(--rb-yellow);
  font-weight: 800;
  animation: pulse 1s infinite;
  padding: 16px;
}

.boss-result {
  text-align: center;
  padding: 20px;
}
.boss-win {
  font-size: 36px;
  font-weight: 900;
  color: var(--rb-green);
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 16px;
  animation: bounceIn .5s;
}
.boss-lose {
  font-size: 36px;
  font-weight: 900;
  color: var(--rb-red);
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 16px;
  animation: shake .5s;
}

/* ===== Инвентарь (на карте) ===== */
.inventory-panel {
  background: linear-gradient(180deg, var(--rb-dark-3), var(--rb-dark-2));
  border: 3px solid var(--rb-dark-3);
  border-radius: var(--rb-radius-l);
  padding: 14px;
  margin-bottom: 16px;
}
.inventory-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--rb-yellow);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 8px;
}
.inv-slot {
  background: var(--rb-dark);
  border: 2px solid var(--rb-dark-3);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  position: relative;
}
.inv-slot.has {
  border-color: var(--rb-yellow);
  box-shadow: 0 0 6px rgba(255,215,0,.2);
}
.inv-slot-icon {
  font-size: 24px;
  display: block;
  line-height: 1;
}
.inv-slot-count {
  font-weight: 800;
  color: var(--rb-yellow);
  font-size: 13px;
}
.inv-slot-label {
  color: var(--rb-gray-l);
  font-size: 9px;
  margin-top: 2px;
}

.gear-panel {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.gear-slot {
  background: var(--rb-dark);
  border: 2px solid var(--rb-dark-3);
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
  font-size: 13px;
}
.gear-slot-label {
  color: var(--rb-gray-l);
  font-size: 10px;
  margin-bottom: 2px;
}
.gear-slot-value {
  font-weight: 800;
  color: var(--rb-yellow);
}

/* Кнопка крафта */
.craft-btn {
  width: 100%;
  margin-top: 8px;
}
.craft-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Кнопка боя с боссом на карте */
.boss-fight-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg, #FF3A30, var(--rb-red));
  color: #fff;
  border: 3px solid rgba(0,0,0,.2);
  border-radius: var(--rb-radius);
  font-size: 18px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--rb-shadow), inset 0 -4px 0 rgba(0,0,0,.2);
  animation: pulse 1.5s infinite;
  margin-top: 12px;
}
.boss-fight-btn:hover { filter: brightness(1.1); }
.boss-fight-btn:active { transform: translateY(3px); }
.boss-fight-btn.defeated {
  background: linear-gradient(180deg, #00C961, var(--rb-green));
  animation: none;
}

/* ===== Поражение → последний шанс ===== */
.boss-last-chance {
  font-size: 14px;
  color: var(--rb-yellow);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* ===== Колесо фортуны (шанс на суперудар при поражении) ===== */
.wheel-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 18, .85);
  backdrop-filter: blur(3px);
  padding: 14px;
  overflow-y: auto;
}
.wheel-box {
  background: linear-gradient(180deg, var(--rb-dark-3), var(--rb-dark-2));
  border: 3px solid var(--rb-dark-3);
  border-radius: var(--rb-radius-l);
  box-shadow: var(--rb-shadow);
  padding: 18px 16px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}
.wheel-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--rb-yellow);
  text-shadow: 2px 2px 0 #000;
}
.wheel-sub {
  font-size: 13px;
  color: var(--rb-gray-l);
  margin: 6px 0 10px;
}
.wheel-arena {
  --wheel-size: min(66vw, 270px);
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  margin: 16px auto 12px;
}
.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid #3E2B1A;
  box-shadow: 0 0 0 3px #7A5A34, 0 8px 24px rgba(0,0,0,.6), inset 0 0 18px rgba(0,0,0,.35);
  position: relative;
  transition: transform 4.2s cubic-bezier(.15, .85, .22, 1);
  will-change: transform;
}
.wheel-label {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.wheel-label span {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
  white-space: nowrap;
  letter-spacing: .3px;
}
.wheel-label.win span {
  animation: wheelWinPulse .5s infinite alternate;
}
@keyframes wheelWinPulse {
  from { transform: scale(1); }
  to { transform: scale(1.25); }
}
.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  color: #fff;
  z-index: 4;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.8));
}
.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6B4A26, #3E2B1A);
  border: 3px solid #8A6A3C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 10px rgba(0,0,0,.5);
  z-index: 3;
}
.wheel-landed .wheel {
  box-shadow: 0 0 0 3px #FFD84D, 0 0 30px rgba(255,216,77,.65), inset 0 0 18px rgba(0,0,0,.35);
}
.wheel-result {
  min-height: 24px;
  font-size: 16px;
  font-weight: 800;
  color: var(--rb-yellow);
  margin: 6px 0 10px;
}
.wheel-overlay .btn { width: 100%; }
@media (max-width: 360px) {
  .wheel-arena { --wheel-size: min(74vw, 240px); }
  .wheel-label span { font-size: 9.5px; }
  .wheel-box { padding: 14px 10px; }
}
