@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #0d0d0d;
  --surface: rgba(20, 20, 20, 0.95);
  --border: rgba(0, 255, 136, 0.15);
  --accent: #00ff88;
  --accent-dim: rgba(0, 255, 136, 0.08);
  --text: #e0e0e0;
  --muted: #666;
  --radius: 10px;
  --glow: 0 0 18px rgba(0, 255, 136, 0.12);
}

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

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#tsparticles { position: fixed; inset: 0; z-index: 0; }

.app {
  position: relative;
  z-index: 1;
  padding: 30px 24px 50px;
  max-width: 1100px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 24px rgba(0, 255, 136, 0.35);
  margin-bottom: 28px;
}

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--glow);
  margin-bottom: 14px;
}

input[type="number"],
select {
  background: #1a1a1a;
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 130px;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.08);
}

input[type="number"]::placeholder { color: var(--muted); }

button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.18s;
  background: #1a1a1a;
  color: var(--text);
  border-color: rgba(0, 255, 136, 0.2);
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.15);
}

button[onclick="enqueue()"] {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
}
button[onclick="enqueue()"]:hover {
  background: #33ffaa;
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.45);
}

button[onclick="resetQueue()"] {
  border-color: rgba(255, 80, 80, 0.3);
  color: #ff6b6b;
}
button[onclick="resetQueue()"]:hover {
  border-color: #ff6b6b;
  box-shadow: 0 0 10px rgba(255, 80, 80, 0.2);
}

/* ── Inline speed control ── */
.speed-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 6px;
  padding: 5px 10px;
  margin-left: 4px;
}

.speed-inline .speed-label {
  font-size: 13px;
  color: var(--accent);
}

.speed-inline input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 99px;
  background: #2a2a2a;
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
  min-width: unset;
}

.speed-inline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d0d0d;
  box-shadow: 0 0 7px rgba(0, 255, 136, 0.6);
  cursor: pointer;
  transition: transform 0.15s;
}

.speed-inline input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.speed-inline input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d0d0d;
  cursor: pointer;
}

.speed-inline .speed-value-display {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid rgba(0, 255, 136, 0.35);
  padding: 1px 8px;
  border-radius: 20px;
  min-width: 36px;
  text-align: center;
}

/* ── Info bar ── */
.info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 13px;
  margin-bottom: 14px;
  box-shadow: var(--glow);
}

.pointer-info {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.pointer-info span {
  color: var(--accent);
  font-weight: 600;
}

/* ── Main layout ── */
.main-layout {
  display: flex;
  gap: 16px;
}

/* ── Visual section ── */
.visual-section {
  flex: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--glow);
  overflow-x: auto;
}

.queue-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 10px;
  flex-wrap: wrap;
}

/* ── Queue boxes ── */
.box {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #1a1a1a;
  border: 1px solid rgba(0, 255, 136, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  position: relative;
  transition: all 0.3s;
}

.box:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

.enqueuing {
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.4);
}

.dequeuing {
  animation: slideOut 0.4s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(-20px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes slideOut {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(0.7); opacity: 0; }
}

/* ── Pointers ── */
.pointer {
  position: absolute;
  top: -22px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
}

.pointer-f {
  color: #4fc3f7;
  background: rgba(79, 195, 247, 0.12);
  border: 1px solid rgba(79, 195, 247, 0.3);
}

.pointer-r {
  color: #ffb300;
  background: rgba(255, 179, 0, 0.12);
  border: 1px solid rgba(255, 179, 0, 0.3);
}

/* ── Code section ── */
.code-section {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--glow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-section select {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 7px 11px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.code-section select:focus { border-color: var(--accent); }

/* ── Code block ── */
pre {
  white-space: pre-wrap;
  color: var(--accent);
  background: #111;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  flex: 1;
  overflow-y: auto;
}

.highlight {
  background: rgba(0, 255, 136, 0.12);
  border-left: 2px solid var(--accent);
  border-radius: 3px;
  display: block;
  width: 100%;
  padding-left: 4px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .main-layout { flex-direction: column; }
  .box { width: 54px; height: 54px; font-size: 16px; }
  .speed-inline input[type="range"] { width: 60px; }
}