/* Retro single-player layout with white background */
:root {
  --bg: #ffffff;
  --surface: #fce4ec;
  --surface-elevated: #f8bbd0;
  --border: #ff6b9d;
  --border-subtle: #ffb6c1;
  --text: #2d1b69;
  --text-muted: #6b5b95;
  --accent: #ff6b9d;
  --accent-hover: #ff1493;
  --white-key: #fafafa;
  --white-key-active: #ffe4e1;
  --black-key: #2d1b69;
  --black-key-active: #1a0f4d;
  --shadow-sm: 0 3px 6px rgba(255, 107, 157, 0.3);
  --retro-cyan: #00ffff;
  --retro-pink: #ff6b9d;
  --retro-purple: #9d00ff;
  --retro-yellow: #ffff00;
}

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

body {
  font-family: 'Courier New', 'Courier', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 107, 157, 0.03) 2px,
      rgba(255, 107, 157, 0.03) 4px
    );
}

#app, .app-shell, .main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

header {
  background: var(--surface);
  border-bottom: 4px double var(--border);
  padding: 20px 32px;
  box-shadow: 0 4px 0 var(--retro-pink), 0 8px 12px rgba(255, 107, 157, 0.2);
}

header h1 {
  font-size: 32px;
  margin-bottom: 16px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(45deg, var(--retro-pink), var(--retro-purple), var(--retro-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 3px 3px 0 rgba(255, 107, 157, 0.2);
  filter: drop-shadow(0 0 10px rgba(255, 107, 157, 0.3));
}

.controls {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.sustain-btn {
  background: var(--surface-elevated);
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 10px 18px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 4px 4px 0 var(--retro-pink), 8px 8px 0 rgba(255, 107, 157, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sustain-btn:hover {
  background: #fff;
  border-color: var(--accent-hover);
  box-shadow: 6px 6px 0 var(--retro-pink), 12px 12px 0 rgba(255, 107, 157, 0.2);
  transform: translate(-2px, -2px);
}

.sustain-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 4px 4px 0 var(--retro-purple), 8px 8px 0 rgba(157, 0, 255, 0.3);
  animation: pulse-retro 1.5s ease-in-out infinite;
}

@keyframes pulse-retro {
  0%, 100% { 
    box-shadow: 4px 4px 0 var(--retro-purple), 8px 8px 0 rgba(157, 0, 255, 0.3);
  }
  50% { 
    box-shadow: 4px 4px 0 var(--retro-cyan), 8px 8px 0 rgba(0, 255, 255, 0.3);
  }
}

.pedal-icon {
  font-size: 18px;
}


.midi-status {
  padding: 8px 14px;
  background: #fff;
  border: 3px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: 3px 3px 0 rgba(255, 107, 157, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.midi-status.connected {
  background: var(--retro-cyan);
  color: var(--text);
  border-color: var(--retro-purple);
  animation: blink-retro 2s ease-in-out infinite;
}

@keyframes blink-retro {
  0%, 100% { 
    background: var(--retro-cyan);
  }
  50% { 
    background: var(--retro-yellow);
  }
}

.octave-indicator {
  padding: 8px 14px;
  border: 3px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(255, 107, 157, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.volume-control,
.velocity-control,
.color-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-control label,
.volume-control label,
.velocity-control label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.color-control input[type="color"] {
  width: 48px;
  height: 32px;
  border: 3px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(255, 107, 157, 0.3);
}

.volume-control input[type="range"],
.velocity-control input[type="range"] {
  width: 120px;
  height: 12px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border-radius: 6px;
  outline: none;
  border: 3px solid var(--border);
  box-shadow: 3px 3px 0 rgba(255, 107, 157, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.volume-control input[type="range"]::-webkit-slider-thumb,
.velocity-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--retro-pink), var(--retro-purple));
  border: 3px solid var(--text);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover,
.velocity-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.volume-control input[type="range"]::-moz-range-thumb,
.velocity-control input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--retro-pink), var(--retro-purple));
  border: 3px solid var(--text);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.volume-control input[type="range"]::-moz-range-thumb:hover,
.velocity-control input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

#velocityValue {
  font-size: 14px;
  min-width: 30px;
  color: var(--text);
  font-weight: 900;
  background: var(--retro-yellow);
  padding: 4px 8px;
  border-radius: 4px;
  border: 2px solid var(--text);
}

.loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
}

.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      rgba(255, 107, 157, 0.03) 0px,
      transparent 2px,
      transparent 4px
    );
  pointer-events: none;
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

.loading p {
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 rgba(255, 107, 157, 0.3);
  animation: blink-text 1.5s ease-in-out infinite;
}

@keyframes blink-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.spinner {
  width: 54px;
  height: 54px;
  border: 6px solid var(--retro-pink);
  border-top-color: var(--retro-cyan);
  border-right-color: var(--retro-purple);
  border-bottom-color: var(--retro-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar {
  width: 320px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.1), 3px 3px 0 rgba(255, 107, 157, 0.3);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--retro-pink), var(--retro-purple), var(--retro-cyan));
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 107, 157, 0.5);
  animation: progress-shine 2s linear infinite;
}

@keyframes progress-shine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

#progressText {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  text-shadow: 2px 2px 0 rgba(255, 107, 157, 0.3);
}

