/* Credit: lautandigital.id */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #0b0e1a;
  --surface:   #141829;
  --primary:   #6c63ff;
  --accent:    #ff6584;
  --text:      #e0e0f0;
  --muted:     #7a7e9a;
  --glow:      rgba(108, 99, 255, 0.6);
}

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* ── Stars background ─────────────────────────────── */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  animation: twinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50%       { opacity: var(--op, 0.8); transform: scale(1.2); }
}

/* ── Container ────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  max-width: 680px;
  width: 100%;
  text-align: center;
}

/* ── Glitch 404 ───────────────────────────────────── */
.glitch-wrapper {
  line-height: 1;
}

.glitch {
  font-size: clamp(6rem, 20vw, 12rem);
  font-weight: 900;
  letter-spacing: -4px;
  color: var(--text);
  position: relative;
  display: inline-block;
  text-shadow: 0 0 30px var(--glow);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.glitch::before {
  color: var(--primary);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
  animation: glitch-top 2.5s infinite linear;
}

.glitch::after {
  color: var(--accent);
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  animation: glitch-bottom 2s infinite linear;
}

@keyframes glitch-top {
  0%, 90%, 100% { transform: translate(0); }
  92%           { transform: translate(-4px, -2px); }
  94%           { transform: translate(4px, 2px); }
  96%           { transform: translate(-2px, 0); }
}

@keyframes glitch-bottom {
  0%, 85%, 100% { transform: translate(0); }
  87%           { transform: translate(4px, 3px); }
  90%           { transform: translate(-4px, -1px); }
  92%           { transform: translate(2px, 0); }
}

/* ── Text content ─────────────────────────────────── */
.subtitle {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--primary);
}

.description {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Buttons ──────────────────────────────────────── */
.actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.6rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 20px var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--glow);
  background: #7d76ff;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Astronaut ────────────────────────────────────── */
.astronaut {
  animation: float 5s ease-in-out infinite;
  filter: drop-shadow(0 0 12px var(--glow));
  position: relative;
  width: 80px;
  height: 100px;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%       { transform: translateY(-16px) rotate(4deg); }
}

.helmet {
  width: 54px;
  height: 54px;
  background: #1e2240;
  border-radius: 50%;
  border: 3px solid var(--primary);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.visor {
  position: absolute;
  top: 14px;
  left: 8px;
  width: 32px;
  height: 20px;
  background: linear-gradient(135deg, #6c63ff88, #ff658488);
  border-radius: 30px;
  border: 2px solid rgba(255,255,255,0.3);
}

.body {
  width: 40px;
  height: 38px;
  background: #1e2240;
  border: 3px solid var(--primary);
  border-radius: 12px;
  margin: 2px auto 0;
  position: relative;
}

.arm {
  position: absolute;
  top: 4px;
  width: 12px;
  height: 26px;
  background: #1e2240;
  border: 2px solid var(--primary);
  border-radius: 8px;
}

.arm-left  { left: -14px; transform: rotate(15deg); }
.arm-right { right: -14px; transform: rotate(-15deg); }

.leg {
  position: absolute;
  bottom: -20px;
  width: 12px;
  height: 22px;
  background: #1e2240;
  border: 2px solid var(--primary);
  border-radius: 6px;
}

.leg-left  { left: 5px; }
.leg-right { right: 5px; }

/* ── Search ───────────────────────────────────────── */
.search-hint {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.search-hint > p {
  font-size: 0.85rem;
  color: var(--muted);
}

.search-box {
  display: flex;
  width: 100%;
  border-radius: 50px;
  overflow: hidden;
  border: 2px solid var(--surface);
  background: var(--surface);
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: var(--primary);
}

#search-input {
  flex: 1;
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
}

#search-btn {
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

#search-btn:hover { background: #7d76ff; }

.search-result {
  font-size: 0.8rem;
  color: var(--accent);
  min-height: 1.2em;
}

/* ── Footer ───────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  padding: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

footer a:hover { text-decoration: underline; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 480px) {
  .glitch { letter-spacing: -2px; }
  .astronaut { width: 64px; height: 84px; }
}
