html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  background: #111;
  color: #eee;
  display: flex;
  justify-content: center;
  height: 100vh;
}

h1 {
  margin: 0;
}

h2 {
  margin: 0;
  font-size: 1rem;
}

h3 {
  margin: 24px 0 0 0;
  font-size: 0.9rem;
  font-weight: bolder;
}

h5 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: bolder;
  color: #aaa;
}

h6 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: lighter;
  color: #aaa;
}

ul {
  padding: 0 0 0 20px;
}

button {
  margin: 5px 0;
  height: 40px;
  background: #444;
  color: #eee;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
}

button:disabled {
  color: #888;
  background: #222;
  cursor: not-allowed;
}

hr {
  border: none;
  height: 1px;
  background: #444;
}

/* Colors */
.green {
  background: #28a745;
}

.green:hover {
  background: #218838;
}

.red {
  background: #dc3545;
}
.red:hover {
  background: #c82333;
}

.orange {
  background: #fd7e14;
}

.orange:hover {
  background: #e67e22;
}

.game-container {
  text-align: center;
  max-width: 280px;
  margin-top: 20px;
}

.deck-container {
  display: flex;
  justify-content: space-between;
  margin: 20px 0;
}

.button-container {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 8px;
}

.labeled-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 5px;
  margin-bottom: 20px;
}

.room {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-counter {
  font-weight: bold;
}

.health {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  position: relative;

  background-image: url('assets/d20.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  transition: text-shadow 1s;
}

.health::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--health-color, hsl(100, 100%, 50%));
  mix-blend-mode: multiply;
  opacity: 0.6;
  pointer-events: none;
  transition: background-color 1s;
  -webkit-mask-image: url('assets/d20.png');
  mask-image: url('assets/d20.png');
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
}

.health-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 50, 50, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: particle-rise 2s ease-out forwards;
}

@keyframes particle-rise {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.5);
  }
}

.health.potion-used::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 100, 100, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse-subtle 2s ease-in-out infinite;
  -webkit-mask-image: url('assets/d20.png');
  mask-image: url('assets/d20.png');
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
}

@keyframes pulse-subtle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

#run-button {
  color: white;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 1rem;
}

#run-button:disabled {
  background: #222;
  cursor: not-allowed;
}

.icon-button-container {
  display: flex;
  gap: 10px;
}

.icon-button {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.prompt-container {
  margin: 20px 0;
}

#prompt {
  font-size: 0.8rem;
}

#score {
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 5px;
  display: none;
}

.restart-button {
  display: none;
  width: 100%;
}

/* Card details */
.card-details {
  width: calc(100% - 32px);
  margin: 20px 0;
  padding: 16px;
  background: #222;
  flex-direction: column;
  border-radius: 16px;
}

.card-details.hidden {
  display: none;
}

#card-description {
  font-size: 0.9rem;
  margin: 10px 0;
}

/* Card styles */
.card {
  width: 60px;
  height: 90px;
  background: #333;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: -4px 4px 6px rgba(0, 0, 0, 0.1), -1px 1px 3px rgba(0, 0, 0, 0.06);
}

.card.heart { 
  color: red;
  /* border: 1px solid #555; */
}
.card.diamond {
  color: orange;
  /* border: 1px solid #555; */
}
.card.spade, .card.club {
  color: white;
  /* border: 1px solid #555; */
}

.card.empty {
  background: #222;
  border: 1px dashed #555;
}

.card.back {
  background: linear-gradient(45deg, #333 25%, transparent 25%), linear-gradient(315deg, #333 25%, transparent 25%) ,linear-gradient(45deg, transparent 24%,#af5858 25%, #af5858 30%, transparent 31%, transparent 39%,#af5858 40%, #af5858 45%, transparent 45%),linear-gradient(315deg, transparent 24%,#af5858 25%, #af5858 30%, transparent 31%, transparent 39%,#af5858 40%, #af5858 45%, transparent 45%);
  background-size: 1em 1em;
  background-color: #333;
  opacity: 1;
  box-sizing: border-box;
  border: 5px solid #666;
  box-shadow: 2px 2px 0 #555;
}

.card.selected-potion {
  box-shadow: 0 0 2px rgba(255, 0, 0, 0.5), 0 0 20px rgba(255, 0, 0, 0.5);
}

.card.selected-weapon {
  box-shadow: 0 0 2px rgba(255, 200, 0, 0.5), 0 0 20px rgba(255, 200, 0, 0.5);
}

.card.selected-monster {
  box-shadow: 0 0 2px rgba(200, 200, 200, 0.5), 0 0 20px rgba(200, 200, 200, 0.5);
}

#deck-contents {
  margin: 0 auto;
  border-collapse: collapse;
  text-align: center;
  table-layout: fixed;
  width: 100%;
}

#deck-contents th,
#deck-contents td {
  border: 1px solid #444;
  padding: 2px;
}

#log {
  margin: 48px 0;
  font-size: 0.9rem;
  min-height: 40px;
  white-space: pre-wrap;
}

.weapon-chain {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.weapon-monsters {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.divider {
  display: none;
  height: 90px;
  width: 2px;
  background: #444;
}

.help {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: start;
  margin-top: 32px
}

/* Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
}

/* Modal */
.modal {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem;
  width: 300px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.modal h2 {
  margin-top: 0;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #aaa;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4ade80; /* green */
}

input:checked + .slider:before {
  transform: translateX(18px);
}