/* ============================================================
   GRAVITY FALLS - Stylesheet
   ============================================================ */

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

body {
  background: #0a0a1a;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  display: block;
  max-width: 900px;
}

/* Overlays */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  pointer-events: all;
  background: rgba(10, 10, 30, 0.92);
  border: 2px solid rgba(100, 200, 255, 0.3);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  color: #e0e8f0;
  max-width: 520px;
  box-shadow: 0 0 60px rgba(50, 120, 255, 0.15);
}

.overlay-content h1 {
  font-size: 42px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #4af, #8f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay-content h2 {
  font-size: 28px;
  margin-bottom: 16px;
  color: #aac;
}

.overlay-content .tagline {
  font-size: 20px;
  line-height: 1.5;
  margin-bottom: 18px;
  color: #ccddeeff;
  letter-spacing: 0.5px;
  font-style: italic;
}

.overlay-content p,
.overlay-content ul {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
  color: #99aabb;
}

.overlay-content ul {
  text-align: left;
  padding-left: 24px;
}

.overlay-content li {
  margin-bottom: 4px;
}

.btn-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
}

.github-link {
  display: inline-block;
  margin-top: 20px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #ccddef;
  text-decoration: none;
  border: 1px solid rgba(100, 200, 255, 0.3);
  border-radius: 8px;
  background: rgba(100, 200, 255, 0.08);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.github-link:hover {
  color: #fff;
  background: rgba(100, 200, 255, 0.18);
  border-color: rgba(100, 200, 255, 0.5);
}

.btn {
  padding: 14px 32px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-easy {
  background: linear-gradient(135deg, #2a4, #4c8);
  color: #fff;
}

.btn-hard {
  background: linear-gradient(135deg, #c33, #e55);
  color: #fff;
}

.btn-again {
  background: linear-gradient(135deg, #36a, #58c);
  color: #fff;
}

.btn-end {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(200, 50, 50, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 100, 100, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-end:hover {
  background: rgba(220, 60, 60, 1);
}

.btn-end.hidden {
  display: none;
}

/* HUD */
.hud {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  z-index: 15;
  padding: 16px 120px 16px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: rgba(10, 10, 30, 0.75);
  font-size: 22px;
  color: #c0cee0;
  flex-wrap: wrap;
}

.hud.hidden {
  display: none;
}

.hud-row {
  display: contents;
}

.gravity-bar-container {
  display: none;
  width: 300px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.gravity-bar-fill {
  height: 100%;
  border-radius: 18px;
  transition: width 0.05s linear;
  background: #4c4;
}

.gravity-bar-label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hud-item {
  white-space: nowrap;
}

.hud-item span {
  font-weight: 700;
  color: #fff;
}

.hud-sep {
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
}

.orb-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 22px;
}

.orb-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.orb-dot.yellow {
  background: #ffdd00;
  box-shadow: 0 0 10px rgba(255, 220, 0, 0.6);
  color: #553d00;
}

.orb-dot.blue {
  background: #66ddff;
  box-shadow: 0 0 10px rgba(100, 220, 255, 0.6);
  color: #1a4a5c;
}

.orb-dot.red {
  background: #ff3355;
  box-shadow: 0 0 10px rgba(255, 50, 80, 0.6);
  color: #fff;
}

.orb-dot.white {
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
  color: #333;
}

.hud-total {
  font-weight: 700;
  color: #4f8;
  font-size: 28px;
}

.hud-penalty {
  font-weight: 700;
  color: #ff5566;
  font-size: 22px;
}

#hudDifficulty,
#hudBooster,
#hudMult {
  display: none;
}

.hud-mult {
  font-weight: 700;
  font-size: 22px;
  transition: color 0.2s, text-shadow 0.2s;
}

.hud-mult.mult-1 {
  color: #c0cee0;
}

.hud-mult.mult-low {
  color: #f0c040;
  text-shadow: 0 0 6px rgba(240, 190, 60, 0.5);
}

.hud-mult.mult-high {
  color: #ff5050;
  text-shadow: 0 0 10px rgba(255, 80, 80, 0.6);
}

.booster-active {
  color: #ff3050;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 48, 80, 0.6);
  animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.7;
  }

  to {
    opacity: 1;
  }
}

.stat-row {
  margin: 8px 0;
  font-size: 18px;
}

.stat-row span {
  font-weight: 700;
  color: #fff;
}

.mobile-hint {
  display: none;
}

.desktop-hint {
  display: inline;
}

/* Touch Controls */
.touch-controls {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 0;
  width: 100%;
  z-index: 25;
  padding: 10px 16px 16px;
  pointer-events: none;
  justify-content: space-between;
  align-items: flex-end;
  background: linear-gradient(to top, rgba(5, 5, 16, 0.85) 0%, rgba(5, 5, 16, 0.4) 70%, transparent 100%);
}

.touch-group {
  display: flex;
  gap: 10px;
  pointer-events: all;
}

.touch-btn {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(30, 40, 70, 0.7);
  color: #cde;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.1s, border-color 0.1s;
}

.touch-btn.active {
  background: rgba(80, 140, 255, 0.5);
  border-color: rgba(100, 180, 255, 0.7);
}

.touch-btn .btn-icon {
  font-size: 26px;
  line-height: 1;
}

.touch-btn .btn-label {
  font-size: 10px;
  margin-top: 2px;
}

.touch-btn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.touch-move-group {
  gap: 6px;
}

.touch-btn.wide {
  width: 74px;
}

/* ============================================================
   Mobile-responsive
   ============================================================ */
@media (max-width: 700px) {
  .touch-controls {
    display: flex;
  }

  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  .hud {
    padding: 4px 6px;
    gap: 2px 4px;
    font-size: 11px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hud-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .hud-row-score {
    gap: 8px;
  }

  .gravity-bar-container {
    display: none;
  }

  .gravity-bar-label {
    font-size: 9px;
  }

  .orb-dot {
    width: 16px;
    height: 16px;
    font-size: 7px;
  }

  .orb-stat {
    gap: 2px;
    font-size: 11px;
  }

  .hud-sep {
    display: none;
  }

  .hud-total {
    font-size: 14px;
  }

  .hud-penalty {
    font-size: 11px;
  }

  .hud-item {
    font-size: 10px;
  }

  .mobile-hint {
    display: inline;
  }

  .desktop-hint {
    display: none;
  }

  .btn-end {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    padding: 3px 8px;
    z-index: 30;
  }

  .hud {
    position: fixed;
  }

  .overlay-content {
    padding: 20px 16px;
    max-width: 92vw;
    max-height: calc(100vh - 170px);
    overflow-y: auto;
  }

  .overlay-content h1 {
    font-size: 26px;
  }

  .overlay-content h2 {
    font-size: 20px;
  }

  .overlay-content p,
  .overlay-content ul {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
  }

  .overlay-content li {
    margin-bottom: 2px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .btn-row {
    margin-top: 12px;
  }
}
