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

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #1E293B;
  width: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#game-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 0;
}

#game-canvas {
  display: block;
  cursor: pointer;
}

/* Portrait mode overlay for mobile */
#portrait-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1E293B;
  color: #FFFFFF;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

#portrait-overlay .rotate-icon {
  font-size: 64px;
  margin-bottom: 24px;
}

#portrait-overlay .rotate-text {
  font-size: 20px;
  line-height: 1.5;
  max-width: 300px;
}

/* Portrait/landscape handled by JS — adds .show-portrait-overlay to body */
body.show-portrait-overlay #portrait-overlay {
  display: flex;
}

body.show-portrait-overlay #game-container {
  display: none;
}

.button-bar {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 20;
  transform-origin: top left;
  /* Padding provides the offset inside the scaled coordinate space */
  padding-top: 7px;
  padding-left: 10px;
}

.game-button {
  width: 36px;
  height: 36px;
  font-size: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-button::before {
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

/* Sound toggle button - 3 states: all sound, no music (sfx only), fully muted */
.music-button {
  background: #3B82F6;
  color: white;
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

/* State 1: All sound (speaker with music notes) */
.music-button::before {
  content: '';
}

.music-button {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3C/svg%3E");
}

.music-button:hover {
  background: #2563EB;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

/* State 2: No music, SFX only (music note with X through it) */
.music-button.no-music {
  background: #D97706;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3' fill='white'/%3E%3Ccircle cx='18' cy='16' r='3' fill='white'/%3E%3Cline x1='2' y1='2' x2='22' y2='22' stroke='%23B45309' stroke-width='3'/%3E%3Cline x1='2' y1='2' x2='22' y2='22' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

.music-button.no-music::before {
  content: '';
}

.music-button.no-music:hover {
  background: #B45309;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3' fill='white'/%3E%3Ccircle cx='18' cy='16' r='3' fill='white'/%3E%3Cline x1='2' y1='2' x2='22' y2='22' stroke='%23925a1a' stroke-width='3'/%3E%3Cline x1='2' y1='2' x2='22' y2='22' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

/* State 3: Fully muted (speaker with X) */
.music-button.muted {
  background: #6B7280;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

.music-button.muted::before {
  content: '';
}

.music-button.muted:hover {
  background: #4B5563;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

.reset-button {
  background: #2563EB;
  color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M3 12a9 9 0 1 1 3 6.9' stroke='white' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M3 21v-6h6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3Ccircle cx='13' cy='10.5' r='4' fill='white' stroke='none'/%3E%3Ccircle cx='11.7' cy='9.7' r='0.9' fill='%232563EB'/%3E%3Ccircle cx='14.3' cy='9.7' r='0.9' fill='%232563EB'/%3E%3Cpath d='M11.5 12.2 Q13 13.2 14.5 12.2' stroke='%232563EB' stroke-width='0.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

.reset-button::before {
  content: '';
}

.reset-button:hover {
  background: #1D4ED8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M3 12a9 9 0 1 1 3 6.9' stroke='white' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M3 21v-6h6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3Ccircle cx='13' cy='10.5' r='4' fill='white' stroke='none'/%3E%3Ccircle cx='11.7' cy='9.7' r='0.9' fill='%231D4ED8'/%3E%3Ccircle cx='14.3' cy='9.7' r='0.9' fill='%231D4ED8'/%3E%3Cpath d='M11.5 12.2 Q13 13.2 14.5 12.2' stroke='%231D4ED8' stroke-width='0.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Tester Level Select button (grid icon) */
.tester-select-button {
  background: #6B7280;
  color: white;
}

.tester-select-button::before {
  content: '▦';
}

.tester-select-button:hover {
  background: #4B5563;
}

.tester-select-button:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}

/* Player Level Select button (play icon) */
.player-select-button {
  background: #7C3AED;
  color: white;
}

.player-select-button::before {
  content: '●';
}

.player-select-button:hover {
  background: #6D28D9;
}

.player-select-button:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}

/* Score display is now rendered on canvas only */

.reset-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#loading {
  font-size: 18px;
  color: #6B7280;
}

/* Completion testing button */
.completion-menu-container {
  position: relative;
}

.completion-button {
  background: #059669;
  color: white;
}

.completion-button::before {
  content: '✓';
}

.completion-button:hover {
  background: #047857;
}

/* Lives testing button */
.lives-menu-container {
  position: relative;
}

.lives-button {
  background: #EF4444;
  color: white;
}

.lives-button::before {
  content: '☠';
}

.lives-button:hover {
  background: #DC2626;
}

/* Corruption testing button */
.corruption-menu-container {
  position: relative;
}

.corruption-button {
  background: #DC2626;
  color: white;
}

.corruption-button::before {
  content: '⚗';
}

.corruption-button:hover {
  background: #B91C1C;
}

.corruption-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 5px;
  background: #1F2937;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 8px 0;
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.corruption-menu.hidden {
  display: none;
}

.corruption-menu-item {
  padding: 8px 16px;
  color: #FFFFFF;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.15s;
}

.corruption-menu-item:hover {
  background: #374151;
}

.corruption-menu-header {
  padding: 8px 16px;
  color: #9CA3AF;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  border-bottom: 1px solid #374151;
  margin-bottom: 4px;
}
