@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

body {
  font-family: 'VT323', monospace;
  background: #000;
  color: #0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-shadow: 0 0 5px #0f0;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

.container {
  position: relative;
  z-index: 2;
}

header {
  padding: 2rem;
  text-align: center;
  border-bottom: 2px solid #0f0;
}

.ascii-title {
  font-size: 1.5rem;
  line-height: 1.2;
  white-space: pre;
  color: #0f0;
  margin-bottom: 1rem;
  overflow-x: auto;
}

@media (max-width: 768px) {
  .ascii-title {
    font-size: 0.7rem;
  }
}

.subtitle {
  font-size: 1.5rem;
  color: #0a0;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0.3;
  }
}

.controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  flex-wrap: wrap;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  .controls {
    padding: 1rem;
    gap: 0.5rem;
  }
}

button {
  background: #000;
  color: #0f0;
  border: 2px solid #0f0;
  padding: 0.5rem 1rem;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.1s ease;
  text-transform: uppercase;
  position: relative;
  text-shadow: 0 0 5px #0f0;
}

@media (max-width: 768px) {
  button {
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    border-width: 1px;
  }
}

button::before {
  content: '[ ';
}

button::after {
  content: ' ]';
}

button:hover {
  background: #0f0;
  color: #000;
  text-shadow: none;
  box-shadow: 0 0 10px #0f0;
}

button:active {
  transform: translate(2px, 2px);
}

button:disabled {
  color: #030;
  border-color: #030;
  cursor: not-allowed;
  text-shadow: none;
}

button:disabled:hover {
  background: #000;
  color: #030;
}

.algorithm-btn.active {
  background: #0f0;
  color: #000;
  text-shadow: none;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  from {
    box-shadow: 0 0 5px #0f0;
  }
  to {
    box-shadow: 0 0 20px #0f0;
  }
}

.visualization-container {
  flex: 1;
  padding: 2rem;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.2;
  white-space: pre;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
}

@media (max-width: 768px) {
  .visualization-container {
    padding: 1rem;
    font-size: 10px;
  }
}

.ascii-display {
  text-align: left;
  padding: 1rem;
  border: 2px solid #0f0;
  background: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
  overflow-x: auto;
  max-width: 100%;
}

@media (max-width: 768px) {
  .ascii-display {
    padding: 0.5rem;
    border-width: 1px;
    font-size: 0.8rem;
  }
}

.bar-row {
  color: #0f0;
  transition: all 0.3s ease;
}

.bar-row.comparing {
  color: #ff0;
  text-shadow: 0 0 10px #ff0;
}

.bar-row.sorted {
  color: #0ff;
  text-shadow: 0 0 10px #0ff;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2rem;
  border-top: 2px solid #0f0;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  .stats {
    gap: 1rem;
    padding: 1rem;
    font-size: 1rem;
    border-width: 1px;
  }
}

.stat {
  text-align: center;
}

.stat-label {
  color: #0a0;
}

@media (max-width: 768px) {
  .stat-label {
    font-size: 0.9rem;
  }
}

.stat-value {
  font-size: 2rem;
  color: #0f0;
  text-shadow: 0 0 10px #0f0;
}

@media (max-width: 768px) {
  .stat-value {
    font-size: 1.5rem;
  }
}

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

input[type='range'] {
  width: 150px;
  height: 8px;
  background: #030;
  border: 1px solid #0f0;
  outline: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #0f0;
  border: 2px solid #000;
  cursor: pointer;
  box-shadow: 0 0 10px #0f0;
}

.glitch {
  animation: glitch 2s infinite;
}

@keyframes glitch {
  0%,
  90%,
  100% {
    transform: translate(0);
  }
  91% {
    transform: translate(-2px, 2px);
  }
  92% {
    transform: translate(2px, -1px);
  }
  93% {
    transform: translate(-1px, 1px);
  }
}

.ascii-title {
    font-size: 1.5rem;
    line-height: 1.2;
    white-space: pre;
    color: #0f0;
    margin-bottom: 1rem;
    overflow-x: auto;
    text-align: center;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
}

header {
    padding: 2rem;
    text-align: center;
    border-bottom: 2px solid #0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
