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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#instructionsOverlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: linear-gradient(180deg, #1a1a3e 0%, #16213e 35%, #0f3460 70%, #1a1a3e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: opacity 0.3s ease;
  overflow: auto;
}
.instructions-stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 5% 15%, white, transparent),
    radial-gradient(2px 2px at 18% 28%, rgba(255,255,255,0.9), transparent),
    radial-gradient(2px 2px at 28% 8%, white, transparent),
    radial-gradient(1.5px 1.5px at 42% 18%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 58% 32%, white, transparent),
    radial-gradient(1.5px 1.5px at 72% 12%, rgba(255,255,255,0.7), transparent),
    radial-gradient(2px 2px at 88% 22%, white, transparent),
    radial-gradient(2px 2px at 95% 42%, rgba(255,255,255,0.85), transparent),
    radial-gradient(2px 2px at 8% 65%, white, transparent),
    radial-gradient(1.5px 1.5px at 35% 78%, rgba(255,255,255,0.75), transparent),
    radial-gradient(2px 2px at 62% 88%, white, transparent),
    radial-gradient(2px 2px at 78% 72%, rgba(255,255,255,0.9), transparent),
    radial-gradient(2px 2px at 22% 48%, white, transparent),
    radial-gradient(1.5px 1.5px at 88% 62%, white, transparent);
  background-repeat: repeat;
  background-size: 100% 100%;
  pointer-events: none;
  opacity: 0.9;
}
#instructionsOverlay.hidden {
  pointer-events: none;
  opacity: 0;
}
#instructionsModal {
  background: rgba(10, 12, 24, 0.6);
  border-radius: 16px;
  padding: 1.25rem;
  max-width: min(480px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.4);
  position: relative;
  z-index: 1;
}
.instructions-title-banner {
  background: #0d0d0d;
  border: 3px solid #d4af37;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}
.instructions-title-banner h1 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.02em;
  margin: 0;
}
.instructions-platforms {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  justify-content: flex-start;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.instructions-platforms::-webkit-scrollbar {
  height: 6px;
}
.instructions-platforms::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.5);
  border-radius: 3px;
}
.platform-card {
  flex: 0 0 110px;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.platform-bar {
  width: 100%;
  height: 20px;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.platform-bar.platform-edge {
  background: linear-gradient(90deg, #7b8c9a 0%, #5a6a78 50%, #2d2d2d 100%);
}
.platform-start .platform-bar { background: #27ae60; }
.platform-ice .platform-bar { background: #a8d8ea; }
.platform-wood .platform-bar { background: #c4a77d; }
.platform-sandpaper .platform-bar { background: #8b7355; }
.platform-teeter .platform-bar { background: transparent; }
.platform-plastic .platform-bar { background: #ffd93d; }
.platform-label {
  color: #e8e8e8;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.platform-desc {
  color: #b8c5d6;
  font-size: 0.7rem;
  line-height: 1.35;
  margin: 0;
}
.platform-desc strong {
  color: #fff;
}
.platform-desc small {
  font-size: 0.65rem;
  opacity: 0.9;
}
#instructionsPlayBtn {
  display: block;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-size: 1.1rem;
  font-weight: bold;
  color: #1a1a2e;
  background: linear-gradient(180deg, #d4af37 0%, #b8941f 100%);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}
#instructionsPlayBtn:hover {
  background: linear-gradient(180deg, #e5c148 0%, #c9a028 100%);
}
#instructionsPlayBtn:active {
  transform: scale(0.98);
}

#playOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 26, 46, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.3s ease;
}
#playOverlay.hidden {
  pointer-events: none;
  opacity: 0;
}
#rotateMessage {
  text-align: center;
  color: #fff;
}
#rotateIcon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: rotateHint 2s ease-in-out infinite;
}
@keyframes rotateHint {
  0%, 100% { transform: rotate(-90deg); }
  50% { transform: rotate(-60deg); }
}
#rotateMessage p {
  font-size: 1.1rem;
  font-family: sans-serif;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #1a1a2e;
}
