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

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse 60% 55% at 15% 50%, rgba(100, 0, 0, 0.1) 0%, transparent 100%), radial-gradient(ellipse 60% 55% at 85% 50%, rgba(0, 30, 100, 0.1) 0%, transparent 100%), radial-gradient(ellipse at center, #16161f 0%, #0c0c12 100%);
  font-family: "Cinzel", Georgia, serif;
  color: #ddd2b8;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: clamp(24px, 6vw, 48px) clamp(12px, 4vw, 24px);
  width: 100%;
  max-width: 420px;
}
@media (max-width: 400px) {
  .page {
    gap: 16px;
  }
}

.header {
  text-align: center;
}
.header__title {
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  color: #f0d060;
  text-shadow: 0 0 24px rgba(201, 160, 42, 0.55), 0 2px 6px rgba(0, 0, 0, 0.9);
  letter-spacing: 2px;
  line-height: 1.2;
}
.header__subtitle {
  margin-top: 10px;
  font-size: 0.72rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: rgba(221, 210, 184, 0.38);
}

.machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.slots {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(170deg, #1e1810 0%, #0d0a06 100%);
  border: 1px solid #6b4f10;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 0 0 1px rgba(201, 160, 42, 0.08), 0 8px 40px rgba(0, 0, 0, 0.85), inset 0 0 24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(240, 208, 96, 0.12);
  width: 100%;
}
.slots::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 18px;
  height: 18px;
  border-top: 1px solid rgba(201, 160, 42, 0.4);
  border-left: 1px solid rgba(201, 160, 42, 0.4);
  border-radius: 3px 0 0 0;
  pointer-events: none;
}
.slots::after {
  content: "";
  position: absolute;
  bottom: 7px;
  right: 7px;
  width: 18px;
  height: 18px;
  border-bottom: 1px solid rgba(201, 160, 42, 0.4);
  border-right: 1px solid rgba(201, 160, 42, 0.4);
  border-radius: 0 0 3px 0;
  pointer-events: none;
}
@keyframes flash-attack {
  0%, 100% {
    border-color: #d94f3b;
    box-shadow: 0 0 0 1px rgba(217, 79, 59, 0.25), 0 0 30px rgba(217, 79, 59, 0.25), inset 0 0 20px rgba(217, 79, 59, 0.08);
  }
  50% {
    border-color: #6b4f10;
    box-shadow: 0 0 0 1px rgba(201, 160, 42, 0.08), inset 0 0 24px rgba(0, 0, 0, 0.55);
  }
}
@keyframes flash-heal {
  0%, 100% {
    border-color: #3bba72;
    box-shadow: 0 0 0 1px rgba(59, 186, 114, 0.25), 0 0 30px rgba(59, 186, 114, 0.25), inset 0 0 20px rgba(59, 186, 114, 0.08);
  }
  50% {
    border-color: #6b4f10;
    box-shadow: 0 0 0 1px rgba(201, 160, 42, 0.08), inset 0 0 24px rgba(0, 0, 0, 0.55);
  }
}
.slots.win-attack {
  animation: flash-attack 400ms steps(2, end) 4;
}
.slots.win-heal {
  animation: flash-heal 400ms steps(2, end) 4;
}

.reel {
  position: relative;
  width: 79px;
  height: 237px;
  border: 1px solid rgba(107, 79, 16, 0.55);
  border-radius: 6px;
  overflow: hidden;
  background-image: url(./public/ervas.webp);
  background-position: 0 0;
  background-repeat: repeat-y;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}
.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.12) 22%, transparent 38%, transparent 62%, rgba(0, 0, 0, 0.12) 78%, rgba(0, 0, 0, 0.72) 100%);
  border-radius: inherit;
  pointer-events: none;
}

