:root {
  --bg: #0b1220;
  --panel: rgba(12, 18, 32, 0.55);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f4f7ff;
  --muted: rgba(244, 247, 255, 0.7);
  --accent: #ff6bcb;
  --accent-2: #7cf5ff;
  --cream: #ffe7a8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Press Start 2P", system-ui, sans-serif;
  --font-body: "Fredoka", system-ui, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#c:active {
  cursor: grabbing;
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(16px, 3vw, 28px);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 245, 255, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(8, 12, 24, 0.45) 0%, transparent 22%, transparent 78%, rgba(8, 12, 24, 0.5) 100%);
}

.title-block {
  max-width: min(520px, 100%);
  pointer-events: none;
  animation: fade-up 0.8s ease both;
}

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--cream);
  background: rgba(255, 231, 168, 0.12);
  border: 1px solid rgba(255, 231, 168, 0.25);
  padding: 8px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  text-shadow: 0 0 12px rgba(255, 231, 168, 0.35);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(18px, 3.2vw, 28px);
  line-height: 1.35;
  color: #fff;
  text-shadow:
    0 0 20px rgba(255, 107, 203, 0.55),
    3px 3px 0 rgba(0, 0, 0, 0.35);
  margin-bottom: 10px;
}

.subtitle {
  font-size: clamp(14px, 2vw, 17px);
  color: var(--muted);
  max-width: 34ch;
}

.controls {
  position: absolute;
  top: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
  display: flex;
  gap: 10px;
  pointer-events: auto;
  animation: fade-up 0.9s 0.1s ease both;
}

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(20, 28, 48, 0.75);
  border-color: rgba(124, 245, 255, 0.35);
}

.btn:active {
  transform: translateY(1px);
}

.btn .icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff9a4d);
  color: #1a1020;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(255, 107, 203, 0.45);
}

.btn.muted .icon {
  background: linear-gradient(135deg, #667, #445);
  box-shadow: none;
}

.hud {
  position: absolute;
  left: clamp(16px, 3vw, 28px);
  bottom: clamp(48px, 8vh, 72px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  animation: fade-up 1s 0.15s ease both;
}

.stat {
  min-width: 180px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 15px;
  font-weight: 600;
}

.hint {
  align-self: end;
  justify-self: center;
  font-size: 13px;
  color: rgba(244, 247, 255, 0.55);
  text-align: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: fade-up 1.1s 0.2s ease both;
}

#boot {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, #1a2744 0%, #0b1220 70%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#boot.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-card {
  text-align: center;
  padding: 28px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  min-width: min(320px, 88vw);
}

.boot-logo {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 16px rgba(255, 180, 80, 0.35));
  animation: bounce 1.2s ease-in-out infinite;
}

.boot-card h2 {
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 18px;
  color: var(--cream);
}

.bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--cream));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  transition: width 0.25s ease;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@media (max-width: 640px) {
  .controls {
    top: auto;
    bottom: clamp(48px, 8vh, 72px);
    right: clamp(12px, 3vw, 20px);
    flex-direction: column;
    align-items: stretch;
  }

  .btn .label {
    display: none;
  }

  .btn {
    padding: 12px;
    justify-content: center;
  }

  .hud {
    bottom: auto;
    top: auto;
    left: clamp(12px, 3vw, 20px);
    bottom: clamp(110px, 18vh, 140px);
  }

  .hint {
    font-size: 11px;
    max-width: 90vw;
  }
}
