:root {
  --border-thickness: 5px; /* default but overridden via JS */
}

body {
  background-color: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
}

h1 {
  text-align: center;
  padding: 20px;
}

.slider-toggle {
  padding: 0 20px 10px;
  font-size: 0.9rem;
  color: #fff;
}

#glow-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px 20px;
}

.slider-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.slider-group input[type="range"] {
  width: 100%;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 40px 40px;
  justify-content: center;
}

.flip-card {
  background: transparent;
  perspective: 1000px;
  cursor: pointer;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.flip-card-front {
  background-color: #111;
  /* border is applied inline via JS */
}

.flip-card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.flip-card-back {
  background-color: #222;
  transform: rotateY(180deg);
}

.flip-card-back p {
  margin: 0;
  /* now p fills the entire back, border flush to edges */
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  /* inner padding so text never touches the border */
  padding: 6%;
  /* dynamic font-size overridden by JS fitText */
  font-size: 1rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  overflow-wrap: break-word;
  /* visual styling */
  background-color: rgba(0, 0, 0, 0.4);
  border: var(--border-thickness) solid currentColor;
  border-radius: 12px;
  color: currentColor;
  text-shadow: 0 0 1px currentColor;
  animation:
    oathFadeIn 0.6s ease-in forwards,
    pulseBorder 3s infinite ease-in-out;
  opacity: 0;
}

@keyframes oathFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseBorder {
  0%, 100% {
    box-shadow: 0 0 2px currentColor;
  }
  50% {
    box-shadow: 0 0 12px currentColor;
  }
}

/* Hide debug content by default */
#debug-content {
  display: none;
}

#debug-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.8rem;
  font-family: monospace;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  border-top: 1px solid #444;
}

#debug-toggle {
  background-color: #444;
  color: #fff;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

#debug-content div {
  margin-bottom: 2px;
}