main.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(248, 187, 208, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
}

#piano-container {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px 20px 40px;
  overflow-x: auto;
  position: relative;
}

#visualCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#keyboard {
  display: flex;
  position: relative;
  height: 300px;
  user-select: none;
  z-index: 1;
}

.piano-key {
  position: relative;
  cursor: pointer;
  transition: all 0.1s;
  border: 3px solid var(--border);
}

.piano-key.white {
  width: 40px;
  height: 300px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  border-radius: 0 0 8px 8px;
  box-shadow: 
    4px 4px 0 rgba(255, 107, 157, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.piano-key.white:hover {
  background: linear-gradient(180deg, #fff 0%, var(--retro-yellow) 100%);
  border-color: var(--retro-pink);
  box-shadow: 
    6px 6px 0 rgba(255, 107, 157, 0.4),
    inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.piano-key.white.active {
  background: linear-gradient(180deg, var(--retro-cyan) 0%, var(--retro-yellow) 100%);
  transform: translateY(3px);
  box-shadow: 
    2px 2px 0 rgba(255, 107, 157, 0.5),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  border-color: var(--retro-purple);
}

.piano-key.black {
  width: 28px;
  height: 180px;
  background: linear-gradient(180deg, var(--black-key) 0%, #1a0f4d 100%);
  border-radius: 0 0 6px 6px;
  position: absolute;
  z-index: 2;
  margin-left: -14px;
  box-shadow: 
    4px 4px 0 rgba(255, 107, 157, 0.4),
    inset 0 -2px 0 rgba(255, 255, 255, 0.1);
}

.piano-key.black:hover {
  background: linear-gradient(180deg, var(--retro-purple) 0%, var(--black-key) 100%);
  border-color: var(--retro-cyan);
  box-shadow: 
    6px 6px 0 rgba(0, 255, 255, 0.4),
    inset 0 -2px 0 rgba(255, 255, 255, 0.2);
}

.piano-key.black.active {
  background: linear-gradient(180deg, var(--retro-pink) 0%, var(--retro-purple) 100%);
  transform: translateY(3px);
  box-shadow: 
    2px 2px 0 rgba(255, 107, 157, 0.6),
    inset 0 2px 4px rgba(0, 0, 0, 0.3);
  border-color: var(--retro-cyan);
}

.key-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
}

.piano-key.black .key-label {
  color: var(--retro-cyan);
  bottom: 8px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 255, 255, 0.6);
}

footer {
  background: var(--surface);
  border-top: 4px double var(--border);
  padding: 14px 32px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
  box-shadow: 0 -4px 0 var(--retro-pink), 0 -8px 12px rgba(255, 107, 157, 0.1);
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  #keyboard {
    height: 200px;
  }
  
  .piano-key.white {
    width: 30px;
    height: 200px;
  }
  
  .piano-key.black {
    width: 22px;
    height: 120px;
    margin-left: -11px;
  }
}

@media (max-width: 900px) {
  header {
    padding: 20px;
  }
  .controls {
    gap: 16px;
  }
}