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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d0d0d;
}

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

#tooltip {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 270px;
  background: rgba(8, 10, 18, 0.93);
  border: 1px solid rgba(180, 130, 230, 0.30);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: monospace;
  z-index: 20;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
}

#tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

#tooltip-title {
  font-size: 0.75rem;
  font-weight: bold;
  color: #bb88ff;
  margin-bottom: 7px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#tooltip-text {
  font-size: 0.70rem;
  color: rgba(200, 215, 240, 0.88);
  line-height: 1.55;
}

#tooltip-dismiss {
  font-size: 0.60rem;
  color: rgba(140, 140, 170, 0.45);
  margin-top: 9px;
  text-align: right;
  letter-spacing: 0.04em;
}

#goal-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  background: rgba(8, 10, 18, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: monospace;
  pointer-events: none;
  z-index: 10;
}

#goal-label {
  font-size: 0.60rem;
  font-weight: bold;
  color: rgba(170, 120, 210, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  white-space: nowrap;
}

#goal-text {
  font-size: 0.72rem;
  color: rgba(195, 220, 255, 0.82);
}

#sound-control {
  position: fixed;
  bottom: 88px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 15;
  padding: 5px 9px;
  background: rgba(8, 10, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  font-family: monospace;
}

.mute-btn {
  font-family: monospace;
  font-size: 0.64rem;
  color: rgba(150, 170, 195, 0.50);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mute-btn:hover {
  color: rgba(195, 220, 255, 0.90);
  border-color: rgba(160, 210, 255, 0.28);
}

.mute-btn.active {
  color: rgba(255, 160, 130, 0.95);
  border-color: rgba(255, 110, 80, 0.45);
  background: rgba(200, 60, 30, 0.12);
}

.mute-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

#time-control {
  position: fixed;
  bottom: 48px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 15;
  padding: 5px 9px;
  background: rgba(8, 10, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  font-family: monospace;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

#time-control:hover {
  border-color: rgba(150, 200, 255, 0.25);
  background: rgba(10, 14, 26, 0.88);
}

.time-label {
  font-size: 0.54rem;
  font-weight: bold;
  color: rgba(130, 155, 180, 0.50);
  letter-spacing: 0.09em;
  margin-right: 2px;
}

.speed-btn {
  font-family: monospace;
  font-size: 0.68rem;
  color: rgba(150, 170, 195, 0.50);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.speed-btn:hover {
  color: rgba(195, 220, 255, 0.90);
  border-color: rgba(160, 210, 255, 0.28);
}

.speed-btn.active {
  color: rgba(170, 215, 255, 0.92);
  border-color: rgba(130, 195, 255, 0.38);
  background: rgba(90, 150, 255, 0.09);
}

#time-control:hover .speed-btn.active[data-speed="4"] {
  color: rgba(255, 190, 90, 0.95);
  border-color: rgba(255, 160, 60, 0.45);
  background: rgba(255, 120, 0, 0.10);
}

#time-control:hover .speed-btn.active[data-speed="2"] {
  color: rgba(140, 220, 255, 0.95);
  border-color: rgba(100, 200, 255, 0.45);
  background: rgba(60, 160, 255, 0.10);
}

.time-hint {
  font-size: 0.50rem;
  color: rgba(120, 145, 170, 0.32);
  letter-spacing: 0.03em;
  margin-left: 3px;
  white-space: nowrap;
}
