:root {
  --nyan-pink: #ff66b2;
  --nyan-yellow: #ffcc00;
  --nyan-blue: #00f2ff;
  --bg-dark: #120520;
  --glass: rgba(0, 0, 0, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  user-select: none; -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  background-color: var(--bg-dark);
  color: #fff;
  overflow: hidden; height: 100vh; width: 100vw;
  display: flex; justify-content: center; align-items: center;
}

#app {
  position: relative; width: 100%; height: 100%; max-width: 500px;
  background:
    radial-gradient(circle at 30% 18%, rgba(0, 242, 255, 0.28), transparent 32%),
    radial-gradient(circle at 72% 24%, rgba(255, 102, 178, 0.24), transparent 28%),
    linear-gradient(150deg, #120520 0%, #281044 48%, #061725 100%);
  display: flex; justify-content: center; align-items: flex-end;
}

#app::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(18, 18, 18, 0.7); backdrop-filter: blur(8px) grayscale(50%); z-index: 1;
}

#game-container {
  position: relative; z-index: 2;
  width: 100%; height: 85%;
  border-top: 4px dashed rgba(255, 102, 178, 0.5);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
}

canvas {
  display: block; width: 100%; height: 100%;
}

#ui-layer {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 10;
}

.back-link {
  position: absolute; top: 15px; left: 15px; pointer-events: auto;
  background: var(--nyan-yellow); color: #000;
  padding: 8px 15px; border-radius: 20px; font-weight: 900;
  text-decoration: none; font-size: 0.8rem;
  box-shadow: 0 4px 10px rgba(255, 204, 0, 0.4);
  z-index: 100;
}

.back-link:active { transform: scale(0.9); }

#hud {
  position: absolute; top: 15px; right: 15px;
  display: flex; gap: 8px; z-index: 100;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(360px, calc(100% - 110px));
}

.score-box, .next-box {
  background: var(--glass); padding: 9px 11px;
  border-radius: 20px; border: 1px solid var(--glass-border);
  font-weight: 900; font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.next-box span { font-size: 1.5rem; }

#danger-line {
  position: absolute;
  top: 112px;
  left: 7%;
  right: 7%;
  border-top: 2px dashed rgba(255, 102, 178, 0.75);
  color: rgba(255, 102, 178, 0.9);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: right;
  pointer-events: none;
}

.overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 85%; padding: 40px 30px;
  background: var(--glass); backdrop-filter: blur(20px);
  border: 3px solid var(--nyan-pink); border-radius: 30px;
  text-align: center; pointer-events: auto;
  display: flex; flex-direction: column; gap: 15px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.hidden { display: none !important; opacity: 0; pointer-events: none; transform: translate(-50%, -45%); }

.logo {
  font-size: 3rem; font-weight: 900; color: var(--nyan-yellow);
  text-shadow: 0 4px 10px rgba(0,0,0,0.5), 0 0 20px rgba(255, 204, 0, 0.3);
  line-height: 1.1; margin-bottom: 10px;
}

h2 { font-size: 2rem; color: var(--nyan-pink); }

.best-score, .final-score { font-size: 1.5rem; font-weight: 800; margin: 10px 0; }

button {
  background: var(--nyan-blue); color: #000; border: none;
  padding: 15px 20px; font-size: 1.2rem; font-weight: 900;
  border-radius: 20px; cursor: pointer;
  box-shadow: 0 6px 0 #0099aa; transition: all 0.1s;
}

button:active { transform: translateY(4px); box-shadow: 0 2px 0 #0099aa; }

.revive-btn {
  background: var(--nyan-yellow); box-shadow: 0 6px 0 #ccaa00;
  animation: pulse 1.5s infinite;
}

#share-btn { background: #1DA1F2; color: #fff; box-shadow: 0 6px 0 #0d79b7; }

@media (max-width: 520px) {
  #hud {
    top: 56px;
    left: 12px;
    right: 12px;
    max-width: none;
    justify-content: center;
  }

  .score-box, .next-box {
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  #danger-line {
    top: 142px;
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}


/* --- GLOBAL NYANTREPRENEUR OVERRIDES --- */
.back-link, .hub-btn {
  position: absolute !important; top: 15px !important; left: 15px !important; z-index: 9999 !important;
  background: rgba(18, 18, 18, 0.8) !important; color: #ffd700 !important;
  padding: 8px 16px !important; border-radius: 20px !important; font-weight: 800 !important;
  text-decoration: none !important; font-size: 0.8rem !important;
  border: 1px solid rgba(255, 215, 0, 0.3) !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3) !important;
  transition: all 0.2s ease !important;
}