.slots__center-line {
  position: absolute;
  top: 50%;
  left: 18px;
  right: 18px;
  height: 79px;
  transform: translateY(-50%);
  border-top: 1px solid rgba(201, 160, 42, 0.22);
  border-bottom: 1px solid rgba(201, 160, 42, 0.22);
  pointer-events: none;
}

.result-bar {
  width: 100%;
  padding: 10px 20px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(107, 79, 16, 0.35);
  border-top: none;
  border-radius: 0 0 10px 10px;
  font-size: 0.7rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(221, 210, 184, 0.35);
  transition: color 0.4s ease, border-color 0.4s ease, text-shadow 0.4s ease;
}
.result-bar.state-rolling {
  color: rgba(221, 210, 184, 0.5);
}
.result-bar.state-attack {
  color: #d94f3b;
  border-color: rgba(217, 79, 59, 0.35);
  text-shadow: 0 0 10px rgba(217, 79, 59, 0.5);
}
.result-bar.state-heal {
  color: #3bba72;
  border-color: rgba(59, 186, 114, 0.35);
  text-shadow: 0 0 10px rgba(59, 186, 114, 0.5);
}

.action-panel {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(107, 79, 16, 0.3);
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.35s ease, background 0.35s ease;
  pointer-events: none;
}
.action-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.action-card.type-attack {
  border-color: rgba(217, 79, 59, 0.38);
  background: rgba(217, 79, 59, 0.07);
}
.action-card.type-attack .action-card__label {
  color: #d94f3b;
  text-shadow: 0 0 12px rgba(217, 79, 59, 0.4);
}
.action-card.type-heal {
  border-color: rgba(59, 186, 114, 0.38);
  background: rgba(59, 186, 114, 0.07);
}
.action-card.type-heal .action-card__label {
  color: #3bba72;
  text-shadow: 0 0 12px rgba(59, 186, 114, 0.4);
}
.action-card__label {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}

.mode-toggle {
  display: flex;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(107, 79, 16, 0.45);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.mode-toggle__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 10px;
  font-family: "Cinzel", serif;
  font-size: clamp(0.72rem, 2.5vw, 0.88rem);
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(221, 210, 184, 0.42);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, text-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.mode-toggle__btn:first-child {
  border-right: 1px solid rgba(107, 79, 16, 0.35);
}
.mode-toggle__btn__icon {
  font-size: 1rem;
}
.mode-toggle__btn:hover:not(.active) {
  color: rgba(221, 210, 184, 0.7);
  background: rgba(255, 255, 255, 0.04);
}
.mode-toggle__btn.active {
  color: #1a0e00;
  font-weight: 900;
}
.mode-toggle #modeAttack.active {
  background: linear-gradient(160deg, #e8826f 0%, #d94f3b 60%, #8a1f0f 100%);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.mode-toggle #modeHeal.active {
  background: linear-gradient(160deg, #8ddab0 0%, #3bba72 60%, #1d6e3e 100%);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.spin-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 42px;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #1a0e00;
  background: linear-gradient(160deg, #f0d060 0%, #c9a02a 50%, #6b4f10 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.6), 0 6px 20px rgba(201, 160, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}
.spin-btn__icon {
  font-size: 1.1rem;
}
.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.6), 0 10px 28px rgba(201, 160, 42, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.spin-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 2px 8px rgba(201, 160, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.spin-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}
@media (max-width: 360px) {
  .spin-btn {
    width: 100%;
    justify-content: center;
    padding: 13px 24px;
  }
}

@media (max-width: 480px) {
  .reel {
    width: 70px;
    height: 210px;
  }
  .slots {
    gap: 8px;
    padding: 14px;
  }
  .slots__center-line {
    height: 70px;
    left: 14px;
    right: 14px;
  }
  .action-card {
    padding: 14px 16px;
  }
  .action-card__label {
    font-size: 0.9rem;
    letter-spacing: 2px;
  }
  .mode-toggle__btn {
    padding: 12px 8px;
    letter-spacing: 2px;
  }
}
