:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #000;
}

* { box-sizing: border-box; }

html, body, .app { width: 100%; min-height: 100%; margin: 0; }
body { overflow: hidden; background: #000; }

#life {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

.empty-message {
  position: fixed;
  z-index: 1;
  top: 50%;
  left: 50%;
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 700;
  letter-spacing: .08em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.empty-message.is-visible { animation: nobody 5s cubic-bezier(.22,.61,.36,1) forwards; }

@keyframes nobody {
  0% { opacity: 0; filter: blur(12px); letter-spacing: .3em; transform: translate(-50%, -45%) scale(1.13); }
  28% { opacity: 1; filter: blur(0); letter-spacing: .08em; transform: translate(-50%, -50%) scale(1); }
  62% { opacity: .92; filter: blur(.3px); }
  100% { opacity: 0; filter: blur(9px); letter-spacing: .2em; transform: translate(-50%, -54%) scale(.92); }
}

.topbar {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.brand {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 24px 16px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .16em;
}

.info-trigger {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pointer-icon {
  position: absolute;
  top: 0;
  left: 5px;
  width: 0;
  height: 0;
  border-top: 16px solid #fff;
  border-right: 10px solid transparent;
  filter: drop-shadow(1px 1px 0 #000);
  transform: rotate(-22deg);
}

.pointer-icon::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 3px;
  left: -5px;
  top: -4px;
  background: #fff;
  transform: rotate(-45deg);
}

.rules {
  position: absolute;
  top: 58px;
  left: 50%;
  width: 570px;
  padding: 16px 18px;
  border: 1px solid #555;
  background: rgba(10, 10, 10, .96);
  color: #dedede;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -7px);
  transition: opacity .15s ease, transform .15s ease;
}

.rules::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-top: 1px solid #555;
  border-left: 1px solid #555;
  background: #0a0a0a;
  transform: translateX(-50%) rotate(45deg);
}

.brand:hover .rules, .brand:focus-within .rules { opacity: 1; transform: translate(-50%, 0); }
.rules strong { display: block; margin-bottom: 8px; color: #fff; font-size: 10px; letter-spacing: .13em; }
.rules p { margin: 5px 0; white-space: nowrap; }

.controls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1;
  display: flex;
  gap: 8px;
}

.button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #777;
  border-radius: 0;
  background: #000;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.button:hover, .button:focus-visible { border-color: #fff; outline: none; }
.button-main { background: #fff; color: #000; border-color: #fff; }
.button-main:hover, .button-main:focus-visible { background: #d7d7d7; }
.button.is-hidden { width: 0; padding: 0; border-width: 0; opacity: 0; pointer-events: none; overflow: hidden; }

.play-icon, .clear-icon { display: block; margin: auto; }
.play-icon { width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid currentColor; margin-left: 16px; }
.clear-icon { width: 15px; height: 15px; border: 1.5px solid currentColor; position: relative; }
.clear-icon::before, .clear-icon::after { content: ''; position: absolute; top: 6px; left: 2px; width: 9px; border-top: 1.5px solid currentColor; transform: rotate(45deg); }
.clear-icon::after { transform: rotate(-45deg); }

.button.is-running .play-icon { width: 12px; height: 15px; border: 0; margin-left: 14px; background: linear-gradient(90deg, currentColor 0 4px, transparent 4px 8px, currentColor 8px); }

@media (max-width: 550px) {
  .controls { right: 14px; bottom: 14px; }
  .button { width: 42px; padding: 0; }
}
