@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Nunito:wght@600;800&display=swap');

:root {
  --bg0: #071512;
  --bg1: #0d2a22;
  --ink: #fff6e4;
  --muted: #b7d4c8;
  --lime: #b6f24a;
  --mango: #ffb347;
  --berry: #ff5c6c;
  --sky: #3ecfff;
  --blade: #ffe9a8;
  --shadow: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #163d32 0%, var(--bg0) 55%, #040a09 100%);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 78%, rgba(255, 179, 71, 0.12), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(62, 207, 255, 0.1), transparent 26%),
    repeating-linear-gradient(
      -12deg,
      transparent 0 18px,
      rgba(255, 246, 228, 0.015) 18px 19px
    );
  animation: drift 18s linear infinite;
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-40px);
  }
}

#hud {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  pointer-events: none;
}

.brand {
  font-family: 'Lilita One', cursive;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 3px 0 #0a1f19, 0 8px 24px var(--shadow);
}

.brand span {
  color: var(--lime);
}

.scores {
  justify-self: center;
  display: flex;
  gap: 1.2rem;
  font-weight: 800;
  font-size: 1.05rem;
}

.scores b {
  color: var(--mango);
}

.lives {
  display: flex;
  gap: 0.35rem;
  justify-self: end;
}

.lives i {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--berry);
  box-shadow: 0 0 0 3px rgba(255, 92, 108, 0.2);
  display: block;
}

.lives i.off {
  background: #335248;
  box-shadow: none;
  opacity: 0.55;
}

#link-panel {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 4;
  width: min(280px, calc(100vw - 2rem));
  padding: 0.9rem 1rem 1rem;
  background: rgba(7, 21, 18, 0.82);
  border: 1px solid rgba(182, 242, 74, 0.28);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px var(--shadow);
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#link-panel.hidden {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
}

#link-panel h2 {
  margin: 0 0 0.35rem;
  font-family: 'Lilita One', cursive;
  font-size: 1.15rem;
  font-weight: 400;
}

#link-panel p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

#qr {
  display: grid;
  place-items: center;
  padding: 0.55rem;
  border-radius: 12px;
  background: #fff8e7;
}

#qr table {
  border-collapse: collapse;
  margin: 0 auto;
}

#qr td {
  width: 5px;
  height: 5px;
  padding: 0;
}

#link-panel code {
  display: block;
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 246, 228, 0.08);
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--sky);
}

#status {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  font-weight: 800;
}

#status.ok {
  color: var(--lime);
}

#status.wait {
  color: var(--mango);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  cursor: none;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(4, 10, 9, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#overlay.show {
  opacity: 1;
  pointer-events: auto;
}

#overlay .card {
  text-align: center;
  padding: 2rem 2.2rem;
  max-width: 26rem;
}

#overlay h1 {
  margin: 0 0 0.5rem;
  font-family: 'Lilita One', cursive;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 400;
  color: var(--lime);
  text-shadow: 0 4px 0 #102820;
}

#overlay p {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

#overlay button,
#link-panel button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  color: #0b1f1a;
  background: linear-gradient(180deg, var(--lime), #8fd62a);
  box-shadow: 0 8px 0 #4f7a12, 0 14px 28px var(--shadow);
  cursor: pointer;
}

#overlay button:active,
#link-panel button:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 #4f7a12, 0 8px 16px var(--shadow);
}

@media (max-width: 720px) {
  #link-panel {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}
