/* Pulse Tiles by SWC styles */
:root {
  --bg1: #0b0f1a;
  --bg2: #101936;
  --bg3: #0f1330;
  --accent1: #5cf1ff;
  --accent2: #9d7bff;
  --accent3: #ff66c4;
  --good: #78ffa1;
  --warn: #ffd26a;
  --danger: #ff6b6b;
  --shadow: 0 0 40px rgba(156, 124, 255, 0.35),
    0 0 80px rgba(92, 241, 255, 0.25);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: #e9f3ff;
  background: radial-gradient(
      80rem 40rem at 10% 10%,
      rgba(157, 123, 255, 0.25),
      transparent 60%
    ),
    radial-gradient(
      60rem 30rem at 90% 30%,
      rgba(92, 241, 255, 0.2),
      transparent 55%
    ),
    radial-gradient(
      80rem 40rem at 30% 90%,
      rgba(255, 102, 196, 0.12),
      transparent 65%
    ),
    linear-gradient(180deg, var(--bg2), var(--bg1));
}

#app {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(16, 25, 54, 0.6);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.topbar h1 {
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
}
.brand {
  font-weight: 500;
  font-size: 0.8em;
  opacity: 0.8;
  color: var(--accent1);
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  border: 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #e9f3ff;
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  transition: transform 0.08s ease, box-shadow 0.25s ease, background 0.25s;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active {
  transform: translateY(0);
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent1));
  color: #051018;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
}

.hud {
  margin: 18px 0 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.stat {
  padding: 12px;
  border-radius: 16px;
  background: rgba(16, 25, 54, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow);
}
.label {
  font-size: 0.8rem;
  opacity: 0.8;
}
.value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 6px;
}
.hearts {
  letter-spacing: 4px;
  color: var(--danger);
  text-shadow: 0 0 18px rgba(255, 107, 107, 0.6);
}

.board {
  transform: scale(0.8);
  transform-origin: top center;
  user-select: none;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(11, 15, 26, 0.6);
  box-shadow: var(--shadow);
}
.row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.tile {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  border: 0;
  cursor: pointer;
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  outline: none;
  transition: transform 0.05s ease;
}
.tile:active {
  transform: scale(0.98);
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  filter: blur(16px);
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(
    60% 60% at 50% 50%,
    rgba(157, 123, 255, 0.6),
    transparent 70%
  );
}

/* States */
.tile.lit {
  background: linear-gradient(
    135deg,
    rgba(157, 123, 255, 0.45),
    rgba(92, 241, 255, 0.35)
  );
  box-shadow: 0 4px 30px rgba(92, 241, 255, 0.35),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}
.tile.lit::after {
  opacity: 1;
}

/* Bonus states */
.tile.bonus {
  background: linear-gradient(
    135deg,
    rgba(120, 255, 161, 0.4),
    rgba(92, 241, 255, 0.35)
  );
  box-shadow: 0 6px 34px rgba(120, 255, 161, 0.5),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}
.tile.slow {
  background: linear-gradient(
    135deg,
    rgba(255, 210, 106, 0.5),
    rgba(157, 123, 255, 0.35)
  );
  box-shadow: 0 6px 34px rgba(255, 210, 106, 0.5),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Helper pop */
.pop {
  position: absolute;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(16, 25, 54, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
}

.help,
.foot {
  margin: 16px 0;
  opacity: 0.9;
}
summary {
  cursor: pointer;
}

/* Responsive */
@media (max-width: 640px) {
  .hud {
    grid-template-columns: repeat(3, 1fr);
  }
}
