@font-face {
  font-family: "Karrik";
  src: url("../fonts/Karrik-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: "Karrik", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(125% 125% at 50% 44%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}

#fade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 1;
  transition: opacity 2.6s ease;
  pointer-events: none;
}
#fade.out { opacity: 0; }

/* ------------------------------------------------ overlay */

#ovl {
  position: fixed;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  user-select: none;
  -webkit-user-select: none;
}

/* quiet local scrim so the type holds against bright rain behind it */
#ovl::before {
  content: "";
  position: absolute;
  inset: -30px -38px -20px -24px;
  background: radial-gradient(140% 140% at 0% 100%, rgba(0, 0, 0, 0.78) 42%, rgba(0, 0, 0, 0.5) 66%, transparent 88%);
  z-index: -1;
  pointer-events: none;
}

#links { order: 1; }
#name  { order: 2; }

#name {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 8px 3px 0;
  margin: 0;
  font-family: "Karrik", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #b9ffc9;
  opacity: 0.85;
  cursor: pointer;
  text-shadow: 0 0 14px rgba(0, 255, 96, 0.4);
}
#name:hover, #name:focus-visible { opacity: 1; }
#name:focus-visible { outline: 1px solid rgba(96, 255, 150, 0.6); outline-offset: 3px; }

#links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0 0 5px 1px;
  max-height: 300px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: max-height 0.5s ease, opacity 0.45s ease, transform 0.45s ease, visibility 0s;
}

#links.closed {
  max-height: 0;
  opacity: 0;
  visibility: hidden; /* drops the hidden links from tab order + AT tree */
  transform: translateY(8px);
  pointer-events: none;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.45s ease, transform 0.45s ease, visibility 0s 0.5s;
}

@media (hover: hover) {
  #ovl:hover #links.closed {
    max-height: 300px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    overflow: visible;
    transition: max-height 0.5s ease, opacity 0.45s ease, transform 0.45s ease, visibility 0s;
  }
}

#links a {
  font-family: "Karrik", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: #7fe69c;
  opacity: 1;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 255, 96, 0.22);
  padding: 2px 1px;
}
#links a:hover, #links a:focus-visible {
  color: #e2ffe9;
  opacity: 1;
  text-shadow: 0 0 10px rgba(0, 255, 96, 0.55);
  border-bottom-color: rgba(120, 255, 160, 0.6);
}
#links a:focus-visible { outline: 1px solid rgba(96, 255, 150, 0.6); outline-offset: 2px; }

/* ------------------------------------------------ hint + joystick */

#hint {
  position: fixed;
  left: 50%;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px));
  transform: translateX(-50%);
  font-family: "Karrik", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #7fe6a0;
  text-shadow: 0 0 12px rgba(0, 255, 96, 0.35);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9;
}
#hint.show { opacity: 0.8; }

#stickBase {
  position: fixed;
  left: 0; top: 0;
  width: 112px; height: 112px;
  margin: -56px 0 0 -56px;
  border-radius: 50%;
  border: 1px solid rgba(86, 255, 140, 0.28);
  background: rgba(0, 26, 8, 0.22);
  display: none;
  pointer-events: none;
  z-index: 8;
}
#stickBase.on { display: block; }

#stickNub {
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(120, 255, 160, 0.22);
  border: 1px solid rgba(120, 255, 160, 0.4);
}

.nojs {
  position: fixed;
  top: 18px;
  left: 20px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #41804f;
}
