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

body {
  font-family: 'Special Elite', 'Courier New', Courier, monospace;
  line-height: 1.6;
  color: #e8e8e8;
  background: #2a2a2a;
  font-size: 22.5px;
  position: relative;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 30%, rgba(42, 26, 32, 0.5) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(42, 32, 28, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 50% 10%, rgba(38, 28, 42, 0.3) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 2;
}

.home-link {
  position: fixed;
  top: 2rem;
  right: 2rem;
  color: #888;
  font-family: 'Special Elite', 'Courier New', Courier, monospace;
  font-size: 14px;
  text-decoration: none;
  z-index: 10;
  opacity: 1;
  cursor: pointer;
}

.home-link:hover {
  color: #aaa;
}

.page {
  padding: 3.75rem;
  max-width: 1000px;
  position: relative;
  z-index: 3;
}

h1 {
  font-size: 1.875rem;
  font-weight: 400;
  margin-bottom: 2.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

p {
  margin-bottom: 1.25rem;
}

.controls {
  margin-bottom: 2.5rem;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.controls label {
  font-weight: 400;
  color: #e8e8e8;
  min-width: 120px;
}

.controls select {
  padding: 0.5rem 0.75rem;
  border: 2px solid #e8e8e8;
  background-color: #2a2a2a;
  color: #e8e8e8;
  font-family: 'Special Elite', 'Courier New', Courier, monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.controls select:focus {
  outline: 2px solid #e8e8e8;
  outline-offset: 2px;
}

.controls select:hover {
  background-color: #3a3a3a;
}

.controls input[type="range"] {
  flex: 1;
  min-width: 150px;
  max-width: 300px;
  height: 6px;
  background: #3a3a3a;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #e8e8e8;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.controls input[type="range"]::-webkit-slider-thumb:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.controls input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #e8e8e8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.controls input[type="range"]::-moz-range-thumb:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.controls input[type="range"]:focus {
  outline: none;
}

.controls input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(232, 232, 232, 0.3);
}

.controls input[type="range"]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(232, 232, 232, 0.3);
}

#volumeValue {
  min-width: 45px;
  color: #e8e8e8;
  font-size: 0.95rem;
  opacity: 0.8;
}

.info-message {
  min-height: 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: #e8e8e8;
  opacity: 0.7;
  font-style: italic;
}

#guitarStrings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.string {
  padding: 1.25rem 1.5rem;
  background-color: rgba(42, 42, 42, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.string svg {
  opacity: 0;
  transition: opacity 0.1s ease-in;
}

.string svg.ready {
  opacity: 1;
}

.string:hover {
  background-color: rgba(60, 60, 60, 0.8);
  transform: translateY(-2px);
}

.string:focus {
  outline: none;
}

.string:active {
  transform: translateY(0);
}

.string.playing {
  background-color: rgba(80, 80, 80, 0.9);
  animation: pulse 0.3s ease;
}

.string.playing::after {
  content: '♪';
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  animation: float 1s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(5px); }
}

.string strong {
  color: inherit;
}

.char {
  display: inline-block;
  position: relative;
}

.error-message {
  background-color: rgba(255, 243, 205, 0.2);
  border: 2px solid #ffc107;
  padding: 1rem;
  margin-bottom: 1.25rem;
  color: #ffc107;
}

/* Tuner Section */
.tuner-section {
  margin-bottom: 3rem;
  padding: 1.5rem;
  background-color: rgba(42, 42, 42, 0.4);
  position: relative;
}

.tuner-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.mic-button {
  padding: 0.75rem 1.5rem;
  background-color: rgba(60, 60, 60, 0.8);
  border: 2px solid #e8e8e8;
  color: #e8e8e8;
  font-family: 'Special Elite', 'Courier New', Courier, monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.mic-button:hover {
  background-color: rgba(80, 80, 80, 0.9);
  transform: translateY(-2px);
}

.mic-button:active {
  transform: translateY(0);
}

.mic-button.active {
  background-color: rgba(100, 100, 100, 0.9);
  border-color: #4CAF50;
  color: #4CAF50;
}

.mic-status {
  font-size: 0.9rem;
  color: #e8e8e8;
  opacity: 0.7;
  font-style: italic;
}

.mic-status.active {
  color: #4CAF50;
  opacity: 1;
}

/* Tuner Display */
.tuner-display {
  padding: 2rem 1.5rem;
  background-color: rgba(30, 30, 30, 0.6);
  position: relative;
}

.tuner-note {
  text-align: center;
  margin-bottom: 2rem;
}

.detected-note {
  font-size: 4rem;
  font-weight: 400;
  color: #e8e8e8;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

.detected-freq {
  font-size: 1.2rem;
  color: #e8e8e8;
  opacity: 0.7;
}

/* Tuner Gauge */
.tuner-gauge {
  margin-bottom: 1.5rem;
}

.gauge-markers {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
}

.marker-text {
  font-size: 1.5rem;
  color: #e8e8e8;
  opacity: 0.6;
}

.marker-text.center {
  font-size: 1.2rem;
  opacity: 0.8;
}

.gauge-bar {
  position: relative;
  height: 60px;
  background: linear-gradient(to right,
    #ff6b6b 0%,
    #ffa500 20%,
    #4CAF50 45%,
    #4CAF50 55%,
    #ffa500 80%,
    #ff6b6b 100%);
  border-radius: 4px;
  margin: 0 1rem;
  overflow: hidden;
}

.gauge-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background-color: #e8e8e8;
  transform: translateX(-50%);
  z-index: 2;
}

.gauge-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 50px solid rgba(232, 232, 232, 0.9);
  transform: translate(-50%, -50%);
  transition: left 0.1s ease-out;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.cents-display {
  text-align: center;
  margin-top: 1rem;
  font-size: 1.5rem;
  color: #e8e8e8;
}

.tuning-status {
  text-align: center;
  font-size: 1.1rem;
  color: #e8e8e8;
  opacity: 0.8;
  margin-top: 1rem;
  font-style: italic;
}

.tuning-status.in-tune {
  color: #4CAF50;
  opacity: 1;
  font-style: normal;
  font-weight: bold;
}

.tuning-status.sharp {
  color: #ffa500;
}

.tuning-status.flat {
  color: #ffa500;
}

@media (max-width: 480px) {
  .page {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .string {
    padding: 1rem 1.25rem;
  }

  .tuner-section {
    padding: 1rem;
  }

  .detected-note {
    font-size: 3rem;
  }

  .detected-freq {
    font-size: 1rem;
  }

  .gauge-bar {
    margin: 0 0.5rem;
  }
}
