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

html {
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  background: #1a1a2e;
  overflow: hidden;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

#canvas {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  will-change: transform;
  touch-action: none;
}

/* Keyboard hint (desktop) — shown only during Playing state */
#esc-hint {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  font-family: monospace;
  font-size: 13px;
  color: #ffd700;
  letter-spacing: 0.5px;
  pointer-events: none;
  opacity: 0.75;
}

/* Menu button (touch devices) — shown only during Playing state */
#menu-btn {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(26, 26, 46, 0.88);
  color: #ffd700;
  border: 1px solid #ffd70066;
  border-radius: 20px;
  padding: 8px 24px;
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
}
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-family: monospace;
  color: #eee;
}
.loading-title {
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 4px;
}
.loading-hint {
  font-size: 14px;
  color: #888;
  letter-spacing: 2px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* Pause overlay */
#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.pause-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  font-family: monospace;
  color: #eee;
}
.pause-title {
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 6px;
}
.pause-resume-btn {
  background: #ffd700;
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  padding: 12px 36px;
  font-family: monospace;
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.15s;
}
.pause-resume-btn:hover {
  background: #ffe84d;
}

.pause-nav-btn {
  color: #eee;
  border: none;
  border-radius: 8px;
  padding: 12px 36px;
  font-family: monospace;
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.15s;
}
.pause-nav-btn.pause-hub {
  background: rgba(20, 50, 110, 0.9);
}
.pause-nav-btn.pause-hub:hover {
  background: rgba(30, 70, 150, 0.95);
}
.pause-nav-btn.pause-home {
  background: rgba(120, 30, 30, 0.9);
}
.pause-nav-btn.pause-home:hover {
  background: rgba(160, 40, 40, 0.95);
}

/* Feedback modal */
#feedback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.80);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#feedback-modal.open {
  display: flex;
}
.feedback-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(480px, 92vw);
  padding: 28px;
  background: rgba(10, 10, 30, 0.97);
  border: 1px solid rgba(100, 100, 180, 0.50);
  border-radius: 10px;
  font-family: monospace;
}
.feedback-title {
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  color: #ddddf8;
  letter-spacing: 0.5px;
}
.feedback-label {
  font-size: 13px;
  color: rgba(160, 160, 210, 0.85);
}
#feedback-textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  background: rgba(5, 5, 20, 0.95);
  border: 1.5px solid rgba(130, 130, 220, 0.80);
  border-radius: 6px;
  color: #e8e8ff;
  font-family: monospace;
  font-size: clamp(14px, 3.5vw, 16px);
  resize: vertical;
  outline: none;
}
#feedback-textarea:focus {
  border-color: rgba(160, 160, 255, 1.0);
}
.feedback-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.feedback-btn {
  padding: 9px 24px;
  border: 1px solid;
  border-radius: 6px;
  font-family: monospace;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.feedback-btn-cancel {
  background: rgba(50, 15, 15, 0.90);
  border-color: rgba(140, 60, 60, 0.55);
  color: #e8a0a0;
}
.feedback-btn-send {
  background: rgba(15, 60, 15, 0.90);
  border-color: rgba(60, 160, 60, 0.60);
  color: #90e890;
}
#feedback-status {
  font-size: 13px;
  color: rgba(130, 220, 140, 0.90);
  min-height: 18px;
  text-align: center;
}

